如何调整此表以跨越页面边界?原始问题在这里:如何创建缩写列表
\documentclass{article}
\usepackage{tabularx}
\usepackage{amsmath}
\usepackage[table]{xcolor}
\usepackage{tabularx, multirow, makecell, rotating} %
\usepackage{enumitem}
\begin{document}
\begin{center}
\bfseries
\settowidth\rotheadsize{List of Abbreviation/accronym}
\begin{tabularx}{\linewidth}{|c|>{\centering\arraybackslash}X|}
\hline
\cellcolor{gray!30} Abbreviation & \cellcolor{gray!30} Explanation \\
\hline
\multirow[b]{2}{*}{USA}
& \cellcolor{blue!30} United state of america
\rule[-1em]{0pt}{2.5em} \\
\cline{2-2}
% &
% \rule[-1em]{0pt}{2.5em} \\
% \cline{2-2}
& \rule[-1em]{0pt}{2.5em} \\
\hline
\multirow[b]{2}{*}{NY}
& \cellcolor{blue!30} New york
\rule[-1em]{0pt}{2.5em} \\
\cline{2-2}
% &
% \rule[-1em]{0pt}{2.5em} \\
% \cline{2-2}
& \rule[-1em]{0pt}{2.5em} \\
\hline
\end{tabularx}
\end{center}
\end{document}
答案1
包ltablex
是包tabularx
结束的组合longtable
。通过它你可以获得:
\documentclass{article}
%\usepackage{tabularx} it is suficient to load it once (by ltablex)
\usepackage{amsmath}
\usepackage[table]{xcolor}
\usepackage{makecell, multirow, rotating, ltablex}
% "ltablex" merge features of `tabularx" and "longtable"
% they are not need to be separately loaded
\keepXColumns % preserve `X` column features when content is shorter
% than cell determined by "tabularx" algorithm
\usepackage{enumitem}
\begin{document}
%\begin{center} % not needed
%\settowidth\rotheadsize{List of Abbreviation/acronym} % not needed,
% you haven't rotated cells
\begingroup % added
\bfseries
\noindent% added
\renewcommand\arraystretch{1.5}
\begin{tabularx}{\linewidth}{|c|
>{\centering\arraybackslash}X|}
\hline
\rowcolor{gray!30}
Abbreviation & Explanation \\
\hline
\multirow{2}{*}{USA}
& \cellcolor{blue!30}
United State of America \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{NY}
& \cellcolor{blue!30}
New York \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{USA}
& \cellcolor{blue!30}
United State of America \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{NY}
& \cellcolor{blue!30}
New York \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{USA}
& \cellcolor{blue!30}
United State of America \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{NY}
& \cellcolor{blue!30}
New York \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{USA}
& \cellcolor{blue!30}
United State of America \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{NY}
& \cellcolor{blue!30}
New York \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{USA}
& \cellcolor{blue!30}
United State of America \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{NY}
& \cellcolor{blue!30}
New York \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{USA}
& \cellcolor{blue!30}
United State of America \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{NY}
& \cellcolor{blue!30}
New York \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{USA}
& \cellcolor{blue!30}
United State of America \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{NY}
& \cellcolor{blue!30}
New York \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{USA}
& \cellcolor{blue!30}
United State of America \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{NY}
& \cellcolor{blue!30}
New York \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{USA}
& \cellcolor{blue!30}
United State of America \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{NY}
& \cellcolor{blue!30}
New York \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{USA}
& \cellcolor{blue!30}
United State of America \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{NY}
& \cellcolor{blue!30}
New York \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{USA}
& \cellcolor{blue!30}
United State of America \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{NY}
& \cellcolor{blue!30}
New York \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{USA}
& \cellcolor{blue!30}
United State of America \\
\cline{2-2}
& \\
\hline
\multirow{2}{*}{NY}
& \cellcolor{blue!30}
New York \\
\cline{2-2}
& \\
\hline
\end{tabularx}
\endgroup % added
\end{document}