1

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}
  • Please post separate questions separately – scottkosty Feb 13 '13 at 9:33
  • Deleted the additional question – user1335014 Feb 13 '13 at 10:00
2

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.

| improve this answer | |
  • 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). – user1335014 Feb 13 '13 at 13:47

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.