![LaTex 嵌套描述列表 - 项目标签放置错误 - 是否需要在 \end{description} 后面加上空行、\par、\mbox{} 或 \item[]?](https://linux22.com/image/425710/LaTex%20%E5%B5%8C%E5%A5%97%E6%8F%8F%E8%BF%B0%E5%88%97%E8%A1%A8%20-%20%E9%A1%B9%E7%9B%AE%E6%A0%87%E7%AD%BE%E6%94%BE%E7%BD%AE%E9%94%99%E8%AF%AF%20-%20%E6%98%AF%E5%90%A6%E9%9C%80%E8%A6%81%E5%9C%A8%20%5Cend%7Bdescription%7D%20%E5%90%8E%E9%9D%A2%E5%8A%A0%E4%B8%8A%E7%A9%BA%E8%A1%8C%E3%80%81%5Cpar%E3%80%81%5Cmbox%7B%7D%20%E6%88%96%20%5Citem%5B%5D%EF%BC%9F.png)
嵌套的描述列表后面是否需要\end{description}
空行? \par
或者\mbox{}
在\item[]
LaTex 嵌套描述列表中?我查看过的所有文档或示例均未表明这一点,但我遇到了布局错误。
使用 LaTex 时,我的嵌套描述列表会导致内部描述列表末尾的项目标签放置错误,通常会在下一个项目的标签上重叠打印。我可以通过以下方式解决这个问题:在现有标签后面插入\end{description}
一个新插入的尾随空行、、\par
或\mbox{}
。\item[]
添加空行或\par
可产生最佳效果。根据下面 David 的回答,我知道删除不必要的\par
命令也可以解决错误。这个空行或\par
解决方案对我有用,似乎合乎逻辑,也不会破坏任何非嵌套列表,但为什么需要进行任何更改?是我遗漏了什么还是有错误?
以下是一些错误示例:
以下是修复错误的相应差异 - 简单地在\par
后面插入一个尾随的\end{description}
:
@@ -865,5 +865,5 @@
a text which ... grammar \par
-\end{description}
+\end{description}\par
\item[{(J002)}]\par
Acronyms and abbreviations \par
@@ -980,5 +980,5 @@
a computer ...
-\end{description}
+\end{description}\par
\item[{(J004)}]\par
Trademarks are ... \par
这是一个 tiny.tex 文件,它表现出相同的布局错误(我试图保留空白行并\par
放置在原始 tex 文件中):
\documentclass[12pt,twoside]{book}\makeatletter
\makeatother
\begin{document}
\chapter[{ DETAILED DESCRIPTION ... }]{ DETAILED DESCRIPTION ... }\par
\begin{description}
\item[{(J001)}]\par
Definitions \par
\begin{description}
\item[{(post-verification ...)}]\par
a text ... \par
\end{description}
\item[{(J002)}]\par
Acronyms and abbreviations \par
\begin{description}
\item[{(ECMA)}]\par
European ... \par
\item[{(YACC)}]\par
Yet Another Compiler Compiler \par
\end{description}
\item[{(J003)}]\par
Glossary \par
\begin{description}
\item[{(2-tuple)}]\par
a tuple with two ordered elements, an ordered pair \par
\item[{(yacc)}]\par
a computer utility program which will
\end{description}
\item[{(J004)}]\par
Trademarks are identified ... \par
\item[{(J005)}]\par
The following terms are ...: \par
\begin{description}
\item[{(+)}]\par
(+)
\end{description}
\end{description} CLA ... \par
\end{document}
下面是从 pdflatex 输出中剪切出来的 PDF 片段,显示与上面相同的错误:
如果我插入\traceparagraphs1
命令并在命令后插入一个空白行\end{description}
并比较日志输出,我会看到以下差异,我不明白,但可以解释为什么需要空白行来产生正确的格式。首先我们添加一个空白行:
--- tiny5.tex 2020-12-18 19:37:23.966114635 +0000
+++ tiny6.tex 2020-12-18 19:37:38.690148323 +0000
@@ -17,4 +17,5 @@
\end{description}
+
\item[{(J002)}]\par
Acronyms and abbreviations \par
我们将 diff 实用程序应用于 tex 日志文件:
--- tiny5.log 2020-12-18 19:37:58.370193342 +0000
+++ tiny6.log 2020-12-18 19:38:02.762203391 +0000
@@ -1,8 +1,8 @@
-This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex 2020.12.13) 18 DEC 2020 19:37
+This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex 2020.12.13) 18 DEC 2020 19:38
@@ other diffs omitted here as mostly tiny5 to tiny6 filename changes @@
@@ -113,9 +113,4 @@
@firstpass
-[]
-@\par via @@0 b=0 p=-10000 d=100
-@@1: line 1.2- t=100 -> @@0
-
-@firstpass
[]\OT1/cmr/m/n/12 The following terms are ...:
@\par via @@0 b=0 p=-10000 d=100
任何线索都值得赞赏。
答案1
目前尚不清楚为什么\par
我开始删除它们,然后我想得到了你想要的输出。
\documentclass[12pt,twoside]{book}\makeatletter
\makeatother
\begin{document}
\chapter[{ DETAILED DESCRIPTION ... }]{ DETAILED DESCRIPTION ... }
\begin{description}
\item[{(J001)}]
Definitions
\begin{description}
\item[{(post-verification ...)}]
a text ...
\end{description}
\item[{(J002)}]
Acronyms and abbreviations
\begin{description}
\item[{(ECMA)}]
European ...
\item[{(YACC)}]
Yet Another Compiler Compiler
\end{description}
\item[{(J003)}]
Glossary
\begin{description}
\item[{(2-tuple)}]
a tuple with two ordered elements, an ordered pair
\item[{(yacc)}]
a computer utility program which will
\end{description}
\item[{(J004)}]
Trademarks are identified ...
\item[{(J005)}]
The following terms are ...:
\begin{description}
\item[{(+)}]
(+)
\end{description}
\end{description} CLA ...
\end{document}