Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
Thanks a lot, this was what I was looking for. –  user1335014 Feb 13 '13 at 13:40
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.