1 Star 0 Fork 80

quyang / nwafuprojrep

forked from nan-cie-nwafu / nwafuprojrep 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
demo.tex 41.61 KB
一键复制 编辑 原始数据 按行查看 历史
nangeng 提交于 2020-07-10 11:17 . 修订实习日志日期格式。
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977
% 西北农林科技大学科技类及IT类课程论文文档类(LaTeX模板)
\documentclass[
% projtype=paper, % 实习类型,可选report(报告)或paper(论文),默认为report
% output=epub, % 输出类型,可选print(打印,不显示超链接颜色)
% 或epub(电子稿,显示超链接颜色),默认为epub
]{nwafuprojrep}
% 载入需要的宏包
\input{settings/packages.tex}
% 进行必要的设置
\input{settings/format.tex}
% 专用术语宏命令
\input{settings/terms.tex}
% 数学符号宏命令
\input{settings/math-commands.tex}
% 设置封面基本信息,\linebreak 前面不要有空格,
% 中文之间的空格无法消除
% 另,在\nwafuset中不可以出现空行
\nwafuset{
college = {信息工程学院}, % 学院名称
projname = {\LaTeX{}科技排版}, % 实践课程名称
title = {\LaTeX{}科技排版实习报告}, % 实习报告题目
stuno = {2013051289}, % 学号
author = {\LaTeX{}er}, % 姓名
major = {计算机科学与技术}, % 专业
classid = {152}, % 班级(只填写数字,不要有其它内容)
adviser = {Registor}, % 指导教师姓名
startdate = {2020年8月10日}, % 实践起始日期
enddate = {8月23日}, % 实践结束日期
}
%biblatex宏包的参考文献数据源加载方式
\addbibresource[location=local]{bib/example.bib}
\begin{document} %在document环境中撰写文档
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 封面及目录,无需改动此处代码
% 面页,需要在导言区用\nwafuset命令填写基本信息
\makecover
% 目录
\tableofcontents
\cleardoublepage
% 设置正文页眉页脚格式,并重新设置页码为1
\pagestyle{main}% 无页眉,页码在页脚居中
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 排版摘要
% 摘要内容
\begin{abstract}
针对课程综合实习实习报告(或论文)排版中的格式问题,基于\emph{内容与格式分离}\LaTeX{}排版技术,通分析西北农林科技大学信息工程学院给出的课程综合实习实习报告(或论文)排版规范和样例文件,采用文档类的方式,结合作者前期开发的boxie、tikz-flowchart、tikz-imglabels等宏包,设计并开发了\enquote{nwafuprojrep.cls}西北农林科技大学信息工程学院课程综合实习实习报告(或论文)\LaTeX{}模板。该模板能够根据操作系统自动选择需要的字体,提供了基本的格式限定及代码、流程图绘制、图像标注等实用功能。测试结果表明,该模板在Ubuntu、Winodws、Mac下均可以按规范实现实习报告(或论文)的正确排版。
\end{abstract}
% 关键词内容(不同关键字,请用英文","分割)
\keywords{\LaTeX{}模板, 文档类, 宏包, 实习报告}
\makeabstract
% 排版正文内容
\section{综合训练目的与要求}
该综合训练的目的是培养应用《\LaTeX{}科技排版》设计方法及思想解决实际问
题的能力,掌握使用\LaTeX{}科技排版技术,熟悉开发工具的使用。同时提升级
调查研究、查阅文献及编写技术文档的能力。
\section{综合训练任务}
根据指定的题目要求,完成功能设计;选择合适的平台和工具实现代码编写和调
试;设计合理的测试方案,对设计的代码进行完整测试。
\section{总体设计}
西北农林科技大学信息工程学院实习报告撰写规范和样例进行\LaTeX{}
nwafuprojrep模板的开发。
在设计中,以\emph{内容与格式分离}为原则,主要对标题格式、图表浮动体、交
叉引用、参考文献等格式进行了限定,以减轻排版中的格式设置与调整工作量。
\section{详细设计说明}
\subsection{插图浮动体}
\enquote{nwafuprojrep.cls}模板中,除了可以使用普通的figure浮动体环境
结合graphicx宏包实现插图排版外,还可以使用floatrow增强浮动体宏包进行浮
动体排版(适合多图并排、子图排版等)。有关该宏包的使用细节,请在命令行使
\enquote{texdoc floatrow}命令查看其使用说明书。例如,可以
\autoref{texcode01}排版\autoref{sharefig:a}
% 该center环境中的代码为排版示例代码,实际排版中不需要该代码
\begin{center}
\begin{langCVOne}[tex][texcode01][\LaTeX{}]{排版单一插图浮动体}
\begin{figure}[!htp]
\begin{floatrow}
\ffigbox[\FBwidth]{
\includegraphics[width=0.4\textwidth]{example-image-a}
}{\caption{一个插图}\label{sharefig:a}}
\end{floatrow}
\end{figure}
\end{langCVOne}
\end{center}
\begin{figure}[!htp]
\begin{floatrow}
\ffigbox[\FBwidth]{
\includegraphics[width=0.4\textwidth]{example-image-a}
}{\caption{一个插图}\label{sharefig:a}}
\end{floatrow}
\end{figure}
当然,也可以用\autoref{texcode02}排版带有子图的\autoref{trifig}
% 该center环境中的代码为排版示例代码,实际排版中不需要该代码
\begin{center}
\begin{langCVOne}[tex][texcode02][\LaTeX{}]{排版单一插图浮动体}
\begin{figure}[!htp]
\ffigbox[\textwidth]%
{%
\begin{subfloatrow}[2]%\useFCwidth
\ffigbox[\FBwidth]{
\includegraphics[width=0.3\textwidth]{example-image-a}
}{\caption{子题注1}\label{trifig:a}}
\ffigbox[\FBwidth]{
\includegraphics[width=0.3\textwidth]{example-image-b}
}{\caption{子题注2}\label{trifig:b}}
\end{subfloatrow}
\begin{subfloatrow}[2]%\useFCwidth
\ffigbox[\FBwidth]{
\includegraphics[width=0.3\textwidth]{example-image-c}
}{\caption{子题注3}\label{trifig:c}}
\ffigbox[\FBwidth]{
\includegraphics[width=0.3\textwidth]{example-image}
}{\caption{子题注4}\label{trifig:d}}
\end{subfloatrow}
}{\caption{四个子图}\label{trifig}}
\end{figure}
\end{langCVOne}
\end{center}
\begin{figure}[!htp]
\ffigbox[\textwidth]%
{%
\begin{subfloatrow}[2]%\useFCwidth
\ffigbox[\FBwidth]{
\includegraphics[width=0.25\textwidth]{example-image-a}
}{\caption{子题注1}\label{trifig:a}}
\ffigbox[\FBwidth]{
\includegraphics[width=0.25\textwidth]{example-image-b}
}{\caption{子题注2}\label{trifig:b}}
\end{subfloatrow}
\begin{subfloatrow}[2]%\useFCwidth
\ffigbox[\FBwidth]{
\includegraphics[width=0.25\textwidth]{example-image-c}
}{\caption{子题注3}\label{trifig:c}}
\ffigbox[\FBwidth]{
\includegraphics[width=0.25\textwidth]{example-image}
}{\caption{子题注4}\label{trifig:d}}
\end{subfloatrow}
}{\caption{四个子图}\label{trifig}}
\end{figure}
在模板中,已为插图设置
{{./figs/}{./figure/}{./figures/}{./image/}{./images/}
{./graphics/}{./graphic/}{./pictures/}{./picture/}}相对路径,可
以在当前工作路径中任意一个这样命名的文件夹,以存放需要的插图文件。
\subsection{表格浮动体}
如果需要插入一个简单的表格,可以仅使用{table}{tabular}环境实现,如%
\autoref{tab:city}
\emph{注意:}科技文档中的表格需要采用\emph{三线表}
\begin{table}[!htb]
\caption[城市人口]{城市人口数量排名 (source: Wikipedia)\label{tab:city}}
\begin{tabular}{lr}
\toprule
城市 & 人口 \\
\midrule
Mexico City & 20,116,842\\
Shanghai & 19,210,000\\
Peking & 15,796,450\\
Istanbul & 14,160,467\\
\bottomrule
\end{tabular}
\end{table}
如果多个表格布局较为复杂,可以使用floatrow宏包实现排版。如用\autoref{texcodetab}可编制\autoref{tab:testsample}\autoref{tab:city2}所示的横向并排表格。
% 该center环境中的代码为排版示例代码,实际排版中不需要该代码
\begin{center}
\begin{langCVOne}[tex][texcodetab][\LaTeX{}]{表格排版}
% 横向排版两个表格
\begin{table}[!htp]
\begin{floatrow}
\ttabbox[\FBwidth]
{
\begin{tabular}{ccl}
\toprule
序号 & 测试用例 & \multicolumn{1}{c}{测试目的}\\
\midrule
1 & a & 小写字母到大写字母转换\\
2 & A & 大写字母到小写字母转换\\
3 & @ & 非字母字符测试\\
4 & 2 & 非字母其它字符\\
\bottomrule
\end{tabular}
}{\caption{字母大小写转换测试用例表}\label{tab:testsample}}
\ttabbox[\FBwidth]
{
\begin{tabular}{lr}
\toprule
城市 & 人口 \\
\midrule
Mexico City & 20,116,842\\
Shanghai & 19,210,000\\
Peking & 15,796,450\\
Istanbul & 14,160,467\\
\bottomrule
\end{tabular}
}{\caption{城市人口数量排名}\label{tab:city2}}
\end{floatrow}
\end{table}
\end{langCVOne}
\end{center}
% 横向排版两个表格
\begin{table}[!htp]
\begin{floatrow}
\ttabbox[\FBwidth]
{
\begin{tabular}{ccl}
\toprule
序号 & 测试用例 & \multicolumn{1}{c}{测试目的}\\
\midrule
1 & a & 小写字母到大写字母转换\\
2 & A & 大写字母到小写字母转换\\
3 & @ & 非字母字符测试\\
4 & 2 & 非字母其它字符\\
\bottomrule
\end{tabular}
}{\caption{字母大小写转换测试用例表}\label{tab:testsample}}
\ttabbox[\FBwidth]
{
\begin{tabular}{lr}
\toprule
城市 & 人口 \\
\midrule
Mexico City & 20,116,842\\
Shanghai & 19,210,000\\
Peking & 15,796,450\\
Istanbul & 14,160,467\\
\bottomrule
\end{tabular}
}{\caption{城市人口数量排名}\label{tab:city2}}
\end{floatrow}
\end{table}
% \begin{table}[!htp]
% \ttabbox[\FBwidth]{
% \begin{tabular}{ccl}
% \toprule
% 序号 & 测试用例 & \multicolumn{1}{c}{测试目的}\\
% \midrule
% 1 & a & 小写字母到大写字母转换\\
% 2 & A & 大写字母到小写字母转换\\
% 3 & @ & 非字母字符测试\\
% 4 & 2 & 非字母其它字符\\
% \bottomrule
% \end{tabular}
% }{\caption{字母大小写转换测试用例表}\label{tab:testsample}}
% \end{table}
如果表格内容很多,导致无法放在一页内的话,需要用{longtable}{longtabu} 进行分页。
\autoref{tab:performance}是一个长表格的例子。
% 定义表中用到的的宏,以简化表格代码并为后续修改提供统一接口
\def\tabcaption{实验数据,这个题注十分的长,注意这在索引中的处理方式,还有 \cs{caption} 后面的双反斜杠}
\def\tabheadrow{
\multirow{2}{*}{测试程序} & \multicolumn{1}{c}{正常运行} &
\multicolumn{1}{c}{同步} & \multicolumn{1}{c}{检查点} &
\multicolumn{1}{c}{卷回恢复} & \multicolumn{1}{c}{进程迁移} &
\multicolumn{1}{c}{检查点} \\
& \multicolumn{1}{c}{时间(s)} & \multicolumn{1}{c}{时间(s)} &
\multicolumn{1}{c}{时间(s)} & \multicolumn{1}{c}{时间(s)} &
\multicolumn{1}{c}{时间(s)} & \multicolumn{1}{c}{文件(KB)} \\
}
% 定义跨页表续表表题
\def\ctntabcap{
\multicolumn{7}{c}{\small\heiti{}续表~\thetable\hskip1em 实验测试数据}
}
% 定义跨页表命令集合
\def\ctntabcmd{
\\\ctntabcap\\
\toprule
\tabheadrow
\midrule
\endhead
\midrule
\multicolumn{7}{r}{续下页}\\
\endfoot
\endlastfoot
}
\begin{longtable}[c]{c*{6}{r}}
\caption[实验数据]{实验测试数据}\label{tab:performance}\\
\toprule
\tabheadrow
\midrule
\endfirsthead
\ctntabcmd
CG.A.2 & 23.05 & 0.002 & 0.116 & 0.035 & 0.589 & 32491 \\
CG.A.4 & 15.06 & 0.003 & 0.067 & 0.021 & 0.351 & 18211 \\
CG.A.8 & 13.38 & 0.004 & 0.072 & 0.023 & 0.210 & 9890 \\
CG.B.2 & 867.45 & 0.002 & 0.864 & 0.232 & 3.256 & 228562 \\
CG.B.4 & 501.61 & 0.003 & 0.438 & 0.136 & 2.075 & 123862 \\
CG.B.8 & 384.65 & 0.004 & 0.457 & 0.108 & 1.235 & 63777 \\
MG.A.2 & 112.27 & 0.002 & 0.846 & 0.237 & 3.930 & 236473 \\
MG.A.4 & 59.84 & 0.003 & 0.442 & 0.128 & 2.070 & 123875 \\
MG.A.8 & 31.38 & 0.003 & 0.476 & 0.114 & 1.041 & 60627 \\
MG.B.2 & 526.28 & 0.002 & 0.821 & 0.238 & 4.176 & 236635 \\
MG.B.4 & 280.11 & 0.003 & 0.432 & 0.130 & 1.706 & 123793 \\
MG.B.8 & 148.29 & 0.003 & 0.442 & 0.116 & 0.893 & 60600 \\
LU.A.2 & 2116.54 & 0.002 & 0.110 & 0.030 & 0.532 & 28754 \\
LU.A.4 & 1102.50 & 0.002 & 0.069 & 0.017 & 0.255 & 14915 \\
LU.A.8 & 574.47 & 0.003 & 0.067 & 0.016 & 0.192 & 8655 \\
LU.B.2 & 9712.87 & 0.002 & 0.357 & 0.104 & 1.734 & 101975 \\
LU.B.4 & 4757.80 & 0.003 & 0.190 & 0.056 & 0.808 & 53522 \\
LU.B.8 & 2444.05 & 0.004 & 0.222 & 0.057 & 0.548 & 30134 \\
CG.B.2 & 867.45 & 0.002 & 0.864 & 0.232 & 3.256 & 228562 \\
CG.B.4 & 501.61 & 0.003 & 0.438 & 0.136 & 2.075 & 123862 \\
CG.B.8 & 384.65 & 0.004 & 0.457 & 0.108 & 1.235 & 63777 \\
MG.A.2 & 112.27 & 0.002 & 0.846 & 0.237 & 3.930 & 236473 \\
MG.A.4 & 59.84 & 0.003 & 0.442 & 0.128 & 2.070 & 123875 \\
MG.A.8 & 31.38 & 0.003 & 0.476 & 0.114 & 1.041 & 60627 \\
MG.B.2 & 526.28 & 0.002 & 0.821 & 0.238 & 4.176 & 236635 \\
MG.B.4 & 280.11 & 0.003 & 0.432 & 0.130 & 1.706 & 123793 \\
MG.B.8 & 148.29 & 0.003 & 0.442 & 0.116 & 0.893 & 60600 \\
LU.A.2 & 2116.54 & 0.002 & 0.110 & 0.030 & 0.532 & 28754 \\
LU.A.4 & 1102.50 & 0.002 & 0.069 & 0.017 & 0.255 & 14915 \\
LU.A.8 & 574.47 & 0.003 & 0.067 & 0.016 & 0.192 & 8655 \\
LU.B.2 & 9712.87 & 0.002 & 0.357 & 0.104 & 1.734 & 101975 \\
LU.B.4 & 4757.80 & 0.003 & 0.190 & 0.056 & 0.808 & 53522 \\
LU.B.8 & 2444.05 & 0.004 & 0.222 & 0.057 & 0.548 & 30134 \\
EP.A.2 & 123.81 & 0.002 & 0.010 & 0.003 & 0.074 & 1834 \\
EP.A.4 & 61.92 & 0.003 & 0.011 & 0.004 & 0.073 & 1743 \\
EP.A.8 & 31.06 & 0.004 & 0.017 & 0.005 & 0.073 & 1661 \\
EP.B.2 & 495.49 & 0.001 & 0.009 & 0.003 & 0.196 & 2011 \\
EP.B.4 & 247.69 & 0.002 & 0.012 & 0.004 & 0.122 & 1663 \\
EP.B.8 & 126.74 & 0.003 & 0.017 & 0.005 & 0.083 & 1656 \\
\bottomrule
\end{longtable}
\subsection{插图标注}
\enquote{nwafuprojrep.cls}模板中,可能通过引入了改自tikz-imagelabels宏包
的tikz-imglabels宏包,利用TikZ为插图进行标注。该宏包的使用细节与
tikz-imagelabels完全一致,请在命令行使用\enquote{texdoc tikz-imagelabels}命令
查看其使用说明书。\autoref{texcode03}用于实现\autoref{fig:annot}所示的插图标注。
% 该center环境中的代码为排版示例代码,实际排版中不需要该代码
\begin{center}
\begin{langCVOne}[tex][texcode03][\LaTeX{}]{插图标注代码}
\begin{figure}[!htp]
\centering
\begin{annotationimage}{width=0.8\textwidth}{figs/01reviewicons01}
% 绘制外观设置按钮分组示意下划线
\draw[thick,blue] (0.86,0.26) -- (1.0,0.26);
% 添加各图标标注
\foreach \ann/\xpos in
{
{\\\\\\}/0.02, {\\\\\\}/0.07,
{\\\\线\\\\}/0.126, {\\\\线\\\\}/0.18,
{\\\\线\\\\\\\\\\\\\\}/0.229, {\\\\\\\\\\}/0.283,
{\\\\\\}/0.346, {\\\\\\\\}/0.40,
{\\\\\\\\\\}/0.45, {\\\\\\\\}/0.51,
{\\\\\\}/0.56, {\\\\\\\\\\}/0.63,
{\\\\\\}/0.7, {\\\\\\\\\\}/0.79,
{\\\\\\\\\\}/0.93
}
{
\draw[annotation below = {{\ann} at \xpos}] to (\xpos,0.48);
}
\end{annotationimage}
\caption{插图标注}\label{fig:annot}
\end{figure}
\end{langCVOne}
\end{center}
% 图像标注
\begin{figure}[!htp]
\centering
\begin{annotationimage}{width=0.8\textwidth}{figs/01reviewicons01}
% 绘制外观设置按钮分组示意下划线
\draw[thick,blue] (0.86,0.26) -- (1.0,0.26);
% 添加各图标标注
\foreach \ann/\xpos in
{
{\\\\\\}/0.02, {\\\\\\}/0.07,
{\\\\线\\\\}/0.126, {\\\\线\\\\}/0.18,
{\\\\线\\\\\\\\\\\\\\}/0.229, {\\\\\\\\\\}/0.283,
{\\\\\\}/0.346, {\\\\\\\\}/0.40,
{\\\\\\\\\\}/0.45, {\\\\\\\\}/0.51,
{\\\\\\}/0.56, {\\\\\\\\\\}/0.63,
{\\\\\\}/0.7, {\\\\\\\\\\}/0.79,
{\\\\\\\\\\}/0.93
}
{
\draw[annotation below = {{\ann} at \xpos}] to (\xpos,0.48);
}
\end{annotationimage}
\caption{插图标注}\label{fig:annot}
\end{figure}
\subsection{流程图}
\enquote{nwafuprojrep.cls}模板中,可能引入了自己开发
的tikz-flowchart宏包进行流程图的绘制。请
\github{}查看%
\href{https://github.com/registor/tikz-flowchart}{tikz-flowchart宏包}
使用说明书。
在绘制流程图时,可以先用纸和笔绘制草稿,然后根据草稿布置各个结点,再
连接流程线。这样,可以做到心中有数,绘制较为方便。
\autoref{subfig:draft}是一个流程图草稿。根据该草稿,基于tikz-flowchart宏包,
\autoref{texcode04}可绘制\autoref{subfig:tikz}所示的流程图。
% 该center环境中的代码为排版示例代码,实际排版中不需要该代码
\begin{center}
\begin{langCVOne}[tex][texcode04][\LaTeX{}]{绘制流程图}
% 流程图绘制属性设置
\flowchartset{
proc fill color = orange!10, % 顺序处理框填充颜色(默认取白色)
test fill color = green!30, % 判断框填充颜色(默认取白色)
io fill color = blue!30, % 输入/输出框填充颜色(默认取白色)
term fill color = red!30, % 开始/结束框填充颜色(默认取白色)
}
% 绘制流程图
\begin{tikzpicture}[scale=0.53,transform shape,]
% 布置结点单元
\node [term] (st) {开始};
\node [proc, text width = 5em, join] (p1) {int divisor};
\node [test, join] (t1) {n <= 1};
\node [proc, text width = 5em] (p2) {divisor = 2};
\node [test, text width = 10em, join] (t2) {divisor * divisor <= n};
\node [test, text width = 8em] (t3) {n \% divisor == 0};
\node [proc, text width = 5em] (p3) {divisor++};
\node [term, below = 1.6 of p3] (end) {结束};
\node [proc, text width = 4em, left = 4.8 of t2] (p4) {return 0};
\node [proc, text width = 4em, right = 3.5 of p3] (p5) {return 0};
\node [proc, text width = 4em, right = 5.8 of t3] (p6) {return 1};
% 布置用于连接的坐标结点,同时为其布置调试标记点。
\node [coord] (c1) at ($(p2.south)!0.5!(t2.north)$) {}; \cmark{1}
\node [coord, below = 0.25 of p3] (c2) {}; \cmark{2}
\node [coord, above = 0.5 of end] (c3) {}; \cmark{3}
\node [coord, left = 0.5 of t2] (ct) {}; \cmark{t}
\node [coord] (c4) at (c3 -| p5) {}; \cmark{4}
\node [coord] (c5) at (c2 -| ct) {}; \cmark{5}
% 判断框连线,每次绘制时,先绘制一个带有一个固定
% 位置标注的路径(path),然后再绘制箭头本身(arrow)。
\path (t1.south) -- node [near start, right] {$N$} (p2.north);
\draw [norm] (t1.south) -- (p2.north);
\path (t1.west) -| node [near start, above] {$Y$} (p4.north);
\draw [norm] (t1.west) -| (p4.north);
\path (t2.south) -- node [near start, right] {$Y$} (t3.north);
\draw [norm] (t2.south) -- (t3.north);
\path (t2.east) -| node [near start, above] {$N$} (p6.north);
\draw [norm] (t2.east) -| (p6.north);
\path (t3.south) -- node [near start, right] {$N$} (p3.north);
\draw [norm] (t3.south) -- (p3.north);
\path (t3.east) -| node [near start, above] {$Y$} (p5.north);
\draw [norm] (t3.east) -| (p5.north);
% 其它连线
\draw [norm](p3.south) |- (c5) |- (c1);
\draw [norm](p4.south) |- (c3);
\draw [norm](p4.south) |- (c3) -- (end);
\draw [norm](p5.south) -- (c4);
\draw [norm](p6.south) |- (c3);
\draw [norm](p6.south) |- (c3) -- (end);
\end{tikzpicture}
\end{langCVOne}
\end{center}
% 流程图绘制属性设置
\flowchartset{
proc fill color = orange!10, % 顺序处理框填充颜色(默认取白色)
test fill color = green!30, % 判断框填充颜色(默认取白色)
io fill color = blue!30, % 输入/输出框填充颜色(默认取白色)
term fill color = red!30, % 开始/结束框填充颜色(默认取白色)
}
\begin{figure}[!htp]
\ffigbox[\textwidth]%
{%
\begin{subfloatrow}[2]%\useFCwidth
\ffigbox[\FBwidth]{
\includegraphics[width=0.35\textwidth]{02gcd}
}{\caption{草图}\label{subfig:draft}}
\ffigbox[\FBwidth]{
\begin{tikzpicture}[scale=0.53,transform shape,]
% 布置结点单元
\node [term] (st) {开始};
\node [proc, text width = 5em, join] (p1) {int divisor};
\node [test, join] (t1) {n <= 1};
\node [proc, text width = 5em] (p2) {divisor = 2};
\node [test, text width = 10em, join] (t2) {divisor * divisor <= n};
\node [test, text width = 8em] (t3) {n \% divisor == 0};
\node [proc, text width = 5em] (p3) {divisor++};
\node [term, below = 1.6 of p3] (end) {结束};
\node [proc, text width = 4em, left = 4.8 of t2] (p4) {return 0};
\node [proc, text width = 4em, right = 3.5 of p3] (p5) {return 0};
\node [proc, text width = 4em, right = 5.8 of t3] (p6) {return 1};
% 布置用于连接的坐标结点,同时为其布置调试标记点。
\node [coord] (c1) at ($(p2.south)!0.5!(t2.north)$) {}; \cmark{1}
\node [coord, below = 0.25 of p3] (c2) {}; \cmark{2}
\node [coord, above = 0.5 of end] (c3) {}; \cmark{3}
\node [coord, left = 0.5 of t2] (ct) {}; \cmark{t}
\node [coord] (c4) at (c3 -| p5) {}; \cmark{4}
\node [coord] (c5) at (c2 -| ct) {}; \cmark{5}
% 判断框连线,每次绘制时,先绘制一个带有一个固定
% 位置标注的路径(path),然后再绘制箭头本身(arrow)。
\path (t1.south) -- node [near start, right] {$N$} (p2.north);
\draw [norm] (t1.south) -- (p2.north);
\path (t1.west) -| node [near start, above] {$Y$} (p4.north);
\draw [norm] (t1.west) -| (p4.north);
\path (t2.south) -- node [near start, right] {$Y$} (t3.north);
\draw [norm] (t2.south) -- (t3.north);
\path (t2.east) -| node [near start, above] {$N$} (p6.north);
\draw [norm] (t2.east) -| (p6.north);
\path (t3.south) -- node [near start, right] {$N$} (p3.north);
\draw [norm] (t3.south) -- (p3.north);
\path (t3.east) -| node [near start, above] {$Y$} (p5.north);
\draw [norm] (t3.east) -| (p5.north);
% 其它连线
\draw [norm](p3.south) |- (c5) |- (c1);
\draw [norm](p4.south) |- (c3);
\draw [norm](p4.south) |- (c3) -- (end);
\draw [norm](p5.south) -- (c4);
\draw [norm](p6.south) |- (c3);
\draw [norm](p6.south) |- (c3) -- (end);
\end{tikzpicture}
}{\caption{TiKZ绘制图}\label{subfig:tikz}}
\end{subfloatrow}
}{\caption{用TiKZ绘制流程图}\label{fig:flowcharttikzdraw}}
\end{figure}
\subsection{UML图}
可以使用\enquote{pgf-umlcd}宏包实现UML图的绘制,在命令行
使用\enquote{texdoc pgf-umlcd}查看该宏包的使用说明书。
但由于TeXLive收集的pgf-umlcd宏包不能很好的处理中文类名,因此请使用模板
提供的pgf-umlcd宏包排版UML图。
\autoref{fig:uml}是使用\enquote{pgf-umlcd}宏包绘制的UML图。
\begin{figure}[!hpt]
\centering
\begin{tikzpicture}[font=\small]
\tikzset{ coord/.style={coordinate} }
\begin{class}[fill=red!25, text width=7em]{动物类CAnimal}{0, 0}
\attribute{-name[32]:char}
\attribute{-age:int}
\attribute{-weight:int}
\operation{+show():void}
\end{class}
\begin{class}[fill=green!25, text width=5em]{马CHorse}{-5, -4.5}
\inherit{动物类CAnimal}
\attribute{-power:int}
\operation{+show():void}
\operation{+talk():void}
\end{class}
\begin{class}[fill=green!25, text width=5em]{鸟CBird}{0, -4.5}
\inherit{动物类CAnimal}
\attribute{-wingSpan:int}
\operation{+show():void}
\operation{+talk():void}
\end{class}
\begin{class}[fill=green!25, text width=5em]{牛CBull}{5, -4.5}
\inherit{动物类CAnimal}
\attribute{-power:int}
\operation{+show():void}
\operation{+talk():void}
\end{class}
\begin{class}[fill=blue!25, text width=6em]{飞马CPegasus}{-2.5, -8}
\inherit{马CHorse}
\inherit{鸟CBird}
\operation{+show():void}
\operation{+talk():void}
\end{class}
\end{tikzpicture}
\caption{\enquote{pgf-umlcd}宏包绘制UML图}\label{fig:uml}
\end{figure}
\subsection{代码排版}
\enquote{nwafuprojrep.cls}模板中,可以引入了自己开发的boxie.sty宏包
进行代码排版。本文档\autoref{secboxiety}中有基本使用样例,详情请在\github{}查看
\href{https://github.com/registor/boxiesty}{boxie宏包}
的使用说明书。
\subsection{列表环境}
\enquote{nwafuprojrep.cls}模板中,基于enumitem宏包分别对itemize、
enumerate和description三个环境的各个距离参数进行了修正,以使其排版结果
符合中文习惯的首先缩进格式。
\subsubsection{itemize环境}
\begin{itemize}
\item 床前明月光,床前明月光,床前明月光,床前明月光,床前明月光,床前明月光,床前明月光。
\item 疑是地上霜,疑是地上霜,疑是地上霜,疑是地上霜,疑是地上霜,疑是地上霜,疑是地上霜。
\item 举头望明月,举头望明月,举头望明月,举头望明月,举头望明月,举头望明月,举头望明月。
\item 低头思故乡,低头思故乡,低头思故乡,低头思故乡,低头思故乡,低头思故乡,低头思故乡。
\end{itemize}
\subsubsection{enumerate环境}
\begin{enumerate}
\item 床前明月光,床前明月光,床前明月光,床前明月光,床前明月光,床前明月光,床前明月光。
\item 疑是地上霜,疑是地上霜,疑是地上霜,疑是地上霜,疑是地上霜,疑是地上霜,疑是地上霜。
\item 举头望明月,举头望明月,举头望明月,举头望明月,举头望明月,举头望明月,举头望明月。
\item 低头思故乡,低头思故乡,低头思故乡,低头思故乡,低头思故乡,低头思故乡,低头思故乡。
\end{enumerate}
\subsubsection{description环境}
\begin{description}
\item[床前明月光],床前明月光,床前明月光,床前明月光,床前明月光,床前明月光,床前明月光。
\item[疑是地上霜],疑是地上霜,疑是地上霜,疑是地上霜,疑是地上霜,疑是地上霜,疑是地上霜。
\item[举头望明月],举头望明月,举头望明月,举头望明月,举头望明月,举头望明月,举头望明月。
\item[低头思故乡],低头思故乡,低头思故乡,低头思故乡,低头思故乡,低头思故乡,低头思故乡。
\end{description}
\subsection{\enquote{emph}强调字体}
\enquote{nwafuprojrep.cls}模板中,重定义强调字体,将默认强调字体
是italic,中文用楷体代替操作更换为加粗操作,用加粗后的字体表示强调。
\subsection{文本框盒子}
文本框盒子继承于自己开发的boxie宏包,其使用细节请在\github{}查看
\href{https://github.com/registor/boxiesty}{boxie宏包}的使用说明书。
同时,在该宏包的基础上,为boxie宏包添加加了摘自于
\href{https://github.com/WisdomFusion/latex-templates/tree/master/progartcn}{progartcn
论文模板}\enquote{标题}\enquote{注意}\enquote{重要}
\enquote{技巧}\enquote{警告}文本框环境代码\footnote{本节示例摘自于
该模板中的tutorial-sample.tex文件}
\subsubsection{\enquote{标题}文本框}
标题文本框环境的使用格式为:
\verb|\begin{titledBox}{<title>} <content> \end{titledBox}|
\begin{titledBox}{HTTP/Console 内核}
HTTP 内核继承自 \verb|Illuminate\Foundation\Http\Kernel| 类,该类定义了一个 \verb|bootstrappers| 数组,这个数组中的类在请求被执行前运行,这些 \verb|bootstrappers| 配置了错误处理、日志、检测应用环境以及其它在请求被处理前需要执行的任务。
\end{titledBox}
\subsubsection{\enquote{注意}文本框}
注意文本框环境的使用格式为:
\verb|\begin{noteBox} <content> \end{noteBox}|
\begin{noteBox}
HTTP 内核继承自 \verb|Illuminate\Foundation\Http\Kernel| 类,该类定义了一个 \verb|bootstrappers| 数组,这个数组中的类在请求被执行前运行,这些 \verb|bootstrappers| 配置了错误处理、日志、检测应用环境以及其它在请求被处理前需要执行的任务。
\end{noteBox}
\subsubsection{\enquote{重要}文本框}
重要文本框环境的使用格式为:
\verb|\begin{importantBox} <content> \end{importantBox}|
\begin{importantBox}
HTTP 内核继承自 \verb|Illuminate\Foundation\Http\Kernel| 类,该类定义了一个 \verb|bootstrappers| 数组,这个数组中的类在请求被执行前运行,这些 \verb|bootstrappers| 配置了错误处理、日志、检测应用环境以及其它在请求被处理前需要执行的任务。
\end{importantBox}
\subsubsection{\enquote{技巧}文本框}
技巧文本框环境的使用格式为:
\verb|\begin{tipBox} <content> \end{tipBox}|
\begin{tipBox}
HTTP 内核继承自 \verb|Illuminate\Foundation\Http\Kernel| 类,该类定义了一个 \verb|bootstrappers| 数组,这个数组中的类在请求被执行前运行,这些 \verb|bootstrappers| 配置了错误处理、日志、检测应用环境以及其它在请求被处理前需要执行的任务。
\end{tipBox}
\subsubsection{\enquote{警告}文本框}
警告文本框环境的使用格式为:
\verb|\begin{warningBox} <content> \end{warningBox}|
\begin{warningBox}
HTTP 内核继承自 \verb|Illuminate\Foundation\Http\Kernel| 类,该类定义了一个 \verb|bootstrappers| 数组,这个数组中的类在请求被执行前运行,这些 \verb|bootstrappers| 配置了错误处理、日志、检测应用环境以及其它在请求被处理前需要执行的任务。
\end{warningBox}
\subsection{交叉引用}
在技术文档中,图、表、公式等必须使用\emph{交叉引用}
\enquote{nwafuprojrep.cls}模板中,交叉引用
\verb|\autoref|命令实现引用,并对图、表、节、小节、公式、代码等引用
标记字/词进行了设置。如对一个标签为\enquote{fig:01}的图使用
\verb|\autoref{fig:01}|便可以得到\enquote{图 XX}的结果,用
\verb|\autoref{texcode01}|就可以得到\enquote{代码 XX}的结果。
\subsection{参考文献}
参考文献采用GB/T7714-2015标准的顺序编码制,使用biber+biblatex方式实现,
样式控制选择\enquote{biblatex-gb7714-2015}宏包的顺序编码制
(gb7714-2015)样式,如\autoref{texcode06}
\begin{center}
\begin{langCVOne}[tex][texcode06][\LaTeX{}]{引用参考文献}
% 引用参考文献
详见文献\cite{Peebles2001-100-100}\parencite{Babu2014--}
另见文献\cite[49]{于潇2012-1518-1523}\parencite[106]{Babu2014--}
\end{langCVOne}
\end{center}
能够生成如下引用结果:
% 引用参考文献
详见文献\cite{Peebles2001-100-100}\parencite{Babu2014--}
另见文献\cite[49]{于潇2012-1518-1523}\parencite[106]{Babu2014--}
\subsection{已载入的宏包}
\enquote{nwafuprojrep.cls}模板中,已引入的宏包有:
\verb|etoolbox|\verb|unicode-math|\verb|geometry|
\verb|ulem|\verb|array|
\verb|graphicx|\verb|fancyhdr|\verb|titletoc|
\verb|caption|\verb|footmisc|\verb|url|
\verb|enumitem|\verb|circledsteps|\verb|filehook|
无需再次引入这些宏包。
\subsection{重要文件}
\begin{importantBox}
在使用在\enquote{nwafuprojrep.cls}模板前请确保:
\verb|nwafuprojrep.cls|模板文件在当前工作文件夹中。
如果需要代码盒子等各类盒子排版,则需要确保\verb|boxie.sty|
\verb|fvextra.sty|\verb|lstlinebgrd.sty|
这3个宏包文件在当前工作文件夹中,并且需要引入\verb|boxie|宏包,
\verb|boxie|宏包会根据需要加载\verb|fvextra|\verb|lstlinebgrd|
宏包,这两个宏包无需手动加载。
如果需要绘制UML图,则需要加载\verb|pgf-umlcd|宏包,此时需要确保\verb|pgf-umlcd.sty|
宏包文件在当前工作文件夹中(TeXLive自带的宏包无法正确处理中文类名称,同时,
修改了其association命令,以符合龚晓庆教材绘图习惯)。
如果需要绘制流程图,则需要加载\verb|tikz-flowchart|宏包,此时需要确保\verb|tikz-flowchart.sty|
宏包文件在当前工作文件夹中。
如果需要为插图进行村注,则需要加载\verb|tikz-imglabels|宏包,此时需要确保\verb|tikz-imglabels.sty|
宏包文件在当前工作文件夹中(TeXLive自带的宏包无法正确标注中的换行问题)。
\verb|Makefile|文件是执行make命令需要的脚本文件,可以根据需要选择。
\verb|.latexmkrc|文件是执行latexmk命令需要的脚本文件,可以根据需要选择。
\end{importantBox}
\subsection{排版编译}
\begin{importantBox}
由于需要排版代码文件,建议使用minted宏包实现代码排版,因此请确保安装
有Python及其Pygments模块,详情请使用\verb|texdoc minted|命令查看
minted宏包的使用说明。
同时,为支持minted编译,请使用\verb|-shell-escape|编译参数。
\end{importantBox}
由于需要交叉引用和参考文献,建议按如下方式执行4次编译:
\subsubsection{使用minted宏包排版代码}
\begin{ubtdark}{4次编译}
xelatex -shell-escape main.tex
biber main
xelatex -shell-escape main.tex
xelatex -shell-escape main.tex
\end{ubtdark}
如果使用Makefile,则执行make命令即可:
\begin{ubtdark}{4次编译}
make
\end{ubtdark}
如果使用\verb|.latexmkrc|,则执行latexmk命令即可:
\begin{ubtdark}{4次编译}
latexmk
\end{ubtdark}
\subsubsection{使用listings宏包排版代码}
\begin{ubtdark}{4次编译}
xelatex main.tex
biber main
xelatex main.tex
xelatex main.tex
\end{ubtdark}
如果使用TeXstudio等IDE工具,请参阅相关资料对IDE进行必要的配置。
建议通过
\href{https://space.bilibili.com/1374419?from=search&seid=9480597470053264528}{
王泽鹏老师的B站}资源,观看耿楠制作的教学视频学习必要的编译和配置过程。
\section{调试与测试}
该模板是第1次发布,仅进行了部分测试,还需要在使用中不断完善。如果发现
问题,请及时在gitee中提交issues,以便改进代码。
\section{实习日志}
实习日志用自定义的\enquote{logentry}环境编排,该环境第1个参数是日志标题
该参数为可选参数,第2个参数是日志日期,该参数为必选参数,日期输入格式务必是\enquote{yyyy/mm/dd}格式,\emph{注意}:星期会自动计算,无需输入。
\begin{logentry}[会议讨论]{2020/6/17}
开会讨论,决定使用\LaTeX{}为实习报告排版提供支持,需要开发
{nwafuprojrep.cls}模板。
\end{logentry}
\begin{logentry}[完成开发]{2020/6/28}
完成开发{nwafuprojrep.cls}模板v1.0.0开发,并进行了简单测试。在gitee平台
开源发布\href{https://gitee.com/registor/nwafuprojrep}{nwafuprojrep v1.0.0模板}
\end{logentry}
\begin{logentry}[修正无Python的Pygments下代码排版问题]{2020/6/29}
在无Python的Pygments模块下,使用listings宏包实现代码排版,并在Windows平台下完成了
测试,同时,发布nwafuprojrep模板v1.0.1版。
\end{logentry}
\begin{logentry}[添加\enquote{logentry}日志环境]{2020/6/30}
为实习日志编写添加自定义\enquote{logentry}环境,该环境设计了2个参数,第1个参数是
可选参数,用于排版日志标题;第2个参数是必选参数,用于排版日志日期。
同时,对\enquote{main.tex}说明文档进行了完善和修定,添加了UML图的绘制示例。
将pgf-umlcd、floatrow、subcaptio、boxie、tikz-imglabels、
tikz-flowchart宏包移出cls模板文件,以减少模板文档类的依赖,提高其灵活
性。
如果需要,需将这些宏包置于当前工作目录下,建议
在settings/packages.tex文件中引用这引宏包,在settings/format.tex中进
\enquote{设置floatrow浮动体属性}\enquote{代码交叉引用命
令autoref的引用格式}等设置。当然,这些引用和设置也可以在导言区完
成。
同时,发布nwafuprojrep模板v1.0.2版。
\end{logentry}
\begin{logentry}[添加操作系统及字体判断功能]{2020/7/1}
借鉴zepinglee开发的\href{https://github.com/ustctug/ustcthesis}{中国科学技术大学学位论文\LaTeX{}模板}代码, 为\textbackslash{}nwafuset命令添加了操作系统和字体选择key-value选项,并实现了操作系统自动判断及字体自动选择功能。
\end{logentry}
\begin{logentry}[简化模板宏包依赖]{2020/7/2}
进一步简化了nwafuprojrep.cls中对其他宏包的依赖,仅添加必要和宏包。其他宏包由用户决定是否需要加载,建议按推荐的目录结构在settings/packages.tex中添加需要的宏包。
添加报告(report)/论文(paper)选项,添加打印稿(print)/电子稿选项(epub)。
添加摘要排版命令,实现摘要排版。
修订README.md说明文件。
\end{logentry}
\begin{logentry}[调整模板宏包]{2020/7/6}
在nwafuprojrep.cls中添加ulem、calc和array宏包,以使单独使用
nwafuprojrep.cls模板时,也可以正常编译,同时删除
settings/packages.tex中ulem和calc的宏包。
删除封面中\enquote{题目}\enquote{学号}\enquote{姓名}
自动添加空格计算,减少对calc宏包的依赖。
在.gitignore排除对main.pdf文件的跟踪,以减少仓库大小。
修订README.md说明文件,说明仅支持LaTeX 2020以后的发行版。
\end{logentry}
\begin{logentry}[调整实习日志日期输出格式]{2020/7/10}
调整logentry实习日志环境的日期输出格式为中文格式,同时将日期输入格式调整为:yyyy/mm/dd。
\end{logentry}
\section{实习总结}
通过本次实习,解决了广大学子在撰写实习报告时的排版问题,减轻了排版工作量,排版结果更标准、更专业......
\section{附录:核心代码清单}\label{secboxiety}
可以使用boxie宏包提供的langPyOne、langCVOne等环境或langPyfile和langCVfile
等命令实现嵌入式代码或来自文件代码的排版。Py系列环境和命令不带引用计数
和标签,CV系列环境和命令带有引用计数和标签。
\subsection{代码排版环境}
例如,使用langPyOne环境可以排版不带引用计数和标签的代码。
\begin{langPyOne}[C++]{基于范围的循环}
#include <iostream>
#include <vector>
using namespace std;
int main()
{
// 累加 20 以内的素数
int sum = 0;
for(int e : {2, 3, 5, 7, 11, 13, 17, 19}) // 用 auto 类型更合理
{
sum += e;
}
cout << sum << endl;
// 输出结果 77
int arr[] = {1, 3, 5, 7, 9};
// 声明数组 arr,初始化为 5 个奇数
for(auto &ele : arr)
{
// 声明 ele,与数组 arr 关联在一起,用了 auto
ele = ele * 2;
// 修改数组每个元素的值
cout << ele << " ";
// 输出 ele,2 6 10 14 18
}
cout << endl;
for(auto ele : arr)
{
cout << ele << " ";
}
// 没有改变:1 3 5 7 9
cout << endl;
return 0;
}
\end{langPyOne}
再如,使用langCVOne环境可以排版带有引用计数和标签的代码,如\autoref{code:ex04-01}
\begin{langCVOne}[C++][code:ex04-01][C++]{基于范围的循环}
#include <iostream>
#include <vector>
using namespace std;
int main()
{
// 累加 20 以内的素数
int sum = 0;
for(int e : {2, 3, 5, 7, 11, 13, 17, 19}) // 用 auto 类型更合理
{
sum += e;
}
cout << sum << endl;
// 输出结果 77
int arr[] = {1, 3, 5, 7, 9};
// 声明数组 arr,初始化为 5 个奇数
for(auto &ele : arr)
{
// 声明 ele,与数组 arr 关联在一起,用了 auto
ele = ele * 2;
// 修改数组每个元素的值
cout << ele << " ";
// 输出 ele,2 6 10 14 18
}
cout << endl;
for(auto ele : arr)
{
cout << ele << " ";
}
// 没有改变:1 3 5 7 9
cout << endl;
return 0;
}
\end{langCVOne}
\subsection{代码排版命令}
代码排版命令用于根据代码文件进行排版,因此,可以在IDE中,例如
Code::Blocks中对代码进行排版,然后将排版后的文件直接用代码排版命令在
\LaTeX{}中进行排版。
例如,使用langPyfile命令可以载入代码文件,排版不带引用计数和标签的代码
(注意指定必要的路径)。
\langPyfile{基于范围的循环}{codes/ex04-01.cpp}
再如,使用langCVfile命令可以载入代码文件,排版带引用计数和标签的代码
(注意指定必要的路径),如\autoref{code:ex04-02}
\langCVfile[C++][code:ex04-02][C++]{基于范围的循环}{codes/ex04-01.cpp}
注:使用minted宏包排版代码,可以使用c++/C++或cpp指定语言名称,若使
用listings宏包排版代码,则只能使用c++/C++指定语言名称
% 新起1页排版参考文献
\newpage
% 打印参考文献表
\printbibliography[heading=bibliography,title=参考文献]
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
TeX/LaTeX
1
https://gitee.com/quyanga/nwafuprojrep.git
git@gitee.com:quyanga/nwafuprojrep.git
quyanga
nwafuprojrep
nwafuprojrep
master

搜索帮助