-
Notifications
You must be signed in to change notification settings - Fork 2
Description
You use \linebreak[0] (in horizontal mode always). This is essentially like \allowbreak but its effect is to examine if there was a skip before and to position the zero penalty before that skip not after. This is not equivalent:
\documentclass{article}
\usepackage{color}
\begin{document}
%\tracingmacros1
\parindent0pt
\newbox\mybox
\setbox\mybox\hbox{xxxxx}
\hsize \wd\mybox
\rule{\hsize}{1pt}
x\hspace{\wd\mybox}\leavevmode\linebreak[0]\,y
x\hspace{\wd\mybox}\leavevmode\allowbreak\,y
\showoutput
\end{document}In the first line, TeX discards (in the sense of "does not position the break there") the penalty 0 after x because it would lead to a too much underfull line (I think). Thus there is then the big hspace but no break points after: there can't be a break at the \, (which is a kern) because it is not followed by glue. Hence we end up with the situation above.
In the second line, the penalty is after the big hspace and allows TeX to break the line there. We get an overfull first line due to the big hspace.
This being said, we see that complicated circumstances lead to different results, but the main point is that \linebreak[0] does much more processing than \allowbreak (which simply expands to \penalty\z@.) I this wonder if \allowbreak would not be better.
