Wie passt der Text in eine große Tabelle?

Wie passt der Text in eine große Tabelle?

Ich arbeite an einer großen Tabelle und verwende einige Tools, um sie an die Textbreite der Standardgröße anzupassen. Eine der Spalten passt jedoch nicht in die Maße der Tabelle. Wie kann ich das tun?

\documentclass[
% -- opções da classe memoir --
article,            % indica que é um artigo acadêmico
11pt,               % tamanho da fonte
oneside,            % para impressão apenas no verso. Oposto a twoside
a4paper,            % tamanho do papel. 
% -- opções da classe abntex2 --
%chapter=TITLE,     % títulos de capítulos convertidos em letras maiúsculas
%section=TITLE,     % títulos de seções convertidos em letras maiúsculas
%subsection=TITLE,  % títulos de subseções convertidos em letras maiúsculas
%subsubsection=TITLE % títulos de subsubseções convertidos em letras maiúsculas
% -- opções do pacote babel --
english,            % idioma adicional para hifenização
brazil,             % o último idioma é o principal do documento
sumario=tradicional
]{abntex2}

\usepackage{tabularx}
\usepackage{adjustbox}

 \begin{document}

 \begin{table}[!htbp]
 \scriptsize
 \centering
 \begin{center}
 \caption{Resultados das regressões utilizando Mínimos Quadrados Ordinários}
 %\scalebox{1}{
 \begin{tabularx}{\textwidth}{cccccccccccccc} \hline %{bss}

 & $R^2 (\%)$ & Int. & \multicolumn{1}{l}{$R_{t}$} & \multicolumn{1}{l}{$R_{t-1}$} & \multicolumn{1} 
 {l}{$R_{t-2}$} & \multicolumn{1}{l}{$R_{t-3}$} & \multicolumn{1}{l}{$R_{t+1}$ } & \multicolumn{1}{l} 
 {$R_{t+2}$} & \multicolumn{1}{l}{$|R_{t}|$} & \multicolumn{1}{l}{$R^2_t$ } & \multicolumn{1}{l}{$\% 
 \Delta OVX_{t-1}$} & \multicolumn{1}{l}{$\% \Delta OVX_{t-2}$} & \multicolumn{1}{l}{$\% \Delta 
 OVX_{t-3}$} \\ \hline
 M1 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00                                 \\
 M2 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00                                 \\
 M3 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00                                 \\
 M4 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00                                 \\
 M5 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00 \\ \hline                                
 \end{tabularx}
 %}
 \label{tab:Tabela 1}
 \end{center}
 \end{table}

 \end{document}

Tabellenbild

Antwort1

Hier sind einige Optionen, wie Sie Ihre Tabelle schmal genug machen können, damit sie in die Textbreite passt:

  1. Im ersten Beispiel habe ich tabularxdurch ersetzt, in diesem konkreten Fall besser geeignet, tabular*und \setlength{\tabcolsep}{0pt}in Kombination mit verwendet @{\extracolsep{\fill}}, um den Abstand zwischen den Spalten zu verringern, damit die Tabelle gerade in die Textbreite passt. In diesem Beispiel habe ich auch die \scriptsizeSchriftgröße beibehalten, aber den redundanten \enteringBefehl und centerdie Umgebung entfernt.

  2. Im zweiten Beispiel habe ich die \hlineBefehle zusätzlich durch horizontale Linien aus dem booktabsPaket ersetzt, um Überlappungen zwischen Text und horizontalen Linien zu vermeiden.

  3. Im dritten Beispiel habe ich versucht, die Spaltenüberschriften zu verkürzen, indem ich wiederholte Informationen in eine gemeinsame Überschrift verschoben habe. Mit diesem Ansatz kann man die Schriftgröße vergrößern und \smalltrotzdem die Tabelle in die Textbreite einpassen.

  4. Im letzten Beispiel habe ich die komplette Tabelle transponiert.

Bildbeschreibung hier eingeben

(Rote Linien zeigen Ränder an.)

\documentclass[
% -- opções da classe memoir --
article,            % indica que é um artigo acadêmico
11pt,               % tamanho da fonte
oneside,            % para impressão apenas no verso. Oposto a twoside
a4paper,            % tamanho do papel. 
% -- opções da classe abntex2 --
%chapter=TITLE,     % títulos de capítulos convertidos em letras maiúsculas
%section=TITLE,     % títulos de seções convertidos em letras maiúsculas
%subsection=TITLE,  % títulos de subseções convertidos em letras maiúsculas
%subsubsection=TITLE % títulos de subsubseções convertidos em letras maiúsculas
% -- opções do pacote babel --
english,            % idioma adicional para hifenização
brazil,             % o último idioma é o principal do documento
sumario=tradicional
]{abntex2}

