physhandout

所属分类:物理/力学计算
开发工具:TeX
文件大小:10KB
下载次数:0
上传日期:2018-11-29 19:20:23
上 传 者sh-1993
说明:  LaTeX软件包用于处理多个讲义、开关内联解决方案和顶部的几个以物理为中心的宏。
(LaTeX packages for handling multiple handouts, on-off inline solutions, and a handful of physics-centric macros on top.)

文件列表:
Makefile (2187, 2018-11-30)
handouts.sty (6608, 2018-11-30)
main.tex (2816, 2018-11-30)
physhandout.sty (1671, 2018-11-30)
solution.sty (2367, 2018-11-30)

Overleaf Workflow for Physics Handouts ====================================== Overleaf is a real-time collaborative LaTeX editor. It has many nice features like a live(ish) document preview. However, each Overleaf project can only compile a single target .tex file into a single document, which makes managing course materials (dozens of handouts) a pain. Also, it only stores a limited version history (24h unless a checkpoint is manually created) and the text editor interface is not always ideal. Based on past quarters' experiences I've written some LaTeX packages to make handling multiple handouts with Overleaf a bit less annoying. Creating Handouts ----------------- The handouts for a given course are defined in the main.tex file. There can be multiple types of handouts (e.g. lectures, problem sets, activity sheets) and each type is automatically numbered separately. In our case, we have `lecture`, `activity`, and `pset` handout classes. These classes are created using `\inithandout{short_name}{Long Name}`, like `\inithandout{pset}{Problem Set}`. To actually create a handout, use the following format in the main.tex file: \begin{}[]{} \input{<filename.tex>} \end{<handout_class>} where `<handout_class>` is `lecture`, `activity`, `pset`, etc.; `<tag>` is a short name for the handout which you can refer to elsewhere (e.g. to specific which handouts to generate, or reference the number of a handout); `<Title>` is the title that will appear in the header of the handout; and `<filename.tex>` is the file containing the LaTeX code for the handout. (You don't necessarily have to use the `\input` line; you could put the code directly in the main.tex file. However, as we get a large number of handouts going, it will be much cleaner to separate things out.) In our Overleaf project, we have a subfolder for the .tex files for each type of handout, as well as one for figures. Note that the numbering of the handouts is automatic and based on the order that their `\begin{}[]{}...\end{}` code appears in main.tex. However, you can interleave (say) `activity`s and `lecture`s without affecting the numbering. Basically, the idea should be to list the handouts in main.tex in chronological order, and the numbering should take care of itself. Selecting Handouts to Compile ----------------------------- You probably don't want to see every handout for the course at the same time, but rather just the one(s) currently under development. For this purpose use the `\only...` macros, e.g. \onlylecture{time_dilation} means that the only lecture output to PDF will be the one with `<tag>` `time_dilation`. Multiple tags can be specified with commas. If there is no `\only...` for a given type of handout, they will all be produced. So, generally main.tex will have a section like this: \onlylecture{current_lecture_tag} \onlyactivity{current_activity_tag} \onlypset{} which means that the only handouts generated are the current lecture and activity (specified by their tags), and no problem sets. This seems a bit complicated at first, but it addresses an issue with Overleaf so that multiple people can be working on multiple handouts at the same time, in the same project. The handouts are added to the LaTeX table of contents, so you can generate a list of the handouts in a given PDF file by using `\tableofcontents`. Since the `\only...` commands are global in scope, you can do some interesting tricks like creating a 'meta-handout' with a table of contents: \inithandout{meta}{Meta-Handout} ... \onlymeta{sr_contents} \begin{meta}[sr_contents]{Special Relativity Unit} \onlylecture{time_dilation,len_con,spacetime,lorentz,causality,four_vectors,energy} % include all SR lectures \onlyactivity{longitudinal_light_clock,binomial,simultaneity,spacetime,lonely_photon,pion_decay} % include all SR activities \onlypset{} % no problem sets \onlymeta{} % we are already inside the relevant meta, so we don't need to include it here \handoutid{} \def\contentsname{List of Materials} \tableofcontents \end{misc} ...definitions of the rest of the handouts... Writing Solutions ----------------- There are several ways to include solutions into the original .tex files. Depending on the setting in main.tex, the solutions will either be completely hidden or show up. `\usepackage{solution}` defines the solution macros but hides the contents (in various ways); `\usepackage[show]{solution}` shows the solutions. There are FOUR different ways to include solutions, depending on the context: * `\begin{solution}...\end{solution}` is for long solutions (e.g. to pset problems). They are completely ignored when hidden and decorated with some horizontal rules and **Solution.** at the beginning when unhidden. **The `\begin` and `\end` commands MUST appear at the beginning of the line with no leading whitespace and nothing else on the line.** (This is a quirk of the `comment` package which handles the showing/hiding of the solutions. It can lead to very very non-obvious, sometimes silent, failures, like missing part of your document in the generated PDF file.) There is a corresponding `antisolution` environment for something that *only* appears in the handout, not in the solution; a common usage is `\clearpage` inside an `antisolution` for a page break that disappears in the solution, saving space. * `\soln{...}` is for short, inline solutions (e.g. in lecture exercises) that leave a space for the student to write the solution in. This works inside math environments, etc. There can be no paragraph breaks, or anything equivalent to a paragraph break (such as a `$$display-mode equation$$` or `align` environment.) LaTeX will tell you that it can't find a closing brace if you try to put in a paragraph break. * `\bigsoln{...}` allows longer solutions which include paragraph breaks, etc. Some space is left for writing in an answer, but it's not always as big as the solution itself. It's often better to use `\solnx` + `\workspace` (see below) for more control. * `\solnx{...}` is the same as `\soln` except it doesn't leave a space for the student to write in. It works for both inline and paragraph-length solutions. There is a nice way to include some space in the original document that disappears in the solution: `\workspace` (or `\workspace[<length>]`). Since `\solnx{<soln>}` + `\workspace[<length>]` is a common combo, there is a shorthand: `\solnx[<length>]{<soln>}`. Finally, you may want to selectively show/hide solutions in parts of a document. For this you can use `\showsolution` and `\hidesolution` which show/hide the solutions after that point, up through the end of the current scope (usually the current handout). Working Locally with git ------------------------ If you prefer to use your favorite TeX editor, work offline, or just don't like Overleaf, it's possible to grab a local copy of the Overleaf repository using git and push your changes back to the cloud. A Makefile is included which will (re)compile each handout to its own PDF file, both with and without solutions included. </div> <hr> <div><B>近期下载者</B>:</div> <div id="download-users"></div> <hr> <div><B>相关文件</B>:</div> <div id="relate-items"></div> <hr> <div><B>评论</B>:[<a href=/Download/comment/id/1687030625805018.html data-toggle=modal data-target="#myModal">我要评论</a>] [<a class='pop-a' href=/Download/report/id/1687030625805018.html>举报此文件</a>]</div> <div id="file-comments"></div> <hr> <div><B>收藏者</B>:</div> <div id="favor-users"></div> <p></p> </div> <div class="col-xs-12 col-md-4"> <div class="ad-sidebar text-center"> <div class="ad-300"> </div> </div> </div> </div> </div> </div> <div class="my-footer"> <div class="container"> <div class="pull-right"> </div> <div> <a href="http://www.pudn.com" target=_blank>© 联合开发网 from 2004</a> | <a href="/Index/contact.html">联系站长</a> | <a href=" https://beian.miit.gov.cn" target=_blank>湘ICP备2023001425号</a> | <a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=43010502000604" target=_blank>网安备43010502000604</a> | </div> </div> </div> </div><!-- /wrapper--> <!-- page specific plugin scripts --> <!-- inline scripts related to this page --> <div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> </div> </div> </div><!-- /.modal-table --> </body> <script type="text/javascript"> $(document).on('click', '.list-more', function(){ var id=$(this).attr('data-id'); $('#list-'+id).css('max-height',$('#list-'+id)[0].scrollHeight); $(this).removeClass('list-more'); $(this).addClass('list-hide'); $(this).html('<i class="fa fa-angle-double-up"></i>'); //$(this).hide(); return false; }); $(document).on('click', '.list-hide', function(){ var id=$(this).attr('data-id'); $('#list-'+id).css('max-height','100px'); $(this).removeClass('list-hide'); $(this).addClass('list-more'); $(this).html('<i class="fa fa-angle-double-down"></i>'); return false; }); $("#myModal").on("hidden.bs.modal", function() { $(this).removeData(); }); $(document).on("click",".keyword",function(){ var keyword=$(this).attr("keyword"); var type_id=$(this).attr("type_id"); if(typeof(type_id) =="undefined" || type_id =="") type_id="0"; location.href="http://search.pudn.com/Download/index?keyword="+keyword; return false; }); </script> <script type="text/javascript" src="/js/time.js"></script> <script type="text/javascript" src="/js/marked.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('.hide-list').each(function(){ if ($(this)[0].offsetHeight < $(this)[0].scrollHeight){ var id=$(this).attr('id'); id =id.substring(5); $(this).after('<div style="text-align:center"><a href="" class="list-more" data-id="' + id + '"><i class="fa fa-angle-double-down"></i></a></div>'); } }); }); var g_id="1687030625805018"; var keywords =new Array(); function get_download_user(){ var url ="/Download/get_download_user/id/"+g_id+".html"; $.get(url,function(ret){ if(ret.length ==0) return; var html=''; for(i in ret){ html =html + '<a href=/User/profile/id/'+ret[i].user_new_id+'.html>'+ret[i].name+'</a> '; } $('#download-users').append(html); }); } function get_relate_item(){ var url ="/Download/get_relate_item/id/"+g_id+'.html'; $.get(url,function(ret){ if(ret.length ==0) return; var html=''; var intro; for(i in ret){ intro =ret[i].intro; for(j in keywords){ var reg =new RegExp(keywords[j],'gmi'); intro =intro.replace(reg,'<font color=brown>'+keywords[j]+'</font>'); } html =html + '[<a href=/Download/item/id/'+ret[i].new_id+'.html>'+ret[i].name+'</a>]  '+intro+'<BR>'; } $('#relate-items').append(html); }); } function get_score_name(score){ switch(score){ case '100': return '很好,推荐下载'; case '85': return '还不错'; case '75': return '一般,勉强可用'; case '50': return '差'; case '3': return '纯粹是垃圾'; case '40': return '和说明完全不符'; case '20': return '文件不全'; case '10': return '不是源代码或资料'; case '5': return '文件有密码,不知道密码'; case '0': return '不能解压或下载失败'; } return ''; } function get_comment(){ var url ="/Download/get_comments/id/"+g_id+'.html'; $.get(url,function(ret){ if(ret.length ==0) return; var total_count =ret.total_count; var data =ret.data; var html=''; for(i in data){ html =html + '<a href="/User/profile/id/'+data[i].user_new_id+'.html" class="uploader">'+data[i].user_name+'</a>: <span class="comment-score">'+get_score_name(data[i].score)+'</span>, '+data[i].content+'<BR>'; } $('#file-comments').append(html); }); } function get_favor(){ var url ="/Download/get_item_favors/id/"+g_id+".html"; $.get(url,function(ret){ if(ret.length ==0) return; var html=''; for(i in ret){ html =html + '<a href=/User/profile/id/'+ret[i].user_new_id+'.html class=user>'+ret[i].name+'</a> '; } $('#favor-users').html(html); }); } // 得到下载这个的用户又下载了什么 function get_more_download(){ } // 得到下载这个的用户又搜索了什么 function get_more_keyword(){ } // 得到论坛相关问题 function get_bbs(){ } // 得到软件工场相关内容 function get_works(){ } // 得到相关聊天室 function get_chat(){ } // 得到相关软件商城信息 function get_shop(){ } // 得到job // 得到学习内容 // 数据 get_download_user(); //get_relate_item(); get_comment(); get_favor(); $('.vote-up').click(function(){ var url="/Download/vote/t/up/id/"+g_id; $.get(url,function(ret){ if(ret.status==0){ alert(ret.info); if(ret.url.length >0) location.href=ret.url; } else{ var s =$('#vote-up-count').html(); if(s =='') s="0"; var count =parseInt(s)+1; $('#vote-up-count').html(count); } }) return false; }); $('.vote-down').click(function(){ var url="/Download/vote/t/down/id/"+g_id; $.get(url,function(ret){ if(ret.status==0) alert(ret.info); else{ var s =$('#vote-down-count').html(); if(s =='') s="0"; var count =parseInt(s)+1; $('#vote-down-count').html(count); } }) return false; }); $('.favor-item').click(function(){ var url="/Favor/add/t/0/id/"+g_id; $.get(url,function(ret){ if(ret.status==0){ alert(ret.info); } else{ var s =$('#favor-count').html(); if(s =='') s="0"; var count =parseInt(s)+1; $('#favor-count').html(count); } }) return false; }); $('.pop-a').click(function(){ var url=$(this).attr('href'); $.get(url,function(ret){ alert(ret.info); //location.reload(); }) return false; }); document.getElementById('readme').innerHTML =marked.parse(document.getElementById('readme').innerHTML); </script> </html>