\itemsep
我在d 环境中增加了列表项之间的间隔itemize
。如何以最小的努力保持内部列表的项目间隔不受影响?一个临时解决方案可能是手动减少\itemsep
内部列表的值。有没有一种优雅的方法来实现同样的效果?
\documentclass{llncs}
\begin{document}
\begin{itemize} \itemsep2em
\item \textbf{L11}: This is level 1 item
\begin{itemize}
\item \textbf{L21}: This is level 2 item
\item \textbf{L22}: This is level 2 item
\item \textbf{L23}: This is level 2 item
\item \textbf{L24}: This is level 2 item
\end{itemize}
\item \textbf{L12}: This is level 1 item
\item \textbf{L13}: This is level 1 item
\item \textbf{L14}: This is level 1 item
\end{itemize}
\end{document}
答案1
您不会在 article 等标准类中看到这种效果,因为它定义了内部列表的命令,以便它们重置 \itemsep。但您可以在使用 llncs 时添加类似的功能:
\documentclass{llncs}
\usepackage{etoolbox}
\makeatletter
\appto\@listii{\itemsep=0pt}
\makeatother
\begin{document}
\begin{itemize} \itemsep2em
\item \textbf{L11}: This is level 1 item
\begin{itemize}
\item \textbf{L21}: This is level 2 item
\item \textbf{L22}: This is level 2 item
\item \textbf{L23}: This is level 2 item
\item \textbf{L24}: This is level 2 item
\end{itemize}
\item \textbf{L12}: This is level 1 item
\item \textbf{L13}: This is level 1 item
\item \textbf{L14}: This is level 1 item
\end{itemize}
\end{document}
您还可以使用 enumitem 来设置类似的效果:
\usepackage{enumitem}
\setlist[1]{itemsep=2cm}
\setlist[2]{itemsep=0pt}
答案2
您可以将其保存\itemsep
为\myitemsep
,然后将其用于内部列表。
\documentclass{llncs}
\usepackage{enumitem}
\newlength{\myitemsep}
\setlength{\myitemsep}{\itemsep}
\begin{document}
\begin{itemize}[itemsep=2em]
\item \textbf{L11}: This is level 1 item
\begin{itemize}[itemsep=\myitemsep]
\item \textbf{L21}: This is level 2 item
\item \textbf{L22}: This is level 2 item
\item \textbf{L23}: This is level 2 item
\item \textbf{L24}: This is level 2 item
\end{itemize}
\item \textbf{L12}: This is level 1 item
\item \textbf{L13}: This is level 1 item
\item \textbf{L14}: This is level 1 item
\end{itemize}
\end{document}