GeneralAlignment in \multirow cells

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Pere Callahan
Posts: 6
Joined: Sun Jun 01, 2008 2:34 pm

Alignment in \multirow cells

Post by Pere Callahan »

Hi,
I played around a little with tables and in particular with \multirow to create cells that span multiple rows.

I created a table construct, and in each cell I would like to have a (horizontally and vertically) centered minipage. I tried the following:

Code: Select all

\documentclass[11pt,a4paper]{article}

\usepackage{array}
\usepackage{multirow}

\begin{document}
\begin{tabular}{|m{.2\textwidth}|m{.2\textwidth}|m{.4\textwidth}|m{.2\textwidth}|}
\hline
	 \begin{minipage}[c]{.2\textwidth}\begin{center}\rule{5pt}{5pt}\end{center}\end{minipage} 
	&\begin{minipage}[c]{.2\textwidth}\begin{center}\rule{20pt}{20pt}\end{center}\end{minipage} 
	&\multirow{2}{*}{\begin{minipage}[c]{.4\textwidth}\begin{center}\rule{10pt}{10pt}\end{center}\end{minipage}} 
	&\multirow{2}{*}{\begin{minipage}[c]{.2\textwidth}\begin{center}\rule{10pt}{10pt}\end{center}\end{minipage}} \\
\cline{1-3}
	 \begin{minipage}[c]{.2\textwidth}\begin{center}\rule{5pt}{5pt}\end{center}\end{minipage} 
	&\begin{minipage}[c]{.2\textwidth}\begin{center}\rule{20pt}{20pt}\end{center}\end{minipage} 
	& 
	& \\
\hline
\end{tabular}
\end{document}
The third column is a a multirow like the fourth one. In the third and fourth row the black box is not vertically centered and I have no idea why this is so... it should be exactly on the same height as the horizontal line, but that's clearly not the case in my axample.

Thanks for any help.

Pere

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
Post Reply