LaTeX:内容自动两列换行
假设我有一个单词列表,需要保留其顺序,并且需要排序为两列。
我可以用表格很好地做到这一点:
\begin{tabular}{l l}
abc & def \\
ghi & jkl \\
\end{tabular}
但这样做会使重新排序列表变得相当困难且耗时。
是否可以有一个自动换行的两列列表? 理想情况下,我想简单地输入一个有序列表:
\begin{magic}
abc \\
def \\
ghi \\
jkl \\
\end{magic}
并将其包装为两列(如表格所启用):
abc def ghi jkl
Say I have a list of words that need to retain their order, and need to be sorted into two columns.
I can do this rather well with a tabular:
\begin{tabular}{l l}
abc & def \\
ghi & jkl \\
\end{tabular}
But doing so makes it rather difficult and time consuming to reorder the list.
Is it possible to have an automatically wrapped two-column list?
Ideally, I would like to simply enter an ordered list:
\begin{magic}
abc \\
def \\
ghi \\
jkl \\
\end{magic}
And have it wrapped to two columns (as the tabular enables):
abc def ghi jkl
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
第二次尝试,测试:
这个版本确实很难看。 tabbing 环境中
\\
之后的负 vskip 是一件好事。这可以适应在您的“神奇”环境中使用\\
。Second attempt, tested:
This version is indeed ugly. A negative vskip after the
\\
in the tabbing env would be a good thing. This can be adapted to use the\\
s in your 'magic' environment.尝试 multicol 环境。不确定这是否是您想要的,但
会将列表包装成两列。我认为你需要
\usepackage{multicol}
,但它可能是multicols
。我还应该注意,您可以使用\begin{multicols*}{2}
创建类似的环境,但具有不同的属性:\begin{multicols}
创建列并平等地平衡它们,但是\begin{multicols*}
创建列并在进入第二个列之前填充第一个列(因此不会总是“平衡”,这对于论文来说更理想)。Try the multicol environment. Not sure if this is what you want, but
will wrap the list into two cols. You need to
\usepackage{multicol}
i think, but it might bemulticols
. I should also note that you can use\begin{multicols*}{2}
to create similar environment, but with a different property:\begin{multicols}
creates columns and balances them equally, but\begin{multicols*}
creates columns and fills the first before going to the second (so won't always be 'balanced', which is more ideal for papers).您可能最好在其他程序中创建表并使用脚本或导出函数将其转换为 LaTeX 表。
longtable
包将允许该表格跨多个页面换行。You might be better off with creating the table in some other program and using a script or export function to convert it to a LaTeX table. The
longtable
package will allow that table to wrap across multiple pages.