2

I have a table that I needed multirow for say column 2, but for column 3, I am putting the best result from column 2.

\documentclass{article}
\usepackage{tabu}
\usepackage{multirow}
\begin{document}
\begin{tabular}{ccc}
\multirow{2}{*}{A} & 4 & 4\\
                   & 5
\end{tabular}
\end{document}

Here A is vertically centered for the multirow. I would like 4 to be able to achieve this same look.

If I do & 4 & 4\\, it will be aligned at the top, and vice verse for 5.

What can I do to achieve my desired result?

1

May be I am missing something but why don't you use another multi row for 4 like

\multirow{2}{*}{A} & 4 & \multirow{2}{*}{4}\\

Code:

\documentclass{article}
\usepackage{tabu}
\usepackage{multirow}
\begin{document}
\begin{tabular}{ccc}
\multirow{2}{*}{A} & 4 & \multirow{2}{*}{4}\\
                   & 5
\end{tabular}

Another one

\begin{tabular}{ccc}
\multirow{4}{*}{A} & 4 & \multirow{4}{*}{4} \\
                   & 5 &                    \\
                   & 3 &                    \\
                   & 1 &
\end{tabular}
\end{document}

enter image description here

  • I don't know that would work. – dustin Apr 19 '14 at 23:49
  • @dustin It happens to all of us some times :) – user11232 Apr 19 '14 at 23:50
1

You can use stacks, perhaps, instead of multirow. Here I give two examples. Note: the \edef\tmp{\the\baselineskip}\setstackgap{L}{\tmp} in the preamble is necessary, because \baselineskip (the default long-stack skip) is zeroed in the tabular environment.

\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\edef\tmp{\the\baselineskip}
\setstackgap{L}{\tmp}
\usepackage{multirow}
\begin{document}
\begin{tabular}{ccc}
A & \Centerstack{4\\5} & 4
\end{tabular}

\begin{tabular}{|c|c|c|}
\hline
A & \Centerstack{1\\2\\3\\4\\5} & 4\\
\hline
\end{tabular}
\end{document}

enter image description here

  • Good answer but I was hoping for something with multirow since I already built my table (very lengthy and pain to change). If no one can provide a solution with the current set up, I will inevitably change it to your form. – dustin Apr 19 '14 at 20:47
  • @dustin Understood completely. – Steven B. Segletes Apr 19 '14 at 20:48

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.