注:本文为 “LaTeX 表格创建” 相关合辑。
略作重排,未整理去重。
如有内容异常,请看原文。
齐全的 LaTeX 表格样式(含斜线表头)
原创于 2018-10-09 18:28:20 发布
示例一
\begin{table*}
\centering
\fontsize{9}{12}\selectfont
\caption{This is a visual sample.}
\label{tab:distortion_type}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|}
\hline
\multirow{2}{*}{Components}& \multirow{2}{*}{Features}&
\multicolumn{2}{c|}{A}&\multicolumn{2}{c|}{ B} &\multicolumn{2}{c|}{C} &\multicolumn{2}{c|}{D}\cr\cline{3-10}
& & a & b & a & b & a & b & a & b \cr
\hline
\multirow{3}{*}{Global}
&$F_f(f_1-f_{6}) $ &0.12&0.23&0.12&0.33&0.14&0.54&0.64&0.44\cr\cline{2-10}
& $F_g(f_{7}-f_{8})$&0.64&0.11&0.32&0.12&0.21&0.66&0.44&0.66\cr\cline{2-10}
& $[F_f,F_g] $ &0.56&0.43&0.21&0.12&0.32&0.33&0.44&0.66\cr\hline
\multirow{3}{*}{Local}
&$F_r(f_1-f_{6}) $ &0.12&0.23&0.12&0.33&0.14&0.54&0.64&0.44\cr\cline{2-10}
& $F_e(f_{7}-f_{8})$&0.64&0.11&0.32&0.12&0.21&0.66&0.44&0.66\cr\cline{2-10}
& $[F_r,F_e] $ &0.56&0.43&0.21&0.12&0.32&0.33&0.44&0.66\cr\hline
All & $f_1-f_{8}$ &0.56&0.43&0.21&0.12&0.32&0.33&0.44&0.66\cr
\hline
\end{tabular}
\end{table*}

示例二
\begin{table*}
\centering
\fontsize{9}{12}\selectfont
\caption{This is a visual sample.}
\label{tab:feat_combin}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|}
\hline
\multirow{2}{*}{Combination}& \multirow{2}{*}{Types}&
\multicolumn{2}{c|}{A}&\multicolumn{2}{c|}{B} &\multicolumn{2}{c|}{C} &\multicolumn{2}{c|}{D}\cr\cline{3-10}
& & a & b & a & b & a & b & a & b \cr
\hline
$F_d, F_a$ & $f_1-f_{6}, f_{2}-f_{4}$ &0.53&0.26 &0.48 &0.62 &0.99 &0.93 &0.99 &0.71 \cr\cline{1-10}
$F_d, F_a$ & $f_1-f_{6}, f_{2}-f_{9}$ &0.77 &0.23 &0.7191 &0.7132 &0.54 &0.87 &0.36 &0.21 \cr\cline{1-10}
$F_a, F_s$ & $f_{1}-f_{2}, f_{2}-f_{4}$ &0.62 &0.85 &0.54 &0.56 &0.42 &0.59 &0.05 &0.66 \cr\cline{1-10}
$F_a, F_f$ & $f_{1}-f_{2}, f_{5}-f_{9}$ &0.07 &0.55 &0.32 &0.92 &0.61 &0.37 &0.92 &0.04 \cr\cline{1-10}
$F_d, F_a, F_a, F_d$ & $f_{1}-f_{9}$ &0.43 &0.72 &0.26 &0.72 &0.40 &0.54 &0.72 &0.81\cr
\hline
\end{tabular}
\end{table*}

示例三
\begin{table}
\centering
\fontsize{8}{10}\selectfont %{字体尺寸}{行距}
\caption{This is a visual sample.}
\begin{tabular}{l|ccccc}
\toprule
\diagbox [width=5em,trim=l] {Sample}{Size} & 1 & 2 & 3 & 4 & {\bf 5} \\
\hline
A & 0.22 & 0.32 & 0.76 & 0.34 & {\bf 0.77} \\
B & 0.23 & 0.12 & 0.75 & 0.45 & {\bf 0.97} \\
C & 7.45 & 6.56 & 6.65 & 6.98 & {\bf 5.78} \\
\bottomrule
\end{tabular}\vspace{0cm}
\label{tab:Training_sizes}
\end{table}

