我正在尝试制作一个描述列表,其中一个项目的名称很长,并且文本从页面右侧移出而不是换到下一行。
\documentclass[12pt]{article}
\begin{document}
\begin{description}
\item[The quick brown fox jumps over the lazy dog The quick brown fox jumps over the lazy dog The quick brown fox jumps over the lazy dog] Lorem me some ipsum yo
\end{description}
\end{document}
我尝试在单词之间的方括号内添加,,,,和,但似乎没有\\
任何效果。\hfill
\newline
\linebreak
\break
答案1
\item[]
列表中的可选参数description
在框中设置大胆的。此框不关心\\
、\hfill
、\newline
或中的任何一个,linebreak
因此\break
输出。
这可能是您的商品的特殊情况,因此您可能需要按以下方式处理:
\documentclass[12pt]{article}
\begin{document}
\begin{description}
\item[The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog]
Lorem me some ipsum yo
\item\hspace*{-\labelsep}{\bfseries The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog}\hspace*{\labelsep}
Lorem me some ipsum yo
\end{description}
\end{document}
这个想法是将常规标签设置为项目的一部分,但弥补差距\labelsep
。以上是使用style=sameline
选项时的默认输出enumitem
:
\documentclass[12pt]{article}
\usepackage{enumitem}
\begin{document}
\begin{description}[style=sameline]
\item[The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog]
Lorem me some ipsum yo
\end{description}
\end{document}
您还可以根据您感兴趣的输出类型来操作段落形状:
\documentclass[12pt]{article}
\begin{document}
\begin{description}
\item[The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog]
Lorem me some ipsum yo
\item \parshape 4 \dimexpr\leftmargin-\labelsep\relax \dimexpr\linewidth-\leftmargin+\labelsep\relax
0pt \linewidth
0pt \linewidth
\leftmargin \dimexpr\linewidth-\leftmargin\relax%
{\bfseries The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog}\hspace*{\labelsep}
Lorem me some ipsum yo Lorem me some ipsum yo Lorem me some ipsum yo Lorem me some ipsum yo Lorem me some ipsum yo
\end{description}
\end{document}