如何调整此表以适合页面?

如何调整此表以适合页面?

如果表格太长,不适合页面,该如何调整表格大小?原始问题在这里:如何创建缩写列表

在此处输入图片描述

 \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

虽然用西班牙语阅读是有意义的,但为了了解更多,我尝试放置一个占据整个页面并可以继续在另一个页面上的表格,我使用了我喜欢的包来制作漂亮的表格禁忌(它可能被废弃了,但对我来说效果很好),为了修改表格的格式,我使用了包几何学,是你想要的吗?

结果如下: 在此处输入图片描述

以下是 MWE:

% arara: pdflatex: {synctex: yes, action: nonstopmode}
\documentclass[a4paper,10pt]{article}
\usepackage[driver=pdftex]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tabu} % Use tabu for nice tables 
\usepackage[usenames,dvipsnames,table]{xcolor}

\usepackage{longtable}
\usepackage{tabularx}
\usepackage{array}
\usepackage[longtable]{multirow}
\usepackage{booktabs, array}
\usepackage{lipsum}

\definecolor{C0}{HTML}{D9D9D9}
\definecolor{C1}{HTML}{B3B2FF}
\renewcommand{\arraystretch}{1.3}

\begin{document}
\lipsum[1-6]    %dummy text for the firts page
\newpage
\pagestyle{empty} %clear head and foot
\newgeometry{%redefine the page dimmensions.
        textwidth=21cm,
        textheight=26cm,
        top=0cm,
        bottom=0cm,
        foot=0cm,
    }
    % Start preamble configurations, longtabu do not use table environment.
    \tabulinesep = 2mm % Separation between cell text and the table lines
    \tabulinestyle{1.5pt,C1} % define table lines style

    \begin{longtabu} to \linewidth {|X[1.1,c]|X[4]|} %check the manual xD
        %Start head definition 
        \tabucline - 
        \rowcolor{C0} % defines the color for all cells in the row
        \rowfont[c]{\bf}    % idem but with text
        Abbreviation & Explanation \\ \tabucline - \endhead % End head definition
        %start middle foot definition.
        \multicolumn{2}{l}{Continues in the next page...}  \endfoot
        %Start last foot definition.
        %NONE
        \endlastfoot
        %Here the table contents...
        \multirow{2}{*}{USA}
        &\cellcolor{C1}United state of america \\
        &\\ \tabucline -

        \multirow{2}{*}{NY}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{BAR}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{FOO}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{ASK}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{MWE}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{AST}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{LM}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{EST}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{NOR}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{MWE}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{AST}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{LM}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{EST}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{NOR}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{ADR}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{WEQ}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{HTTP}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{STI}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{FDA}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{RCT}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{NBC}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{HTTP}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{STI}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{FDA}
        &\cellcolor{C1}New york \\*  %\\* This is to force to split the table and separate properly; FDA goes to the next page
        &\\ \tabucline -

        \multirow{2}{*}{RCT}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{NBC}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

        \multirow{2}{*}{END}
        &\cellcolor{C1}New york \\
        &\\ \tabucline -

    \end{longtabu}

\restoregeometry % this restores the page at the preamble configuration.

\newpage{plain}
\lipsum[3-7] %dummy text for MWE
\end{document}

相关内容