
Estou tentando encaixar uma tabela bastante grande na minha página. É muito largo para a página. Eu tentei algo como
\begin{longtable}{| p{0.14\textwidth} | p{0.14\textwidth} |
p{0.14\textwidth} | p{0.14\textwidth} | p{0.14\textwidth} |
p{0.14\textwidth} | p{0.14\textwidth} |}
porque tenho sete colunas.
Um dos problemas que tenho agora é que, como estou usando scrartcl
, o espaço de anotação também está incluído \textwidth
, mas é claro que quero ficar dentro dos limites normais.
Além disso, já estou usando o footnotesize, mas ele não separa as palavras -> se forem muito longas, são parcialmente escritas na próxima coluna.
Agora preciso de um método que ajuste a tabela na largura "normal" da página (conforme mostrado por showframe
) e também adicione uma quebra de linha ou separe palavras, para evitar escrever na próxima coluna.
Não postei um exemplo mínimo, pois estou aberto a todas as soluções possíveis, (mas deveria usar algo como longtable e, se possível, ajustar o tamanho da coluna em relação ao \textwidth
).
(desculpe se isso parece um pouco confuso)
\begin{footnotesize}
\begin{center}
\begin{longtable}{| p{0.14\textwidth} | p{0.14\textwidth} |
p{0.14\textwidth} | p{0.14\textwidth} | p{0.14\textwidth} |
p{0.14\textwidth} | p{0.14\textwidth} |}
\hline
\textbf{Variable} & \textbf{Kurzbezeichnung} & \textbf{Frage} & \textbf{type} & \textbf{value label} & \textbf{Range} & \textbf{missing value}\\
\hline
\endhead % all the lines above this will be repeated on every page
ffhrwoggbgbgfieh & fefgogergeroigregb & fhoergregre & fhoerghergie & herogheggire & hgieghrgri & ngjreoigehrero\\
\hline
\caption{Alle Variablen von der Dokumentation aus dem Codebuch.}
\label{tab:VarDoku}
\end{longtable}
\end{center}
\end{footnotesize}
Responder1
Não há como “Kurzbezeichnung” ser acomodado em uma largura tão estreita, então eu abreviei para “KB”.
\documentclass{article}
\usepackage{longtable,calc,array}
\newlength\alicewidth
\begin{document}
\begingroup\footnotesize
\setlength{\alicewidth}{\textwidth/7-2\tabcolsep-8\arrayrulewidth/7}
\begin{longtable}{|*{7}{>{\raggedright\arraybackslash}p{\alicewidth}|}}
\hline
\textbf{Variable} & \textbf{KB} & \textbf{Frage} &
\textbf{type} & \textbf{value label} & \textbf{Range} & \textbf{missing value}\\
\hline
\endhead % all the lines above this will be repeated on every page
ffhrwo ggbgbg fieh & fefgo gerge roigr egb & fhoerg regre & fhoerg hergie &
herogh eggire & hgieg hrgri & ngjreoi gehrero\\
\hline
\caption{Alle Variablen von der Dokumentation aus dem Codebuch.\label{tab:VarDoku}}
\end{longtable}
\endgroup
\end{document}
Responder2
Eu usaria o ltablex
pacote, que combina as funcionalidades de longtable
e tabularx
e makecell
para ter uma formatação comum de todos os cabeçalhos de coluna. Além disso, as legendas das tabelas geralmente são colocadasacimatabela, principalmente no caso de tabelas de múltiplas páginas, para facilidade do leitor:
\documentclass[a4paper]{scrartcl}
\usepackage[utf8x]{inputenc}
\usepackage{ucs}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{caption, ltablex, makecell}%
\captionsetup{font=footnotesize, labelfont=sc}
\renewcommand\theadfont{\footnotesize\bfseries}
\usepackage{showframe} %
\renewcommand\ShowFrameLinethickness{0.3pt}
\renewcommand{\tabularxcolumn}[1]{>{\footnotesize\arraybackslash}p{#1}}
\begin{document}
\
\keepXColumns
\begin{tabularx}{\linewidth}{|*{7}{ X|}}
\caption{Alle Variablen von der Dokumentation aus dem Codebuch.}\medskip
\label{tab:VarDoku}\\
\hline \thead{Variable} & \thead{Kurzbe- & & & & & \\zeichnung} & \thead{Frage} & \thead{Type} & \thead{Value\\ label} & \thead{Range} & \thead{Missing\\ value}\\
\hline
\endfirsthead
\hline
\thead{Variable} & \thead{Kurzbe- & & & & & \\zeichnung} & \thead{Frage} & \thead{type} & \thead{value\\ label} & \thead{Range} & \thead{missing\\ value}\\
\hline
\endhead % all the lines above this will be repeated on every page
ffhrwogg bgbgfieh & fefgogerge roigregb & fhoergregre & fhoerghergie & herogheggire & hgieghrgri & ngjreoigeh rero \\
\hline
\end{tabularx}
\end{document}