\usepackage{booktabs}
\usepackage{showframe}\renewcommand*\ShowFrameColor{\color{red}}

 \begin{document}

 \begin{table}[!htbp]
 \scriptsize
 \setlength{\tabcolsep}{0pt}
 \caption{Resultados das regressões utilizando Mínimos Quadrados Ordinários}
 \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}cccccccccccccc} \hline %{bss}

 & $R^2 (\%)$ & Int. & \multicolumn{1}{l}{$R_{t}$} & \multicolumn{1}{l}{$R_{t-1}$} & \multicolumn{1} 
 {l}{$R_{t-2}$} & \multicolumn{1}{l}{$R_{t-3}$} & \multicolumn{1}{l}{$R_{t+1}$ } & \multicolumn{1}{l} 
 {$R_{t+2}$} & \multicolumn{1}{l}{$|R_{t}|$} & \multicolumn{1}{l}{$R^2_t$ } & \multicolumn{1}{l}{$\% 
 \Delta OVX_{t-1}$} & \multicolumn{1}{l}{$\% \Delta OVX_{t-2}$} & \multicolumn{1}{l}{$\% \Delta 
 OVX_{t-3}$} \\ \hline
 M1 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00                                 \\
 M2 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00                                 \\
 M3 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00                                 \\
 M4 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00                                 \\
 M5 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00 \\ \hline                                
 \end{tabular*}
 \label{tab:Tabela 1}
 \end{table}


 \begin{table}[!htbp]
 \scriptsize
 \setlength{\tabcolsep}{0pt}
 \caption{Resultados das regressões utilizando Mínimos Quadrados Ordinários}
 \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}cccccccccccccc} 
 \toprule %{bss}
 & $R^2 (\%)$ & Int. & $R_{t}$ & $R_{t-1}$ & $R_{t-2}$ & $R_{t-3}$ & $R_{t+1}$  &  
 $R_{t+2}$ & $|R_{t}|$ & $R^2_t$ & $\%\Delta OVX_{t-1}$ & $\% \Delta OVX_{t-2}$ & $\% \Delta OVX_{t-3}$ \\ \midrule
 M1 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00                                 \\
 M2 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00                                 \\
 M3 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00                                 \\
 M4 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00                                 \\
 M5 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00 \\ \bottomrule
 \end{tabular*}
 \label{tab:Tabela 1}
 \end{table}
 
 
\begin{table}[!htbp]
 \small
 \setlength{\tabcolsep}{0pt}
 \caption{Resultados das regressões utilizando Mínimos Quadrados Ordinários}
 \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}cccccccccccccc} 
 \toprule
 & & &&&&&&&&& \multicolumn{3}{c}{$\% \Delta OV$}\\
 \cmidrule{12-14}
 & $R^2 (\%)$ & Int. & $R_{t}$ & $R_{t-1}$ & $R_{t-2}$ & $R_{t-3}$ & $R_{t+1}$  &  
 $R_{t+2}$ & $|R_{t}|$ & $R^2_t$ & $X_{t-1}$ & $X_{t-2}$ & $X_{t-3}$ \\ \midrule
 M1 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00                                 \\
 M2 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00                                 \\
 M3 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00                                 \\
 M4 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00                                 \\
 M5 & 0.00                      & 0.00       & 0.00                     & 0.00                       
 & 0.00                       & 0.00                       & 0.00                       & 0.00                       
 & 0.00                       & 0.00                                        & 0.00                                
 & 0.00                                 & 0.00 \\ \bottomrule
 \end{tabular*}
 \label{tab:Tabela 1}
 \end{table}
 
 
\begin{table}[!htbp]
\centering
 \caption{Resultados das regressões utilizando Mínimos Quadrados Ordinários}
 \begin{tabular}{lccccc} \hline %{bss}
 & M1 & M2 & M3 & M4 & M5\\
 \midrule
  $R^2 (\%)$            & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
  Int.                  & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
  $R_{t}$               & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
  $R_{t-1}$             & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
  $R_{t-2}$             & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
  $R_{t-3}$             & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
  $R_{t+1}$             & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
  $R_{t+2}$             & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
  $|R_{t}|$             & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
  $R^2_t$               & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
  $\%\Delta OVX_{t-1}$  & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
  $\% \Delta OVX_{t-2}$ & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
  $\% \Delta OVX_{t-3}$ & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\ 
  \bottomrule
 \end{tabular}
 \label{tab:Tabela 1}
\end{table}


 \end{document}

verwandte Informationen