Unfortunately, it keeps bugging me with forgotten \endgroup
, float(s) lost
, not in outer par mode
and so on.
In other words, why can't I do something like this (the actual table is significantly more complex with rules and stuff):
\documentclass{article}
\usepackage{blindtext}
\usepackage{tabularx}
\begin{document}
\begin{table}
\begin{tabularx}{\textwidth}{X}
\begin{table}
\begin{tabularx}{\textwidth}{X}
\blindtext
\end{tabularx}
\caption{Inner table}
\end{table}
\end{tabularx}
\caption{Outer table}
\end{table}
\end{document}
Best Answer
There are two problems here:
Nested
table
environments:Not in outer par mode
I suggest dropping the inner
table
environment. (How should the concept of floating be applicable inside a tabular where the contents are fixed, anyway?)Nested
tabularx
environments:Extra }, or forgotten \endgroup
,Missing \endgroup inserted
andMissing } inserted
The solution is to enclose the inner
tabularx
by a pair of braces.The the
tabularx
manual states:Now the inner caption does work without problems and results in a enumerated caption:
If this is not preferred, one can use the starred version of
\caption*
for the inner caption from thecaption
package.I also replaced
\textwidth
with\linewidth
so that innertabularx
uses the correct remaining horizontal space (→ Difference between \textwidth, \linewidth and \hsize)Further improvements could be
tabularx
and itscaption
inside thecenter
environment ortabularx
, i.e.\\[2ex]
.Code
Output