Preciso de ajuda para formatar uma tabela longa em Latex

Preciso de ajuda para formatar uma tabela longa em Latex

Estou tendo problemas para formatar minha longa tabela em duas páginas. Este é o meu código atual:

insira a descrição da imagem aqui

\begin{longtable}{p{5cm}p{9cm}}
    \caption{Descriptions of learning styles \citep{Hoerner2013}}\\
    \hline
    \multicolumn{1}{c}{\textbf{Learning Style}} & \multicolumn{1}{c}{\textbf{Description}} \\\hline
    \endhead 
    \multicolumn{1}{c}{1. Visual} & \parbox[c]{\hsize}{People who understand work better when it is in the form of a diagram. Knowledge and concept maps are good tools for such learners.} \vspace{1mm} \\\hline
    \multicolumn{1}{c}{2. Aural} &  \parbox[c]{\hsize}{\vspace{1mm} People who dislike reading, but enjoys hearing someone else say something aloud. Hearing the information is key for such students and group discussions can be of great aid.} \vspace{1mm}  \\\hline
    \multicolumn{1}{c}{3. Verbal} & \parbox[c]{\hsize}{Verbal learners are people who express themselves easier through writing and speaking. Mnemonics, scripting and role playing are some great techniques to helps those learners.} \vspace{1mm} \\\hline
    \multicolumn{1}{c}{4. Physical} &   \parbox[c]{\hsize}{Hands-on activities rather than lectures or demonstrations appeal to these learners. They are a small percentage of the population, but they learn better through practical experience.} \vspace{1mm} \\\hline
    \multicolumn{1}{c}{5. Logical} &    \parbox[c]{\hsize}{People who are good with numbers and using logic to understand. They easily recognize patterns and often tend to group information to further their understanding.}  \vspace{1mm} \\\hline
    \multicolumn{1}{c}{6. Social} & \parbox[c]{\hsize}{When communicating and socialising with others come easy, someone is a social learner. Studying in group formats and learning from others are their speciality and is how they excel.}   \vspace{1mm} \\\hline
    \multicolumn{1}{c}{7. Solitary} &   \parbox[c]{\hsize}{People who are more comfortable studying in private and introspective.  The concentration of these students are at their peak when they can focus on their own thoughts without the distractions of others around them.} \vspace{1mm} \\\hline
    \label{learningstyles}
\end{longtable}

e é exibido como na imagem anexada. Como pode ser visto, em cada linha da tabela a linha h fica bem próxima do topo de cada parágrafo. Inseri \ após cada \hline que funciona, mas o espaçamento acima de cada parágrafo e abaixo não é do mesmo tamanho e uma linha vazia é adicionada acima de 3. Verbal na segunda página da tabela. Tentei adicionar um \vspace{1mm} atrás de cada \hline em vez de \ para que o espaçamento fosse do mesmo tamanho, mas o programa travou.

Há algo mais que eu possa fazer para melhorar a aparência?

Responder1

Não use \hlinee \cline; em vez disso, carregue o booktabspacote e utilize seus comandos \toprule, \midrule, \bottomrulee \addlinespacesde desenho de linha.

Eu também substituiria as linhas horizontais internas por espaços em branco, não centralizaria o conteúdo das colunas e não usaria excessivamente o negrito.

insira a descrição da imagem aqui

\documentclass{article} % select a suitable document class
\usepackage{natbib, longtable, booktabs}

\newlength\mylen
\settowidth\mylen{Learning Style}
% Calculate maximal permissible width of second column:
\setlength\mylen{\dimexpr\textwidth-\mylen-2\tabcolsep\relax}

