Is it a requirement to follow a nested \end{description}
with a blank line, \par
, \mbox{}
or \item[]
in a LaTex nested description list? None of the documentation or samples I have reviewed suggests it is, but I have a layout error.
Using LaTex, my nested description list results in the labels of the item following the end of an inner description list being wrongly placed, often over-printed on the next item's label. I can resolve this by following the existing \end{description}
with a newly inserted trailing blank line, \par
, \mbox{}
, or \item[]
. Adding a blank line or \par
produces the best results. Following David's answer below, I know that deleting the unneccessary \par
commands also resolves the error. This blank line or \par
solution works for me, seems logical and does not disrupt any non-nested list either, but why are any changes required? Am I missing something or is a bug?
Here are a couple of samples of the errors:
Here are the corresponding diff's to fix the error - simple insertion of a trailing \par
following the \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
Here is a tiny.tex file which exhibits the same layout errors (I have tried to keep the blank lines and \par
placed as in the original tex file):
\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}
And here is the resulting PDF snippet cut from the pdflatex output and showing the same errors as above:
If I insert the \traceparagraphs1
command and insert a single blank line after the \end{description}
command and diff the log output I see the following differences which I do not understand but may explain why the blank line is needed to produce the correct format. First we add a blank line:
--- 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
The we apply the diff utility to the tex log files:
--- 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
Any clues appreciated.
\par
in a document (just use a blank line) that can be used if the following text is a new pararagraph.\item
should follow if the nested list was the end of the previous item,\mbox{}
doesn't do anything but if you have text that should be part of the previous item that can follow.\end{description}
with a blank line instead of a\par
also fixes my layout errors. My TeX is generated from someone else's templates, so, before I go to the effort of overriding those, I would like to understand the root of the problem. I am happy with my solution, I just don't understand why the errors occur nor why my solution fixes it. I had hoped someone else had seen the same error but I can not find other examples or questions. Thanks.\par
commands. You mention "Adding a blank line or \par produces the best results. This blank line or \par solution works for me" but as your MWE clearly shows, it does not. Could you clarify that?\par
after the\end{description}
commands. That was my first fix (along with adding\mbox{}
or\item[]
). After David's comment I tried adding additional blank lines after the\end{description}
commands and that second fix worked too. So I can fix the problem by adding certain commands or blank lines after the\end{description}
commands but have not tried removing\par
command or indeed removing anything else.\par
after the\end{description}
, my first fix. I tried to describe this edit in the diff utility output early on in the question. After David I tried adding additional blank lines after the\end{description}
commands and that second fix worked too and I added it to the question. So I can fix the problem by adding certain commands or blank lines after the\end{description}
but have not tried removing\par
commands or indeed removing anything. Is the use of\par
so awful in this sample?