## How to Make LaTeX use a Hanging Indent

Ah, LaTeX. The programmer’s text processing system, in which you have to compile your document before it turns into something viewable. It gives us the joys of truly beautiful equation typesetting and the agonies of obscure commands, crazy “badness” rules, and sometimes obstreperous auto-figure placement.

Today was a case in point. I’m typesetting the index for a book and I wanted to get entries to have hanging indents, like this:

This is my paragraph, which I am writing to demonstrate what it looks like to have a paragraph that wraps and uses a hanging indent.

The only problem is that LaTeX only lets you specify how much to indent the first line of a paragraph, not the rest. The assumption is that the “typical” sort of indentation you want is to get paragraphs like this:

This is another paragraph, which shows what it looks like to have a paragraph that wraps but indents the first line instead of the following lines.

The solution turns out to be to set your left margin in to where you want the hanging lines to be, and then use a negative offset to specify the indentation of the first line. Here’s an example:

\leftskip 0.1in
\parindent -0.1in

Thank you, google! Talk about thinking outside the box.

P.S. What’s funny is that HTML has the same limitation, so to show the first example above, I had to set a negative text indentation.

### 9 Comments 8 of 8 people learned something from this entry.

1. #### k said,

August 29, 2008 at 5:55 pm

(Learned something new!)

thanks a lot! helped out a bunch

2. #### k said,

August 29, 2008 at 6:04 pm

also check out the following:

\begin{hangparas}{.25in}{1}
Paragraph to be hanging indented

Another paragraph to be hanging indented
\end{hangparas}

3. #### MartinB said,

March 3, 2009 at 1:06 am

(Learned something new!)

PlainTex also has the nice commands
\hangindent and
\hangafter

They are a bit tricky to use, but very powerful. (See the TeX book, ch 14)

4. #### Swift Arrow said,

May 16, 2009 at 3:19 am

(Learned something new!)

Thank You!!! Life Saver!!! Just in Time!!!

5. #### Lisa said,

September 8, 2009 at 3:08 pm

(Learned something new!)

Awesome! So incredibly helpful. :)

6. #### Vijay Kaul said,

December 3, 2010 at 5:10 pm

(Learned something new!)

I think that’s just how computer scientists think! I always forget these things, though; thanks for posting!

7. #### Anonym said,

September 24, 2011 at 2:16 am

(Learned something new!)

Thanks, was useful for me.

8. #### Yalag said,

March 4, 2012 at 4:26 am

(Learned something new!)

Thanx. Just what I needed.

9. #### Red said,

July 9, 2012 at 6:02 pm

(Learned something new!)

You can also do \hangindent=1cm or something similar before the paragraph that you want to use it with. But it might be different for what exactly you’re wanting to do.