9

In the tabular environment, horizontal alignment is traditionally achieved using such arguments as l, c, and r for the table spec. However, when \multirow (from package multirow) is used, the chosen alignment seems to no longer apply. This example

\documentclass{standalone}
\usepackage{multirow}

\begin{document}
\begin{tabular}{|r|p{5cm}|}
 \multirow{2}{2.3cm}{text1 text1 text1} & text2 \\
 & text3 \\
 & text4 \\
\end{tabular}
\end{document}

produces

MWE showing left-aligned text in column 1

The problem is that "text1" is left-aligned despite the fact that the first column was created using an 'r' argument to tabular. How can I specify the alignment of the text in the multirow element? For example, how could I right-align or center it instead?

1 Answer 1

14

If you specify a width in \multirow, it is essentially a p column, so you specify alignment in the same way:

\documentclass{standalone}
\usepackage{multirow}

\begin{document}
\begin{tabular}{|r|p{5cm}|}
 \multirow{2}{2.3cm}{\raggedleft text1 text1 text1} & text2 \\
 & text3 \\
 & text4 \\
\end{tabular}
\end{document}
2
  • What do you mean by "the same way"?
    – Cerran
    Feb 28, 2015 at 22:39
  • 1
    @Cerran I mean without multirow or any other package, if you want to align text in a p column or \parbox you use \centering, \raggedright, or \raggedleft. multirow works just like those standard latex constructs. Feb 28, 2015 at 22:46

You must log in to answer this question.

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