# Can't make table with non-standard multicolumns

I want to create a table like this:

1. 1-st row: 2 columns, 50% each.
2. 2-nd row: 9 columns, sizes given.

I tried to use the approach from this answer:

Table with non-standard multicolumns

Created 10 X columns and united them according to scheme.

But instead of the desired outcome I got this:

\documentclass[8pt]{extarticle}
\usepackage[a5paper]{geometry}
\geometry{verbose,tmargin=1cm,bmargin=1.5cm,lmargin=0.7cm,rmargin=0.7cm}
\usepackage{array}
\usepackage{tabularx}
\setlength{\parindent}{0cm}
\begin{document}
\begin{tabularx}{\textwidth}{ |*{10}{X} }
\hline
\multicolumn{5}{|X}{50\%} & \multicolumn{5}{|X|}{50\%}\\
\hline
\multicolumn{1}{|m{12mm}}{12mm} &
\multicolumn{1}{|m{9mm}}{9mm} &
\multicolumn{1}{|m{17mm}}{17mm} &
\multicolumn{1}{|m{11mm}}{11mm} &
\multicolumn{2}{|X}{X} &
\multicolumn{1}{|m{18mm}}{18mm} &
\multicolumn{1}{|m{17mm}}{17mm} &
\multicolumn{1}{|r}{r} &
\multicolumn{1}{|r|}{r}\\
\hline
\end{tabularx}
\end{document}


How to fix?

-
If you want to specify the widths of all columns explictly you don't need (and should't use) tabularx just use tabular andp columns. as it is, the top level preamble means X corresponds to roughly p(0.1\textwidth} (ignoring tabcolsep) but your two 5 columns spans are also specified as being X so the same .1\textwidth. they could just be c –  David Carlisle May 9 '13 at 22:35

Note if you use vertical lines in multicolumns you should only use them at the left of an entry (except the first entry in the row which can have them either side) otherwise they will not line up correctly.

\documentclass[8pt]{extarticle}
\usepackage[a5paper]{geometry}
\geometry{verbose,tmargin=1cm,bmargin=1.5cm,lmargin=0.7cm,rmargin=0.7cm}
\usepackage{array}
\usepackage{tabularx}
\setlength{\parindent}{0cm}
\begin{document}
\noindent
\begin{tabularx}{\textwidth}{ |m{12mm}|m{9mm}|m{17mm}|m{11mm}|X|m{18mm}|m{17mm}|r|r|}
\hline
\multicolumn{9}{|@{}c@{}|}{\begin{tabularx}{\dimexpr\hsize-2\arrayrulewidth\relax}
{X|X}
50\% & 50\% \\
\hline
50\% & 50\% \end{tabularx}}\\
\hline
12mm &
9mm &
17mm &
11mm &
X &
18mm &
17mm &
r &
r\\
\hline
\end{tabularx}
\end{document}

-
I tried 2 rows in 50% table, separated by \hline. But there is a space between \hline and the borders of external table. I tried modifying the width of internal table: \dimexpr\hsize-2\arrayrulewidth-2\tabcolsep, but it didn't help: table broke. –  user4035 May 9 '13 at 23:54
@user4035 in that case you just need to be a bit more careful how you distribute the tabcolsep padding, so the \hline gets the correct width. I updated answer with image –  David Carlisle May 10 '13 at 0:00
Maybe a simple solution?

\documentclass[8pt]{extarticle}
\usepackage[a5paper]{geometry}
\geometry{verbose,tmargin=1cm,bmargin=1.5cm,lmargin=0.7cm,rmargin=0.7cm}
\usepackage{array}
\usepackage{tabularx}
\setlength{\parindent}{0cm}
\begin{document}
%\begin{tabularx}{\textwidth}{ |*{10}{X} }
\begin{tabularx}{\textwidth}{ |*{9}{X} }
\hline
% \multicolumn{5}{|X}{50\%} & \multicolumn{5}{|X|}{50\%}\\
\multicolumn{9}{|c|}{50\%\hfil\vline\hfil50\%\hfil } \\
\hline
\multicolumn{1}{|m{12mm}}{12mm} &
\multicolumn{1}{|m{9mm}}{9mm} &
\multicolumn{1}{|m{17mm}}{17mm} &
\multicolumn{1}{|m{11mm}}{11mm} &
% \multicolumn{2}{|X}{X} &
\multicolumn{1}{|X}{X} &
\multicolumn{1}{|m{18mm}}{18mm} &
\multicolumn{1}{|m{17mm}}{17mm} &
\multicolumn{1}{|r}{r} &
\multicolumn{1}{|r|}{r}\\
\hline
\end{tabularx}
\end{document}


-
No. If you try a multiline text inside a parbox instead of 50%, it will break. –  user4035 May 10 '13 at 0:01