How can I doubly indent some lines of text?

The general idea is...

Once indented
Once indented
Twice indented 
Once indented

The following is my attempt but it only indents once.

  for each $v \in win$\\

if ($pl(v) = 1 \& \exists (v,v') \in E : v' \in win$)\\
{\addtolength{\leftskip}{1cm}$win \cup= v; st \cup = \{v \rightarrow v'\}$}\\
if ($pl(v) = 2 \& \forall (v,v') \in E : v' \in win$)\\
{\addtolength{\leftskip}{1cm}$wim \cup= v;$}\\
if ($pl(v) = 2 \& \exists (v,v') \in E : v' \in lose$)\\
{\addtolength{\leftskip}{1cm}$lose \cup=v$;}\\

Could someone please tell me a better way of doing this, and/or why my attempt doesn't work?

Many thanks.

6 Answers 6


I think what you're looking for is something like this.

For each $v\in win$,\+\\
if ($pl(v)=1\ \&\ \exists(v,v')\in E:v'\in win$)\\
\>$\mathit{win}\cup=v;st\cup=\{v\rightarrow v'\}$\\
if ($pl(v) = 2 \& \forall (v,v') \in E : v' \in win$)\\
\>$wim \cup= v;$\\
if ($pl(v) = 2 \& \exists (v,v') \in E : v' \in lose$)\\
\>$lose \cup=v$;\\

In the interest of keeping the answer as close to your example as possible, I've kept the math exactly as you wrote it, but I don't think that's a good idea. Writing things like $win$ will typeset it as the multiplication of w, i, and n.

As an explanation,

  • \= sets the tab stops. So here, I'm setting 2 tab stops: one at 1 \parindent and one 1 \parindent later.
  • \kill ignores the previous text which is used just for setting the tab stops.
  • \+ indents all following commands by one tab stop.
  • \> moves to the next tab stop.

There are analogous \- and \< commands that do what you would expect. (There are also \' and \` which do strange things inside the tabbing environment, but I've never used them.)


I nest quote environments when I want to achieve such an effect:

  Once indented
  Once indented
    Twice indented 
  Once indented

You may also wish to define your own indentation environment where you can control left and right margins and vertical skips before and after. But that's a different question.

For example, you can define an environment indentmore this way (initially, I've borrowed changemargin from this page, thanks to Hendrik for converting it to LaTeX):



Change \parsep, \partopsep and \topsep to control vertical spacing).

This is how nested indentmore look like in text:

nested indentmore environments

You can find the complete source of the example at pastebin.

  • With quote you will get increased left and right margins. Moreover, it will give additional vertical space. Commented Nov 26, 2010 at 9:54
  • @jetxee: This way of controlling the vertical skip with \vspace is definitely not recommendable. Commented Nov 26, 2010 at 11:17
  • Updated the solution with use of \topsep and \parsep.
    – sastanin
    Commented Nov 26, 2010 at 13:01
  • @jetxee: Setting \topsep and \parsep is a lot better; you also have to set \partopsep=0pt. However, it's not a good idea to promote the usage of \def and \let here; they don't check if a control sequence has been defined before. Commented Nov 26, 2010 at 15:34
  • 1
    @jetxee: I've edited your answer to show what I meant in my previous comment. Hope you don't mind. I've marked my edits in a way that it's clear that I messed around there. You may want to further edit your question and remove the things I wrote in slanted letters. You could use my code as a replacement of your \def\changemargin.... Commented Nov 26, 2010 at 18:17

The answer depends on what you want to achieve. Indentation usually means that only the first line of a paragraph is indented (by the \parindent amount). You increased \leftskip, which means that the whole paragraph gets an increased left margin.

Your attempt with \leftskip didn't work because you need to end the paragraph before ending the group with }. The following works:

{\addtolength{\leftskip}{1cm}This has an increased left margin.\par}

If you only want to indent the first line of a paragraph (or if you only have single lines anyway), then you can use

{\addtolength{\parindent}{1cm}This has an additional indentation of 1cm.}

(No need to end the paragraph here.)

  • I always thought that indentation means the blank space between a margin and the beginning of an indented line, and by margin meaning either left or right margin!
    – yannisl
    Commented Nov 26, 2010 at 11:17
  • @Yiannis: It's possible that my usage of "margin" is not correct. But it is also used in the explanation of \leftskip in the TeXbook, p. 100. Commented Nov 26, 2010 at 11:22
  • It's also possible that my interpretation is also wrong!
    – yannisl
    Commented Nov 26, 2010 at 15:17

The given text looks like an equation which could be aligned, hence \eqalign might be appropriate here (this is in plain-tex):

{\rm for each\ } v \in win\cr
{\rm if\ } \big(pl(v) &= 1 \mathrel{\&} \exists (v,v') \in E : v' \in win\big)\cr
win \cup&= v; st \cup = \{v \to v'\}\cr
{\rm if\ } \big(pl(v) &= 2 \mathrel{\&} \forall (v,v') \in E : v' \in win\big)\cr
wim \cup&= v;\cr
{\rm if\ } \big(pl(v) &= 2 \mathrel{\&} \exists (v,v') \in E : v' \in lose\big)\cr
lose \cup&=v;\cr

Which yields:

output of code

\hspace{1cm} One indent \linebreak
\hspace{2cm} Two indent \linebreak


\indent One indent \linebreak
\indent \indent Two indent \linebreak

Though the latter is a bit sloppy.

  • Neither of these seem to work. The first only indents the first line, with the second is unaffected. The latter does nothing at all.
    – asdf123
    Commented Nov 26, 2010 at 4:22
  • 2
    @asdf123, @Mica: At the beginning of a line you have to use \hspace* instead of \hspace to really get the space. Commented Nov 26, 2010 at 9:41

The best solutions are normally the simpler. TeX defines a macro called narrower that simply makes a paragraph indent by one more parindent. Similarly we can define a macro called wider as shown in the minimal example below:

 \advance\leftskip -\parindent
 \advance\rightskip -\parindent}

Should you not want the right side indentation you can remove the rightskip in both the definition of wider as well as narrower. A gentle reminder, is always best to elaborate your code with a full working minimal example.

You must log in to answer this question.