Here is an example of a parbox that produces both an underfull and an overfull warning:
\parbox{100pt}{A set of comparison triplets \(T = \{ (i,j,l) | z_i \;is\; more\; similar\; to\; z_j\; than\; z_l\}\) is given.}
When rendered to pdf, it looks like this:
Apparently, parts of the formula can't be broken up across multiple lines. I would like to allow Latex to linebreak the text within the curly braces and to position it like the other text in the parbox. Is that possible?
I have searched for similar questions:
Why do I have overfull \hbox when I use inline math without line breaks The answer explains the difference between
${...}$
and$...$
. I'm already using the latter, so I would expect linebreaks to work for me.How can I split an equation over two (or more) lines This seems to target equations that are in their own line already. I would like the equation to be embedded in the text.
Break an inline math formula The accepted answer does a complex redefinition of the comma sign, based on the showframe package. But another answer points to \allowbreak.
There is also this: How to auto linebreak before/after parenthesis in inline math But to be honest, I don't understand what the accepted answer is doing (some parts of latex are still completely magic to me).
\allowbreak works for me as well. I can define specific points at which the equation may be broken up. But how can I avoid sprinkling allowbreak everywhere in my math typesetting? The following code works (well it still produces an underfull warning, but that's my text content and has nothing to do with the inline formula) but is horrible to read and edit:
\parbox{100pt}{A set of comparison triplets \(T = \{ (i,j,l) | \allowbreak z_i \; \allowbreak is\; \allowbreak more\; \allowbreak similar\; \allowbreak to\; \allowbreak z_j\; \allowbreak than\; \allowbreak z_l\}\) is given.}
\text{is more similar to}
so that TeX knows you're dealing with text not math.