
我正在處理一張大桌子,並使用一些工具將其調整為預設寬度的文字。但是,其中一列不適合表的度量。我怎樣才能做到這一點?
\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}
答案1
以下是有關如何使表格足夠窄以適應文字寬度的一些選項:
在第一個範例中,我已替換
tabularx
為,在這種特定情況下,更合適並與 結合tabular*
使用,以減少列之間的距離,以確保表格恰好適合文字寬度。在這個例子中,我還保留了字體大小,但刪除了多餘的命令和環境。\setlength{\tabcolsep}{0pt}
@{\extracolsep{\fill}}
\scriptsize
\entering
center
在第二個範例中,我另外用套件
\hline
中的水平線取代了指令booktabs
,以避免文字和水平線之間的重疊。在第三個範例中,我嘗試透過將重複資訊移至共用標題中來縮短列標題。透過這種方法,您可以放大字體大小,
\small
同時仍然使表格適合文字寬度。在上一個範例中,我轉置了整個表格。
(紅線表示邊距。)
\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}