LaTeX常见用法

创建表格

Tables-overleaf

\begin{center}
​		\begin{tabular}{|c|c|c|c|}	% | 代表列之间插入竖线,c代表center,还可以有l(left)、r(right)
​			\hline							% \hline代表行之间有横线
​			\ & a & b & \$ \\			% 需要换行符\\
​			\hline
​			S & 1 & 2 & 3 \\
​			\hline
​			A & 4 & 5 & \ \\
​			\hline
​			B & 5 & 6 & \ \\
​			\hline
​		\end{tabular}
\end{center}

避免转义

{verbatim}可以使标签中的内容为raw,而无需转义,可以插入多行文本

\begin{verbatim}\r\n\1 $ (?<=#)\end{verbatim}

\verb*插入短小的片段,需要使用界定符,比较常见的界定符包括 |、$、/、!、#、~ 等

\verb*$hello$

空格和空行

LaTeX 中提供了一些命令可以插入空格,例如:

  • \+空格
  • , 表示插入一个窄空格(1/6 个 em);
  • : 表示插入一个中等空格(1/4 个 em);
  • ; 表示插入一个宽空格(5/18 个 em);
  • \quad 表示插入一个等于当前字体大小的空格;
  • \qquad 表示插入一个两倍于当前字体大小的空格。

LaTeX插入多个空行

这是第一段。

\vspace{\baselineskip}

\vspace{\baselineskip}

这是第二段。

特殊符号

LaTeX Mathematical symbols

$\epsilon$	%
$\alpha$	% α
$\beta$		% β
$in$
$\hat{\;\;}$% ^(推荐使用)
\^{}		% 更宽的^
\{			% 直接使用{}会将文本作为整体处理
\_
\$

树状图

forest-quickstart
forest库中不能用空行

代码示例

\usepackage[linguistics]{forest}	% 导入包

...

\begin{forest}
	[{expr[0]}		% 需要加上大括号,否则expr[0]中的[0]就会被当作节点
		[ID
			[1]
		]
		[+]
		[{expr[3]}
			[ID
				[2]
			]
			[$\hat{\;\;}$]
			[{expr[3]}
				[ID
					[3]
				]
				[$\hat{\;\;}$]
				[{expr[3]}
					[ID
						[4]
					]
				]
			]
		]
		[+]
		[{expr[3]}
			[ID
				[5]
			]
		]
	]
\end{forest}

序号

\begin{itemize}
	\item nice to meet you
	\item hello kartone
\end{itemize}

效果:

  • nice to meet you
  • hello kartone
\begin{enumerate}[(1)]
	\item dance
	\item makes
	\item me
	\item happy
\end{enumerate}

效果:

(1) dance
(2) makes
(3) me
(4) happy

\begin{enumerate}
  \item Items are numbered automatically.
  \item The numbers start at 1 with each use of the enumerate environment.
  \item Another entry in the list

效果:

  1. Items are numbered automatically.
  2. The numbers start at 1 with each use of the enumerate environment.
  3. Another entry in the list

标签缩进

%\usepackage{enumitem}

\begin{enumerate}[leftmargin=2cm]
	\item hello
	\item world
\end{enumerate
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
LaTeX中的supertabular是一个可用于创建大型、跨页的表格的环境。它类似于常见的tabular环境,但可以在多个页面上同时显示表格的不同部分。 要使用supertabular环境,首先需要加载supertabular宏包。在导言区输入\usepackage{supertabular}命令即可。 接下来,在文档中使用以下代码创建supertabular表格: \begin{center} \tablecaption{表格标题} \tablefirsthead{ \hline 列头1 & 列头2 & 列头3 \\ \hline } \tablehead{ \hline \multicolumn{3}{|c|}{续表} \\ \hline 列头1 & 列头2 & 列头3 \\ \hline } \tabletail{ \hline \multicolumn{3}{|r|}{续下页} \\ \hline } \tablelasttail{ \hline \multicolumn{3}{|r|}{表格结束} \\ \hline } \begin{supertabular}{|c|c|c|} \hline 内容1 & 内容2 & 内容3 \\ \hline ... & ... & ... \\ ... & ... & ... \\ \hline \end{supertabular} \end{center} 代码中的\tablecaption命令用于设置表格标题。\tablefirsthead命令用于设置表格第一页的表头,\tablehead命令用于设置表格从第二页开始的表头,\tabletail命令用于设置每页的表尾,\tablelasttail命令用于设置最后一页的表尾。 \begin{supertabular}命令用于开始supertabular环境,并通过{c|c|c}设置表格的列数和每列的对齐方式,|表示绘制竖线。 在supertabular环境中,可以使用\hline命令绘制水平线,使用&命令分隔单元格,使用\\命令换行。 通过设置\tablefirsthead,\tablehead,\tabletail和\tablelasttail的内容,可以定制表格的表头和表尾,并指定在多个页面上进行分页时的相应内容。 总之,通过supertabular环境可以方便地创建大型的、跨页的表格,并且可以对表头、表尾进行自定义。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值