# Fully indenting second and subsequent paragraphs inside table cell

I am using the following setup to typeset a table that will eventually contain too many rows to fit on one page thus using xtabular from the xtab package. Conceptually, I have multiple sub-rows inside each row but I want the table to not break the page inside these rows, so resorted to adding line breaks with \newline to create these sub-rows such that the "outer" table rows contain the potential break points for xtabular.

Now I want the following layout inside one row/cell: how can I make the whole row/cell "hanging" as in adding extra horizontal space to the 2nd and subsequent paragraphs. See this MWE:

\documentclass{article}

\usepackage{array}
\usepackage{xtab} % for tables spanning multiple pages
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}

\begin{document}

\begin{xtabular}{|L{7cm}|}
short first par\newline
longer paragraph that should be ragged right and fully indented\newline
third paragraph also indented \\ % this is the row end for tabular
\end{xtabular}

\end{document}


Looking at the output from the MWE, I want the second and subsequent paragraphs be fully indented (not just hanging or first line indent) as indicated by the orange line and arrow:

I'd be inclined to do something like

\documentclass{article}

\usepackage{array}
\def\zz{\def\par{\endgraf\leftskip1em\let\par\endgraf}}
\usepackage{xtab} % for tables spanning multiple pages
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\zz
\arraybackslash\hspace{0pt}}p{#1}}

\begin{document}

\begin{xtabular}{|L{7cm}|}
short first par

longer paragraph that should be ragged right and fully indented

third paragraph also indented \\ % this is the row end for tabular
\end{xtabular}

\end{document}


It seems like the bulk of your tabular content is indented. So, an alternative approach would be to only adjust your heading (short) paragraph text via a negative indent (or \undent):

\documentclass{article}

\usepackage{array,xtab}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcommand{\undent}{\hspace*{-15pt}}

\begin{document}

\begin{xtabular}{|@{\hspace{\dimexpr15pt+\tabcolsep}}L{7cm}|}
\undent short first par

longer paragraph that should be ragged right and fully indented

third paragraph also indented \\

\undent short first par

longer paragraph that should be ragged right and fully indented

third paragraph also indented \\
\end{xtabular}

\end{document}


The 15pt space comes from the default \parindent (which resets to 0pt within a the xtabular).

Well, after crafting the question, it occurred to me to abuse the hanging of paragraphs by declaring the hanging to occur after line 0. Not pretty but it works. Still open to any cleaner ideas!

\documentclass{article}

\usepackage{array}
\usepackage{xtab} % for tables spanning multiple pages
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}

\begin{document}

\begin{xtabular}{|L{7.5cm}|}
short first par\newline\everypar{\hangindent=1em\hangafter=0}
longer paragraph that should be ragged right and fully indented\newline
third paragraph also indented \\ % this is the row end for tabular
\end{xtabular}

\end{document}


which looks like this:

• why use \newline for a paragraph break? rather than a blank line as usual? \newline is intended for linebreaks within the same paragraph. Oct 11 '16 at 18:25