最佳实践长表

最佳实践长表

我有一张长表,其中有 50 个项目的解释(MWE 仅显示 9 个)。我认为这很难阅读。我该如何让它变得易于阅读?

\documentclass[10pt,cleardoublepage=empty,twoside]{book}
\usepackage[a5paper]{geometry}
\usepackage{longtable}
\usepackage[T1]{fontenc} 
\usepackage{booktabs}

\begin{document}
\begin{longtable}{p{4.8cm} p{4.8cm}}
\caption{Lorem ipsum dolor sit amet, orci vivamus ac neque augue cras, pellentesque libero integer.}\\
\textsc{Lorem ipsum dolor sit amet}&\textsc{Lorem ipsum}\\
\midrule
\endfirsthead
\caption[]{(continued)}\\
\endhead
\endlastfoot

aenean ipsum enim egestas dui amet, ut condimentum ipsum vel arcu ullamcorper, nec et quis dolor mi, nunc id laoreet velit elit sit orci. Pede vestibulum ac amet
&\textit{enean}\slash \textit{egestas}\\

pede vestibulum ac amet
&\textit{egestas}\slash \textit{condimentum}\\

aenean ipsum enim egestas dui amet, ut condimentum ipsum vel arcu ullamcorper, ante voluptatem, suspendisse sed euismod leo
&\textit{hasellus}\slash \textit{egestas}\\

pede vestibulum ac amet.
&\textit{egestas}\slash \textit{condimentum}\\

aenean ipsum enim egestas dui amet, ut condimentum ipsum vel arcu ullamcorper
&\textit{laoreet}\slash \textit{velit}\\

aenean ipsum enim egestas dui amet, ut condimentum ipsum vel arcu ullamcorper, ante voluptatem, suspendisse
&\textit{enean}\slash \textit{egestas}\\

mauris lectus vel nulla neque lectus vel nulla eget cras luctus enim pharetra, curabitur sed curabitur sed vitae, lectus vel nulla neque
&\textit{egestas}\slash \textit{condimentum}\\

mauris eget cras luctus enim pharetra, curabitur sed vitae, lectus vel nulla neque
&\textit{cras}\slash \textit{enim}\\

sapien in sed. Sit lectus sed nullam, condimentum elit quae, morbi lacus nullam dictum libero convallis 
&\textit{convallis}\slash \textit{Sit}\\
\end{longtable}
\end{document}

输出(摘录):

桌子

我还有另一张桌子。你觉得它看起来比这张更好吗?

\documentclass[10pt,cleardoublepage=empty,twoside]{book}
\usepackage[a5paper]{geometry}
\usepackage[english]{babel}
\usepackage{longtable}
\usepackage{multirow}
\usepackage[T1]{fontenc} 
\usepackage{booktabs}

\begin{document}

\begin{longtable}{l l}
\caption{Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh}\\
\textsc{Lorem Ipsum}&\textsc{Ament}\\
\midrule
\endfirsthead
\caption[]{(continued)}\\
\textsc{Semantic Category}&\textsc{Variable}\\
\midrule
\endhead
\endlastfoot
\multirow{3}{*}{consectetur eiusmod tempor}&\textit{dolor}/\textit{sit}\\ &\textit{ament}/\textit{sit}\\ &\textit{laboris}/\textit{explicabo}\\
\\
\multirow{3}{*}{consectetur adipisicing elit, sed do eiusmod}&\textit{exercitationem}/\textit{voluptatem}\\ &\textit{incidunt}/\textit{laboris}\\
&\textit{aliquid}/\textit{explicabo}\\
\\
\multirow{2}{*}{consectetur adipisicing elit, sed do}& \textit{holiday}/\textit{exercitationem}\\
&\textit{sundown}/\textit{laboris}\\
\\
\multirow{2}{*}{consectetur adipisicing, sed do eiusmod}&\textit{laboris}/\textit{incidunt}\\
&\textit{exercitationem}/\textit{voluptatem}\\
\\
consectetur adipisicing elit, sed&\textit{aliquid}/\textit{incidunt}\\
\\
consectetur elit, sed do eiusmod&\textit{explicabo}/\textit{laboris}\\
\end{longtable}

\end{document}

答案1

第一个建议:增加行间距,使段落不会太拥挤。只需在序言中插入以下内容即可实现:

\usepackage{array}
\renewcommand{\arraystretch}{1.5}

结果如下:

使用 arraystretch

第二个建议是否可以交换列?在这种情况下,我会\hfill在较短的列中插入一个,以便使其与较长的列右对齐。即:

\begin{longtable}{>{\hfill}p{4.8cm}p{4.8cm}}  % <----- here 
\caption{Lorem ipsum dolor sit amet, orci vivamus ac neque augue cras, pellentesque libero integer.}\\
\textsc{Lorem ipsum} & \textsc{Lorem ipsum dolor sit amet}\\
\midrule
\endfirsthead
\caption[]{(continued)}\\
\endhead
\endlastfoot

\textit{enean}\slash \textit{egestas}
& aenean ipsum enim egestas dui amet, ut condimentum ipsum vel arcu ullamcorper, nec et quis dolor mi, nunc id laoreet velit elit sit orci. Pede vestibulum ac amet
\\
\textit{egestas}\slash \textit{condimentum}
& pede vestibulum ac amet
\\
[etc.]
\end{longtable}

导致:

交换列

最后,这个表格看起来像是一个描述列表。如果是这样,也许description环境是最好的选择。

答案2

基于避免使用所有软件包的一般原则,对我来说,这看起来更像是一个列表而不是一个表格,如下所示:

在此处输入图片描述

\documentclass[10pt,cleardoublepage=empty,twoside]{book}
\usepackage[a5paper]{geometry}

\usepackage[italian]{babel}

\usepackage[T1]{fontenc} 
\renewcommand*\descriptionlabel[1]{\hbox to \textwidth{\hspace\labelsep
 \normalfont\bfseries\itshape #1}}

\begin{document}

\section*{Lorem ipsum dolor sit amet, orci vivamus ac neque augue cras, pellentesque libero integer}
\subsection*{Lorem ipsum dolor sit amet}

\begin{description}
\item[enean\slash egestas]
aenean ipsum enim egestas dui amet, ut condimentum ipsum vel arcu ullamcorper, nec et quis dolor mi, nunc id laoreet velit elit sit orci. Pede vestibulum ac amet


\item[egestas\slash condimentum]
pede vestibulum ac amet

\item[hasellus\slash egestas]
aenean ipsum enim egestas dui amet, ut condimentum ipsum vel arcu ullamcorper, ante voluptatem, suspendisse sed euismod leo

\item[egestas\slash condimentum]
pede vestibulum ac amet.

\item[laoreet\slash velit]
aenean ipsum enim egestas dui amet, ut condimentum ipsum vel arcu ullamcorper

\item[enean\slash egestas]
aenean ipsum enim egestas dui amet, ut condimentum ipsum vel arcu ullamcorper, ante voluptatem, suspendisse

\item[egestas\slash condimentum]
mauris lectus vel nulla neque lectus vel nulla eget cras luctus enim pharetra, curabitur sed curabitur sed vitae, lectus vel nulla neque

\item[cras\slash enim]
mauris eget cras luctus enim pharetra, curabitur sed vitae, lectus vel nulla neque

\item[convallis\slash Sit]
sapien in sed. Sit lectus sed nullam, condimentum elit quae, morbi lacus nullam dictum libero convallis 
\end{description}
\end{document}

相关内容