![如何添加双列样式的整页表格?](https://linux22.com/image/312881/%E5%A6%82%E4%BD%95%E6%B7%BB%E5%8A%A0%E5%8F%8C%E5%88%97%E6%A0%B7%E5%BC%8F%E7%9A%84%E6%95%B4%E9%A1%B5%E8%A1%A8%E6%A0%BC%EF%BC%9F.png)
这是我的表格代码:
% Please add the following required packages to your document preamble:
% \usepackage{multirow}
% \usepackage[table,xcdraw]{xcolor}
% If you use beamer only pass "xcolor=table" option, i.e. \documentclass[xcolor=table]{beamer}
\begin{table}[h]
\begin{tabular}{|l|l|l|l|}
\hline
\rowcolor[HTML]{333333}
{\color[HTML]{FFFFFF} {\bf Layer}} & {\color[HTML]{FFFFFF} {\bf Attack}} & {\color[HTML]{FFFFFF} {\bf countermeasure}} & {\color[HTML]{FFFFFF} {\bf Ref.}} \\ \hline
\cellcolor[HTML]{3531FF}{\color[HTML]{FFFFFF} } & {\color[HTML]{3531FF} } & {\color[HTML]{3531FF} \begin{tabular}[c]{@{}l@{}}Glue or bond, Embedding in the product,\\ Alarm function trigger\end{tabular}} & {\color[HTML]{3531FF} {[}a{]}} \\ \cline{3-4}
\cellcolor[HTML]{3531FF}{\color[HTML]{FFFFFF} } & \multirow{-2}{*}{{\color[HTML]{3531FF} Tag Remove}} & {\color[HTML]{3531FF} Chip coating, Tamper-proof} & {\color[HTML]{3531FF} {[}b{]}} \\ \cline{2-4}
\cellcolor[HTML]{3531FF}{\color[HTML]{FFFFFF} } & {\color[HTML]{3531FF} Kill Command} & {\color[HTML]{3531FF} \begin{tabular}[c]{@{}l@{}}Class-1 Gen-2 EPC Standard, \\ Master Password\end{tabular}} & {\color[HTML]{3531FF} {[}10{]}} \\ \cline{2-4}
\cellcolor[HTML]{3531FF}{\color[HTML]{FFFFFF} } & {\color[HTML]{3531FF} } & {\color[HTML]{3531FF} \begin{tabular}[c]{@{}l@{}}Encryption, Authentication, \\ Password, PIN, biometric\end{tabular}} & {\color[HTML]{3531FF} {[}a{]}} \\ \cline{3-4}
\cellcolor[HTML]{3531FF}{\color[HTML]{FFFFFF} } & {\color[HTML]{3531FF} } & {\color[HTML]{3531FF} Round Trip Delay} & {\color[HTML]{3531FF} {[}48{]}} \\ \cline{3-4}
\multirow{-6}{*}{\cellcolor[HTML]{3531FF}{\color[HTML]{FFFFFF} {\bf Physical}}} & \multirow{-3}{*}{{\color[HTML]{3531FF} Relay}} & {\color[HTML]{3531FF} Distance Bounding Protocol} & {\color[HTML]{3531FF} {[}21,44{]}} \\ \hline
\cellcolor[HTML]{036400}{\color[HTML]{FFFFFF} } & {\color[HTML]{036400} } & {\color[HTML]{036400} \begin{tabular}[c]{@{}l@{}}Challenge-response Authentication \\ Protocol, Public key cryptography\end{tabular}} & {\color[HTML]{036400} {\bf {[}25{]}}} \\ \cline{3-4}
\cellcolor[HTML]{036400}{\color[HTML]{FFFFFF} } & {\color[HTML]{036400} } & {\color[HTML]{036400} PIN-based Access} & {\color[HTML]{036400} {\bf {[}27{]}}} \\ \cline{3-4}
\cellcolor[HTML]{036400}{\color[HTML]{FFFFFF} } & {\color[HTML]{036400} } & {\color[HTML]{036400} Correlating Information} & {\color[HTML]{036400} {\bf {[}a{]}}} \\ \cline{3-4}
\cellcolor[HTML]{036400}{\color[HTML]{FFFFFF} } & {\color[HTML]{036400} } & {\color[HTML]{036400} Back-end database} & {\color[HTML]{036400} {[}38{]}} \\ \cline{3-4}
\cellcolor[HTML]{036400}{\color[HTML]{FFFFFF} } & {\color[HTML]{036400} } & {\color[HTML]{036400} Finger Print} & {\color[HTML]{036400} {[}35{]}} \\ \cline{3-4}
\cellcolor[HTML]{036400}{\color[HTML]{FFFFFF} } & \multirow{-6}{*}{{\color[HTML]{036400} {\bf Cloning}}} & {\color[HTML]{036400} Unclonable Function} & {\color[HTML]{036400} {[}b{]}} \\ \cline{2-4}
\cellcolor[HTML]{036400}{\color[HTML]{FFFFFF} } & {\color[HTML]{036400} Eavesdropping} & {\color[HTML]{036400} Encyption} & {\color[HTML]{036400} {[}a,b{]}} \\ \cline{2-4}
\cellcolor[HTML]{036400}{\color[HTML]{FFFFFF} } & {\color[HTML]{036400} } & {\color[HTML]{036400} Authentication} & {\color[HTML]{036400} {[}a,b{]}} \\ \cline{3-4}
\cellcolor[HTML]{036400}{\color[HTML]{FFFFFF} } & {\color[HTML]{036400} } & {\color[HTML]{036400} PINs or biometric} & {\color[HTML]{036400} {[}12{]}} \\ \cline{3-4}
\cellcolor[HTML]{036400}{\color[HTML]{FFFFFF} } & {\color[HTML]{036400} } & {\color[HTML]{036400} Pseduonymization} & {\color[HTML]{036400} {[}a{]}} \\ \cline{3-4}
\cellcolor[HTML]{036400}{\color[HTML]{FFFFFF} } & {\color[HTML]{036400} } & {\color[HTML]{036400} Hash-hock} & {\color[HTML]{036400} {[}53{]}} \\ \cline{3-4}
\cellcolor[HTML]{036400}{\color[HTML]{FFFFFF} } & {\color[HTML]{036400} } & {\color[HTML]{036400} Randomized hash-lock} & {\color[HTML]{036400} {[}54{]}} \\ \cline{3-4}
\cellcolor[HTML]{036400}{\color[HTML]{FFFFFF} } & {\color[HTML]{036400} } & {\color[HTML]{036400} Chained hashes} & {\color[HTML]{036400} {[}41{]}} \\ \cline{3-4}
\multirow{-14}{*}{\cellcolor[HTML]{036400}{\color[HTML]{FFFFFF} {\bf Network}}} & \multirow{-7}{*}{{\color[HTML]{036400} Spoofing}} & {\color[HTML]{036400} Encryption} & {\color[HTML]{036400} {[}b,6{]}} \\ \hline
\cellcolor[HTML]{330001}{\color[HTML]{FFFFFF} } & {\color[HTML]{330001} } & {\color[HTML]{330001} Aluminum-lined wallets} & {\color[HTML]{330001} {[}a, 37{]}} \\ \cline{3-4}
\cellcolor[HTML]{330001}{\color[HTML]{FFFFFF} } & {\color[HTML]{330001} } & {\color[HTML]{330001} Blocker tags} & {\color[HTML]{330001} {[}28{]}} \\ \cline{3-4}
\cellcolor[HTML]{330001}{\color[HTML]{FFFFFF} } & {\color[HTML]{330001} } & {\color[HTML]{330001} Guardian} & {\color[HTML]{330001} {[}45{]}} \\ \cline{3-4}
\cellcolor[HTML]{330001}{\color[HTML]{FFFFFF} } & {\color[HTML]{330001} } & {\color[HTML]{330001} Symmetric key encryption} & {\color[HTML]{330001} {[}34{]}} \\ \cline{3-4}
\cellcolor[HTML]{330001}{\color[HTML]{FFFFFF} } & {\color[HTML]{330001} } & {\color[HTML]{330001} Public Key Encryption} & {\color[HTML]{330001} {[}14{]}} \\ \cline{3-4}
\cellcolor[HTML]{330001}{\color[HTML]{FFFFFF} } & {\color[HTML]{330001} } & {\color[HTML]{330001} Hash Function} & {\color[HTML]{330001} {[}54{]}} \\ \cline{3-4}
\cellcolor[HTML]{330001}{\color[HTML]{FFFFFF} } & {\color[HTML]{330001} } & {\color[HTML]{330001} Mutual Authentication} & {\color[HTML]{330001} {[}40,7{]}} \\ \cline{3-4}
\cellcolor[HTML]{330001}{\color[HTML]{FFFFFF} } & \multirow{-8}{*}{{\color[HTML]{330001} Unauthorized tag reading}} & {\color[HTML]{330001} Pseudonyms} & {\color[HTML]{330001} {[}26{]}} \\ \cline{2-4}
\cellcolor[HTML]{330001}{\color[HTML]{FFFFFF} } & {\color[HTML]{330001} } & {\color[HTML]{330001} Field Detectors, Authentication} & {\color[HTML]{330001} {[}b{]}} \\ \cline{3-4}
\cellcolor[HTML]{330001}{\color[HTML]{FFFFFF} } & \multirow{-2}{*}{{\color[HTML]{330001} Tag Modification}} & {\color[HTML]{330001} Read-Only-Tag} & {\color[HTML]{330001} {[}a{]}} \\ \cline{2-4}
\cellcolor[HTML]{330001}{\color[HTML]{FFFFFF} } & {\color[HTML]{330001} Middleware} & {\color[HTML]{330001} Isolating, Input Checking} & {\color[HTML]{330001} {[}a{]}} \\ \cline{2-4}
\multirow{-12}{*}{\cellcolor[HTML]{330001}{\color[HTML]{FFFFFF} {\bf Application}}} & Virus & Blocking Anomalous Bits & {[}b{]} \\ \hline
\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} } & {\color[HTML]{FE0000} Social Engineering} & {\color[HTML]{FE0000} \begin{tabular}[c]{@{}l@{}}Training, Education, Awareness and \\ Oversight\end{tabular}} & {\color[HTML]{FE0000} {[}31{]}} \\ \cline{2-4}
\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} } & {\color[HTML]{FE0000} } & {\color[HTML]{FE0000} EPC Global Guidelines} & {\color[HTML]{FE0000} {[}11{]}} \\ \cline{3-4}
\multirow{-3}{*}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} {\bf Strategic}}} & \multirow{-2}{*}{{\color[HTML]{FE0000} Privacy}} & {\color[HTML]{FE0000} Fair Information Practices (FIP)} & {\color[HTML]{FE0000} {[}16{]}} \\ \hline
\cellcolor[HTML]{6665CD}{\color[HTML]{FFFFFF} } & {\color[HTML]{6665CD} Dos and Traffic Analysis} & {\color[HTML]{6665CD} Cryptographic Algorithms} & {\color[HTML]{6665CD} {[}43{]}} \\ \cline{2-4}
\cellcolor[HTML]{6665CD}{\color[HTML]{FFFFFF} } & {\color[HTML]{6665CD} Side Channel} & {\color[HTML]{6665CD} \begin{tabular}[c]{@{}l@{}}Limiting the Electromagnetic\\ Emissions, Complex Circuit\end{tabular}} & {\color[HTML]{6665CD} {[}a{]}} \\ \cline{2-4}
\cellcolor[HTML]{6665CD}{\color[HTML]{FFFFFF} } & {\color[HTML]{6665CD} } & {\color[HTML]{6665CD} Challenge Response} & {\color[HTML]{6665CD} {[}a{]},{[}b{]}} \\ \cline{3-4}
\cellcolor[HTML]{6665CD}{\color[HTML]{FFFFFF} } & \multirow{-2}{*}{{\color[HTML]{6665CD} Replay}} & {\color[HTML]{6665CD} \begin{tabular}[c]{@{}l@{}}Timestamps, One-time Passwords,\\ Encryption\end{tabular}} & {\color[HTML]{6665CD} {[}a{]}} \\ \cline{2-4}
\cellcolor[HTML]{6665CD}{\color[HTML]{FFFFFF} } & {\color[HTML]{6665CD} Cryptography} & {\color[HTML]{6665CD} Eccryption} & {\color[HTML]{6665CD} {[}a{]}} \\ \cline{2-4}
\multirow{-6}{*}{\cellcolor[HTML]{6665CD}{\color[HTML]{FFFFFF} {\bf Multilayer}}} & {\color[HTML]{6665CD} Man-In-The-Middle} & {\color[HTML]{6665CD} Encryption, Authentication} & {\color[HTML]{6665CD} {[}b{]}} \\ \hline
\end{tabular}
\caption{My caption}
\label{my-label}
\end{table}
答案1
这是一个解决方案xtab
。我借此机会稍微简化了您的代码并纠正了一些拼写错误:
\documentclass[twocolumn]{article}
\usepackage{geometry}
\usepackage{cuted, ragged2e}
\usepackage{lipsum, array, booktabs, multirow, caption, float,xtab}
\usepackage[table]{xcolor}
\usepackage{makecell}
\renewcommand\theadalign{lc}
\renewcommand\theadfont{\bfseries}
\renewcommand\cellalign{lc}
\setcellgapes{3pt}
\usepackage{cellspace}
\setlength\cellspacetoplimit{5pt}
\setlength\cellspacebottomlimit{5pt}
\cellset{\color{red}}
\begin{document}
\lipsum[3]
\begin{strip}
\centering
\begin{xtabular}{|l|l| > {\RaggedRight\arraybackslash}m{65mm}|Sl|}
\hline
\rowcolor[HTML]{333333}
\color{white} {\bfseries Layer} & {\color{white} {\bfseries Attack}} & {\color{white} {\bfseries countermeasure}} & {\color{white} {\bfseries Ref.}} \\
\hline
\cellcolor[HTML]{3531FF} & {\color[HTML]{3531FF} } & \color[HTML]{3531FF}\makecell{Glue or bond, Embedding in the product,\\ Alarm function trigger} & {\color[HTML]{3531FF} {[}a{]}} \\
\cline{3-4}
\cellcolor[HTML]{3531FF} & \multirow{-2}{*}{{\color[HTML]{3531FF} Tag Remove}} & {\color[HTML]{3531FF} Chip coating, Tamper-proof} & {\color[HTML]{3531FF} {[}b{]}} \\
\cline{2-4}
\cellcolor[HTML]{3531FF} & {\color[HTML]{3531FF} Kill Command} & \color[HTML]{3531FF}\makecell{
Class-1 Gen-2 EPC Standard, \\ Master Password} & {\color[HTML]{3531FF} {[}10{]}} \\
\cline{2-4}
\cellcolor[HTML]{3531FF} & {\color[HTML]{3531FF} } & \color[HTML]{3531FF}\makecell{Encryption, Authentication, \\ Password, PIN, biometric} & {\color[HTML]{3531FF} {[}a{]}} \\
\cline{3-4}
\cellcolor[HTML]{3531FF} & {\color[HTML]{3531FF} } & {\color[HTML]{3531FF} Round Trip Delay} & {\color[HTML]{3531FF} {[}48{]}} \\
\cline{3-4}
\multirow{-9}{*}{\cellcolor[HTML]{3531FF}{\color{white} {\bf Physical}}} & \multirow{-3}{*}{{\color[HTML]{3531FF} Relay}} & {\color[HTML]{3531FF} Distance Bounding Protocol} & {\color[HTML]{3531FF} {[}21,44{]}} \\
\hline
\cellcolor[HTML]{036400} & {\color[HTML]{036400} } & \color[HTML]{036400}\makecell{ Challenge-response Authentication \\ Protocol, Public key cryptography} & {\color[HTML]{036400} {\bf {[}25{]}}} \\
\cline{3-4}
\cellcolor[HTML]{036400} & {\color[HTML]{036400} } & {\color[HTML]{036400} PIN-based Access} & {\color[HTML]{036400} {\bf {[}27{]}}} \\
\cline{3-4}
\cellcolor[HTML]{036400} & {\color[HTML]{036400} } & {\color[HTML]{036400} Correlating Information} & {\color[HTML]{036400} {\bf {[}a{]}}} \\
\cline{3-4}
\cellcolor[HTML]{036400} & {\color[HTML]{036400} } & {\color[HTML]{036400} Back-end database} & {\color[HTML]{036400} {[}38{]}} \\
\cline{3-4}
\cellcolor[HTML]{036400} & {\color[HTML]{036400} } & {\color[HTML]{036400} Finger Print} & {\color[HTML]{036400} {[}35{]}} \\
\cline{3-4}
\cellcolor[HTML]{036400} & \multirow{-6}{*}{{\color[HTML]{036400} {\bf Cloning}}} & {\color[HTML]{036400} Unclonable Function} & {\color[HTML]{036400} {[}b{]}} \\
\cline{2-4}
\cellcolor[HTML]{036400}{\color{white} {\bf Network}} & {\color[HTML]{036400} Eavesdropping} & {\color[HTML]{036400} Encryption} & {\color[HTML]{036400} {[}a,b{]}} \\
\cline{2-4}
\cellcolor[HTML]{036400} & {\color[HTML]{036400} } & {\color[HTML]{036400} Authentication} & {\color[HTML]{036400} {[}a,b{]}} \\
\cline{3-4}
\cellcolor[HTML]{036400} & {\color[HTML]{036400} } & {\color[HTML]{036400} PINs or biometric} & {\color[HTML]{036400} {[}12{]}} \\
\cline{3-4}
\cellcolor[HTML]{036400} & {\color[HTML]{036400} } & {\color[HTML]{036400} Pseudonymization} & {\color[HTML]{036400} {[}a{]}} \\
\cline{3-4}
\cellcolor[HTML]{036400} & {\color[HTML]{036400} Spoofing} & {\color[HTML]{036400} Hash-hock} & {\color[HTML]{036400} {[}53{]}} \\
\cline{3-4}
\cellcolor[HTML]{036400} & {\color[HTML]{036400} } & {\color[HTML]{036400} Randomized hash-lock} & {\color[HTML]{036400} {[}54{]}} \\
\cline{3-4}
\cellcolor[HTML]{036400} & {\color[HTML]{036400} } & {\color[HTML]{036400} Chained hashes} & {\color[HTML]{036400} {[}41{]}} \\
\cline{3-4}
\cellcolor[HTML]{036400}{\color{white}} & \multirow{-7}{*}{} & {\color[HTML]{036400} Encryption} & {\color[HTML]{036400} {[}b,6{]}} \\
\hline
\cellcolor[HTML]{330001} & {\color[HTML]{330001} } & {\color[HTML]{330001} Aluminum-lined wallets} & {\color[HTML]{330001} {[}a, 37{]}} \\
\cline{3-4}
\cellcolor[HTML]{330001} & {\color[HTML]{330001} } & {\color[HTML]{330001} Blocker tags} & {\color[HTML]{330001} {[}28{]}} \\
\cline{3-4}
\cellcolor[HTML]{330001} & {\color[HTML]{330001} } & {\color[HTML]{330001} Guardian} & {\color[HTML]{330001} {[}45{]}} \\
\cline{3-4}
\cellcolor[HTML]{330001} & {\color[HTML]{330001} } & {\color[HTML]{330001} Symmetric key encryption} & {\color[HTML]{330001} {[}34{]}} \\
\cline{3-4}
\cellcolor[HTML]{330001} & {\color[HTML]{330001} } & {\color[HTML]{330001} Public Key Encryption} & {\color[HTML]{330001} {[}14{]}} \\
\cline{3-4}
\cellcolor[HTML]{330001} & {\color[HTML]{330001} } & {\color[HTML]{330001} Hash Function} & {\color[HTML]{330001} {[}54{]}} \\
\cline{3-4}
\cellcolor[HTML]{330001} & {\color[HTML]{330001} } & {\color[HTML]{330001} Mutual Authentication} & {\color[HTML]{330001} {[}40,7{]}} \\
\cline{3-4}
\cellcolor[HTML]{330001} & \multirow{-8}{*}[7ex]{{\color[HTML]{330001} Unauthorized tag reading}} & {\color[HTML]{330001} Pseudonyms} & {\color[HTML]{330001} {[}26{]}} \\
\cline{2-4}
\cellcolor[HTML]{330001} & {\color[HTML]{330001} } & {\color[HTML]{330001} Field Detectors, Authentication} & {\color[HTML]{330001} {[}b{]}} \\
\cline{3-4}
\cellcolor[HTML]{330001} & \multirow{-2}{*}{{\color[HTML]{330001} Tag Modification}} & {\color[HTML]{330001} Read-Only-Tag} & {\color[HTML]{330001} {[}a{]}} \\
\cline{2-4}
\cellcolor[HTML]{330001} & {\color[HTML]{330001} Middleware} & {\color[HTML]{330001} Isolating, Input Checking} & {\color[HTML]{330001} {[}a{]}} \\
\cline{2-4}
\multirow{-12}{*}[10ex]{\cellcolor[HTML]{330001}{\color{white} {\bf Application}}} & Virus & Blocking Anomalous Bits & {[}b{]} \\
\hline
\cellcolor[HTML]{FE0000} & {\color[HTML]{FE0000} Social Engineering} & \color[HTML]{FE0000}\makecell{Training, Education, Awareness and \\ Oversight} & {\color[HTML]{FE0000} {[}31{]}} \\
\cline{2-4}
\cellcolor[HTML]{FE0000} & {\color[HTML]{FE0000} } & {\color[HTML]{FE0000} EPC Global Guidelines} & {\color[HTML]{FE0000} {[}11{]}} \\
\cline{3-4}
\multirow{-4}{*}[1ex]{\cellcolor[HTML]{FE0000}{\color{white} {\bf Strategic}}} & \multirow{-2}{*}[0.6ex]{{\color[HTML]{FE0000} Privacy}} & {\color[HTML]{FE0000} Fair Information Practices (FIP)} & {\color[HTML]{FE0000} {[}16{]}} \\
\hline
\cellcolor[HTML]{6665CD} & {\color[HTML]{6665CD} Dos and Traffic Analysis} & {\color[HTML]{6665CD} Cryptographic Algorithms} & {\color[HTML]{6665CD} {[}43{]}} \\
\cline{2-4}
\cellcolor[HTML]{6665CD} & {\color[HTML]{6665CD} Side Channel} & \color[HTML]{6665CD}\makecell{Limiting the Electromagnetic \\ Emissions, Complex Circuit} & {\color[HTML]{6665CD} {[}a{]}} \\
\cline{2-4}
\cellcolor[HTML]{6665CD} & {\color[HTML]{6665CD} } & {\color[HTML]{6665CD} Challenge Response} & {\color[HTML]{6665CD} {[}a{]},{[}b{]}} \\
\cline{3-4}
\cellcolor[HTML]{6665CD} & \multirow{-2}{*}[1.5ex]{{\color[HTML]{6665CD} Replay}} & \color[HTML]{6665CD}\makecell{Timestamps, One-time Passwords, \\ Encryption} & {\color[HTML]{6665CD} {[}a{]}} \\
\cline{2-4}
\cellcolor[HTML]{6665CD} & {\color[HTML]{6665CD} Cryptography} & {\color[HTML]{6665CD} Encryption} & {\color[HTML]{6665CD} {[}a{]}} \\
\cline{2-4}
\multirow{-8}{*}[3ex]{\cellcolor[HTML]{6665CD}{\color{white} {\bfseries Multilayer}}} & {\color[HTML]{6665CD} Man-In-The-Middle} & {\color[HTML]{6665CD} Encryption, Authentication} & {\color[HTML]{6665CD} {[}b{]}} \\ \hline
\end{xtabular}
\captionof{table}{My caption}
\label{my-label}
\end{strip}
\lipsum[2-3]
\end{document}