# Align top with multirow tables in Lyx 2.0

I'm having trouble doing vertical alignment in tables with multirow in Lyx. I have data that is in a 'tree' format that I need to present in tables. I would like Category 1, Subcategory 1.1 and Value 1 to all align vertically, same for Category 2, subcategory 2.1 etc. Any tips? The normal 'align top' option is disabled in Lyx as soon as I use multirow.

This is the latex source created by my lyx file:

% Preview source code

%% Do not edit unless you really know what you are doing.
\documentclass[english]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{array}
\usepackage{multirow}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

\makeatother

\usepackage{babel}
\begin{document}
\begin{tabular*}{1\columnwidth}{@{\extracolsep{\fill}}>{\raggedright}m{0.33\columnwidth}>{\raggedright}m{0.33\columnwidth}>{\centering}p{0.33\columnwidth}}
Column 1 & Column 2 & Column 3\tabularnewline
\multirow{4}{0.33\columnwidth}{Category 1 With very long text that wraps} & \multirow{2}{0.33\columnwidth}{Subcategory 1.1} & Value 1\tabularnewline
&  & Value 2\tabularnewline
& \multirow{2}{0.33\columnwidth}{Subcategory 1.2} & Value 3\tabularnewline
&  & Value 4\tabularnewline
\multirow{2}{0.33\columnwidth}{Category 2} & Subcategory 2.1 & Value 5\tabularnewline
& Subcategory 2.2 & Value 6\tabularnewline
\end{tabular*}
\end{document}

-

I am not sure about the alignment that you desire; perhaps something like this?

\documentclass[english]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{array}
\usepackage{multirow}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

\makeatother

\usepackage{babel}
\begin{document}

\begin{tabular*}{1\columnwidth}{@{\extracolsep{\fill}}>{\raggedright}m{0.33\columnwidth}>{\raggedright}m{0.33\columnwidth}>{\centering}p{0.33\columnwidth}}
Column 1 & Column 2 & Column 3\tabularnewline
\multirow{2}{0.33\columnwidth}{Category 1 With very long text that wraps} & Subcategory 1.1 & Value 1\tabularnewline
&  & Value 2\tabularnewline
& Subcategory 1.2 & Value 3\tabularnewline
&  & Value 4\tabularnewline
Category 2 & Subcategory 2.1 & Value 5\tabularnewline
& Subcategory 2.2 & Value 6\tabularnewline
\end{tabular*}

\end{document}

-
medina Thanks. That works. It is a little clunky though having to manually chose the number of lines to make each multirow depending on the length of text - means redoing in case of changing the font size for example. In the past, vertical alignment did seem to work in multirow cells in Lyx, so not sure what has change. Thanks though - sorted for now! –  moabi2000 Jun 18 '11 at 15:41