0
\documentclass[a4paper,12pt]{article}
\begin{document}
\begin{enumerate}
\item \begin{enumerate}
    \item 
        \begin{enumerate}
         \item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt \hfill [Lorem ipsum]
         \item I'm going to relate a time-traveling joke, but you didn't appreciate it. \hfill [Lorem ipsum]
        \end{enumerate}
    \end{enumerate}
\end{enumerate}
\end{document}

gives the following output:

enter image description here

Why is the second [Lorem ipsum] split up even though the item has less wording?

Chrystomath
  • 139
  • 1
  • 5

2 Answers2

1

If you remove the misplaced first \item, it works as expected for me.

\documentclass[a4paper,12pt]{article}
\begin{document}
  \begin{enumerate}
    \item
      \begin{enumerate}
        \item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt \hfill [Lorem ipsum]
        \item I'm going to relate a time-traveling joke, but you didn't appreciate it. \hfill [Lorem ipsum]
      \end{enumerate}
  \end{enumerate}
\end{document}

enter image description here


EDIT If a higher nesting is intended, I cite egreg's comment:

[...] TeX will prefer a paragraph where the last but one line is not hyphenated. The \hfill makes it possible.

\documentclass[a4paper,12pt]{article}
\begin{document}
  \begin{enumerate}
    \item
      \begin{enumerate}
        \item
        \begin{enumerate}
          \item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt \hfill [Lorem ipsum]
          \item I'm going to relate a time-traveling joke, but you didn't appreciate it. \hfill [Lorem~ipsum]
        \end{enumerate}
      \end{enumerate}
  \end{enumerate}
\end{document}

enter image description here

Alternatively have a look at \linepenalty.

Suuuehgi
  • 887
  • 4
  • 18
  • 1
    Yes, but if you embed the list in another list it shows the output in the OP's image. – Alan Munn Dec 18 '19 at 15:43
  • Sorry about that. I meant to have another enumerate list, which I edited in now. I put the \documentclass later in case the 12pt mattered, but I forgot to put in the other enumerate environment. Like you said, it is not misplaced but needed for the 'error' to occur. – Chrystomath Dec 19 '19 at 10:32
  • The problem is with the hyphenation. Changing the wording just slightly solves the problem. The \linepenalty is also great. – Chrystomath Dec 19 '19 at 10:40
1

From the explanation by @Ulrike Fischer--- https://tex.stackexchange.com/a/16333/197451

Output with \newcommand\quelle

enter image description here

Output without \newcommand\quelle enter image description here

Also, the first\item should be giving you an error since the enumerate environment has not \begin--probably you have edited out the first item before capturing your screenshot of the output--is that right?

    \documentclass[a4paper,12pt]{article}
    \begin{document}
      \newcommand\quelle[1]{{%
      \unskip\nobreak\hfil\penalty50
      \hskip2em\hbox{}\nobreak\hfil\textbf{#1}%
      \parfillskip=0pt \finalhyphendemerits=0 \par}}
    \begin{enumerate}
        \item fg \hfill [lorem ipsum]
            \begin{enumerate}
             \item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed 
              \quelle {[Lorem ipsum]}
             \item I'm going to relate a time-traveling joke, but you didn't 
             appreciate 
             it. \hfill [Lorem ipsum]
            \end{enumerate}
        \end{enumerate}
    \end{document}
js bibra
  • 21,280