# Why does \moveleft not contribute to width but \moveright does?

Consider example1:

``````\setbox1=\vbox{
\moveleft 1pt \vbox{\hrule width 4pt height 10pt depth 0pt}
\hrule width 4pt height 10pt depth 0pt
}
\showbox1
``````

The output:

``````\vbox(20.0+0.0)x4.0
.\vbox(10.0+0.0)x4.0, shifted -1.0
..\rule(10.0+0.0)x4.0
.\rule(10.0+0.0)x4.0
``````

Consider example2:

``````\setbox2=\vbox{
\moveright 1pt \vbox{\hrule width 4pt height 10pt depth 0pt}
\hrule width 4pt height 10pt depth 0pt
}
\showbox2
``````

The output:

``````\vbox(20.0+0.0)x5.0
.\vbox(10.0+0.0)x4.0, shifted 1.0
..\rule(10.0+0.0)x4.0
.\rule(10.0+0.0)x4.0
``````

The outputs of example 1 and 2 differ with the width of the resulting vbox. With respect to `\moveleft` it is unchanged, whereas `\moveright` contributes to its width. What is the reason for this and where is it mentioned in TeXbook?

EDIT:

This is explained in TeXbook, page 81, third paragraph:

The width of a computed `\vbox` is the maximum distance by which an enclosed box extends to the right of the reference point, taking possible shifting into account. This width is always nonnegative.

The question now is: How to achieve the same behavior in example2, i.e., that the resulting document would be the same, but the width will be 4pt, instead of 5pt?

• interesting although the difference isn't actually `\moveleft` v `\moveright` as `moveright -1pt` acts like `\moveleft` and `\moveleft -1pt` acts like `\moveright` including the width of the outer box. Sep 2, 2015 at 0:00
• @DavidCarlisle: you are right, negative `\moveright` does not contribute to the width, and negative `\moveleft` does. Wait a second... I know the answer - page 81, third paragraph. Sep 2, 2015 at 0:09
• Yes, you should self answer:-) Sep 2, 2015 at 0:23
• No, I changed the question a bit - see EDIT. Sep 2, 2015 at 0:23
• \moveright 1pt \rlap{\vbox.... Sep 2, 2015 at 0:25

The difference isn't actually `\moveleft` v `\moveright` as `\moveright -1pt` acts like `\moveleft 1pt` and `\moveleft -1pt` acts like `\moveright 1pt` including the width of the outer box.
The width of a computed `\vbox` is the maximum distance by which an enclosed box extends to the right of the reference point, taking possible shifting into account. This width is always nonnegative.
Possibly the easiest way to add a box ensuring that it does not affect th width of the outer box, even if shifting left or right is to use `\rlap` to hide the box width, so `\rlap{\vbox{\moveright ...` or just use a kern rather than a shifted box, so `\rlap{\kern-1pt\vbox{...`