示例四
\renewcommand{\arraystretch}{1.5} %控制行高
\begin{table*}[tp]
\centering
\fontsize{7.5}{10}\selectfont
\begin{threeparttable}
\caption{This is a visual sample.}
\label{tab:perfor}
\begin{tabular}{ccccccccccc}
\toprule
\toprule
\multirow{1}{*}{D}&C&B&GM-LO&N&GW&NR&BTMQ&HIGRADE-&Y&{\bf P}\cr
\midrule
\multirow{3}*{ES}
& PC &0.48&0.22&0.01&0.42&0.45&0.65&0.78&0.45&{\bf 0.82}\cr
~ & SC &0.76&0.90&0.04&0.48&0.43&0.15&0.75&0.76&{\bf 0.74}\cr
~ & RE &8.43&8.09&8.13&8.78&8.66&7.84&6.75&6.77&{\bf 5.44}\cr
\hline
\multirow{1}{*}{Run Time (Seconds)}& &0.22&0.42&0.14&0.49&0.09&0.51&4.25&2.24&1.23\cr
\bottomrule
\bottomrule
\end{tabular}
\end{threeparttable}
\end{table*}

示例五
\begin{table}
\centering
\fontsize{8}{11}\selectfont %{字体尺寸}{行距}
\caption{This is a visual sample.}
\begin{tabular}{ccccc}
\toprule
\toprule
\multirow{2}{*}{Da}&\multirow{2}{*}{Tr-Te Sizes}&
\multicolumn{3}{c}{Criteria} \cr
\cmidrule(lr){3-5}
& & PC & SC & RE \cr
\cmidrule(lr){1-5}
\multirow{5}{*}{ES}
&$50\%-50\%$ & 0.74 & 0.77 & 6.37 \cr
&$60\%-40\%$ & 0.75 & 0.78 & 6.10 \cr
&$70\%-30\%$ & 0.76 & 0.79 & 6.00 \cr
&$80\%-20\%$ & 0.82 & 0.79 & 5.93 \cr
&$90\%-10\%$ & 0.80 & 0.89 & 5.87 \cr
\bottomrule
\bottomrule
\end{tabular}\vspace{0cm}
\label{tab:Training_sizes}
\end{table}

示例六
\begin{table*}
\centering
\fontsize{8}{10}\selectfont
\caption{This is a visual sample.}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|}
\hline
\diagbox{A}{B}{Methods}& NI & IL & BRI & GM & GW & FR & BQ & SE & LT & PC \\ %添加斜线表头
\hline
D & 92 & 81 & 12 & 306 & 673 & 0.37 & 712 & 801 & 437 & 534\\
\hline
ED & 541 & 254 & 0.6 & 199 & 65 & 9 & 195 & 9.84 & 63 & 95\\
\hline
Q & 81 & 19 & 37 & 0.12 & 0.30 & 0.21 & 56.2 & 71 & 0.43 & 0.44\\
\hline
\end{tabular}
\label{tab:time}
\end{table*}

LaTeX 插入矩阵、表格、带斜线表头的表格、图片、超链接
原创于 2019-02-12 15:52:38 发布
1. 插入矩阵
1.1 基础 5×5 矩阵
\begin{equation}\nonumber
\begin{aligned}
\left[
\begin{array}{ccccc}
5.57677536e-01&-5.57677536e-01&-5.57677536e-01&2.58819045e-01&0.00000000e+00\\
-1.49429245e-01&1.49429245e-01&1.49429245e-01&9.65925826e-01&0.00000000e+00\\
0.00000000e+00&0.00000000e+00&0.00000000e+00&0.00000000e+00&1.00000000e+00\\
7.91098826e-01&5.70540801e-01&2.20558025e-01&5.55111512e-17&-0.00000000e+00\\
2.02062650e-01&-5.84080355e-01&7.86143005e-01&-2.56739074e-16&0.00000000e+00
\end{array}
\right]
\end{aligned}
\end{equation}
运行结果如下图所示:

1.2 含运算步骤的矩阵变换
矩阵运算过程可通过箭头符号标注行变换操作,代码如下:
\begin{equation}\nonumber
\begin{aligned}
\mathbf{A}=&\left[
\begin{array}{ccccc}
-2&2&2&-2&0\\
-2&2&2&-2&0\\
2&-2&-2&-2&0\\
0&0&0&0&2\\
0&0&0&0&2
\end{array}
\right]\\
\xrightarrow[r_{3}+r_{1}]{r_{2}-r_{1}}
&\left[
\begin{array}{ccccc}
-2&2&2&-2&0\\
0&0&0&0&0\\
0&0&0&-4&0\\
0&0&0&0&2\\
0&0&0&0&2
\end{array}
\right]\\
\underrightarrow{r_{5}-r_{4}}
&\left[
\begin{array}{ccccc}
-2&2&2&-2&0\\
0&0&0&0&0\\
0&0&0&-4&0\\
0&0&0&0&2\\
0&0&0&0&0
\end{array}
\right]\\
\xrightarrow[r_{4}\times\left(\frac{1}{2}\right)]{r_{3}\times\left(-\frac{1}{4}\right)}
&\left[
\begin{array}{ccccc}
-2&2&2&-2&0\\
0&0&0&0&0\\
0&0&0&1&0\\
0&0&0&0&1\\
0&0&0&0&0
\end{array}
\right]\\
\xrightarrow[r_{1}-r_{3}]{r_{1}\times\left(-\frac{1}{2}\right)}
&\left[
\begin{array}{ccccc}
1&-1&-1&0&0\\
0&0&0&0&0\\
0&0&0&1&0\\
0&0&0&0&1\\
0&0&0&0&0
\end{array}
\right]
\end{aligned}
\end{equation}
运行结果如下图所示:

