Latex 删除列表中项目之间的空格

发布于 2024-09-10 12:25:25 字数 32 浏览 3 评论 0原文

格式化列表以删除列表项之间的空格的最佳方法是什么。

What is the best way to format a list as to remove the spaces between list items.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

旧夏天 2024-09-17 12:25:26

你可以这样做:

\documentclass{article}

\begin{document}

Normal:

\begin{itemize}
  \item foo
  \item bar
  \item baz
\end{itemize}

Less space:

\begin{itemize}
  \setlength{\itemsep}{1pt}
  \setlength{\parskip}{0pt}
  \setlength{\parsep}{0pt}
  \item foo
  \item bar
  \item baz
\end{itemize}

\end{document}

You could do something like this:

\documentclass{article}

\begin{document}

Normal:

\begin{itemize}
  \item foo
  \item bar
  \item baz
\end{itemize}

Less space:

\begin{itemize}
  \setlength{\itemsep}{1pt}
  \setlength{\parskip}{0pt}
  \setlength{\parsep}{0pt}
  \item foo
  \item bar
  \item baz
\end{itemize}

\end{document}
时光匆匆的小流年 2024-09-17 12:25:26

这个问题已经在 https://tex.stackexchange.com/questions/10684/vertical- 上提出过列表中的空格。得票最高的答案还提到了 enumitem 包(这里由 Stefan 回答),但我也喜欢这个,它涉及创建您自己的逐项环境而不是加载新包:

\newenvironment{myitemize}
{ \begin{itemize}
    \setlength{\itemsep}{0pt}
    \setlength{\parskip}{0pt}
    \setlength{\parsep}{0pt}     }
{ \end{itemize}                  } 

应该像这样使用:

\begin{myitemize} 
  \item one 
  \item two 
  \item three 
\end{myitemize}

来源:https://tex.stackexchange.com/a/136050/12065

This question was already asked on https://tex.stackexchange.com/questions/10684/vertical-space-in-lists. The highest voted answer also mentioned the enumitem package (here answered by Stefan), but I also like this one, which involves creating your own itemizing environment instead of loading a new package:

\newenvironment{myitemize}
{ \begin{itemize}
    \setlength{\itemsep}{0pt}
    \setlength{\parskip}{0pt}
    \setlength{\parsep}{0pt}     }
{ \end{itemize}                  } 

Which should be used like this:

\begin{myitemize} 
  \item one 
  \item two 
  \item three 
\end{myitemize}

Source: https://tex.stackexchange.com/a/136050/12065

等往事风中吹 2024-09-17 12:25:26

compactitem 可以完成这项工作。

\usepackage{paralist}

...

\begin{compactitem}[$\bullet$]
    \item Element 1
    \item Element 2
\end{compactitem}
\vspace{\baselineskip} % new line after list

compactitem does the job.

\usepackage{paralist}

...

\begin{compactitem}[$\bullet$]
    \item Element 1
    \item Element 2
\end{compactitem}
\vspace{\baselineskip} % new line after list
若言繁花未落 2024-09-17 12:25:26

您可以将其与负数一起使用来手动更改间距

\begin{itemize}
\itemsep-1.5em
  \item foo
  \item bar
  \item baz
\end{itemize}

You can use this with negative numbers to change the separation manually

\begin{itemize}
\itemsep-1.5em
  \item foo
  \item bar
  \item baz
\end{itemize}
决绝 2024-09-17 12:25:25

使用 enumitem 包更容易:

\documentclass{article}
\usepackage{enumitem}
\begin{document}
Less space:
\begin{itemize}[noitemsep]
  \item foo
  \item bar
  \item baz
\end{itemize}

Even more compact:
\begin{itemize}[noitemsep,nolistsep]
  \item foo
  \item bar
  \item baz
\end{itemize}
\end{document}

example

enumitem 包提供了许多自定义项目符号、编号和长度的功能。

paralist 包提供了非常紧凑的列表:compactitem、compactenum 甚至段落内的列表,如 inparaenum 和 inparaitem。

It's easier with the enumitem package:

\documentclass{article}
\usepackage{enumitem}
\begin{document}
Less space:
\begin{itemize}[noitemsep]
  \item foo
  \item bar
  \item baz
\end{itemize}

Even more compact:
\begin{itemize}[noitemsep,nolistsep]
  \item foo
  \item bar
  \item baz
\end{itemize}
\end{document}

example

The enumitem package provides a lot of features to customize bullets, numbering and lengths.

The paralist package provides very compact lists: compactitem, compactenum and even lists within paragraphs like inparaenum and inparaitem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文