Latex写作常用操作和注意事项

Latex写作常用操作说明和注意事项

页面边剧设置

\usepackage{geometry}

\geometry{a4paper,scale=0.8}

上面命令设置了纸张为a4 纸,并且版心占页面长度的比例为80%;scale也可以改为ratio,表示版面边距占页面长度的比例。

该宏包还可以设置页面的上下左右边距,例如:
\geometry{a4paper,left=2cm,right=2cm,top=3cm,bottom=3cm}

latex中采用的单位unit

pt:一个点point相当于1/72.27inch,也就是大约0.0138inch或0.3515mm ;

mm:毫米; cm:厘米; in:英寸;

ex:约等于当前字体中字母x(小写)的高度;

em:约等于当前字体中字母M(大写)的宽度;

mu:当前采用的数学字体为参考的em,则1mu=1/18em。

常用参数说明

  1. [c]是水平居中,[l]水平左居中,[r]水平右居中;
  2. *[c]水平 + 垂直居中,*[l]垂直居中 + 水平左居中,*[r]垂直居中 + 水平右居中。
  3. 自动换行在英语中又两种请:一种是warp,即单词间会以单词为单位换行,如果左对齐了,有段会显得参差不齐。另一种是line break,单词换行的时候会以“-”连接。

 

常用功能

  1. 如果是分章节写,那么章节路径文件名中不能有空格。
  2. \noindent:换行不缩进;\indent段首加空格。
  3. \hspace{2em}:手动缩进2em。
  4. \ref和\ref*的区别在于,前者会cross-reference,后者只是当你想引用又不想创建引用链接的时候会用到(来自:URL)。
  5. 对于期刊类文章的模板,插入附录节(appendix):使用\usepackage{appendix}包(参考:URL)。
    \begin{subappendices}
    \subsection{How I became inspired}
    ...
    \end{subappendices}
  6. 插入附录章(写学位论文时),可以用​\usepackage[toc,page]{appendix}包(参考:URL)。

    \usepackage[toc,page]{appendix}
    ...
    \begin{appendices}
    ...
    \end{appendices}
  7. 对于IEEE conference template插入附录的话,使用\appendices即可。(参考:URL

    \appendices
    \section*{Appendix} \label{app:A}
    input text here.
  8. 不需要添加包和修改环境的情况下,直接插入空行:\\ \hspace*{\fill} \\, 或者\hspace*{\fill} \\

  9.  

字体

改变字体颜色

\usepackage{color}

1. {\color{red} 文本}

2. \textcolor[rgb]{1,0,0}{文本}  颜色参数范围为[0,1]

 

表格

表格的常用参数说明

p{width}: Top-aligned cells width fixed width

m{width}: Middle-aligned cells width fixed width

b{width}: Bottom-aligned cells with fixed width

 

表格的操作

  1. \renewcommand\arraystretch{2}这一句代码,作用是讲每一行的高度变为原来的两倍。
  2. \addlinespace这个用于在表格里增加空行。
  3. *相当于文字与单元格上下边线之间的垂直空隙增加了一个\jot (约3pt)。
  4. 多行表格(\multirow)想要顶端对齐,可以这样\multirow[t]{2}{*}{XXX},表示一个跨两行的表格,XXX顶端对齐了。
  5. 想让多行表格(\multirow)里的文字自动换行(warp),可以提供设置宽度来代替*,如\multirow[t]{6}{ 3cm}{Design or structure defects}。
  6. 表格内的内容过多要手动换行时,调用\usepackage{makecell}包,然后在要换行的单元格内,\makecell[参数: c,l,p,tl,tp,tc,…]{ {111} \\ {222} \\ {333}}。简单内容可以直接用\makecell[参数: c,l,p,tl,tp,tc,…]{11 \\ 22 \\ 33},但是复杂内容一定要加括号,即{ {222} \\ {333}}。
  7. 设置单元格自动换行,例如表格有两列,想让第一列居中(c),第二列自动换行(限定宽度即可自动换行,如p{0.85\textwidth}),可以这样设置:\begin{ tabular}{cp{0.85\textwidth}}
\begin{table}[H]
    \footnotesize
    \centering
    \caption{Example of a Table}\label{T:Table}
    \begin{tabular}{cp{0.85\textwidth}}
    \toprule
    \textbf{No.} & \textbf{Question}\\
    \hline
    Q1 & Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question \\\hline
    Q2 & Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question \\\hline
   \multirow[t]{3}*{Q3} & Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question \\
   ~ & \textbf{A}. Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question \\
   ~ & \textbf{B}. Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question \\\bottomrule
    \end{tabular}
\end{table}

  8. 页面横置(横向页面),插入横向表格。

\usepackage{lscape}

\begin{document}

\begin{landscape}
This is a landscape page.

\end{landscape}

\end{document}

 9. 表格限宽且居中的设置:

\begin{tabular}{|p{3cm}<{\centering}|p{4cm}|p{6cm}|}

10. 表格单元格宽度调整:

\usepackage{booktabs} %用到的包
\specialrule{0em}{1pt}{2pt} %0em表示单元格上方插入一根宽为0em的横线,因为宽度为0,所以相当于没有插入横线;紧跟着的俩个{1pt}分别表示单元格内容距离上方单元的距离为1pt和距离下方单元格的距离为2pt(可以根据自己的需求调整)。

11. 

数学公式

字体大小:

七号   5.25pt      1.845mm    \tiny
六号   7.875pt    2.768mm    \scriptsize
小五号  9pt       3.163mm    \footnotesize
五号   10.5pt      3.69mm      \small
小四号  12pt     4.2175mm    \normalsize
四号   13.75pt    4.83mm      \large
三号   15.75pt    5.53mm      \Large
二号   21pt     7.38mm              \LARGE
一号   27.5pt      9.48mm      \huge
小初号  36pt     12.65mm    \Huge
初号   42pt     14.76mm 

使用方法:替换下面代码中的small即可

\begin{small} 
\begin{equation} 
\ldots 公式,如:{
   
   {F}_{1}}-score=\frac{2\times precision\times recall}{precision+recall}
\end{equation} 
\end{small}

数学符号

这个网站总结的很全面:http://mohu.org/info/symbols/symbols.htm

参考文献相关

1. 在使用Latex排版论文时候,参考文献部分会出现论文题目的第一个字符外的其他字符转换为小写,例如{ABCDEFG}会变成{Abcdefg},这时候如果想保持标题原来的样式可以用花括号将题目括起来,例如:{ {ABCDEFG}}

2. 在期刊论文写作的时候,如果想改变参考文献的标题大小写,可以从.cls文件入手。将references标题从小写换成大写的REFERENCES即可。

其他

\textwidth与linewidth的区别

\textwidth \linewidth

\textwidth is the normal width of the text on a page. It should generally be changed only in the preamble.

 

\linewidth is the width of lines in the current environment. Normally equal to \textwidth, it may be different within an environment such as list or quote environments.

 

(不定期更新)

猜你喜欢

转载自blog.csdn.net/Ryan_lee9410/article/details/111873177
今日推荐