9

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!

  • 3
    it's called a hanging indent :) – Kit Sep 6 '10 at 7:14
8

\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}
  • Caveat: \everypar shouldn't be used outside of such restricted contexts; various standard LaTeX commands will (unfortunately) clobber it. – Will Robertson Sep 6 '10 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 '10 at 9:17
  • 2
    See the everyhook package. – Philipp Oct 17 '10 at 19:33
  • @TH Just \parindent-1em \lipsum would do the trick. – Yiannis Lazarides Oct 17 '10 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 '10 at 7:28
2

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}

Your Answer

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