我正在尝试创建一个包含许多表格的文档,其布局如以下 Word 模型所示:
尽管我认为我可以使用tabular
环境来创建它,但这会相当混乱。
理想情况下,我想使用类似
\begin{funkytable}
\entry{Normal entry}
With some text aside.
\entry{A very long entry here, requiring a break}
Some more text, aligned with the botton of the text on the right, expanding downward.
A new paragraph here. There are none such for the right column.
\entry{Another normal entry}
\entry{And another one.}
Nothing in the line above.
\end{funkytable}
您能否指出一个更容易实现这一点的软件包,或者帮助我了解如何创建自己的命令/环境来生成它?
答案1
您可以使用enumitem
包裹。当然,在极少数情况下,标签比描述长,您需要手动添加空格来分隔项目以解决问题(在合理范围内)。通过\\\mbox{}
在有问题的较长标签的描述末尾添加(而不是标签的末尾)来完成此操作。
\documentclass{article}
\usepackage{enumitem}
\SetLabelAlign{parright}{\strut\smash{\parbox[t]{\labelwidth}{\raggedleft#1}}}
\setlist[itemize]{style=multiline,leftmargin=5cm, align=parright}
\begin{document}
\begin{itemize}[font=\bfseries]
\item[Normal entry] With some text aside.
\item[A very long entry here, requiring a break] Some more text, aligned with the botton of the text on the right, expanding downward.\\\\A new paragraph here. There are none such for the right column.
\item[Another normal entry]
\item[And another one.] Nothing in the line above.
\end{itemize}
\end{document}
答案2
这是一个tabular
类似环境的funkytable
使用tabularx
:
\documentclass{article}
\usepackage{array,tabularx}
\newcommand{\insertnewline}{}
\newcommand{\entry}[1]{\insertnewline #1 &}
\newenvironment{funkytable}
{\gdef\insertnewline{\gdef\insertnewline{\\}}%
\noindent
\tabularx{\linewidth}{>{\raggedleft\bfseries\arraybackslash}b{.3\linewidth}X}
}
{\endtabularx}
\begin{document}
\begin{funkytable}
\entry{Normal entry}
With some text aside.
\entry{A very long entry here, requiring a break}
Some more text, aligned with the botton of the text on the right, expanding downward.
A new paragraph here. There are none such for the right column.
\entry{Another normal entry}
\entry{And another one.}
Nothing in the line above.
\end{funkytable}
\end{document}
当然,这个结构不会跨越页面边界。