[Tex/LaTex] Typesetting curiosity: word change on one line does not affect how that line is set, but affects how the next line is set

line-breakingparagraphstex-coretypography

The following two paragraphs differ only in that the first one uses "his" on the first line and the second one uses "her".

\documentclass[12pt]{book}
\RequirePackage[adobe-utopia]{mathdesign}

\textwidth5.5in

\begin{document}

Each producer \(j\), when choosing the output of his production unit (an element in \(T(j)\))
takes as given the price system \((p_1,p_2)\) prevailing in the market and maximizes the value
of this output (the unit's profit).

Each producer \(j\), when choosing the output of her production unit (an element in \(T(j)\))
takes as given the price system \((p_1,p_2)\) prevailing in the market and maximizes the value
of this output (the unit's profit). 
\end{document}

TeX sets the paragraphs like this:
enter image description here
The linebreak for the first line is the same in both paragraphs, but the linebreak for the second line differs between the paragraphs. Thus the difference in the first lines doesn't affect the way the first line is set, but affects the way the second line is set. Why does TeX's paragraph-setting mechanism do that?

Best Answer

I could not reproduce the output that you show, however by exaggerating width of her I can produce the effect,

enter image description here

\documentclass[12pt]{book}
\RequirePackage[adobe-utopia]{mathdesign}

\textwidth5.5in


\lefthyphenmin=3
\tracingparagraphs2

\begin{document}

Each producer \(j\), when choosing the output of his production unit (an element in \(T(j)\))
takes as given the price system \((p_1,p_2)\) prevailing in the market and maximizes the value
of this output (the unit's profit).

Each producer \(j\), when choosing the output of he\vrule width7.01pt r production unit (an element in \(T(j)\))
takes as given the price system \((p_1,p_2)\) prevailing in the market and maximizes the value
of this output (the unit's profit). 
\end{document}

TeX tries to avoid having a very loose line next to a very tight one. In order to get and on to the second line the white space has to be very compressed and that isn't allowed in the first paragraph but with the wider her in the second form, the white space in the first line is compressed enough to allow the tight second line.

The log shows

First paragraph:

@firstpass
@secondpass
[]\T1/mdput/m/n/12 Each pro-ducer $\OML/mdput/m/it/12 j$\T1/mdput/m/n/12 , when
 choos-ing the out-put of his pro-duc-tion unit (an ele-
@\discretionary via @@0 b=0 p=50 d=2600
@@1: line 1.2- t=2600 -> @@0
ment in $\OML/mdput/m/it/12 T\OT1/mdput/m/n/12 (\OML/mdput/m/it/12 j\OT1/mdput/
m/n/12 )$\T1/mdput/m/n/12 ) takes as given the price sys-tem $\OT1/mdput/m/n/12
 (\OML/mdput/m/it/12 p[]; p[]\OT1/mdput/m/n/12 )$ \T1/mdput/m/n/12 pre-vail-ing
 in the mar-ket 
@ via @@1 b=28 p=0 d=1444
@@2: line 2.1 t=4044 -> @@1
and 
@ via @@1 b=86 p=0 d=9216
@@3: line 2.3 t=11816 -> @@1
max-i-mizes the value of this out-put (the unit's profit). 
@\par via @@2 b=0 p=-10000 d=100
@\par via @@3 b=0 p=-10000 d=100
@@4: line 3.2- t=4144 -> @@2

second paragraph

@firstpass
@secondpass
[]\T1/mdput/m/n/12 Each pro-ducer $\OML/mdput/m/it/12 j$\T1/mdput/m/n/12 , when
 choos-ing the out-put of he|r pro-duc-tion unit (an 
@ via @@0 b=102 p=0 d=22544
@@1: line 1.0 t=22544 -> @@0
ele-
@\discretionary via @@0 b=38 p=50 d=4804
@@2: line 1.3- t=4804 -> @@0
ment in $\OML/mdput/m/it/12 T\OT1/mdput/m/n/12 (\OML/mdput/m/it/12 j\OT1/mdput/
m/n/12 )$\T1/mdput/m/n/12 ) takes as given the price sys-tem $\OT1/mdput/m/n/12
 (\OML/mdput/m/it/12 p[]; p[]\OT1/mdput/m/n/12 )$ \T1/mdput/m/n/12 pre-vail-ing
 in the mar-
@\discretionary via @@1 b=9 p=50 d=12861
@@3: line 2.2- t=35405 -> @@1
ket 
@ via @@1 b=4 p=0 d=10196
@ via @@2 b=28 p=0 d=11444
@@4: line 2.1 t=16248 -> @@2
and 
@ via @@2 b=86 p=0 d=9216
@@5: line 2.3 t=14020 -> @@2
max-i-mizes the value of this out-put (the unit's profit). 
@\par via @@3 b=0 p=-10000 d=5100
@\par via @@4 b=0 p=-10000 d=100
@\par via @@5 b=0 p=-10000 d=100
@@6: line 3.2- t=14120 -> @@5




Martin sent me a full \tracingall log of the document in the question, run through Bakoma TeX, so that I could investigate why I needed to add the rule to make her wider.....

Comparing a \tracingall log of the original version, the LaTeX in the bakoma tex run advertises itself as

LaTeX2e <2017-04-15>

I actually got the fewest differences using texlive 2016, but there the main difference appears to be slight differences in the mathdesign package setup

In particular the diff of the logs shows

tl2016

Package: mathdesign 2013/08/29 v2.31 Math Design Project
...
{select font mdputr8t at 11.28003pt}
...
OT1/mdput/m/n -><->s*[0.94]mdputr7t

bakoma

Package: mathdesign 2006/01/29 v1.55 Math Design Project
...
{select font mdputr8t at 11.03998pt}
...
OT1/mdput/m/n -><->s*[0.92]mdputr7t

so a .02 difference in scale factors used in the fonts. After that of course it is not surprising that in a particularly sensitive paragraph like this where two possible linebreaking options have similar badness and just the width difference between his and her tips the balance that a small difference in font size meant that I had to adjust the word widths to see the same effect.

Related Question