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 need to locate my text in such way. At first, I have some formula. There must be a little indent.

$bla-bla-bla$ \\

Then I have another formula, but the indent must be bigger.

   $bla-bla-bla$ \linebreak

An so on. It looks like the depth of the recursion.

   $bla-bla-bla$ \\ 

      $bla-bla-bla$ \\

          $bla-bla-bla$ \\

   $bla-bla-bla$  \\

   $bla-bla-bla$  \\

        $bla-bla-bla$  \\

        $bla-bla-bla$   \\

How can I do it? I try to use \hspace, but it works only at the beginning.

share|improve this question
It seems to me as algorithmic could take place here. Are you writing an algoritm? What do you need this for? – yo' Apr 25 '12 at 12:31
it is just the picture of some call stack – user565447 Apr 25 '12 at 13:01
Then I would recommend you to ask something like "How to display indented call stack" or similar, which points out your real target, and not the way you tried to solve it. That would allow the answers to better fit to your problem ;) See XY problem – yo' Apr 25 '12 at 13:14
up vote 3 down vote accepted

If you need it once or twice, you can stay with something like the following. The empty \hbox makes sure that the following skip (\quad in this case) is not ignored.



\quad $f(3)=f(2)+f(1)=3$
\quad\quad $f(2)=f(1)+f(0)=2$
\quad\quad\quad $f(1)=1$
\quad\quad\quad $f(0)=1$
\quad\quad $f(1)=0$
\quad $f(2)=f(1)+f(0)=2$
\quad\quad $f(1)=1$
\quad\quad $f(0)=1$

share|improve this answer
do not use \hbox (as that behaves differently within a paragraph and between paragraphs and for that reason is not a user-level LaTeX command). Use either \mbox{} or better \hspace*{1em} etc. – Frank Mittelbach Apr 25 '12 at 14:50
@FrankMittelbach Is there any other reason why not to use \hbox{} here other than that it's a TeX primitive? And \hspace*{1em} seems to me as "too long", even though it might be shorter than \hbox{}\quad, that's why I provided this alternative to David's answer. – yo' Apr 25 '12 at 16:05
LaTeX has a fairly consistent user-level context in that it ensures that all text-producing commands always ensure that they are in horizontal mode, ie within a paragraph, if necessary by starting one. A primitive like \hboxdoesn't do this and that is giving users unnecessary surprises. For example if you would say, "use \hbox{word} to ensure that a certain word is not hyphenated" then this fails if it is the first word in a paragraph. Therefore those primitives should not be advertised as user-level commands and instead the LaTeX variants (in this case \mbox) should be suggested. – Frank Mittelbach Apr 26 '12 at 10:54
I therefore suggest you alter your solution to use the latter. – Frank Mittelbach Apr 26 '12 at 10:54

You could use \hspace* as the star form avoids the space being discarded at the start of a line, but using an environment designed for laying out such expressions is probably preferable. It is hard to say given your truncated example but perhaps tabbing or one of the amsmath alignments would be more suitable.

share|improve this answer

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.