# How is “noindent” different from “parindent0pt + leavevmode”?

Why these two examples produce different results?

\parindent=0pt \leavevmode
\hbox to 0pt{\hskip -\parindent \bf 8.}%
Lorem ipsum dolor sit amet.
\bye

\noindent
\hbox to 0pt{\hskip -\parindent \bf 8.}%
Lorem ipsum dolor sit amet.
\bye


Incidentally, in this post it is mentioned, that \noindent works independently of \parindent, but what does it mean exactly?

• You're inserting width to the left in the second case. I think it is like saying that the box should have its right-most edge here (to 0pt). And it does. As defined, the box has no width to the right and only width to the left. So it all works out. In the first case, the box has no width to right or to left of here (to 0pt). so it has nowhere to go and the text collides with it. – cfr Aug 7 '15 at 3:16
• Try putting the Lorem before the \hbox to see what I mean. It is kind of hard (for me) to explain. Or just wait and somebody good with explanations who understands this stuff better will explain it properly anyway. – cfr Aug 7 '15 at 3:18
• Obviously, there is difference, because \hskip-\parindent acts differently when \parindent is zero than \parindent has default value 20pt. But the \hbox to0pt position is exactly at the same place in both examples. The box itself is overfull in first example (text laps to the right plus overfull rule is printed). The same box is underfull in second example, because first the typesetting point is moved 20pt left and then \bf 8 (which has width less than 20pt) is printed. The rest to 20pt is space in this underfull box. Both examples look like if somebody don't understand TeX. – wipet Aug 7 '15 at 4:36
• Sorry, I cannot answer because I don't know the desired result of the first example. I only see the real result which is overfull box. – wipet Aug 7 '15 at 5:38
• it depends, are you looking for \hangindent or perhaps \noindent\llap{\bf 8.} or perhaps \noindent\kern-2cm{\bf 8.} or.... – David Carlisle Aug 7 '15 at 5:47

The two examples obviously produce different results, at least because the \hbox will be overfull in the first case and underfull in the second one.

## Example code

\tracingonline=1
\showboxdepth=\maxdimen

\setbox0=\vbox{

\parindent=0pt \leavevmode
\hbox to 0pt{\hskip -\parindent \bf 8.}%
Lorem.

}\showbox0

\setbox0=\vbox{
\noindent
\hbox to 0pt{\hskip -\parindent \bf 8.}%
Lorem.

}\showbox0

\bye


## Output for the first box

Overfull \hbox (8.9444pt too wide) detected at line 8
\tenbf 8.|

\hbox(6.44444+0.0)x0.0
.\glue 0.0
.\tenbf 8
.\tenbf .
.\rule(*+*)x5.0

> \box0=
\vbox(6.83331+0.0)x469.75499
.\hbox(6.83331+0.0)x469.75499, glue set 439.0327fil
..\hbox(0.0+0.0)x0.0
..\hbox(6.44444+0.0)x0.0
...\glue 0.0
...\tenbf 8
...\tenbf .
...\rule(*+*)x5.0
..\tenrm L
..\tenrm o
..\tenrm r
..\tenrm e
..\tenrm m
..\tenrm .
..\penalty 10000
..\glue(\parfillskip) 0.0 plus 1.0fil
..\glue(\rightskip) 0.0

! OK.


## Output for the first box

Underfull \hbox (badness 10000) detected at line 15
\tenbf 8.

\hbox(6.44444+0.0)x0.0
.\glue -20.0
.\tenbf 8
.\tenbf .

> \box0=
\vbox(6.83331+0.0)x469.75499
.\hbox(6.83331+0.0)x469.75499, glue set 439.0327fil
..\hbox(6.44444+0.0)x0.0
...\glue -20.0
...\tenbf 8
...\tenbf .
..\tenrm L
..\tenrm o
..\tenrm r
..\tenrm e
..\tenrm m
..\tenrm .
..\penalty 10000
..\glue(\parfillskip) 0.0 plus 1.0fil
..\glue(\rightskip) 0.0

! OK.


You can clearly see the “overfull” message for the first case and the “underfull” message for the second one. The box

\hbox to 0pt{\hskip -\parindent\bf 8.}


will be neither overfull nor underfull if and only if \parindent is the same as the width of 8. in boldface.

We can also examine what's shown after \box0= and the only difference, apart from the value of \parindent applied for the \skip is that in the first case there's \hbox(0.0+0.0)x0.0 which corresponds to the indentation box (it would be \hbox(0.0+0.0)x20.0, if the value of \parindent had been the default one), that's missing in the second case, because \noindent starts horizontal mode but does not add the indentation box.

It's not clear what you're after. If what you need is hanging paragraphs with the number flush to the left margin, with hanging indentation equal to the \parindent, you can do

Lorem ipsum dolor sit amet lorem ipsum dolor sit amet
lorem ipsum dolor sit amet lorem ipsum dolor sit amet
lorem ipsum dolor sit amet lorem ipsum dolor sit amet
lorem ipsum dolor sit amet lorem ipsum dolor sit amet
lorem ipsum dolor sit amet lorem ipsum dolor sit amet
lorem ipsum dolor sit amet lorem ipsum dolor sit amet.

\hangindent=\parindent
\hangafter=1
\leavevmode
\llap{\hbox to\parindent{\bf 8.\hfil}}%
Lorem ipsum dolor sit amet lorem ipsum dolor sit amet
lorem ipsum dolor sit amet lorem ipsum dolor sit amet
lorem ipsum dolor sit amet lorem ipsum dolor sit amet
lorem ipsum dolor sit amet lorem ipsum dolor sit amet
lorem ipsum dolor sit amet lorem ipsum dolor sit amet
lorem ipsum dolor sit amet lorem ipsum dolor sit amet.

\bye


Finally, what does it mean that \noindent is independent of \parindent? Simply that it behaves the same whatever value the \parindent parameter has: it starts horizontal mode without adding the indentation box (and does nothing if TeX is already in horizontal mode).

• Your solution is good. This also gives the same result: \leavevmode\hang\llap{\hskip-\parindent\bf 8.\hfill} – Igor Liferenko Sep 4 '15 at 0:13