使页面适合表格

使页面适合表格

我怎样才能使一页适合显示整个表格(我在这里看到的都是相反的,使表格大小适合页面大小。但是,因为我不会打印结果,所以我想做相反的事情)

这是我的表格的示例(我需要使用,longtable因为它使用了 2 页)

\documentclass[landscape, letter]{report}
\usepackage{ltxtable}
\usepackage[table]{xcolor}
\usepackage{colortbl}
\usepackage{multirow}
\usepackage[latin1]{inputenc}
\usepackage[left=0cm,top=.5cm,right=0cm]{geometry}
\usepackage{longtable}
\title{titulo}
\author{Rodrigo Coster - 1141783-01}
\begin{document}
\begin{center}\textbf{{\LARGE Relação de vagas autorizadas, providas e disponíveis}}\end{center}
\tiny
\begin{longtable}{cccccccccccccccccccccccccccccccccccccc}
\hline
\multirow{3}*{Cod.} & \multirow{3}*{Sec.} & \multicolumn{12}{c}{Categoria A} & \multicolumn{12}{c}{Categoria B} & \multicolumn{12}{c}{Categoria G} \\ 
& & \multicolumn{3}{c}{4h}  & \multicolumn{3}{c}{5h}  & \multicolumn{3}{c}{6h}  & \multicolumn{3}{c}{Total} & \multicolumn{3}{c}{4h}  & \multicolumn{3}{c}{5h}  & \multicolumn{3}{c}{6h}  & \multicolumn{3}{c}{Total} & \multicolumn{3}{c}{4h}  & \multicolumn{3}{c}{5h}  & \multicolumn{3}{c}{6h}  & \multicolumn{3}{c}{Total} \\
& & A & P & D & A & P & D & A & P & D & A & P & D & A & P & D & A & P & D & A & P & D & A & P & D & A & P & D & A & P & D & A & P & D & A & P & D \\ 
\rowcolor{yellow} 187 & GP & \cellcolor{red} 5 & \cellcolor{red} 6 & \cellcolor{red} -1 &  0 &  0 &  0 &  0 &  0 &  0 & \cellcolor{red} 5 & \cellcolor{red} 6 & \cellcolor{red} -1 &  6 &  4 &  2 &  0 &  0 &  0 &  23 &  20 &  3 &  29 &  25 &  4 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 \\
\rowcolor{yellow} 912 & SMA &  46 &  35 &  11 &  0 &  0 &  0 &  24 &  15 &  9 &  70 &  50 &  20 &  10 &  8 &  2 &  0 &  0 &  0 &  26 &  10 &  16 &  36 &  22 &  14 & \cellcolor{red} 0 & \cellcolor{red} 6 & \cellcolor{red} -6 &  0 &  0 &  0 & \cellcolor{red} 0 & \cellcolor{red} 6 & \cellcolor{red} -6 & \cellcolor{red} 0 & \cellcolor{red} 12 & \cellcolor{red} -12 \\
 825 & SMACIS &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 \\
