在 Latex 中将列表分成多列
希望这很简单:我有一个相对较长的列表,其中每个列表项包含很少的文本。例如:
* a * b * c * d * e * f
我希望将其格式化为这样:
* a * d * b * e * c * f
我不想创建一个包含 2 个列表的表,因为我希望能够轻松更改列表,而不必担心更新所有列。
在乳胶中做到这一点的最佳方法是什么?
Hopefully this is simple: I have a relatively long list where each list item contains very little text. For example:
* a * b * c * d * e * f
I wish to format it like so:
* a * d * b * e * c * f
I would rather not create a table with 2 lists as I want to be able to easily change the list without worrying about updating all the columns.
What is the best way to do this in latex?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
使用 multicol 包并将列表嵌入到
multicols
环境中会执行以下操作你想要:Using the multicol package and embedding your list in a
multicols
environment does what you want:我不知道它是否有效,但也许您可以使用 multicol 包将页面分成几列。
I don't know if it would work, but maybe you could break the page into columns using the multicol package.
避免嵌套两个不同环境的另一种选择(例如
multicols
和enumerate
)。同名包中名为
tasks
的环境似乎由于有多种选项,我很容易自定义(此处为 pdf 指南)。此代码:
产生此输出
包
tasks
于 2020 年 8 月更新,它最初是专门为水平列列表创建的(请参见上面的屏幕截图) ),指南中恢复了其背后的动机。如果项目/任务的这种安排是可以接受的,那么这可能是一个不错的选择,因为它保持 - 恕我直言 - 代码整洁和灵活。Another option to avoid nesting two different environments (like
multicols
andenumerate
).The environment called
tasks
from the package with the same name seems to me very easy to customize thanks to a variety of options (pdf guide here).This code:
produces this output
The package
tasks
was updated in August 2020 and it was originally created specifically for horizontally columned lists (see the screenshot just above here), the motivations behind this are resumed in the guide. If such arrangement of the items/tasks is acceptable, then this may be a good choice since it keeps - IMHO - the code tidy and flexible.通过组合 multicol 包和 enumitem 软件包 很容易定义与 enumerate 和 itemize 环境类似的多列环境:
输出就是您所希望的:
By combining the multicol package and enumitem package packages it is easy to define environments that are multi-column analogues of the enumerate and itemize environments:
The output is what you would hope for:
我有 multenum< /a> 向我推荐了“多列枚举列表”,但我自己从未真正使用过它。
编辑:语法看起来并不完全像您可以轻松地将列表复制+粘贴到 LaTeX 代码中。因此,它可能不是适合您的用例的最佳解决方案!
I've had multenum for "Multi-column enumerated lists" recommended to me, but I've never actually used it myself, yet.
Edit: The syntax doesn't exactly look like you could easily copy+paste lists into the LaTeX code. So, it may not be the best solution for your use case!