Sadly, I am not able to recreate a MWE since I'm working on a fairly complex template. I cannot understand how LaTeX decides to break lines, I googled but I couldn't find a clear cut answer. This is the code I'm working with:
\begin{itemize}
% [...]
\item A TOSCA requirement definition within a node type definition was encoded with the term
\texttt{requirement(}$RName$\texttt{, }$RCap$\texttt{, }$RNType$\texttt{, }$RRel$\texttt{, occurrences(}$ROccLB$\texttt{, }$ROccUB$\texttt{))}, where $RName$ is an atom for the name of the
requirement, $RCap$ is an atom for the required capability, $RNType$ is an atom for the type of nodes admitted
as a target (including subtypes), $RRel$ is an atom representing the relationship underlying the requirement,
and $ROccLB$ and $ROccUB$ are respectively lower and upper bound for the number of occurrences of the
requirement, $ROccUB$ possibly being the atom \texttt{unbounded};
% [...]
\end{itemize}
The item is typeset like this:
If I add a newline (a literal newline, not a \\
, followed by indentation) after the first occurrence of $RRel$
in the code, the line is broken correctly after $ROccLB$
, like so:
I get it that LaTeX works in mysterious ways, but I would like to understand this behaviour.
MWE
\documentclass{article}
\addtolength\textwidth{45pt}
\begin{document}
\begin{itemize}
\item A TOSCA requirement definition within a node type definition was
encoded with the term \texttt{requirement(}$RName$\texttt{,
}$RCap$\texttt{, }$RNType$\texttt{, }$RRel$\texttt{,
occurrences(}$ROccLB$\texttt{, }$ROccUB$\texttt{))}, where $RName$
is an atom for the name of the requirement, $RCap$ is an atom for
the required capability, $RNType$ is an atom for the type of nodes
admitted as a target (including subtypes), $RRel$ is an atom
representing the relationship underlying the requirement, and
$ROccLB$ and $ROccUB$ are respectively lower and upper bound for the
number of occurrences of the requirement, $ROccUB$ possibly being
the atom \texttt{unbounded};
\item A TOSCA requirement definition within a node type definition was
encoded with the term \texttt{requirement(}$RName$\texttt{,
}$RCap$\texttt{, }$RNType$\texttt{, }$RRel$ \texttt{,
occurrences(}$ROccLB$\texttt{, }$ROccUB$\texttt{))}, where $RName$
is an atom for the name of the requirement, $RCap$ is an atom for
the required capability, $RNType$ is an atom for the type of nodes
admitted as a target (including subtypes), $RRel$ is an atom
representing the relationship underlying the requirement, and
$ROccLB$ and $ROccUB$ are respectively lower and upper bound for the
number of occurrences of the requirement, $ROccUB$ possibly being
the atom \texttt{unbounded};
\end{itemize}
\end{document}
\texttt
is like\mbox
and an unbreakable box. I would have used\mathtt
and only around each identifier separately not around the ( or , (italic names like RNmae should be in\mathit
not the default math font which is designed to make adjacent letters look like a product of 1-letter variables not a word. the newline (a space would be the same) is adding an inter-word space so an allowed line breaking point.