# Nesting longtable within a longtable

As per the working MWE below (based on the solution https://tex.stackexchange.com/a/165337/69378), I like the simplicity of nesting a table into the cell of a parent table compared to the multirow package. Page breaking is one of my favourite capabilities of the longtable package and I'm wondering if it's possible to, rather than starting from longtable and using tabular sub-tables to create columns or tables to present greater details, use longtable in both instances.

Since it doesn't work to use two nested instances of longtable, is it possible to patch a macro or command to let longtable nest within other longtables or does the capabilities that let it split across pages make this too complicated?

I did test using tabular as the parent table, and tabular as the sub-tables which works fine, so I'd guess that it's indeed particular to the longtable code even though the errors thrown look pretty generic (missing end groups and paragraph ending before complete).

%https://tex.stackexchange.com/questions/165332/creating-a-table-within-a-longtable

\documentclass{article}
\usepackage{multirow,longtable}

\begin{document}

\begin{longtable}{ l l}
\hline
Outer column & Detail column\\
\hline

a &
\begin{tabular}{l l }
A1 & B1 \\
A2 & B2 \\
A3 & B3 \\
\end{tabular}
\\
b &
\begin{tabular}{l l }
A1 & B1 \\
A2 & B2 \\
A3 & B3 \\
\end{tabular}
\\
d & etc \\
\hline
\end{longtable}

\end{document}

• As far as I can see, there is no need for multirows or nested tables unless you want the contents of the outer column to be vertically centered with respect to the corresponding entries in the detail column. – leandriis Mar 25 at 6:00
• It would be perhaps possible to setup things so that you don't get an error from an inner longtable, but it wouldn't break either, so where is the point? – Ulrike Fischer Mar 25 at 9:17

• Thanks a lot for your answer, I must be misremembering a previous use-case I had. I thought I remembered, at one point, having huge paragraphs of text in a row splitting itself adequately across a page break mid cell. Extrapolating on this, I thought I could get the sub rows to break themselves without introducing too much extra white space on a page, while preserving the outer layer. I wonder if I was thinking about tcolorbox... I think I will try and make a second MWE with sum large amounts of dummy text and p{} formatted columns to see if I can't pin down what I thought I remembered. – EngBIRD Mar 26 at 4:02