Alignment of columns of nested tables (tabularx)

I want to nest 2 tabularx tables: the columns of the "inside" table belong to a column of the "outside" table and therefore shall be indented and have a vertical line on their side.

I tried to do that with the following MWE, but I wish that the second column of the inserted table would be aligned with the "outside" table, so h and j shall be horizontally aligned with b and d.

\documentclass[11pt, a4paper]{scrartcl}
\usepackage{tabularx}
\begin{document}

\begin{tabularx}{\textwidth}{p{3cm} X}
\hline
a & b\\
c & d\\
\begin{minipage}{\textwidth}
\begin{tabularx}{\textwidth}{p{3cm} X}
g & h \\
i & j \\
\end{tabularx}
\end{minipage}
}\\
e & f \\
\hline
\end{tabularx}

\end{document}

-

There's probably more than one way to achieve what you're trying to get, but I think the easiest solution is to reduce the width of the p column in the "inner" tabularx group by the combined widths of \quad (1 em) and \tabcolsep. The following MWE does this:

\documentclass[11pt,a4paper]{scrartcl}
\usepackage{tabularx,calc}
\begin{document}

\begin{tabularx}{\textwidth}{p{3cm} X}
\hline
a & b\\
c & d\\
\begin{minipage}{\textwidth}
\begin{tabularx}{\textwidth}{p{3cm-1em-\tabcolsep} X}
g & h \\
i & j \\
\end{tabularx}
\end{minipage} }\\
e & f \\
\hline
\end{tabularx}
\end{document}

-

You need to modify the width of the first column in your "inner tabularx" to accommodate for the tabular column separation as well as your indentation using \quad. This length arithmetic is made possible by the calc package:

\documentclass{article}
\usepackage{tabularx}% http://ctan.org/pkg/tabularx
\usepackage{calc}% http://ctan.org/pkg/calc
\begin{document}
\noindent\begin{tabularx}{\textwidth}{p{3cm} X}
\hline
a & b\\
c & d\\
\begin{minipage}{\linewidth}