\begin{document}
\frenchspacing
\begin{longtable}{@{}lp{\mylen}@{}}
    \caption{Descriptions of learning styles \citep{Hoerner2013}}
    \label{learningstyles} \\
    \toprule
    Learning Style & Description \\    
    \midrule
    \endhead 
    
    \bottomrule
    \endfoot
    
    1. Visual & People who understand work better when it is in the form of a diagram. Knowledge and concept maps are good tools for such learners.  \\ 
    \addlinespace
    2. Aural &  People who dislike reading, but enjoys hearing someone else say something aloud. Hearing the information is key for such students and group discussions can be of great aid.   \\ 
    \addlinespace
    3. Verbal & Verbal learners are people who express themselves easier through writing and speaking. Mnemonics, scripting and role playing are some great techniques to helps those learners.  \\ 
    \addlinespace
    4. Physical &   Hands-on activities rather than lectures or demonstrations appeal to these learners. They are a small percentage of the population, but they learn better through practical experience.  \\ 
    \addlinespace
    5. Logical &    People who are good with numbers and using logic to understand. They easily recognize patterns and often tend to group information to further their understanding.  \\ 
    \addlinespace
    6. Social & When communicating and socialising with others come easy, someone is a social learner. Studying in group formats and learning from others are their speciality and is how they excel.    \\ 
    \addlinespace
    7. Solitary &   People who are more comfortable studying in private and introspective.  The concentration of these students are at their peak when they can focus on their own thoughts without the distractions of others around them.  \\ 
    
\end{longtable}

\end{document}

Responder2

Com o uso da xltabularlargura das colunas pode ser determinado automaticamente:

\documentclass{article}

\usepackage{booktabs, makecell, xltabular}
\renewcommand\theadfont{\normalsize\bfseries}

\usepackage{lipsum}

\begin{document}
\lipsum[1-3]

\begin{xltabular}{\linewidth}{@{} lX @{}}
    \caption{Descriptions of learning styles}
    \label{learningstyles}                              \\
    \toprule
\thead{Learning\\ Style}  & \thead{Description}         \\
    \midrule
\endfirsthead
    \caption[]{Descriptions of learning styles (cont.)} \\
    \toprule
\thead{Learning\\ Style}  & \thead{Description}         \\
    \midrule
\endhead
    \midrule
    \multicolumn{2}{r}{%
        \footnotesize\textit{Continue on the next page}}\\    
\endfoot
    \bottomrule
\endlastfoot
1. Visual
    &   People who understand work better when it is in the form of a diagram. Knowledge and concept maps are good tools for such learners.\\
    \addlinespace
2. Aural
    &   People who dislike reading, but enjoys hearing someone else say something aloud. Hearing the information is key for such students and group discussions can be of great aid.\\
    \addlinespace
3. Verbal
    &   Verbal learners are people who express themselves easier through writing and speaking. Mnemonics, scripting and role playing are some great techniques to helps those learners.\\
    \addlinespace
4. Physical
    &   Hands-on activities rather than lectures or demonstrations appeal to these learners. They are a small percentage of the population, but they learn better through practical experience.\\
    \addlinespace
5. Logical
    &   People who are good with numbers and using logic to understand. They easily recognize patterns and often tend to group information to further their understanding.\\
    \addlinespace
6. Social
    &   When communicating and socialising with others come easy, someone is a social learner. Studying in group formats and learning from others are their speciality and is how they excel.\\
    \addlinespace
7. Solitary
    &   People who are more comfortable studying in private and introspective.  The concentration of these students are at their peak when they can focus on their own thoughts without the distractions of others around them.\\
\end{xltabular}

\end{document}

insira a descrição da imagem aqui

Responder3

Considere remover \parboxqual é o culpado pelo espaçamento estranho e substituí-lo pelas mcolunas do arraypacote.

Também usei o booktabspacote para linhas horizontais mais bonitas.

\documentclass{article}

\usepackage{longtable}
\usepackage{array}
\usepackage{booktabs}

\begin{document}

