如何使description
环境的项目标签以段落缩进开头?我的意思是它们应该像这样缩进:
\documentclass{article}
\begin{document}
\newlength{\trueparindent}
\setlength{\trueparindent}{\parindent}
The paragraph before the description.
\begin{description}
\item[\hspace*{\trueparindent}The first description label.]Some text. Some text. Some text. Some text. Some text.
\item[\hspace*{\trueparindent}The second description label.]Some text. Some text. Some text. Some text. Some text.
\end{description}
\end{document}
(如果您只是\hspace*{\parindent}
在description
上面使用,则不会得到任何缩进。)我认为有一种方法可以做到这一点,而不必\hspace*
像我一样在每个标签前面放置一个。
我可以使用该enumitem
包,因此给我一个需要它的答案就可以了。
答案1
这里有 3 种解决方案(相同的标签缩进和不同的左边距:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{enumitem}
\usepackage{lipsum}
\begin{document}
\newlength{\trueparindent}
\setlength{\trueparindent}{\parindent}
\lipsum[1]
With the default left margin:
\begin{description}[labelindent = \parindent]
\item[The first description label.]Some text. Some text. Some text. Some text. Some text.
\item[The second description label.]Some text. Some text. Some text. Some text. Some text.
\end{description}
With the left margin aligned with the text margin:
\begin{description}[labelindent = \parindent, leftmargin = 0em]
\item[The first description label.]Some text. Some text. Some text. Some text. Some text.
\item[The second description label.]Some text. Some text. Some text. Some text. Some text.
\end{description}
Label aligned with left margin:
\begin{description}[labelindent = \parindent, leftmargin = \labelindent]
\item[The first description label.]Some text. Some text. Some text. Some text. Some text.
\item[The second description label.]Some text. Some text. Some text. Some text. Some text.
\end{description}
\end{document}
当然,你可以在全局范围内设置其中一个值,方法是在序言中写入:
\setlist[description]{…}