29

I want to do the opposite of normal paragraph indentation, meaning:

  1. Have no indent on the first line of each paragraph, but

  2. Indent each subsequent line in the paragraph.

Currently I'm using the command \setlength{\parindent}{0pt} to accomplish (1), but what is the command for (2)?

  • 1
    It seems to me that you want a negative indentation. – egreg Oct 23 '13 at 7:30
  • 1
    @egreg But a negative indentation will result in the first line extending into the margin. I assume that that was probably not what the OP wanted. – A.Ellett Oct 23 '13 at 14:20
  • 1
    @A.Ellett Why not? Just define titles to also be in the margin and push the margin a bit to the right. ;-) – egreg Oct 23 '13 at 14:40
  • 1
    @egreg I'd be interested in seeing a solution along the lines your suggesting. It's a very simple idea. I kind of really like it. But what about things like math equations or other matter that you might normally want centered on the page. Are there other clever tricks to get those effects too? :) – A.Ellett Oct 23 '13 at 16:07
10

A combination of \leftskip and \parindent can achieve, I think, what you seek (that is, having the hanging indent persist beyond a single paragraph). Then reset them when you are done.

\documentclass{article}
\usepackage{lipsum}
\parindent=0em
\begin{document}
\lipsum[4]
\leftskip=2em
\parindent=-2em
\lipsum[2-4]
\leftskip=0em
\parindent 0em
\lipsum[4]
\end{document}

enter image description here

Alternately, you can set the stuff off in its own brace-delimited group. Then, you don't have to reset them at the end:

\documentclass{article}
\usepackage{lipsum}
\parindent=0em
\begin{document}
\lipsum[4]
{
\leftskip=2em
\parindent=-2em
\lipsum[2-4]
}
\lipsum[4]
\end{document}
  • Is there any disadvantage to this that \hangindent doesn't have? Otherwise, it seems like the perfect solution! – jamaicanworm Oct 23 '13 at 22:21
  • 1
    @jamaicanworm I am not aware of a particular disadvantage of this solution, but then again, I can't claim to be ultimately versed on the topic either. And, as you are already aware, this approach persists across paragraph boundaries. – Steven B. Segletes Oct 23 '13 at 23:45
37

You could consider using \hangindent

For example:

\documentclass{article}
\usepackage{lipsum}
\pagestyle{empty}
\begin{document}

\noindent
\hangindent=2em
\lipsum[1]

\end{document}

results in

enter image description here

In conjunction with \hangafter you can get various interesting effects:

\documentclass{article}
\usepackage{lipsum}
\pagestyle{empty}
\begin{document}

\hangindent=2em%%
\hangafter=3\relax
\noindent
\lipsum[1]

\end{document}

results in

enter image description here

Combining positive and negative values to \hangindent and \hangafter allows you to create various holes in your paragraphs:

\hangindent=-2in%%
\hangafter=3\relax
\noindent
\lipsum[1]

\vspace{1cm}

\hangindent=-2in%%
\hangafter=-3\relax
\noindent
\lipsum[2]

enter image description here

Another command worth considering is \parshape: The syntax of \parshape is

 \parshape <number of lines>
           <indent dimension> <line width>
           <indent dimension> <line width>
           <indent dimension> <line width>
           <indent dimension> <line width>

Here there are as many <indent dimension> <line width> pairs as <number of lines>. The effect of \parshape ends at the end of the paragraph regardless of how many lines the paragraph contains. If there are more lines to the paragraph than provided to \parshape the last <indent dimension> <line width> pair applies to the remainder of the paragraph.

\parshape 2
          0pt \textwidth
          2em \dimexpr\textwidth-2em\relax
\noindent
\lipsum[1]

enter image description here

With \parshape and a bit a creativity, you can create all sorts of paragraph shapes:

\parshape 11
          0pt \textwidth
          1em \dimexpr\textwidth-2em\relax
          2em \dimexpr\textwidth-4em\relax
          3em \dimexpr\textwidth-6em\relax
          4em \dimexpr\textwidth-8em\relax
          5em \dimexpr\textwidth-10em\relax
          4em \dimexpr\textwidth-8em\relax
          3em \dimexpr\textwidth-6em\relax
          2em \dimexpr\textwidth-4em\relax
          1em \dimexpr\textwidth-2em\relax
          0em \textwidth
\noindent
\lipsum[1]

enter image description here

  • 1
    Thank you for the wonderfully detailed answer! Is there any way to make \hangindent work for all subsequent paragraphs (even ones that are separated by a newline in the text editor)? – jamaicanworm Oct 23 '13 at 5:01
  • 1
    @jamaicanworm I was anticipating that question. I'm not quite sure how to do this. You would have to do some magic involving \everypar. But depending on what's going on in your document, \everypar is easily overwritten and you lose your formatting. I would suggest that you ask a second question about how to apply your for to all paragraph. – A.Ellett Oct 23 '13 at 5:17
  • 1
    @jamaicanworm You can do this by make LaTeX execute the \par primitive inside a group. This may break with more complex constructs, but try \setlength{\parindent}{0pt} \makeatletter \@setpar{\begingroup\@@par\endgroup} \makeatletter – Joseph Wright Oct 23 '13 at 6:00
  • 1
    @Joseph, how does this make changes to paragraph shape persistent? Please explain. – alexis Oct 23 '13 at 9:28
  • 1
    Of course this is incompatible with all list constructions in LaTeX. – egreg Oct 23 '13 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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