2

I want to reproduce the following table for my bachelorthesis (Taxonomy for literature review cf. Cooper):

Taxonomy following Cooper

My first attempt was to create a table using multicolumn from the multirow package. I used 15 columns, so that the "Characteristic" column equals 3 columns and the 12 columns left in each row are good for 3 items in a row (equals multicolumn of 4) and 4 items (equals multicolumn of 3).

So my first approch to produce the rows for (1) and (2) was:

\usepackage{multirow}
\definecolor{gray}{RGB}{224,224,224}
\begin{figure}
   \centering
   \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
      \hline
      \multicolumn{3}{|>{\columncolor{gray}}c|}{focus} & 
      \multicolumn{3}{|>{\columncolor{gray}}c|}{research outcomes} &
      \multicolumn{3}{|>{\columncolor{gray}}c|}{research methods} & 
      \multicolumn{3}{|>{\columncolor{gray}}c|}{theories} & 
      \multicolumn{3}{|>{\columncolor{gray}}c|}{applications}\\
      \hline
      \multicolumn{3}{|>{\columncolor{gray}}c|}{goal} & 
      \multicolumn{4}{|>{\columncolor{gray}}c|}{integration} &
      \multicolumn{4}{|>{\columncolor{gray}}c|}{critisism} & 
      \multicolumn{4}{|>{\columncolor{gray}}c|}{central issues}\\
      \hline
   \end{tabular}
   \caption{Test}
   \label{fig:test}
\end{figure}

Which produced

enter image description here

I also tried the same using the tabularx environment, which gave me strange results.

Is there a good possibility to produce this table using multicolumns?

1 Answer 1

2

Regarding the use of multicolumn you could use the following approach that automatically calculates the widths of the columns according to the textwidth and the widest entry in the first column that has to be specified in the preamble.

\documentclass{article}
\usepackage{geometry}

\usepackage{calc}



\newlength{\longestentry}
\setlength{\longestentry}{\widthof{focus}}

\newlength{\mytablewidth}
\setlength{\mytablewidth}{\textwidth-\longestentry-2\tabcolsep-2\arrayrulewidth}

\newcolumntype{T}{>{\centering\arraybackslash}p{0.33\mytablewidth-2\tabcolsep-\arrayrulewidth}}
\newcolumntype{F}{>{\centering\arraybackslash}p{0.25\mytablewidth-2\tabcolsep-\arrayrulewidth}}


\begin{document}
\noindent
   \begin{tabular}{|p{\longestentry}cccccccccccc}
      \hline
      focus & 
      \multicolumn{3}{|F|}{research outcomes} &
      \multicolumn{3}{F|}{research methods} & 
      \multicolumn{3}{F|}{theories} & 
      \multicolumn{3}{F|}{applications}\\
      \hline
      goal & 
      \multicolumn{4}{|T|}{integration} &
      \multicolumn{4}{T|}{critisism} & 
      \multicolumn{4}{T|}{central issues}\\
      \hline
   \end{tabular}


\end{document}

enter image description here


The following is a more complete MWE that includes some more features of the desired output shown in the question (like color, white space to separate columns and rows and automated row numbering:

\documentclass{article}


\usepackage[table]{xcolor}
\usepackage{calc}
\usepackage{etoolbox}
\usepackage{array, hhline}


%%%%% longest entry of the caracteristic column %%%%%
\newlength{\longestentry}
\setlength{\longestentry}{\widthof{organisation}}

%%%%% Automatic row numbering %%%%%
\preto\tabular{\setcounter{magicrownumbers}{0}}
\newcounter{magicrownumbers}
\newcommand\rownumber{\stepcounter{magicrownumbers}\arabic{magicrownumbers}}
\newlength{\rownumberwidth}
\setlength{\rownumberwidth}{2.25em}
\newcommand{\insertrownumber}{\makebox[\rownumberwidth][r]{\bfseries(\rownumber)\space}}

%%%%% calculates the width that is left for the category columns %%%%%
\newlength{\mytablewidth}
\setlength{\mytablewidth}{\textwidth-\longestentry-2\tabcolsep-4\arrayrulewidth-4pt-\rownumberwidth}

%%%%% Introduces three new table column types and three new commands for the categroy cells %%%%%
\newcolumntype{T}{>{\centering\arraybackslash}m{0.33\mytablewidth-2\tabcolsep-\arrayrulewidth}}
\newcolumntype{F}{>{\centering\arraybackslash}m{0.25\mytablewidth-2\tabcolsep-\arrayrulewidth}}
\newcolumntype{O}{>{\centering\arraybackslash}m{0.5\mytablewidth-2\tabcolsep-\arrayrulewidth}}
\newcommand{\halfentry}[1]{\multicolumn{6}{O|}{#1}}
\newcommand{\thirdentry}[1]{\multicolumn{4}{T|}{#1}}
\newcommand{\fourthentry}[1]{\multicolumn{3}{F|}{#1}}


%%%%% Settings for horizontal lines and cellcolor %%%%%
\setlength{\doublerulesep }{4pt}
\doublerulesepcolor{white}
\newcommand{\myhline}{\hhline{-~------------}}
\newcommand{\mywhitehline}{\hhline{~~------------}\hhline{=}\hhline{~~------------}}
\definecolor{gray}{RGB}{224,224,224}


\begin{document}
\noindent
   \begin{tabular}{|@{\insertrownumber}|m{\longestentry}|@{}m{4pt}@{}|cccccccccccc}
      \myhline
      \multicolumn{1}{|>{\centering\arraybackslash}m{2.25em+\longestentry+\arrayrulewidth}|}{Characteristic} & &
      \multicolumn{12}{>{\centering\arraybackslash}m{\mytablewidth-2\tabcolsep}|}{Category}\\ %
      \mywhitehline
       focus & &
      \fourthentry{research outcomes} &
      \fourthentry{\cellcolor{gray} research methods} & 
      \fourthentry{theories} & 
      \fourthentry{applications}\\
      \myhline
       goal & &
      \thirdentry{integration} &
      \thirdentry{\cellcolor{gray}critisism} & 
      \thirdentry{central issues}\\
      \myhline
       organisation &  &
      \thirdentry{historical} &
      \thirdentry{conseptual} & 
      \thirdentry{methodological}\\
      \myhline
       perspective &  &
      \halfentry{neutral representation} &
      \halfentry{\cellcolor{gray}espousal of position}\\
      \myhline
   \end{tabular}


\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .