LaTeX 非常紧凑的逐项列出
我正在尝试使用 LaTeX 构建一个非常紧凑的 itemize,因为我想将其放入表格中,而各处都没有空格。
我需要什么:
- 列表之前没有空格
- 列表之后没有空格
- 行之间没有空格
- 项目符号之前减少缩进
我尝试过很多包(paralist
、mdwlist
、enumitem< /code>) 但他们中没有人能完全做到这一点。
我自己尝试过(在 paralist
的帮助下),并且可以删除除列表后的空白之外的所有内容。这是我当前的解决方案:
\makeatletter
\newcommand*{\compress}{\@minipagetrue}
\makeatother
\newenvironment{ilist}%
{
%from parlist package, reduces indent before bulletpoints
\setdefaultleftmargin{1em}{1em}{}{}{}{}
\compress %places itemize into minipage, removing whitespace before
\begin{itemize}%
\setlength{\itemsep}{0pt}%
\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt}
\setlength{\parsep}{0pt}
\setlength{\parskip}{0pt}}%
{\end{itemize}}
但是,我无法删除列表后面的空格。我可以使用负 vspace
来完成此操作,但这是:
- 丑陋
- 不适用于表:列表所在行之后的规则仍将是下面一行。
谁能告诉我该怎么做?我已经用谷歌搜索了很多,但不知何故,我似乎是第一个尝试将逐项插入表中的人:D
I am trying to build a very compact itemize with LaTeX, because I want to fit it in a table without whitespace everywhere.
What I need:
- No whitespace before list
- No whitespace after list
- No whitespace between lines
- Less indent before the bulletpoints
I have tried many packages (paralist
, mdwlist
, enumitem
) but non of them can fully do it.
I tried it myself (with the help of paralist
) and could get rid of everything except the whitespace after the list. This is my current solution:
\makeatletter
\newcommand*{\compress}{\@minipagetrue}
\makeatother
\newenvironment{ilist}%
{
%from parlist package, reduces indent before bulletpoints
\setdefaultleftmargin{1em}{1em}{}{}{}{}
\compress %places itemize into minipage, removing whitespace before
\begin{itemize}%
\setlength{\itemsep}{0pt}%
\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt}
\setlength{\parsep}{0pt}
\setlength{\parskip}{0pt}}%
{\end{itemize}}
However, I am unable to get rid of the space after the list. I can do it with a negative vspace
but this is:
- Ugly
- Does not work for tables: The rule after the row in which the list is will still be one line below.
Can anyone tell me how to do it? I have googled so much, but it somehow seems that I am the first human that ever tried to insert an itemize into a table :D
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
要全局更改这些设置
(您可以对其他类型的列表使用
\setenumerate
、\setdescription
或\setlist
命令)或者仅用于单个列表
To change these settings globally
(And you can use the
\setenumerate
,\setdescription
or\setlist
commands for other types of lists)Or for just a single list
正如评论中所述,接受的答案不是最新的。这就是我用来获取紧凑列表的方法:
然后像往常一样使用
\begin{itemize}
来启动列表。The accepted answer is not up to date as mentioned in the comments. This is what I used to get a compact list:
Then use
\begin{itemize}
as usual to start a list.尝试
enumitem
和shortlst
软件包。Try the
enumitem
andshortlst
packages.这个解决方案是在 @damien-pollet 的评论中提供的,但每次我回到这里再次找到它时,我总是很难找到它,因为它是一条评论,所以我将其作为答案,以利于我的利益未来的自己将再次寻找这个答案。
paralist 包的
compactitem
环境创造了奇迹:This solution was provided in a comment by @damien-pollet but every time I come back here to find it again, I always have a hard time finding it because it is a comment, so I am putting it as answer for the benefit of my future-self who will be looking for this answer again.
The
compactitem
environment of the paralist package works wonders:您可以使用
savetrees
包获得所需的布局(注意:这也会压缩文档的其余部分)You get the desired layout with the
savetrees
package (caveat: this will also compactify the rest of your document)在序言中:
在文件中:
In the preamble:
In the document: