LaTeX使用笔记:表格

本文记录自已在插入表格所遇到问题及解决办法。

1. 表格居中,表头加粗居中

我看IEEEtran论文的表格为:表格居中,表头居中加粗,举例如下:

table_center_bold

LaTeX源码如下[1]

\begin{table}
\centering
\caption{table decription}
\label{t_sim}
\begin{tabular}{|l|l|}
\hline
\multicolumn{1}{|c|}{\textbf{Key}} & \multicolumn{1}{c|}{\textbf{Value}} \\
\hline
$x$ & description of x \\
$y$ & description of y \\
$y$ & description of z \\
\hline
\end{tabular}
\end{table}

还可以用\usepackage{makecell},详情见官方文档makecell,摘抄部分如下:

This pack­age sup­ports com­mon lay­outs for tab­u­lar col­umn heads in whole doc­u­ments, based on one-col­umn tab­u­lar en­vi­ron­ment. In ad­di­tion, it can cre­ate multi-lined tab­u­lar cells.

使用方法如下:

\usepackage{makecell} 
\renewcommand\theadfont{\bfseries}

\begin{tabular}{|l|l|l|l|}
\hline
\thead{Key} & \thead{Value} & \thead{Key} & \thead{Value} \\
\hline

参考资料:
[1]TeX: How can I only make table headers center and bold?

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “LaTeX使用笔记:表格