1

I am attempting to create a table where the every box in the table merges to be two columns wide and two rows tall.
I currently have the code below commanding two columns, but I have failed to combine this with two rows despite struggling with it for a couple hours (and trying similar question on this website).

\documentclass[12pt]{book}
\usepackage{multirow,array,booktabs}
\usepackage[utf8]{inputenc}
\usepackage{titlesec}

\begin{document}
\begin{center}
\begin{tabular}{ |c|c|c|c|c|c|c|c|c| }
\hline
\multicolumn{2}{|c|}{ } & S & M & T & W & T & F & S \\
\hline
\multicolumn{2}{|c|}{T} & & & & & & & \\
\hline
\multicolumn{2}{|c|}{S} & & & & & & & \\
\hline
\multicolumn{2}{|c|}{O} & & & & & & & \\
\hline
\multicolumn{2}{|c|}{R} & & & & & & & \\
\hline
\multicolumn{2}{|c|}{F} & & & & & & & \\
\hline
\multicolumn{2}{|c|}{I} & & & & & & & \\
\hline
\multicolumn{2}{|c|}{S} & & & & & & & \\
\hline
\multicolumn{2}{|c|}{J} & & & & & & & \\
\hline
\multicolumn{2}{|c|}{M} & & & & & & & \\
\hline
\multicolumn{2}{|c|}{Cl.} & & & & & & & \\
\hline
\multicolumn{2}{|c|}{T} & & & & & & & \\
\hline
\multicolumn{2}{|c|}{Ch.} & & & & & & & \\
\hline
\multicolumn{2}{|c|}{H} & & & & & & & \\
\hline
\end{tabular}
\end{center}
\end{document}
  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Mike Renfro May 24 '16 at 3:44
  • It looks like Multi-column and multi-row cells in LaTeX tables has an example of a multi-row/column cell: a \multicolumn{2}{c}{\multirow{2}{*}{Multi content}} followed by a \multicolumn{2}{c}{} on the next row. – Mike Renfro May 24 '16 at 3:45
  • It is not clear if you have \usepackage{multirow} in preamble. – Przemysław Scherwentke May 24 '16 at 3:47
  • Don't use \hline and booktabs: booktabs has its own set of horizontal rules -- e.g., \toprule, \midrule, bottomrule, and \cmidrule. booktabs was created partly because its author thought \hline produced ugly output by default. – jon May 25 '16 at 4:32
  • Do you mean that every cell of the table should be 2x2? If so, why? How would that be any different from their all being 1x1 with wider columns and deeper rows? – cfr May 26 '16 at 0:16
1

Here are two possibilities. Since you have not provided an MWE, it is hard to know what you are doing and what else you should or could be doing.

One possibiliy is to use multirow, which has the following syntax:

 \multirow{nrows}[bigstruts]{width}[fixup]{text}

I do not use the optional arguments in the example below.

Another idea is to embed a 'mini table' in the main table, which I have done with this command:

  \newcommand{\minitab}[1]{% note the use of `@{}` to skip out on the normal column sep used in tables; remove if desired
    \begin{tabular}{@{}>{\centering}p{3cm}@{}}#1\end{tabular}
  }

So, compare how these two choices differ:

\documentclass[landscape]{article}
\parindent 0pt % just for this example
\usepackage[showframe]{geometry}% just to help visualize the page layout

\usepackage{multirow}
\usepackage{array}
\newcolumntype{D}{@{}>{\centering}p{3cm}@{}}
\newcolumntype{C}{@{}>{\centering}p{1.5cm}@{}|}

\newcommand{\minitab}[1]{%
  \begin{tabular}{@{}>{\centering}p{3cm}@{}}#1\end{tabular}
}

\begin{document}

\begin{tabular}{ |D|*{8}C }
\hline

% using a 'mini table'
\minitab{ONE\\ ONE} & TWO & THREE & FOUR & FIVE & SIX & SEVEN & EIGHT & NINE \tabularnewline

% using 'multirow'
\multirow{2}*{ONE}  & TWO & THREE & FOUR & FIVE & SIX & SEVEN & EIGHT & NINE \tabularnewline
                    & TWO & THREE & FOUR & FIVE & SIX & SEVEN & EIGHT & NINE \tabularnewline

\hline
\end{tabular}

\end{document}

Normally, I would recommend loading booktabs as well and skipping on the \hline, but it is impossible to know what you are trying to do, so I've left them in this example.

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.