我正在写一份简短的表格简历,需要将其添加到我的论文中。我认为一个快捷的方法是使用表格来实现此目的:
\begin{tabular}{ll}
2009-present & very long text 1, very long text 2, very long text 3 , very long text 4, very long text 5, very long text 6, very long text 7, very long text 8, very long text 9, very long text 10\\
2009 & Masters\\
2006 & Bachelors\\
\end{tabular}
不幸的是,LaTeX 不会在空格处换行。到目前为止,我找到的唯一解决方案是
- “向表中添加其他行”
- “使用固定表格大小+
\newline
”。
手动调整文本效率不高。
是否还有一种方法可以自动化执行此操作(例如,将单元格/列定义为“文本单元格/列”)?
\begin{tabular}{lp{12cm}}
2009-present & very long text 1, very long text 2, very long text 3 , very long text 4, very long text 5, very long text 6, very long text 7, very long text 8, very long text 9, very long text 10\\
2009 & Masters\\
2006 & Bachelors\\
\end{tabular}
可能是一个解决方案,但是右列不会自动到达页面的右“边框”。
答案1
根据要求,答案是tabularx
。我还添加了一个解决方案。由于垂直对齐,listliketab
我仍然更喜欢列表。description
代码
\documentclass{article}
\usepackage{tabularx}
\usepackage{listliketab}
\usepackage{lipsum} % only for this example
\begin{document}
\lipsum[2]
\medskip
\noindent
\begin{tabularx}{\linewidth}{@{}>{\bfseries}l@{\hspace{.5em}}X@{}}
2009--present & very long text 1, very long text 2, very long text 3, very long text 4, very long text 5, very long text 6, very long text 7, very long text 8, very long text 9, very long text 10 \\
2009 & Masters \\
2006 & Bachelors
\end{tabularx}
\medskip
\lipsum[2]
\begin{description}
\item[2009--present] very long text 1, very long text 2, very long text 3, very long text 4, very long text 5, very long text 6, very long text 7, very long text 8, very long text 9, very long text 10
\item[2009] Masters
\item[2006] Bachelors
\end{description}
\lipsum[2]
\storestyleof{description}
\begin{listliketab}
\begin{tabularx}{\linewidth}{@{}>{\bfseries}l @{\hspace{.5em}} XR}
2009--present & very long text 1, very long text 2, very long text 3, very long text 4, very long text 5, very long text 6, very long text 7, very long text 8, very long text 9, very long text 10 \\
2009 & Masters \\
2006 & Bachelors
\end{tabularx}
\end{listliketab}
\lipsum[2]
\end{document}
输出
答案2
无论如何,你应该指定所需的列宽。没有人能猜出哪一个是可以接受的:)
您可以使用p{}
而不是列对齐来指定列的宽度。它只有一个参数,即列的宽度。
\documentclass{article}
\begin{document}
\begin{tabular}{lp{5cm}}
2009--present & very long text 1, very long text 2, very long text 3, very long text 4, very long text 5, very long text 6, very long text 7, very long text 8, very long text 9, very long text 10\\
2009 & Masters\\
2006 & Bachelors\\
\end{tabular}
\end{document}
或者您可以\parbox{}{}
在包含长文本的单元格中使用。
\documentclass{article}
\begin{document}
\begin{tabular}{ll}
2009--present & \parbox{5cm}{very long text 1, very long text 2, very long text 3, very long text 4, very long text 5, very long text 6, very long text 7, very long text 8, very long text 9, very long text 10}\\
2009 & Masters\\
2006 & Bachelors\\
\end{tabular}
\end{document}
答案3
您可以使用表格,但通常最好使用列表,例如
\begin{description}
\item[2009--present] very long text 1, very long text 2, very long text 3 , very long text 4, very long text 5, very long text 6, very long text 7, very long text 8, very long text 9, very long text 10
\item[2009]Masters
\item[2006] Bachelors
\end{description}