# Rotated Text in Table Extending into Rows in Lyx

I'm trying to create a table with some rotated text in it, but the rotated text is extending into the rows below the cell, as shown here:

Here is what my screen looks like in Lyx:

I've tried using multirow, multicolumn, and rotatetext to no avail. Right now the cells in the left-most column are rotated by using the Rotate cell by 90 function in Lyx.

• Well, a solution depends on the text to be rotated. You can increase the rows height, or rotate some multiline \parbox (easy to do with the makecell package). – Bernard Dec 11 '14 at 23:20
• @Bernard, Thanks for your comment. My text is roughly the same width as that shown in the figures above. So any commands you have should be helpful. Please let me know. – Veridian Dec 11 '14 at 23:43
• Could you post a minimal example. The solutions can be very specific, or be a blend of several techniques. – Bernard Dec 12 '14 at 0:05
• @Bernard, my example is posted in my question. I put it there to help and show what I've done. I'm using Lyx. – Veridian Dec 12 '14 at 0:13

Here is a way. I use the makecell and rotating packages, plus hhline (the ordinary horizontal last line and vertical first line do not join well) and caption (for a correct vertical spacing between caption and table):

\documentclass{article}%
\usepackage{graphicx}
\usepackage[ margin = 2.5cm]{geometry}
\usepackage{tabularx, booktabs, array, rotating, multirow}
\ usepackage{hhline}
\usepackage{makecell}
\setcellgapes{3pt}

\begin{document}

\noindent\setlength\tabcolsep{4pt}\footnotesize\makegapedcells
\begin{tabularx}{\linewidth}{l|l*{3}{|X}|}
\cline{3-5}
\cline{2-5}
\multirowcell{9}[-2pt]{ \rotatebox{90}{{Lorem Ipsum}}} & Lorem Ipsum & & & \\
\cline{2-5}
& Lorem Ipsum & & & \\
\cline{2-5}
& Lorem Ipsum & & & \\
\cline{2-5}
& Lorem Ipsum & & & \\
\cline{2-5}
& Lorem Ipsum & & & \\
\cline{2-5} & Lorem Ipsum & & & \\
\hhline{~|----|}
\end{tabularx}
\end{document}


• Thanks for your response. It's insane to me that no one has written a basic table generation package that can center text properly like is done in Excel. I'm sure the problem isn't trivial, but it boggles my mind this doesn't exist. – Veridian Dec 12 '14 at 5:14
• Do you mean centre a rotated text in a table? The problem comes mainly from multirow, which very often requires some manual adjustment. – Bernard Dec 12 '14 at 11:21
• Yes, and that is what I had to do in my code eventually, I had to use a bunch of manual adjustment. I had to use these commands get the rotated text on two lines and the ~ symbol for spacing \rotatebox[origin=c]{90}{ Lorem Ipsum ~~~} \rotatebox[origin=c]{90}{ Lorem Ipsum Ipsum ~~~} – Veridian Dec 12 '14 at 16:20