我正在使用该paralist
包创建非常紧凑的列表(用于海报)。我想使用
\setdefaultleftmargin{0em}{2em}{}{}{}{}
将逐项列表的缩进设置为零。除非我有较长的换行行,否则这种方法很有效:换行文本的缩进太小。
示例代码 (实例):
\documentclass[a4paper]{article}
\usepackage{paralist}
\begin{document}
\setlength{\parindent}{0em}
\setdefaultleftmargin{0em}{2em}{}{}{}{}
(I have also set the indentation of paragraphs to 0.)
\begin{compactitem}
\item I want the bullet to be right at the left border.
\item foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar \textbf{This second line is not properly aligned :(}
\begin{compactitem}
\item foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar \textbf{Here it's correct.}
\end{compactitem}
\end{compactitem}
With non-zero indentation it works as it should:
\setdefaultleftmargin{2em}{2em}{}{}{}{}
\begin{compactitem}
\item foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar \textbf{correct}
\begin{compactitem}
\item foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar \textbf{correct}
\end{compactitem}
\end{compactitem}
\end{document}
我该如何解决?
答案1
您可能想要使用enumitem
,它比更强大paralist
。
\documentclass[a4paper]{article}
\usepackage{enumitem}
\begin{document}
\setlength{\parindent}{0em}
(I have also set the indentation of paragraphs to 0.)
\begin{itemize}[nosep,leftmargin=1em,labelwidth=*,align=left]
\item I want the bullet to be right at the left border.
\item foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar
foobar foobar \textbf{This second line is properly aligned}
\end{itemize}
Some text follows.
\end{document}
答案2
基于egreg 的回答,我现在使用这个代码来替代包compactlist
中的定义paralist
:
\usepackage{enumitem}
\newlist{compactitem}{itemize}{3} % 3 is max-depth
\setlist[compactitem]{label=\textbullet, nosep}
为了nosep
工作,我必须下载最新版本包的enumitem
。
(升级之前enumitem
我曾尝试过不使用nosep
:
\setlist[compactitem]{label=\textbullet, leftmargin=1em, labelindent=0.1em, itemsep=0em, parsep=0em}
但这在列表和前面的段落之间留下了一些分离。)