1

I'm working on a large table and I use some tools to fit it into the default width text. However, one of its columns doesn't fit into the table's measures. How can I do this?

\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}

table image

leandriis
  • 62,593
  • Why do you use tabularx here? Since you do not use any X type column, tabular* would be better suited. – leandriis Sep 11 '20 at 16:53
  • Since your table is quite wide and you already quite significantly reduced the font size, I doubt that you will be able to fit your table into the textwidth. Could you transpose the whole table? – leandriis Sep 11 '20 at 16:54

1 Answers1

0

Here are some options on how to make your table narrow enough to fit into the textwidth:

  1. In the first example, I have replaced tabularx with the, in this specific case, more suitable tabular* and used \setlength{\tabcolsep}{0pt} in combination with @{\extracolsep{\fill}} in order to reduce the distance between the columns in order to make sure the table just fits into the textwidth. In this example, I have also kept the \scriptsize font size, but removed the redundant \entering command and center environment.

  2. In the second example, I have additionally replaced the \hline commands with horizontal lines from the booktabs package in order to avoid overlaps between the text and the horizontal lines.

  3. In the third example, I tried to shorten the column headers by moving repeated information into a shared header. With this approach, you can enlarge the font size to \small while still fitting the table into the textwidth.

  4. In the last example, I have transposed the entire table.

enter image description here

(Red lines indicate margins.)

\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}

leandriis
  • 62,593