如何在简单表格的特定列中允许更多行并尊重页边距

如何在简单表格的特定列中允许更多行并尊重页边距

需要一个简单的表格。问题是第二列中有很多文本,它应该尊重文本边距。

例子:

\documentclass[11pt]{article}
\usepackage{booktabs}

\begin{document}



\begin{tabular}{@{}llr@{}} \toprule 
Animal & Description \\ \midrule

During & the period while Major Henry Lee and his famous Light Dragoons were serving in New Jersey, intelligence came of the marauding operations of a band of Tory robbers \\
Located & in the extensive pine woods toward Barnegat, in Monmouth county, whose head-quarters were at a secret cave in that region. Lee dispatched a select party of fearless men \\ 
who & approached the dangerous region in a farmer’s wagon, concealed under a covering of straw \\
Fagans & the robber leader, with some followers, stopped the wagon to plunder it, when the concealed dragoons immediately put a ball through Fagans’s head \\\bottomrule
\end{tabular}\\


Source: Modified Text fragments Forman (2014) Down the Ohio and Mississippi \texttt{http://www.gutenberg.org/files/44823/44823-h/44823-h.htm}

\end{document}

答案1

tabularx可用于使用X允许换行并跨越可用空间的列:

\documentclass[11pt]{article}
\usepackage{booktabs}
\usepackage{tabularx}

\begin{document}

\noindent
\begin{tabularx}{\linewidth}{@{}lX@{}}
\toprule 
Animal & Description \\
\midrule

During & the period while Major Henry Lee and his famous Light Dragoons were
serving in New Jersey, intelligence came of the marauding operations of a   
band of Tory robbers \\
Located & in the extensive pine woods toward Barnegat, in Monmouth county,
whose head-quarters were at a secret cave in that region. Lee dispatched a
select party of fearless men \\ 
who & approached the dangerous region in a farmer’s wagon, concealed under a
covering of straw \\
Fagans & the robber leader, with some followers, stopped the wagon to
plunder it, when the concealed dragoons immediately put a ball through
Fagans’s head \\\bottomrule
\end{tabularx}\\
Source: Modified Text fragments Forman (2014) Down the Ohio and Mississippi
\texttt{http://www.gutenberg.org/files/44823/44823-h/44823-h.htm}
\end{document}

结果

有很多方法可以将来源放在表格标题中,例如:

\documentclass[11pt]{article}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{url}

\urldef\urlOhio\url{http://www.gutenberg.org/files/44823/44823-h/44823-h.htm}

\begin{document}

\begin{table}
\captionsetup{format=hang, justification=RaggedRight}
\centering
\begin{tabularx}{\linewidth}{@{}lX@{}}
\toprule
Animal & Description \\
\midrule
During & the period while Major Henry Lee and his famous Light Dragoons were
serving in New Jersey, intelligence came of the marauding operations of a
band of Tory robbers \\
Located & in the extensive pine woods toward Barnegat, in Monmouth county,
whose head-quarters were at a secret cave in that region. Lee dispatched a
select party of fearless men \\
who & approached the dangerous region in a farmer’s wagon, concealed under a
covering of straw \\
Fagans & the robber leader, with some followers, stopped the wagon to
plunder it, when the concealed dragoons immediately put a ball through
Fagans’s head \\\bottomrule
\end{tabularx}
\caption{Source: Modified Text fragments Forman (2014)
  Down the Ohio and Mississippi \urlOhio}
\end{table}
\end{document}

结果标题

相关内容