2

I have a table in LyX document. And I'm using multirow to span text across multiple rows. For example I might want the text to span across 2 rows, the problem occurs when it doesn't fit, then it just goes over the cell border (to third cell). Is there a way to set row height manually for single row? Or even better could is there a way to update multirow such that it will automatically enlarge cells when text inside them is too big?

This is the Lyx source for it:

\begin{tabular}{|c|c|}
\hline 
a & b\tabularnewline
\hline 
\hline 
\multirow{2}{2cm}{Text spanning over two fields} & \tabularnewline
\cline{2-2} 
 & \tabularnewline
\hline 
\end{tabular}
2
  • Please post separate questions separately
    – scottkosty
    Feb 13, 2013 at 9:33
  • Deleted the additional question Feb 13, 2013 at 10:00

1 Answer 1

3

You have to make sure, that there is enough room for the multirow. In the following example I increase the height of the second colums with a strut (sr). The code will be:

\documentclass{article}
\usepackage{multirow}

\newcommand{\sr}{\rule[-0.45cm]{0pt}{0.9cm}}
\begin{document}

\begin{tabular}{|c|c|}
\hline 
a & b\tabularnewline
\hline 
\hline 
\multirow{2}{2cm}[0.1cm]{Text spanning over two fields} &\sr one\tabularnewline
\cline{2-2} 
 & \sr two\tabularnewline
\hline 
\end{tabular}


\end{document}

I gave the \rule a depth to make the items of the second column vertically centered.

1
  • Is it also possible to vertically center text in the multirows? For example let's say I have two multirow columns: one with short text and other with long text (because of which I'll increase the room for the multirows). This means then yields that the multirow with short text is not vertically aligned, but at the top (basically at the same place as it would have been hadn't I increased the room). Feb 13, 2013 at 13:47

You must log in to answer this question.

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