2. 插入表格
2.1 基础要求与参数说明
- 需提前导入宏包:
\usepackage{graphics} - 图片位置参数(常用
ht):h(here):表示在当前位置插入t(top):表示在页面顶部插入b(bottom):表示在页面底部插入p(page):表示插入到单独的图表页
caption:表格标题- 列格式(如
cc|c):表示第 1、2 列无竖线分隔,第 2、3 列有竖线分隔,所有列内容居中 \hline:绘制水平分隔线\\:表示换行
2.2 基础表格代码示例
\begin{table}[ht]
\begin{center}
\caption{Table Example}
\begin{tabular}{cc|c}
\hline
A & B & C \\ \hline
1 & 2 & 3 \\
2 & 3 & 4 \\
3 & 4 & 5 \\
4 & 5 & 6 \\ \hline
\end{tabular}
\end{center}
\end{table}
运行结果如下图所示:

3. 插入带斜线表头的表格
3.1 代码示例
\begin{table}[ht]
\begin{center}
\begin{tabular}{|c|cc|}
\hline
\diagbox{Bottom Label}{Top Label} & A & B \\
\hline
1 & 2 & 3 \\
2 & 3 & 4 \\
3 & 4 & 5 \\
\hline
\end{tabular}
\end{center}
\end{table}
运行结果如下图所示:

4. 插入图片
4.1 基础要求与参数说明
- 需提前导入宏包:
\usepackage{graphics} - 图片位置参数(同表格,常用
ht) scale:图片显示比例caption:图片标题label:图片引用标识(用于后文交叉引用)
4.2 图片插入代码示例
\begin{figure}[ht]
\centering
\includegraphics[scale=0.4]{picture.jpg}
\caption{Picture Example}
\label{fig:example}
\end{figure}
5. 插入超链接
5.1 基础要求
需提前导入宏包:\usepackage{hyperref}
5.2 超链接代码示例
通过 \href{URL}{显示文本} 命令实现超链接,可通过 \color{blue} 设置文本颜色为蓝色,代码如下:
\href{https://blog.youkuaiyun.com/Albert_Bolt}{\color{blue}优快云 Blog}
运行结果如下:

LaTeX:斜线表头的表格制作
原创于 2022-04-28 11:03:02 发布
1. 核心需求与实现基础
正规表格的左上角首个单元格通常作为表头,需通过斜线分区实现多维度信息展示。本文介绍的方法不仅适用于表头,还可应用于表格中任意单元格;其核心依赖 diagbox 宏包与 tabular 环境。
2. 关键宏包与命令
- 必备宏包:
\usepackage{diagbox} - 核心命令:
\diagbox[斜线参数]{分区1内容}{分区2内容}{分区3内容}...- 斜线方向:支持 4 种预设方向(参数见下文)
- 分区数量:由命令后
{}的个数决定,有几条斜线则对应几个分区
3. 实例演示
3.1 代码示例
\begin{tabular}{|l|c|c|c|}
\hline
\diagbox{学科}{成绩}{姓名} & ABC & BBC & CED \\
\hline
数学 & 99 & 89 & \diagbox{ce1}{ce2} \\
\hline
化学 & \diagbox[dir=SW]{ce3}{ce4} & 67 & 82 \\ % 方向参数通过[]设置
\hline
\end{tabular}
3.2 运行效果

4. 斜线方向参数说明
斜线方向可通过 dir 参数控制,具体参数与对应方向如下表所示:

via:
- 齐全的 Latex 表格样式 (有斜杠)_latex 表格斜杠 - 优快云 博客
https://blog.youkuaiyun.com/God_68/article/details/82986558 - LaTeX 插入矩阵、表格、带斜线表头的表格、图片、超链接_latex 画斜线表格 - 优快云 博客
https://blog.youkuaiyun.com/Albert_Bolt/article/details/87092590 - LaTeX:斜线表头的表格制作_latex 表格斜线 - 优快云 博客
https://blog.youkuaiyun.com/weixin_36670529/article/details/106984375
1299

被折叠的 条评论
为什么被折叠?



