2

I'm trying to reproduce the following tabular design as close as possible:

enter image description here

This is what I have right now:

\documentclass[12pt,a4paper]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}

\begin{document}
    \begin{tabularx}{\textwidth}{X X X X X X}
        \hline
        \multicolumn{3}{|Y|}{Width 1/2} & \multicolumn{3}{Y|}{Width 1/2} \\
        \hline
        \multicolumn{3}{|X|}{
            \begin{itemize}
                \item Item 1
                \item Item 2
                \item Item 3
            \end{itemize}
        } & \multicolumn{3}{X|}{
            \begin{itemize}
                \item Item 1
                \item Item 2
                \item Item 3
            \end{itemize}
        } \\
        \hline
        \multicolumn{6}{|Y|}{Width 1} \\
        \hline
        \multicolumn{6}{|X|}{
            \begin{itemize}
                \item Item 1
                \item Item 2
                \item Item 3
            \end{itemize}
        } \\
        \hline
        \multicolumn{2}{|Y|}{Width 1/3} & \multicolumn{2}{Y|}{Width 1/3} & \multicolumn{2}{Y|}{Width 1/3} \\
        \hline
        \multicolumn{2}{|Y|}{
            \begin{itemize}
                \item Item 1
                \item Item 2
                \item Item 3
            \end{itemize}
        } & \multicolumn{2}{Y|}{
            \begin{itemize}
                \item Item 1
                \item Item 2
                \item Item 3
            \end{itemize}
        } & \multicolumn{2}{Y|}{
            \begin{itemize}
                \item Item 1
                \item Item 2
                \item Item 3
            \end{itemize}
        } \\
        \hline
    \end{tabularx}
\end{document}

However I end up with this:

  • The column width is not working
  • Text is not vertically centered
  • I'm not sure if the text in the cells will linebreak

How can I improve the result? I'm close to using Word/Excel for this...

Result

3

A slight improvement with vertical centring of the cell contents and a title:

\documentclass[12pt,x11names, a4paper]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{array}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\setlength\extrarowheight{3pt}
\usepackage{ragged2e}
\usepackage{xcolor, colortbl}
\usepackage{etoolbox}

\usepackage{enumitem}
\AtBeginEnvironment{tabular}{%
\setlist[itemize, 1,2]{label=\color{LightSteelBlue3}\textbullet, leftmargin = 0.8em,nosep, before =\leavevmode\vspace{-\baselineskip}\RaggedRight, after=\leavevmode\vspace{\dimexpr-\baselineskip + \extrarowheight\relax},}%itemsep=1pt, , topsep=0pt,
}
\begin{document}
\noindent
    \begin{tabular}{cccccc}
        \hline
        \multicolumn{6}{|c|}{\cellcolor{LightSteelBlue3}\sffamily\bfseries\color{white}Title}\\
        \hline
        \multicolumn{3}{|p{\dimexpr(\textwidth-3\arrayrulewidth-4\tabcolsep)/2\relax}|}{
            \begin{itemize}
                \item Item 1
                \item Item 2
                \item Item 3
            \end{itemize}
        } & \multicolumn{3}{|p{\dimexpr(\textwidth-3\arrayrulewidth-4\tabcolsep)/2\relax}|}{
            \begin{itemize}
                \item Item 1
                \item Item 2
                \item Item 3
            \end{itemize}
        } \\
        \hline
        \multicolumn{6}{|c|}{Width 1} \\
        \hline
        \multicolumn{6}{|p{\dimexpr\textwidth-2\arrayrulewidth-2\tabcolsep\relax}|}{
            \begin{itemize}
                \item Item 1
                \item Item 2
                \item Item 3
            \end{itemize}
        } \\
        \hline
        \multicolumn{2}{|c|}{Width 1/3} & \multicolumn{2}{c|}{Width 1/3} & \multicolumn{2}{c|}{Width 1/3} \\
        \hline
        \multicolumn{2}{|p{\dimexpr(\textwidth-4\arrayrulewidth-6\tabcolsep)/3\relax}|}{
            \begin{itemize}
                \item Item 1
                \item Item 2
                \item Item 3
            \end{itemize}
        } & \multicolumn{2}{p{\dimexpr(\textwidth-4\arrayrulewidth-6\tabcolsep)/3\relax}|}{
            \begin{itemize}
                \item Item 1
                \item Item 2
                \item Item 3
            \end{itemize}
        } & \multicolumn{2}{p{\dimexpr(\textwidth-4\arrayrulewidth-6\tabcolsep)/3\relax}|}{
            \begin{itemize}
                \item Item 1
                \item Item 2
                \item Item 3
            \end{itemize}
        } \\
        \hline
    \end{tabular}
\end{document} 

enter image description here

3

You really don't want tabularx here as you know in advance how wide you want the columns to be. Your attempt failed as tabularx essentially does some calculations and then replaces every X by p{x} for some width x (the same value in every case) but you want cells that are half, full or third width.

enter image description here

\documentclass[12pt,a4paper]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{array}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\setlength\extrarowheight{3pt}
\begin{document}
\noindent
    \begin{tabular}{cccccc}
        \hline
        \multicolumn{6}{|c|}{Title}\\
        \hline
        \multicolumn{3}{|p{\dimexpr(\textwidth-3\arrayrulewidth-4\tabcolsep)/2\relax}|}{
            \begin{itemize}
                \item Item 1
                \item Item 2
                \item Item 3
            \end{itemize}
        } & \multicolumn{3}{|p{\dimexpr(\textwidth-3\arrayrulewidth-4\tabcolsep)/2\relax}|}{
            \begin{itemize}
                \item Item 1
                \item Item 2
                \item Item 3
            \end{itemize}
        } \\
        \hline
        \multicolumn{6}{|c|}{Width 1} \\
        \hline
        \multicolumn{6}{|p{\dimexpr\textwidth-2\arrayrulewidth-2\tabcolsep\relax}|}{
            \begin{itemize}
                \item Item 1
                \item Item 2
                \item Item 3
            \end{itemize}
        } \\
        \hline
        \multicolumn{2}{|c|}{Width 1/3} & \multicolumn{2}{c|}{Width 1/3} & \multicolumn{2}{c|}{Width 1/3} \\
        \hline
        \multicolumn{2}{|p{\dimexpr(\textwidth-4\arrayrulewidth-6\tabcolsep)/3\relax}|}{
            \begin{itemize}
                \item Item 1
                \item Item 2
                \item Item 3
            \end{itemize}
        } & \multicolumn{2}{p{\dimexpr(\textwidth-4\arrayrulewidth-6\tabcolsep)/3\relax}|}{
            \begin{itemize}
                \item Item 1
                \item Item 2
                \item Item 3
            \end{itemize}
        } & \multicolumn{2}{p{\dimexpr(\textwidth-4\arrayrulewidth-6\tabcolsep)/3\relax}|}{
            \begin{itemize}
                \item Item 1
                \item Item 2
                \item Item 3
            \end{itemize}
        } \\
        \hline
    \end{tabular}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.