\begin{longtable}{m{5cm}m{9cm}}
    \caption{Descriptions of learning styles}\\
    \toprule
    \multicolumn{1}{c}{\textbf{Learning Style}} & \multicolumn{1}{c}{\textbf{Description}} \\
    \midrule
    \endhead 
    \multicolumn{1}{c}{1. Visual} 
        & People who understand work better when it is in the form of a diagram. Knowledge and concept maps are good tools for such learners.\\
    \midrule
    \multicolumn{1}{c}{2. Aural} 
        & People who dislike reading, but enjoys hearing someone else say something aloud. Hearing the information is key for such students and group discussions can be of great aid.\\
    \midrule
    \multicolumn{1}{c}{3. Verbal} 
        & Verbal learners are people who express themselves easier through writing and speaking. Mnemonics, scripting and role playing are some great techniques to helps those learners.\\
    \midrule
    \multicolumn{1}{c}{4. Physical} 
        & Hands-on activities rather than lectures or demonstrations appeal to these learners. They are a small percentage of the population, but they learn better through practical experience.\\
    \midrule
    \multicolumn{1}{c}{5. Logical} 
        & People who are good with numbers and using logic to understand. They easily recognize patterns and often tend to group information to further their understanding.\\
    \midrule
    \multicolumn{1}{c}{6. Social} 
        & When communicating and socialising with others come easy, someone is a social learner. Studying in group formats and learning from others are their speciality and is how they excel.\\
    \midrule
    \multicolumn{1}{c}{7. Solitary} 
        & People who are more comfortable studying in private and introspective.  The concentration of these students are at their peak when they can focus on their own thoughts without the distractions of others around them.\\
    \bottomrule
    \label{learningstyles}
\end{longtable}


\end{document}

insira a descrição da imagem aqui

Editar

Em geral, concordo com as sugestões do Mico, mas se você preferir o estilo de tabela fornecido (que repliquei), ainda recomendaria calcular a largura da coluna conforme sugerido pelo Mico usando a entrada mais longa.

\documentclass{article}

\usepackage{longtable}
\usepackage{array}
\usepackage{booktabs}

\newlength\colOne
\newlength\colTwo
\settowidth\colOne{Learning Style}
% Calculate maximal permissible width of second column:
\setlength\colTwo{\dimexpr\textwidth-\colOne-2\tabcolsep\relax}

\begin{document}

\begin{longtable}{m{\colOne}m{\colTwo}}
    \caption{Descriptions of learning styles}\\
    \toprule
    \multicolumn{1}{c}{\textbf{Learning Style}} & \multicolumn{1}{c}{\textbf{Description}} \\
    \midrule
    \endhead 
    \multicolumn{1}{c}{1. Visual} 
        & People who understand work better when it is in the form of a diagram. Knowledge and concept maps are good tools for such learners.\\
    \midrule
    \multicolumn{1}{c}{2. Aural} 
        & People who dislike reading, but enjoys hearing someone else say something aloud. Hearing the information is key for such students and group discussions can be of great aid.\\
    \midrule
    \multicolumn{1}{c}{3. Verbal} 
        & Verbal learners are people who express themselves easier through writing and speaking. Mnemonics, scripting and role playing are some great techniques to helps those learners.\\
    \midrule
    \multicolumn{1}{c}{4. Physical} 
        & Hands-on activities rather than lectures or demonstrations appeal to these learners. They are a small percentage of the population, but they learn better through practical experience.\\
    \midrule
    \multicolumn{1}{c}{5. Logical} 
        & People who are good with numbers and using logic to understand. They easily recognize patterns and often tend to group information to further their understanding.\\
    \midrule
    \multicolumn{1}{c}{6. Social} 
        & When communicating and socialising with others come easy, someone is a social learner. Studying in group formats and learning from others are their speciality and is how they excel.\\
    \midrule
    \multicolumn{1}{c}{7. Solitary} 
        & People who are more comfortable studying in private and introspective.  The concentration of these students are at their peak when they can focus on their own thoughts without the distractions of others around them.\\
    \bottomrule
    \label{learningstyles}
\end{longtable}


\end{document}

insira a descrição da imagem aqui

Editar 2

Como Mico sugeriu em seu comentário, temos que calcular a largura da versão em negrito do texto, pois ela difere da largura normal da fonte. Além disso, há mais dois \tabcolsepneste exemplo em comparação com o do Mico. O que está à esquerda da mesa e o que está à direita. Mico os suprimiu escrevendo @{}lp{\mylen}@{}, onde @{}é usado para redefinir \tabcolseplocalmente para qualquer dimensão que esteja entre as chaves, portanto, neste caso, nada.

Assim, o código para cálculo das larguras das colunas deve ser substituído pelo seguinte:

\newlength\colOne
\newlength\colTwo
\settowidth\colOne{\textbf{Learning Style}}
% Calculate maximal permissible width of second column:
\setlength\colTwo{\dimexpr\textwidth-\colOne-4\tabcolsep\relax}

informação relacionada