TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am beginner of LaTeX. From many examples I found, I notice that it's very common to use command \leavevmode. I can't find any information about this command. Could anyone tell me what's the function of it and how to use it?

share|improve this question

migrated from stackoverflow.com Jul 12 '11 at 10:42

This question came from our site for professional and enthusiast programmers.

@all: Do we need a tag for the different modes of TeX? – Martin Scharrer Jul 12 '11 at 10:56
@Martin: We already have mathmode. So introducing vertical-mode and horizontal-mode might make sense. – Caramdir Jul 12 '11 at 16:07
up vote 59 down vote accepted

The \leavevmode is defined by LaTeX and plainTeX and ensures that the vertical mode is ended and horizontal mode is entered. In vertical mode, TeX stacks horizontal boxes vertically, whereas in horizontal mode, they are taken as part of the text line.

For example \mbox{..} is defined as \leavevmode\hbox{..} to ensure that horizontal mode is entered if it is used at the beginning of a paragraph. If you only use \hbox{ } it is stacked above the following paragraph instead.


Text\par\hbox{Hello} World




Text\par\mbox{Hello} World


  Hello World

You see that in the first case the \hbox is stacked with the two paragraphs vertically (but without paragraph indention) because it is processed in vertical mode. In the second case horizontal mode is entered first and so Hello is processed as part of the second paragraph.

Use \leavevmode for all macros which could be used at the begin of the paragraph and add horizontal boxes by themselves (e.g. in form of text).

share|improve this answer
Thanks a lot. That helps. – Jason Xu Jul 14 '11 at 16:20
+1 Your last sentence is particularly enlightening. – doncherry Feb 19 '12 at 21:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.