减少描述列表中标签和项目之间的空间

减少描述列表中标签和项目之间的空间

我有我正在使用的描述列表,例如

\begin{description}
    \item[Video recordings] arguably produced the richest part of the data set.
    \item[Questionnaires] were no second, mind you!
\end{description}

不幸的是,这会导致标签和项目之间的空格大于同一行上单词之间的常规空格:

LaTeX 中描述列表的示例。

我可以做些什么来使“视频录像”和“可以说”之间的空间等于“可以说”和“制作”之间的空间?

答案1

在此处输入图片描述

\documentclass[12pt]{article}
\usepackage{enumitem}
\begin{document}

\begin{description}[labelsep=\fontdimen2\font]
    \item[Video recordings] arguably produced the richest part of the data set.
    \item[Questionnaires] were no second, mind you!
\end{description}

\end{document}

要控制标签和项目之间的间距,您可以更改列表labelsep的参数description(可从enumitem包中获得)。要获得常规单词间距,您需要\fontdimen2(正常的单词间距)labelsep。这是通过传递以下内容来完成的:

[labelsep=\fontdimen2\font]

作为description环境的一种选择。

答案2

正在加载enumitem,你可以玩labelsep

\documentclass{article}
\usepackage{enumitem}

\begin{document}

\begin{description}[labelsep=0pt]
    \item[Video recordings] arguably produced the richest part of the data set.
    \item[Questionnaires] were no second, mind you!
\end{description}


\begin{description}[labelsep=2cm]
    \item[Video recordings] arguably produced the richest part of the data set.
    \item[Questionnaires] were no second, mind you!
\end{description}

\end{document} 

在此处输入图片描述

答案3

这是可能的,通过稍微扩展列表模型;在这种情况下,description这不是一个大问题假如不要在里面嵌套枚举列表description

\documentclass{article}
\usepackage{lipsum} % for context

\makeatletter
\renewenvironment{description}
  {\list{}{%
    \labelwidth\z@
    \itemindent-\leftmargin
    \labelsep=\z@
    \let\makelabel\descriptionlabel
    \let\item\desc@item
  }}
  {\endlist}
\def\desc@item[#1]{\@item[#1]\ \ignorespaces}
\makeatother

\begin{document}
\lipsum*[2]
\begin{description}

\item[Video recordings] arguably produced the richest part of the data set.

\item[Questionnaires] were no second, mind you! Some text that should
  make the~text~wrap over a couple of lines

\end{description}
\end{document}

在此处输入图片描述

放大视图(单击可获得更高的分辨率)

在此处输入图片描述

答案4

温和的替代品egreg 的回答如果你想将常规description与修改后的混合bfdesc

在此处输入图片描述

\documentclass{article}
\usepackage[paper=a6paper,showframe]{geometry}% Just for this example

\newenvironment{bfdesc}
  {\begin{description}
   \let\olditem\item
   \renewcommand{\item}[1][]{%
     \olditem% Set old \item without [..]
     \hspace*{-\labelsep}% Remove \labelsep
     {\bfseries ##1}% Set new \item
     \space% Insert space (\ )
     \ignorespaces}}% Ignore any following spaces
  {\end{description}}

\begin{document}

\begin{description}
  \item[Video recordings] arguably produced the richest part of the data set.
  \item[Questionnaires] were no second, mind you!
\end{description}

\begin{bfdesc}
  \item[Video recordings] arguably produced the richest part of the data set.
  \item[Questionnaires] were no second, mind you!
\end{bfdesc}

\end{document}

相关内容