Latex排版

[目录]

Latex介绍及安装

   TeX 已经很老了,它在 1982 年以后基本就没有变化过。但是你相信世界上有如此完美的程序吗?它几乎没有bug, 而且你可以在几乎任何计算机上使用它,从PC机到Cray巨型机。经过几十年的风霜,它仍然是文档排版界的 “No.1”, “state-of-the-art”.它的王牌地位明显还将在21世纪继续保持!

  • 发行版Tex下载

  • 安装教程,只看第一部分。若你想使用Vscode对程序进行编译则继续看完。

  • 出现这样的问题,解决方案如下:

    • 在系统变量中 path 中添加变量 C:\Windows\System32
    • 重启电脑;
    • 管理员cmd运行 fmtutil-sys —all
  • Texstudo编译器,可以辅助编写程序。当然你用Texlive自带的Texwoks也行,愿意瞎搞用Vscode也行。

    • Texstudo编译器优点:
      • 具有自动补齐的功能,可提高编写效率,也是许多大佬使用的TeX编辑器;
      • 在编译的功能上,明显强于Texworks和WinEdt10;
      • 可一边编写代码,一边预览输出的文档效果。
  • 版本更新—在cmd中运行 tlmgr update —all

  • 命令编译自行探索,这里只提供可视化操作过程


Latex 结构

Latex常用宏包

1
2
3
4
5
6
\usepackage{amsmath}  %数学公式  
\usepackage{graphicx} %插图
\usepackage{xcolor} %颜色
\usepackage{array} %表格
\usepackage{fancyhdr}
\pagestyle{fancy} %导入页眉页脚需要的宏包



数学建模模板

  精心编写适合数学建模论文编撰!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
%定调文章格式
%\documentclass{cumcmthesis}
\documentclass[withoutpreface,bwprint]{cumcmthesis} %去掉封面与编号页
\usepackage{geometry} %版面设置宏包
\usepackage{fancyhdr} %导入页眉页脚需要的宏包

%纸张布局
\geometry{a4paper,left=2.5cm,right=2.5cm,top=3.5cm,bottom=2.5cm}
%标题
\title{标题}
%设置页首
\pagestyle{fancy}
\fancyhead[c]{标题}
% 将标题编号改为阿拉伯数字
\renewcommand\thesection{\arabic{section}}

% 正文区
\begin{document}
%\tableofcontents %此语句为目录设置,有则添加目录
\thispagestyle{empty}
\maketitle
\graphicspath{{figures/}}

\begin{abstract}
\thispagestyle{empty}
这里写摘要
\end{abstract}

\section{演示}
\subsection{三线表}

\begin{table}[!htbp]
\centering
\caption{\kaishu 标题}
\begin{tabular}{c c c}
\toprule[1.5pt]
符号 &含义 & 单位 \\
\midrule[1pt]

$ R $ &鼓面半径 &$ 0.2m $ \\

\toprule[1.5pt]
\end{tabular}
\end{table}

\subsubsection{绘图}
\begin{figure}[H]
\centering
\includegraphics[scale=0.9 ]{7.png}
\caption{\kaishu "同心协力"游戏示意图}
\end{figure}

\textbf{附录}
\begin{appendices}
\section{规划解决程序--lingo源代码}
\begin{lstlisting}[language=c]
F=tuo(h)
\end{lstlisting}
\end{appendices}
\end{document}

1


模块插入

1 插入图片

  在可选项进行设置:

1
2
3
4
5
   \begin{figure}[H]
\centering
\includegraphics[scale=0.9 ]{7.png}
\caption{\kaishu "同心协力"游戏示意图}
\end{figure}
  • 语法: \includegraphics [可选项]{文件};
  • 格式:ESP、PDF、PNG、JPG、BMP 可导入。
1
2
3
4
5
6
7
8

\includegraphics[scale=0.3]{tex.jpg} %设置缩放比例
\includegraphics[height=3cm]{tex.jpg} %设置图片的高度
\includegraphics[width=100pt]{tex.jpg} %设置图片的宽度
\includegraphics[height=1\textheight]{tex.jpg} %设置图片的相对高度
\includegraphics[width=1\textwidth]{tex.jpg} %设置图片的相对宽度
\includegraphics[angle=-45]{b.png} %设置角度
\includegraphics[width=1\textwidth,angle=-45]{b.png} %同时设置多个参数时,用逗进行分割

2 插入表格

  • 代码实现三线表
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    \begin{table}[!htbp]

    \centering
    \caption{\kaishu 标题}
    \begin{tabular}{c c c}
    \toprule[1.5pt]
    符号 &含义 & 单位 \\
    \midrule[1pt]
    $ R $ &鼓面半径 &$ 0.2m $ \\
    \toprule[1.5pt]
    \end{tabular}
    \end{table}

3 插入数学公式

  • 此处仅仅只放环境代码,具体 数学语法 见这里。


版面设计

1 纸张大小

  • %导入版面设置的宏包— \usepackage{geometry}

  • 使用命令: \geometry{papersize={宽, 高}}

  • 如: \geometry{papersize={20cm, 15cm}}


2 边距设置

  • 导入版面设置的宏包— \usepackage{geometry}
  • 使用命令:
    1
    2
    3
    4
    5
    \geometry{left          左边距
    \righ 右边距
    \top 上边距
    \bottom 下边距
    \geometry{left=5cm,right=5cm,top=5cm,bottom=5cm}


3、改变Section编号

1
\renewcommand\thesection{\arabic{section}}
  • arabic 阿拉伯数字
  • roman 小写的罗马数字
  • Roman 大写的罗马数字
  • alph 小写字母
  • Alph 大写字母

4、取消段落首行缩进

1
\noindent