
Estou trabalhando com tese clássica e tenho um documento geral bastante complicado, então não posso postar um MWE (desculpe, bastante novo no LaTeX). Estou postando alguns pacotes que acredito que possam estar em relação à mesa. Meu problema: estou usando uma tabela longa que se espalha automaticamente por várias páginas. Tudo funciona bem, exceto que excede a largura do texto (apesar de definir as colunas usando \linewidth).
Você poderia me ajudar a identificar o que estou fazendo de errado ou como posso combinar a largura da tabela com a largura da linha?
Muito obrigado!
\usepackage{calc, longtable, ltablex, booktabs,array, caption, enumitem}
\keepXColumns
\newcolumntype{x}[1]{>{\raggedright}p{#1}}
\begin{spacing}{.7}
\footnotesize
\begin{longtable}{x{0.35\textwidth} x{0.25\textwidth} x{0.4\textwidth}}
\caption{Example table}\label{tab:example} \\
\toprule
{\textbf{Column One}} & {\textbf{Column Two}} & {\textbf{Column Three}}
\tabularnewline
\midrule
\endfirsthead
%%%%
\caption{Example table (cont.)} \\
\toprule
{\textbf{Column One}} & {\textbf{Column Two}} & {\textbf{Column Three}}
\tabularnewline
\midrule
\endhead
%%%%
\midrule[\heavyrulewidth]
\multicolumn{3}{r}{\footnotesize\itshape Continue on the next page}
\endfoot
%%%%
\bottomrule
\endlastfoot
%%%%
Content & Content & Content \tabularnewline
Content & Content & Content \tabularnewline
\end{longtable}
\end{spacing}
Responder1
Você tem
\begin{longtable}
{x{0.35\textwidth} x{0.25\textwidth} x{0.4\textwidth}}
mas cada coluna tem \tabcolsep
espaço (padrão 6pt) em ambos os lados, então você terá 36pt de largura a mais.
tentar
\begin{longtable}
{@{}x{0.35\textwidth} x{\dimexpr 0.25\textwidth - 24pt\relax} x{0.4\textwidth}@{}}
então você remove o preenchimento das laterais @{}
e salva 24pt na coluna do meio (ou é claro que você pode distribuí-lo de forma diferente e remover um pouco de cada coluna)
Responder2
Eu usaria o xltabular
ambiente (o pacote carrega ltablex
, mas poupa o incômodo de ter que adicionar keepXColumns
), com as especificações >{\hsize)xx\hsize
para ter colunas de larguras diferentes):
\documentclass{report}
\usepackage{classicthesis}
\usepackage{array, setspace}
\usepackage{calc, longtable,xltabular, booktabs, array, caption, enumitem}
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.3pt}
\begin{document}
\mbox{}
\begin{spacing}{.7}
\footnotesize
\begin{xltabular}{\linewidth}{>{\hsize=1.05\hsize}X >{\hsize=0.75\hsize}X >{\hsize=1.20\hsize\arraybackslash}X}
\caption{Example table}\label{tab:example} \\
\toprule
{\textbf{Column One}} & {\textbf{Column Two}} & {\textbf{Column Three}} \\
\midrule
\endfirsthead
%%%%
\caption{Example table (cont.)} \\
\toprule
{\textbf{Column One}} & {\textbf{Column Two}} & {\textbf{Column Three}} \\
\midrule
\endhead
%%%%
\midrule[\heavyrulewidth]
\multicolumn{3}{r}{\footnotesize\itshape Continue on the next page}
\endfoot
%%%%
\bottomrule
\endlastfoot
%%%%
Content & Content & Content \\
Content & Content & Content
\end{xltabular}
\end{spacing}
\end{document}