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

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.


As an addition to existing answers, the idea is as follows.

TeX classifies lines in a paragraph as

  1. tight
  2. decent
  3. loose
  4. very loose
  5. overfull/underfull

according to their badness, which is computed by looking at how much interword spaces have to be stretched or shrinked for obtaining justification; the names should be self-explanatory.

The algorithm for dividing paragraphs into lines takes the badness of each possible line into account because it works on the whole paragraph. The final result will be so that consecutive lines don't differ by more than one degree according to the table above. So there will be no loose line next to a tight one, nor a very loose one next to a decent one.

If there is no way to obtain the result, you'll get a warning of underfull box or, in some cases, overfull box: this happens if there is no way to break the paragraph respecting the stated tolerance.

The result is that changing a word in the first line of a paragraph might even influence the last one: if the first line changes from decent to tight, say, this may propagate.