10

Inside of a table column with a width determined by a p{5in} tag, I want all but the first line of text to be indented.

Is there any way to achieve this? Doing it by hand would make later edits overly cumbersome.

Thanks!

1
  • 4
    it's called a hanging indent :)
    – Kit
    Sep 6, 2010 at 7:14

2 Answers 2

9

\everypar{\hangindent1em \hangafter1} seems to do what you want.

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{lipsum}
\begin{document}
\noindent
\begin{tabular}{cp{5in}c}
X&\everypar{\hangindent1em \hangafter1} \lipsum[1-3]&X
\end{tabular}
\end{document}
5
  • Caveat: \everypar shouldn't be used outside of such restricted contexts; various standard LaTeX commands will (unfortunately) clobber it. Sep 6, 2010 at 9:05
  • 1
    It's too bad really. It wouldn't be that hard to implement a stack of \everypar commands that one could push/pop tokens to/from.
    – TH.
    Sep 6, 2010 at 9:17
  • 2
    See the everyhook package.
    – Philipp
    Oct 17, 2010 at 19:33
  • @TH Just \parindent-1em \lipsum would do the trick.
    – yannisl
    Oct 17, 2010 at 23:42
  • @Yiannis Lazarides: Not really. That causes the first line to stick out into the space between columns. Try changing the column specification to c@{}p{5in}c to see it overlap the X. One could increase the spacing between those columns by 1 em and then use 5in - 1em as the width of the parbox to compensate.
    – TH.
    Oct 18, 2010 at 7:28
4

One "pure LaTeX" way of doing this looks something like this, using a custom list environment:

\newenvironment{hanglist}[1][\parindent]{%
    \begin{list}{}{%
        \setlength{\leftmargin}{#1}
        \setlength{\labelwidth}{0pt}
        \setlength{\labelsep}{0pt}
        \setlength{\itemindent}{-#1}}
    }{%
        \end{list}
    }

\begin{hanglist}[2cm]
\item\lipsum[1]
\item\lipsum[2]
\end{hanglist}

You must log in to answer this question.