latex是一种基于ΤΕΧ的排版系统,由美国计算机学家莱斯利·兰伯特(Leslie Lamport)在20世纪80年代初期开发,利用这种格式,即使使用者没有排版和程序设计的知识也可以充分发挥由TeX所提供的强大功能,能在几天、甚至几小时内生成很多具有书籍质量的印刷品。对于生成复杂表格和数学公式,这一点表现得尤为突出。因此它非常适用于生成高印刷质量的科技和数学类文档。这个系统同样适用于生成从简单的信件到完整书籍的所有其他种类的文档。
————————————
帮助文档 Documentation:
Latex生成公式
官方文档:
CTEX - 在线文档 - 数学公式https://ctex.org/documents/packages/math/index.htm
行内公式和行间公式。前者公式嵌入在行内,适用于简单短小的公式;后者居中独占一行,适用于比较长或重要的公式。公式中的空格均会被忽略,可以使用命令\quad或\qquad实现
在行间公式中,命令\tag{n}可以进行手动编号
使用在线LaTeX公式编辑器https://www.latexlive.com/,来生成LaTeX公式代码,然后复制到LaTeX编辑器(或Markdown编辑器)中,并在两边加上$
或$$
左对齐公式(行中公式):$数学公式$
居中公式(独立公式):$$数学公式$$
注意:使用$
行中公式时,数学公式
与$
连接处不要有空格,否则公式不会显示;使用$$
居中公式时,数学公式
与$$
连接处可以有空格。即$ 数学公式 $
不显示公式。
参考链接:
————————————————————————
在 LaTeX 中插入表格:
在线转化工具:
Create LaTeX tables online – TablesGenerator.comEasily create even complex LaTeX tables with our online generator – you can paste data from a spreadsheet, merge cells, edit borders and more.https://www.tablesgenerator.com/从CSV文件导入,即,在excel里做成表格,转csv格式然后导入到这个网站
Tables - Overleaf, Online LaTeX EditorAn online LaTeX editor that’s easy to use. No installation, real-time collaboration, version control, hundreds of LaTeX templates, and more.https://www.overleaf.com/learn/latex/Tables在 LaTeX 中插入表格_Xovee的博客-CSDN博客_latex插入表格本文介绍了如何在LaTeX文档中插入表格,并且详细介绍了如何自定义表格中的各个模块,例如宽度、颜色等。https://blog.csdn.net/xovee/article/details/109254872?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522166851333616800192242102%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=166851333616800192242102&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~top_positive~default-1-109254872-null-null.142%5Ev63%5Ejs_top,201%5Ev3%5Eadd_ask,213%5Ev2%5Et3_control1&utm_term=latex%E8%A1%A8%E6%A0%BC&spm=1018.2226.3001.4187Latex 制作表格:
解决双栏中,需要单栏显示表格的latex代码
\begin{table*}
\small
\caption{\ robot \textendash\ table captions do not end in a full point}
\label{tbl:example2}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}lllllll}
\hline
Header one & Header two & Header three & Header four & Header five & Header six & Header seven\\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7\\
8 & 9 & 10 & 11 & 12 & 13 & 14 \\
15 & 16 & 17 & 18 & 19 & 20 & 21\\
\hline
\end{tabular*}
\end{table*}
table spec参数:表格中各列的对齐方式。
l、c、r——分别表示左、中、右。
p{width} ——指定列的宽度。LaTeX不能自动断行,当文字过长时,需要手动指定列的宽度。
|、||——表示在表格中画一条、两条垂直线。
*{num}{cols}——表示cols重复num次。
@{...}expressions——删除两边的列之间的空白,插入指定的文本。要想留有空白,需要使用\hspace命令,或者用\extracolsep{width}命令在列之间插入指定的空白。
表格行:
&——列分隔符;
\\——换行符,每行末尾都需要。还可以在此之后指定额外空间:\\[6pt]。
\hline——在两行之间画一条与表格同样宽度的水平线。
\cline{n-m}——在n列和m列之间画一条水平线。
\vline——在当前位置画一条与行等高的垂直线。
如果想在表格环境中使用其他环境,如verbatim或enumerate,需将列参数选项设成p{width},或m{width}、b{width};后两者需导入宏包array。
制作跨列表格的命令:\multicolumn{num cols}{alignment}{contents}。
制作跨行表格的命令:\multirow{num rows}{width}{contents};需导入multirow宏包。将*指定为width时宽度是内容的自然宽度。
为表格添加标题。将tabular环境放在table环境之中,可以添加标题,表格的对齐,添加标签以便加以交叉引用;还可以在使用\listoftables命令时将表格添加到表格目录中。
控制表格宽度,使用环境tabular* ,格式为:\begin{tabular*}{width}[pos]{table spec}。为了使表格延伸到指定的宽度,必须在列格式参数中某处使用@{\extracolsep{\fill}}。
自动计算列宽,需导入宏包tabularx;将列格式指定为X,该列的宽度可以根据表格的宽度。
表格中插入垂直居中的图像。插入表格中的图像会排列在顶部。使用array宏包定义一新的列类型可以解决这个问题。格式为:\newcolumntype{col}[n]{decl}。其中col表示新列格式选项名,用一个字母表示;n表示选项的参数数量;decl表示选项的定义。如\newcolumntype{C}{>{$}c<{$}}定义的选项对应的列处于数学模式中。 \newcolumntype{S}{>{\centering\arraybackslash} m{.4\linewidth} }定义的新选项S对应的列中插入的图片在表格中垂直居中。
制作三线表。制作科研写作中三线表格需要使用booktabs宏包,命令分别为:\toprule、\midrule、\cmidrule和\bottomrule,用于画表格顶部、中间和底部水平线。
表格与文本对齐。使用标准的tabular环境建立无框表格时,可使表格的第一行或最后一行的基线与表格外的文本基线对齐。但建立带边框的表格时,通常只能使表格的上边线或下边线与表格外的文本基线对齐。array提供的命令\firsthline和\lasthline可以解决这个问题,两命令分别放在最前和最后。
彩色表格。需要使用 colortbl 宏包提供的一些命令:\columncolor、\rowcolor、\cellcolor 等。
跨页表格。表格太长要跨页,可以使用 longtable 宏包。\endhead 、\endfirsthead命令用来定义首页表头和通用表头,\endfoot、\endlastfoot命令用来定义通用表尾和末页表尾。
更多复杂特性:
hhline:处理水平线
array:处理列
colortbl:为表格添加色彩
supertab:多页表格
longtable:与上一宏包相同。Footnote在tabular环境中不能正常工作,需要换成longtable。
xtabular:也是处理多页表格的宏包。
tabulary:改版后的tabular*,能制作正方形的单元格。
\begin{table*}
\small
\caption{\ robot \textendash\ table captions do not end in a full point}
\label{tbl:example2}
\resizebox{\linewidth}{!}{
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}lllllll}
\hline
Header one & Header two & Header three & Header four & Header five & Header six & Header seven\\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7\\
8 & 9 & 10 & 11 & 12 & 13 & 14 \\
15 & 16 & 17 & 18 & 19 & 20 & 21\\
\hline
\end{tabular*}
}
\end{table*}
\begin{table*}
\centering
\caption{Variation of some parameters}
\label{tab7}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} cccccc}
\toprule
序号 & 姓名 & 性别 & 年龄 & 身高/cm & 体重/kg \\
\midrule
1 & 张三 & M & 16 & 163 & 50 \\
2 & 王红 & F & 15 & 159 & 47 \\
3 & 李二 & M & 17 & 165 & 52 \\
\bottomrule
\end{tabular*}
\end{table*}
\begin{table}
\centering
\caption{A Table Demo}
\label{tab_demo}
\resizebox{1.0\linewidth}{!}{
\begin{tabular}{ccccccccccc}
\hline
Animal & Weight & Color & Weight & Color & Weight & Color & Weight & Color & Weight & Color\\
\hline
Dog & 20.1 & White & 18.0 & Gray & 30.5 & Black & 30.5 & Black& 30.5 & Black\\
Cat & 10.2 & Yellow & 11.2 & Black & 11.5 & White & 11.5 & White& 11.5 & White\\
Fox & 15.5 & Gold & 15.6 & Gold & 16.5 & Gold & 16.5 & Gold & 16.5 & Gold\\
Duck & 2.4 & White & 3.0 & White & 4.0 & White & 4.0 & White& 4.0 & White\\
\hline
\end{tabular}
}
\end{table}
\begin{table}
\centering
\caption{Variation of some parameters}
\label{tab7}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} llllll}
\toprule
序号 & 姓名 & 性别 & 年龄 & 身高/cm & 体重/kg \\
\midrule
1 & 张三 & M & 16 & 163 & 50 \\
2 & 王红 & F & 15 & 159 & 47 \\
3 & 李二 & M & 17 & 165 & 52 \\
\bottomrule
\end{tabular*}
\end{table}
————————————————————————————————
图片:
\documentclass{article}
\usepackage{graphicx}
\graphicspath{ {./images/} }
\begin{document}
The universe is immense and it seems to be homogeneous,
in a large scale, everywhere we look at.
\includegraphics{universe}
There's a picture of a galaxy above
\end{document}
——————————————————
中文字符:
Chinese - Overleaf, Online LaTeX EditorAn online LaTeX editor that’s easy to use. No installation, real-time collaboration, version control, hundreds of LaTeX templates, and more.https://www.overleaf.com/learn/latex/ChineseLaTeX 中文_Xovee的博客-CSDN博客_latex中文LaTeX 支持世界上的许多种语言。本篇文章介绍如何在 LaTeX 中输入中文。https://blog.csdn.net/xovee/article/details/111565398?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522166851407516800186570621%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=166851407516800186570621&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~top_click~default-2-111565398-null-null.142%5Ev63%5Ejs_top,201%5Ev3%5Eadd_ask,213%5Ev2%5Et3_control1&utm_term=latex%E4%B8%AD%E6%96%87&spm=1018.2226.3001.4187
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK*}{UTF8}{gbsn}
\section{前言}
\section{关于数学部分}
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments.
\end{CJK*}
\bigskip %% Just some white space
You can also insert Latin text in your document
\bigskip %% Just some white space
\begin{CJK*}{UTF8}{bsmi}
這是繁體中文。
\end{CJK*}
\end{document}
——————————————————
LaTeX文档多图排版 | Wei's BlogLaTex文档中实现多图排版https://vvingerfly.github.io/2018/02-16-Tex-imageTypesetting/