1

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:

item label in wrong position item label in wrong position and over-printing

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:

pdflatex output

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.

5
  • 3
    please post a test file it is very hard to debug disconnected fragments. there is no requirement on what follows. You should almost never use \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. – David Carlisle Dec 16 '20 at 19:33
  • David, thanks for the comments, I've updated the question to include a tiny.tex sample. I've also confirmed that post-pending the \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. – IDog1993 Dec 17 '20 at 19:44
  • Your minimal example works perfectly fine once I remove all \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? – leandriis Dec 17 '20 at 19:52
  • I can fix my tiny.tex sample by adding in additional \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. – IDog1993 Dec 17 '20 at 20:17
  • Too slow editing. I can fix my erroneous tiny.tex sample by adding in \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? – IDog1993 Dec 17 '20 at 20:25
2

It is not clear why you had all the \par I started by deleting them all, then I think got the output you intended.

enter image description here

\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}
3
  • Okay, thank you - so now I have solutions based on deleting \par commands and solutions based on adding in \par commands or blank lines or other commands. But when I read answers such as tex.stackexchange.com/questions/82664/… they tell me that \par and newline are equal and neither should be required after my \end{description} command. So I am not sure why any of the solutions work. What I have done is run pdflatex with \traceparagraphs1 and applied the diff utility and added to the question. – IDog1993 Dec 18 '20 at 19:48
  • @IDog1993 \par is the same as a blank line so should basically never occur in a document, but you would have the same issue if you used blank lines. The problem is that description items are designed to be inserted inline at the start of the following paragraph so if you put a paragraph break between the \item[..] and the following text latex has to got to special effort to make it still work, but if you have nested lists and multiple unexpected paragraph breaks you can eventually defeat it. – David Carlisle Dec 18 '20 at 20:45
  • Excellent, thank you. So errors in the LaTeX are compensated for but eventually overwhelm the system. In my case the LaTeX and hence the \item and \par commands are produced from some third party templates in another language. So, before overriding those templates to generate better LaTex to fix the problem, I needed first to understand why the LaTex generated is not working - just to avoid piling layer-upon-layer of problems and misunderstandings. – IDog1993 Dec 19 '20 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.