30

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)?

4
  • 1
    It seems to me that you want a negative indentation.
    – egreg
    Commented Oct 23, 2013 at 7:30
  • 2
    @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
    Commented Oct 23, 2013 at 14:20
  • 2
    @A.Ellett Why not? Just define titles to also be in the margin and push the margin a bit to the right. ;-)
    – egreg
    Commented Oct 23, 2013 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
    Commented Oct 23, 2013 at 16:07

2 Answers 2

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}
2
  • Is there any disadvantage to this that \hangindent doesn't have? Otherwise, it seems like the perfect solution! Commented Oct 23, 2013 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. Commented Oct 23, 2013 at 23:45
38

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

7
  • 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)? Commented Oct 23, 2013 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
    Commented Oct 23, 2013 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
    Commented Oct 23, 2013 at 6:00
  • 1
    @Joseph, how does this make changes to paragraph shape persistent? Please explain.
    – alexis
    Commented Oct 23, 2013 at 9:28
  • 1
    Of course this is incompatible with all list constructions in LaTeX.
    – egreg
    Commented Oct 23, 2013 at 10:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .