1. 程式人生 > 其它 >CV論文Ablation Study表格Latex實用工具

CV論文Ablation Study表格Latex實用工具

技術標籤:latexieee論文

文章目錄


基於自己經驗,在CV論文Ablation Study Quantitative Comparison中常用到一下Latex的一些功能,特整理如下。

Latex插入表格

latex插入表格可通過以下程式碼實現

\begin{table}[htbp]
	\centering
	\caption{Ablation Study}
	\label{ablation}
	\begin{tabular}{|c|c|c|c|c|c|c|}
		\hline
		Model Name & Component 1 & Component 2 &  Component 3  &  Component 4 &  Component 5 &  Component 6 \\
		\hline
		blah blah & blah blah & blah blah & blah blah  & blah blah  & blah blah  & blah blah\\
		\hline
	\end{tabular}
\end{table}

在這裡插入圖片描述

自動縮放表格使表格不超出頁面範圍

上面示例可以看到,因為表格較長的緣故,表格已經超出了頁面範圍,甚至出現了顯示不全的情況。遇到這種情況,可以通過新增\resizebox來解決。

\begin{table}[htbp]
	\centering
	\caption{Ablation Study}
	\label{ablation}
	\resizebox{\textwidth}{!}{\begin{tabular}{|c|c|c|c|c|c|c|}
		\hline
		Model Name & Component 1 & Component 2 &  Component 3  &  Component 4 &  Component 5 &  Component 6 \\
		\hline
		blah blah & blah blah & blah blah & blah blah  & blah blah  & blah blah  & blah blah\\
		\hline
	\end{tabular}}
\end{table}

可以看到,表格實現了自動縮放,不再超出頁面範圍且與段落同款。
在這裡插入圖片描述

表格單元換行的實現

想要實現表格單元格內的換行,可以在在文件開始處,新增以下句:

\newcommand{\tabincell}[2]{\begin{tabular}{@{}#[email protected]{}}#2\end{tabular}}

在表格欲實現單元格內換行處,通過以下方式實現換行

\tabincell{c}{component\\1}

完整示例如下所示:

\begin{table}[htbp]
	\centering
	\caption{Ablation Study}
	\label{ablation}
	\resizebox{\textwidth}{!}{\begin{tabular}{|c|c|c|c|c|c|c|}
		\hline
		 \tabincell{c}{Model\\Name} & Component 1 & Component 2 &  Component 3  &  Component 4 &  Component 5 &  Component 6 \\
		\hline
		blah blah & blah blah & blah blah & blah blah  & blah blah  & blah blah  & blah blah\\
		\hline
	\end{tabular}}
\end{table}

在這裡插入圖片描述

在單元格中插入打勾和打叉

要插入好看的打勾和打叉,需要使用到一個包bbding。在文件開始處,新增以下句:

\usepackage{bbding}

bbding可查入各種特殊符號,這邊僅以打勾和打叉為示例。

\Checkmark 

\CheckmarkBold

\XSolid

\XSolidBrush

對應效果入如下:
在這裡插入圖片描述

設定文字顏色

首先,在文件開始處,新增以下句:

\usepackage{color}

使用方法:

{\color{green}\CheckmarkBold}

{\color{red}\XSolidBrush}

在這裡插入圖片描述