[Tex/LaTex] Align top with multirow tables in Lyx 2.0

lyxtablesvertical alignment

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.

Example of problem

This is the latex source created by my lyx file:

% Preview source code

%% LyX 2.0.0 created this file.  For more info, see http://www.lyx.org/.
%% 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}

Best Answer

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}