[Tex/LaTex] Horizontal lines in nested tabular environment

tables

I currently have this table:

\begin{table}
\centering
\begin{tabular}{ |c|c| }
\hline
no test & no test \\
\hline
no test & \begin{tabular}{c|c} D1 & 1.23 \\ \hline D2 & 1.23 \\ \end{tabular} \\
\hline
\end{tabular}
\end{table} 

Giving:

enter image description here

hline in the nested tabular does not span the entire cell width.

Of course multirow/multicolumn would be a choice. However, this is a "mutable" table, to which I will need to add "sub-rows" each time new data arrives, but I do not know in advance where. So, it could become something like:

enter image description here

For such purpose, multirow/multicolumn seems that would require constantly changing their row/column numbers.

How can this be solved in such a way that minimizes the work each time a new "sub-row" is added?

Thanks.

Best Answer

Something like this:

enter image description here

For this you need to eliminate table column separation in column in which you nested table. This is done with use of @{}:

\begin{table}
\centering
\begin{tabular}{ |c|@{}c@{}| }% <-- aded @{}
\hline
no test & no test \\
\hline
no test & 
    \begin{tabular}{c|c} D1 & 1.23 \\ \hline D2 & 1.23 \\ \end{tabular} \\
\hline
\end{tabular}
\end{table}
Related Question