环境
\(\LaTeX\)编译器可以在VS Code本地化部署,也可以采用Overleaf在线平台。官网:https://www.overleaf.com/,注册登录即可。
\(\LaTeX\)布局
\(\LaTeX\)是一个通过写代码来对文章进行排版编辑的工具。它分为导言区+正文。
- 导言区
首先是文章的声明:
1
\documentclass[UTF8]{ctexart}
文章编码:UF8。文章类型:中文。然后导入所有的宏包:
1
2
3\usepackage{mathtools,wallpaper}
\usepackage{t1enc}
\usepackage{pagecolor}
这些都是你在文章中所需要的工具包或者插件。然后是文章标题与日期:
1
2\title{论文标题}
\date{} %不显示日期
- 正文
1
2
3\begin{document}
文章
\end{document}
文章主体都要写在这个框架之内。 \maketitle
\maketitle一定要加上,并且是在\begin{document}的后面,否则会有语法错误。
\(\LaTeX\)内容
- 各级标题
1
2
3
4
5\section{}
\subsection{}
\subsubsection{}
\paragraph{}
\subparagraph{}
这是\(\LaTeX\)各级标题的命名方法。 - 列表
1
2
3
4
5\begin{enumerate}
\item 第一条
\item 第二条
\item 第三条
\end{enumerate}
这是有序列表的代码。
- 字体
1
2
3
4
5
6{\normalsize }
{\large } % 通常这个对应“小四”号字体
{\Large }
{\LARGE }
{\huge }
{\Huge }
1
2
3{\songti } % 宋体
{\heiti } % 黑体
{\fangsong } % 仿宋
1
2{\bf } % 粗体
{\it } % 斜体
贴一个:论文常用LaTeX代码。
- 表格
基础的三线表(三条线一样粗)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18\section{符号说明}
%浮动体表格,使用table实现
\begin{table}[H] %[h]表示在此处添加浮动体,默认为tbf,即页面顶部、底部和空白处添加
\captionsetup{skip=4pt} % 设置标题与表格的间距为4pt
\centering
\setlength{\arrayrulewidth}{1pt} % 设置表格线条宽度为1pt
\begin{tabular}{cc} %c表示居中,l表示左对齐,r表示右对齐,中间添加“|”表示竖线
\hline
\makebox[0.15\textwidth][c]{符号} & \makebox[0.6\textwidth][c]{说明} \\
\hline
r & Spearman系数 \\
& \\
& \\
& \\
\hline
\end{tabular}
% \hline是横线,采用\makebox设置列宽
\end{table}三线表2
1
2
3
4
5
6
7
8
9
10
11
12
13
14\begin{center}
% 导言区
% \usepackage{booktabs}
\begin{tabular}{ccccc}
\toprule
序号 & 性别 & 年龄 & 身高/cm& 体重/kg\\
\midrule
1 & F & 14 & 156 & 42 \\
2 & F & 16 & 158 & 45 \\
3 & M & 14 & 162 & 48 \\
4 & M & 15 & 163 & 50 \\
\bottomrule
\end{tabular}
\end{center}基础表格(用tabular实现)
1
2
3
4
5
6
7
8
9
10
11
12\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}定宽表(常用)
1
2
3
4
5
6
7
8
9
10
11\begin{table}[!ht]
\centering
\caption{问题一年平均光学效率及功率表}
\resizebox{\linewidth}{!}{
\begin{tabular}{|l|l|l|l|l|l|}
\hline
年平均光学效率 & 年平均余弦效率 & 年平均阴影遮挡效率 & 年平均截断效率 & 年平均输出热功率 (MW) & 单位面积镜面年平均 输出热功率 (kW/m2 ) \\ \hline
0.6066 & 0.8112 & 0.9297 & 0.9073 & 41.273 & 0.5326 \\ \hline
\end{tabular}
}
\end{table}
- 图片
1
2
3
4
5
6\begin{figure}[htbp]
\centering
\includegraphics[width=0.4\linewidth]{坐标示意图}
\caption{地平坐标线示意图}
\label{fig:enter-label}
\end{figure}
西电毕设\(\LaTeX\)模板:https://github.com/note286/xduts