\rowcolor{yellow} 925 & SMACIS & \cellcolor{red} 0 & \cellcolor{red} 2 & \cellcolor{red} -2 &  0 &  0 &  0 &  0 &  0 &  0 & \cellcolor{red} 0 & \cellcolor{red} 2 & \cellcolor{red} -2 & \cellcolor{red} 0 & \cellcolor{red} 2 & \cellcolor{red} -2 &  0 &  0 &  0 &  0 &  0 &  0 & \cellcolor{red} 0 & \cellcolor{red} 2 & \cellcolor{red} -2 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 \\
\rowcolor{yellow} 83 & SMED &  151 &  8 &  143 &  0 &  0 &  0 &  0 &  0 &  0 &  151 &  8 &  143 & \cellcolor{red} 0 & \cellcolor{red} 2 & \cellcolor{red} -2 &  0 &  0 &  0 & \cellcolor{red} 0 & \cellcolor{red} 1 & \cellcolor{red} -1 & \cellcolor{red} 0 & \cellcolor{red} 3 & \cellcolor{red} -3 & \cellcolor{red} 0 & \cellcolor{red} 37 & \cellcolor{red} -37 &  0 &  0 &  0 & \cellcolor{red} 0 & \cellcolor{red} 6 & \cellcolor{red} -6 & \cellcolor{red} 0 & \cellcolor{red} 44 & \cellcolor{red} -44 \\
\rowcolor{yellow} 913 & SMF & \cellcolor{red} 0 & \cellcolor{red} 73 & \cellcolor{red} -73 &  0 &  0 &  0 &  0 &  0 &  0 & \cellcolor{red} 0 & \cellcolor{red} 73 & \cellcolor{red} -73 & \cellcolor{red} 0 & \cellcolor{red} 35 & \cellcolor{red} -35 &  0 &  0 &  0 & \cellcolor{red} 0 & \cellcolor{red} 37 & \cellcolor{red} -37 & \cellcolor{red} 0 & \cellcolor{red} 73 & \cellcolor{red} -73 & \cellcolor{red} 0 & \cellcolor{red} 10 & \cellcolor{red} -10 &  0 &  0 &  0 & \cellcolor{red} 0 & \cellcolor{red} 5 & \cellcolor{red} -5 & \cellcolor{red} 0 & \cellcolor{red} 15 & \cellcolor{red} -15 \\
\rowcolor{yellow} 7 & SMED &  0 &  0 &  0 &  0 &  0 &  0 &  67 &  0 &  67 &  67 &  0 &  67 & \cellcolor{red} 0 & \cellcolor{red} 8 & \cellcolor{red} -8 &  0 &  0 &  0 &  124 &  63 &  61 &  124 &  71 &  53 & \cellcolor{red} 0 & \cellcolor{red} 10 & \cellcolor{red} -10 &  0 &  0 &  0 & \cellcolor{red} 0 & \cellcolor{red} 51 & \cellcolor{red} -51 & \cellcolor{red} 0 & \cellcolor{red} 61 & \cellcolor{red} -61 \\
\rowcolor{yellow} 918 & SMS &  138 &  93 &  45 &  0 &  0 &  0 & \cellcolor{red} 2 & \cellcolor{red} 3 & \cellcolor{red} -1 &  140 &  97 &  43 &  93 &  43 &  50 &  0 &  0 &  0 &  13 &  2 &  11 &  106 &  47 &  59 & \cellcolor{red} 0 & \cellcolor{red} 17 & \cellcolor{red} -17 &  0 &  0 &  0 & \cellcolor{red} 0 & \cellcolor{red} 1 & \cellcolor{red} -1 & \cellcolor{red} 0 & \cellcolor{red} 19 & \cellcolor{red} -19 \\
\rowcolor{yellow} 166 & SMS &  0 &  0 &  0 & \cellcolor{red} 2 & \cellcolor{red} 5 & \cellcolor{red} -3 &  0 &  0 &  0 & \cellcolor{red} 2 & \cellcolor{red} 5 & \cellcolor{red} -3 &  0 &  0 &  0 &  103 &  52 &  51 &  0 &  0 &  0 &  103 &  54 &  49 &  0 &  0 &  0 & \cellcolor{red} 0 & \cellcolor{red} 2 & \cellcolor{red} -2 &  0 &  0 &  0 & \cellcolor{red} 0 & \cellcolor{red} 2 & \cellcolor{red} -2 \\
\end{longtable}
\end{document}

如您所见,使用后\tiny,仍然缺少一列。

答案1

你需要把它紧贴在桌子上吗?或者干脆把它弄宽一点,把

\addtolength\pdfpagewidth{1in}

例如,在工作之前\begin{longtable}。可以在稍后的运行中精确测量表格。但通常只需增加一个固定量就足够了。

请注意,这\pdfpagewidth只会影响 pdf 查看器用于剪辑视图的大小,表格仍将用于overfullTeX,如果您想更改它,那么您可能还需要

\addtolength\textwidth{1英寸}

在该文件的序言中。

当然,不一定非要是1in任意 TeX 长度都可以。

相关内容