我尝试使用此代码但失败了:
\begin{table}
\begin{center}
\begin{tabular}{|l|c|}
\hline
Security mode & Security provided \\
\hline
\hline
No Security & Data is not encrypted \\
\hline
AES-CBC-MAC-32 & Data is not encrypted\\
\hline
AES-CBC-MAC-64 & Data is not encrypted\\
\hline
AES-CBC-MAC-128 & Data is not encrypted\\
\hline
AES-CTR & Data is encrypted\\
\hline
AES-CCM-32 & Data is encrypted\\
\hline
AES-CCM-64 & Data is encrypted\\
\hline
AES-CCM-128 & Data is encrypted\\
\hline
\end{tabular}
\caption{\label{tab:tab1}Security modes in the IEEE802.15.4e Standard.}
\end{center}
\end{table}
答案1
为了实现这样的表格,需要进行以下调整:
- 顶行的背景颜色。 套餐:
xcolor
+colortbl
- 顶部有双水平线。包装:
hhline
- 标题的格式。包:
caption
\definecolor{mygrey}{rgb}{211,211,211}
您在表格中使用和 定义浅灰色,然后使用\rowcolor{mygrey}
。使用 可实现双水平线\hhline{==}
。标题通过两个命令进行格式化:
\captionsetup{justification=centering,singlelinecheck=false,labelfont=sc,labelsep = newline}
它将标题居中,将字体变为小写,并在名称后提供一个新行\renewcommand*\thetable{\Roman{table}}
这会将表格编号更改为罗马数字。
此代码将起作用:
\documentclass{article}
\usepackage{xcolor,colortbl,hhline,caption}
\definecolor{mg}{RGB}{211,211,211}
\captionsetup{justification=centering,singlelinecheck=false,labelfont=sc,labelsep = newline}
\renewcommand*\thetable{\Roman{table}}
\begin{document}
\begin{table}
\begin{center}
\caption{\label{tab:tab1}
\scshape{{Security modes in the IEEE802.15.4e Standard.}}}
\begin{tabular}{l|c}
\hhline{==}
\rowcolor{mg}
Security mode & Security provided \\\hline
\hhline{==}
No Security & Data is not encrypted \\\hline
AES-CBC-MAC-32 & Data is not encrypted\\\hline
AES-CBC-MAC-64 & Data is not encrypted\\\hline
AES-CBC-MAC-128 & Data is not encrypted\\\hline
AES-CTR & Data is encrypted\\\hline
AES-CCM-32 & Data is encrypted\\\hline
AES-CCM-64 & Data is encrypted\\\hline
AES-CCM-128 & Data is encrypted\\\hline
\end{tabular}
\end{center}
\end{table}
\end{document}
输出: