latex入門(八) 美賽模闆
本文采用仙交大大佬制作的easymcm宏包,在模闆上稍作修改,建議先學習一些latex基礎。具體更新資訊與使用請前往大佬部落格:
https://www.cnblogs.com/xjtu-blacksmith/p/easymcm.html
(再次向仙交大的大佬表示感謝:
注意事項:
1.目錄已在easymcm.sty檔案中定義,使用tableofcontents生成
\tableofcontents % 生成目錄
2.每一部分
由section,subsection,subsubsection組成
\section{Introduction}
\subsection{Problem Background}
\subsubsection{Detail 1 about Model 1}
...
...
\subsection{Our Work}
...
...

3.enumerate可以列出1,2,3,…點,itemiz可以以圓點方式給出各點
\begin{enumerate}[\bf 1.]
\item ...
\item ...
\item ...
\item ...
\end{enumerate}
\begin{itemize}
\item First one...
\item Second one ...
\end{itemize}
4.對于符号說明直接使用模闆填入就ok
\subsection{Notations}
The primary notations used in this paper are listed in \textbf{Table \ref{Ntt}}. There can be some
other notations to be described in other parts of the paper.
\begin{table}[!htbp]
\begin{center}
\caption{Notations}
\begin{tabular}{cl}
\toprule
\multicolumn{1}{m{3cm}}{\centering Symbol}
&\multicolumn{1}{m{8cm}}{\centering Definition}\\
\midrule
%隻需填寫下面部分
$I$&The Intensity of the Heat Source\\
$k$&The Material's Conductivity\\
$h$&The Heat Transfer Coefficient\\
$c$&The Heat Capacity of Water (=4200 J/(kg$\cdot^\circ$C))\\
$\rho$&The Density of Water (=10$^3$ kg/m$^3$)\\
\bottomrule
\end{tabular}\label{tb:notation}
\end{center}
\end{table}
5.引用參考文獻用\cite
6.關于附錄中的代碼模闆
摘自:
https://blog.csdn.net/lydyangliu/article/details/9208635
首先在文章開始前加入lstlisting的設定代碼
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{listings}
\lstset{%
alsolanguage=Java,
%language={[ISO]C++}, %language為,還有{[Visual]C++}
%alsolanguage=[ANSI]C, %可以添加很多個alsolanguage,如alsolanguage=matlab,alsolanguage=VHDL等
%alsolanguage= tcl,
alsolanguage= XML,
tabsize=4, %
frame=shadowbox, %把代碼用帶有陰影的框圈起來
commentstyle=\color{red!50!green!50!blue!50},%淺灰色的注釋
rulesepcolor=\color{red!20!green!20!blue!20},%代碼塊邊框為淡青色
keywordstyle=\color{blue!90}\bfseries, %代碼關鍵字的顔色為藍色,粗體
showstringspaces=false,%不顯示代碼字元串中間的空格标記
stringstyle=\ttfamily, % 代碼字元串的特殊格式
keepspaces=true, %
breakindent=22pt, %
numbers=left,%左側顯示行号 往左靠,還可以為right,或none,即不加行号
stepnumber=1,%若設定為2,則顯示行号為1,3,5,即stepnumber為公差,預設stepnumber=1
%numberstyle=\tiny, %行号字型用小号
numberstyle={\color[RGB]{0,192,192}\tiny} ,%設定行号的大小,大小有tiny,scriptsize,footnotesize,small,normalsize,large等
numbersep=8pt, %設定行号與代碼的距離,預設是5pt
basicstyle=\footnotesize, % 這句設定代碼的大小
showspaces=false, %
flexiblecolumns=true, %
breaklines=true, %對過長的代碼自動換行
breakautoindent=true,%
breakindent=4em, %
escapebegin=\begin{CJK*}{GBK}{hei},escapeend=\end{CJK*},
aboveskip=1em, %代碼塊邊框
tabsize=2,
showstringspaces=false, %不顯示字元串中的空格
backgroundcolor=\color[RGB]{245,245,244}, %代碼背景色
%backgroundcolor=\color[rgb]{0.91,0.91,0.91} %添加背景色
escapeinside=``, %在``裡顯示中文
%% added by http://bbs.ctex.org/viewthread.php?tid=53451
fontadjust,
captionpos=t,
framextopmargin=2pt,framexbottommargin=2pt,abovecaptionskip=-3pt,belowcaptionskip=3pt,
xleftmargin=4em,xrightmargin=4em, % 設定listing左右的空白
texcl=true,
% 設定中文沖突,斷行,列模式,數學環境輸入,listing數字的樣式
extendedchars=false,columns=flexible,mathescape=true
% numbersep=-1em
}
然後附錄部分輸入即可
\section{Appendix}
\begin{lstlisting}[language=matlab,caption={The matlab Source code of Algorithm}]
kk=2;[mdd,ndd]=size(dd);
while ~isempty(V)
[tmpd,j]=min(W(i,V));tmpj=V(j);
for k=2:ndd
[tmp1,jj]=min(dd(1,k)+W(dd(2,k),V));
tmp2=V(jj);tt(k-1,:)=[tmp1,tmp2,jj];
end
tmp=[tmpd,tmpj,j;tt];[tmp3,tmp4]=min(tmp(:,1));
if tmp3==tmpd, ss(1:2,kk)=[i;tmp(tmp4,2)];
else,tmp5=find(ss(:,tmp4)~=0);tmp6=length(tmp5);
if dd(2,tmp4)==ss(tmp6,tmp4)
ss(1:tmp6+1,kk)=[ss(tmp5,tmp4);tmp(tmp4,2)];
else, ss(1:3,kk)=[i;dd(2,tmp4);tmp(tmp4,2)];
end;end
dd=[dd,[tmp3;tmp(tmp4,2)]];V(tmp(tmp4,3))=[];
[mdd,ndd]=size(dd);kk=kk+1;
end; S=ss; D=dd(1,:);
\end{lstlisting}
\begin{lstlisting}[language=c,caption={The lingo source code}]
kk=2;
[mdd,ndd]=size(dd);
while ~isempty(V)
[tmpd,j]=min(W(i,V));tmpj=V(j);
for k=2:ndd
[tmp1,jj]=min(dd(1,k)+W(dd(2,k),V));
tmp2=V(jj);tt(k-1,:)=[tmp1,tmp2,jj];
end
tmp=[tmpd,tmpj,j;tt];[tmp3,tmp4]=min(tmp(:,1));
if tmp3==tmpd, ss(1:2,kk)=[i;tmp(tmp4,2)];
else,tmp5=find(ss(:,tmp4)~=0);tmp6=length(tmp5);
if dd(2,tmp4)==ss(tmp6,tmp4)
ss(1:tmp6+1,kk)=[ss(tmp5,tmp4);tmp(tmp4,2)];
else, ss(1:3,kk)=[i;dd(2,tmp4);tmp(tmp4,2)];
end;
end
dd=[dd,[tmp3;tmp(tmp4,2)]];V(tmp(tmp4,3))=[];
[mdd,ndd]=size(dd);
kk=kk+1;
end;
S=ss;
D=dd(1,:);
\end{lstlisting}
效果圖: