转载:论文常用LaTeX代码

在本专栏中,记录了一些Latex的操作,近日听了本校O奖学长的经验分享,颇受启发。故拜访他的个人博客,发现了他总结得非常漂亮,然而他使用的是github服务器,访问起来加载有些缓慢,故将部分内容进行转载。
原作地址:https://levitate-qian.github.io/2020/08/30/latex-code/

图片
导言区代码

\usepackage{graphicx} %插入图片的宏包
\usepackage{float} %设置图片浮动位置的宏包
\usepackage{subfigure} %插入多图时用子图显示的宏包

1、单图

\begin{figure}[htbp]
    \centering
    \includegraphics[width=.9\textwidth]{XXX.pdf} 	% 图片相对位置
    \caption{Electric Vehicles: January 2020}		% 图片标题 
    \label{fig:American}							% 图片标签
\end{figure}

\begin{figure}[H]
    \centering
    \includegraphics[width=.4\textwidth]{ex2-3jie.pdf} 	% 图片相对位置
    \caption{习题2.3解图}		% 图片标题 
    \label{fig:ex4-9}
\end{figure}

2、多图并列放置(子图格式)

\begin{figure}[htbp]
    \centering    
    \subfigure[Hot Map of one Room]{				% 图片1([]内为子图标题)
    \label{fig:sub.roomhot}							% 子图1的标签
    \includegraphics[width=0.45\textwidth]{XXX.jpg}}% 子图1的相对位置
    \subfigure[Hot Map of one Floor]{				% 图片2
    \label{fig:sub.floorhot}						% 子图2的标签
    \includegraphics[width=0.45\textwidth]{XXX.jpg}}% 子图2的相对位置
    \caption{Hot Map of one Room and one Floor}		% 总图标题
    \label{fig:hot}									% 总图标签
\end{figure}

3、多图并列放置(全图格式)

\begin{figure}[htbp]
	\centering 									%图片全局居中
%并排几个图,就要写几个minipage
	\begin{minipage}[b]{0.45\textwidth} 		%所有minipage宽度之和小于1
		\centering 								%图片局部居中
		\includegraphics[width=0.8\textwidth]{DV_demand} 
							%此时的图片宽度比例是相对于这个minipage的,不是全局
		\caption{name 1}
		\label{fig:1}
	\end{minipage}
	\begin{minipage}[b]{0.45\textwidth} 
		\centering 									%图片局部居中
		\includegraphics[width=0.8\textwidth]{P+R_demand}
		\caption{name 2}
		\label{fig:2}
	\end{minipage}
\end{figure}

4、放置图片过程中,调整图片尺寸

\includegraphics[width=0.45\textwidth,trim=85 80 80 85,clip]{room_pic_guidance_new/step179.jpg}}
% 从左到右依次为左、下、右、上

5、Visio画图有多余边框
http://www.mamicode.com/info-detail-2181323.html
6、图片环绕文字

% \usepackage{wrapfig} 				%环绕文字需要引用的宏包
\begin{wrapfigure}{r}{8cm}			%靠文字内容的左侧
    \centering
    \includegraphics[width=.45\textwidth]{01.jpg} 	% 图片相对位置
    \caption{程控放大器设计框图}		  % 图片标题 
    \label{fig:01}					% 图片标签
\end{wrapfigure}

公式
1.局部对齐不标序号

\begin{equation*} 
    \begin{aligned}
		\text{the initial temperature: } &\quad T_0=1, \\
		\text{the terminal temperature: }&\quad e = 10^{-30},\\
		\text{attenuation coefficient: }&\quad \alpha =0.999, \\
		\text{the solution domain: }&\quad \mathbb{S}=\left\{p \in(0, \infty), t \in\left(0, t_{\max }\right]\right\}
    \end{aligned}
\end{equation*}

2.一个优化模型的示例

\begin{align}
	\min &\,Z=\sum_{i \in \mathbb{I}} \sum_{j} \in B(j)\\
	\mathrm{s.t.} &\left\{\begin{array}{llll}
    	\sum\limits_{i \in A(i)} V_i y_{ij} \le \sum\limits_{j \in A(i)} E_j x_j,\\
    	\sum\limits_{j \in B(i)} y_{ij} \ge 1, \forall i\in \mathbb{I}, \forall j \in B(j), \\
        \sum\limits_{i \in A(i)} x_j \ge 1, \forall i \in \mathbb{I}, \\
        y_{ij}\le x_j, \forall i\in \mathbb{I}, j\in \mathbb{J}. \\
    \end{array}\right.
\end{align}

3.添加行属性、列属性的矩阵

\begin{equation}\label{Eq:matrix1}
\bordermatrix{%
       & t_1       & t_2     &\cdots     &t_n\cr
u_1    & ?         & ?       &\cdots     & ?\cr
u_2    & ?         & ?       &\cdots     & ?\cr
\vdots & \vdots    &\vdots   &\cdots     &\vdots\cr
u_m    & ?         & ?       &\cdots     &?
},
\end{equation}

表格
LaTeX表格:http://www.tablesgenerator.com/tex_tables

1.符号说明(基础三线表)

\begin{table}[!htbp]
\begin{center}
\caption{Notations}							% 表格标题
\begin{tabular}{c|l}			% 三线表格式('c'居中,'l'左对齐,'|'表示竖框线)
	\toprule								% 上框线
	\multicolumn{1}{m{3cm}}{\centering Symbol}
	&\multicolumn{1}{m{8cm}}{\centering Definition}\\
	\midrule								% 中框线
    $\rho$      &   the people density\\
    $\mathit{SD_i}$ & the spatial danger of the $i^{th}$ cellular\\
    $v_i$       &   the velocity of the $i^{th}$ visitor\\
    $\overrightarrow{F_{Mi}}$   &   the attractive force (spatial danger and velocity) on the $i^{th}$ visitor\\
    $\overrightarrow{F_{ppi}}$  &   the people-to-people interaction force on the $i^{th}$ visitor\\
    $\overrightarrow{d_i}$  &   the expected movement direction the $i^{th}$ visitor\\
	$\alpha$ &the weight of the spatial danger and visitors’ velocity in $\overrightarrow{d_i}$\\
    $\beta$ &the weight of interaction force between people in $\overrightarrow{d_i}$\\
    $p$ &   the ratio of the crowd decentralization\\
    \bottomrule								%底框线
\end{tabular}\label{tb:notation}
\end{center}
\end{table}

2.基础表格

\begin{table}[!htbp]
    \begin{center}
    \caption{Grey prediction accuracy registration}
    \begin{tabular}{c|ccccccc}
        \toprule
        \textbf{Year}   &2011 &2012 &2013 &2014 &2015 &2016 &2017\\
        \midrule
        \textbf{EV Amount} & 1000& 1800& 3000&5000&8000&15000&20000 \\
        \bottomrule
    \end{tabular}\label{tb:Gray_Prediction}
    \end{center}
\end{table}

3.固定列宽表格

\begin{table}[!htbp]
    \begin{center}
    \caption{Normalized results of raw data for each indicator}
    \begin{tabularx}{32em}						% 控制固定总列宽32em
    {*{8}{>{\centering\arraybackslash}X}}		% 8栏每栏表格居中
        \toprule
        \textit{C}\textsubscript{1}  &\textit{C}\textsubscript{2} &\textit{C}\textsubscript{3}  &\textit{C}\textsubscript{4} &\textit{C}\textsubscript{5} &\textit{C}\textsubscript{6} &\textit{C}\textsubscript{7} &\textit{C}\textsubscript{8}\\
        \midrule
        0.0833& 1.0& 0 &0.375& 1 &0.9326 &0.9067 &0 \\
        \bottomrule
    \end{tabularx}\label{tb:Normalized_results}
    \end{center}
\end{table}

4.标题行分两类的表格

\begin{table}[!htbp]
    \begin{center}
    \caption{Metabolic rate of different Flying creatures in Static and Dynamic}
    \begin{tabular}{cccc}
        \toprule
         \multirow{2}{*}{Flying creatures} & \multirow{2}{*}{Body weight (g)} &\multicolumn{2}{c}{Metabolic rate (cal$\cdot\text{g}^{-1}\cdot\text{hr}^{-1}$)}\\
         \cmidrule{3-4}
            & & Dynamic & Static\\
        \midrule
        \textbf{Parrot}    &    42&     106 &       15.4\\
        \textbf{Gull} &         345     &56      &  7.2\\
        \textbf{Bat} &          512&    60 &        6.9\\
        \textbf{Eagle} &        2117&   36 &        4.5\\
        \bottomrule
    \end{tabular}\label{tb:Metabolic_rate}
    \end{center}
\end{table}

信件

% 以下为信件/备忘录部分,不需要可自行去掉
% 如有需要可将整个 letter 环境移动到文章开头或中间
% 请在后一个花括号内填写信件(Letter)或备忘录(Memorandum)标题
\begin{letter}{Memorandum}
\begin{flushleft}  % 左对齐环境,无首行缩进
\textbf{To:} Heishan Yan\\
\textbf{From:} Team XXXXXXX\\
\textbf{Date:} October 1st, 2019\\
\textbf{Subject:} A better choice than MS Word: \LaTeX
\end{flushleft}

In the memo, we want to introduce you an alternate typesetting program to the prevailing MS Word: \textbf{\LaTeX}. In fact, the history of \LaTeX\ is even longer than that of MS Word. In 1970s, the famous computer scientist Donald Knuth first came out with a typesetting program, which named \TeX\ \ldots

Firstly, \ldots

Secondly, \ldots

Lastly, \ldots

According to all those mentioned above, it is really worth to have a try on \LaTeX! 
\end{letter}

参考文献(MLA)
1.普通书籍

\bibitem{1} Venuti, Fiammetta, and Luca Bruno. "Crowd-structure interaction in lively footbridges under synchronous lateral excitation: A literature review." \emph{Physics of life reviews} 6.3 (2009): 176-206.
\bibitem{6} Yuan, Weifeng, and Kang Hai Tan. "An evacuation model using cellular automata." \emph{Physica A: Statistical Mechanics and its Applications} 384.2 (2007): 549-566.

2.博士论文

\bibitem{4} Kongjin Zhu. \emph{Study on Evacuation Characteristics and Evacuation Strategy in Typical Rigions of buildings}. Diss. Hefei: University of Science and Technology of China, 2013.

3.网站

\bibitem{3} \emph{Charging Station}. (2019). Retrieved January 1, 2020, from\url{https://en.wikipedia.org/wiki/Charging_station}

代码高亮

\noindent\textsc{Part A} - \textbf{lab021.m}
\lstinputlisting[language=matlab]{./code/lab021.m}
\begin{lstlisting}[language=vhdl]
process(sel3) --根据音调编码,分配分频系数
begin
    case sel3 is
        when"000"=>count_ld<="0111011101110"; --3822    -- 1(中音do!)
        when"001"=>count_ld<="0000000110010"; --50      -- 1(低音do)
        when"010"=>count_ld<="0000000010100"; --20      -- 2(低音re)
        when"011"=>count_ld<="0000000001010"; --10      -- 3(低音mi)
        when"100"=>count_ld<="0000000000101"; --5       -- 4(低音fa)
        when"101"=>count_ld<="0000000000010"; --2       -- 5(低音sol)
        when"110"=>count_ld<="1000111000000"; --4544    -- 6(低音la)
        when"111"=>count_ld<="0111111010000"; --4048    -- 7(低音si)
        when others=>count_ld<="0111011101110"; --3822
end case;
end process;   
\end{lstlisting}

另外附加学长整理的美赛英文表述
传送门

猜你喜欢

转载自blog.csdn.net/qq1198768105/article/details/113656737