我有一张很长的表格,但一直在苦苦寻找方法:a) 将第 3 列和第 4 列的标题分成两行(传输的未加密数据和第三方域);b) 我还没有找到在不破坏格式的情况下缩小表格的方法。有什么建议吗?
谢谢
\begin{longtable}[c]{| c | c | c | c|} \hline \rowcolor{orange}
\textbf{Category} & \textbf{Application} & Transmitted data that was
unencrypted & Third party domains\\ \hline \endfirsthead
\hline \multicolumn{4}{|c|}{Continuation of Table
\ref{long:unencrypted}}\\ \hline \rowcolor{orange} \textbf{Category} &
\textbf{Application} & Transmitted data that was
unencrypted & Third party domains\\ \hline \endhead
\hline \endfoot \endlastfoot
\multirow{7}{*}{\textbf{Business}} & Adobe Reader & something &
something \\ \cline{2-4}
& ADP Mobile Solutions & 26 & 4 \\ \cline{2-4}
& Dropbox & 26 & 4 \\ \cline{2-4}
& Facebook Pages & 26 & 4 \\ \cline{2-4}
& Indeed Jobs & 26 & 4 \\ \cline{2-4}
& Reed.co.uk & 26 & 4 \\ \cline{2-4}
& Smart Scan Express & 26 & 4 \\ \cline{2-4}
\end{long table}
PS. 现在看起来是这样的..为什么我没有得到列末尾的颜色?
答案1
使用\thead
来自的命令makecell
。Ir 允许换行和列标题的常见格式。添加一个,\extrarowheight
使垂直间距看起来不那么紧:
\documentclass{article}
\usepackage[showframe, nomarginpar]{geometry}
\usepackage{array}
\usepackage[labelfont=bf]{caption}
\captionsetup{format=plain,font=footnotesize}
\usepackage{xcolor} \usepackage{multirow, ltablex, colortbl, makecell}
\renewcommand{\theadfont}{\normalsize, \bfseries}
\usepackage{ragged2e}
\usepackage{lipsum}
\begin{document}
...
\setlength\extrarowheight{3pt}
\begin{longtable}[c]{| c | c | c | >{\arraybackslash}c|} \hline \rowcolor{orange}
\textbf{Category} & \textbf{Application} &\thead{ Transmitted data\\ that was
unencrypted} & \thead{Third party \\domains}\\ \hline \endfirsthead
\hline \multicolumn{4}{|c|}{Continuation of Table
\ref{long:unencrypted}}\\ \hline \rowcolor{orange} \textbf{Category} &
\textbf{Application} &\thead{ Transmitted data \\that was
unencrypted} & \thead{Third party \\domains}\\ \hline \endhead
\hline \endfoot \endlastfoot
\multirow{7}{*}{\textbf{Business}} & Adobe Reader & something &
something \\ \cline{2-4}
& ADP Mobile Solutions & 26 & 4 \\ \cline{2-4}
& Dropbox & 26 & 4 \\ \cline{2-4}
& Facebook Pages & 26 & 4 \\ \cline{2-4}
& Indeed Jobs & 26 & 4 \\ \cline{2-4}
& Reed.co.uk & 26 & 4 \\ \cline{2-4}
& Smart Scan Express & 26 & 4 \\ \cline{2-4}
\end{longtable}
...
\end{document}