Take the 2-minute tour ×

I have been using \hspace and \vspace in my latex documents lately. I was surprised when \hspace{1em} didn't work and found out that I needed to use \hspace*{1em} to force latex to put the space requested.
My question is why does latex sometimes ignores \hspace{1em}

share|improve this question
add comment

1 Answer

up vote 16 down vote accepted

When TeX breaks a line it discards white space (glue) that would come at the start of a line. This is why you get an inter-word space or a line break between words, not both. So if the \hspace comes at the beginning of a line the space gets added by LaTeX but discarded by the TeX paragraph breaker. The * version arranges to put a non-discardable invisible item in fromt of the space so the space is never first thing on the line (even though it looks like it is). \vspace and \vspace* the same with respect to vertical space discarded at a page break.

share|improve this answer
so if I put \vspace at the end of the previous line, it'll behave the same as \vspace*? Thanks for your explanation –  Joseph Elcid Jul 20 '12 at 9:30
did you mean \vspace there or \hspace. If you use \vspace(*) mid-paragraph then after the paragraph is broken in to lines tex will insert vertical space after the line that contained the vspace. Then later if the page breaker breaks the page between those lines the space will be discarded unless the * form was used. –  David Carlisle Jul 20 '12 at 9:33
Ok, I get it :-) –  Joseph Elcid Jul 20 '12 at 9:43
add comment

Your Answer


