[Tex/LaTex] vertical alignment of multirow tables in lyx

lyxtablesvertical alignment

After having searched a lot, I still didn't find an option to align multirow cells vertically correctly in Lyx' native tables. There seem to be some solutions but I haven't found any for use with Lyx native tables without individually adjusting the vertical displacement.

I created an example file to show what I mean and the corresponding rendering. The code in Lyx is as followed:

\begin{table}
\begin{centering}
\begin{tabular*}{1\textwidth}{@{\extracolsep{\fill}}>{\raggedright}m{0.2\textwidth}>{\raggedright}m{0.4\textwidth}>{\raggedright}m{0.3\textwidth}}
\toprule 
\addlinespace
\textbf{Typ} & \textbf{Technologie} & \textbf{Materialien}\tabularnewline\addlinespace
\midrule 
\addlinespace
Extrusion & Fused Deposition Molding (FDM) & Thermoplaste (z.B. PLA, ABS), HDPE, eutektische Metalle, Gummi, Ton,
Knetmasse\tabularnewline\addlinespace
\midrule 
\addlinespace
Draht & Electron Beam Freeform Fabrication (EBF) & fast jede Metalllegierung\tabularnewline\addlinespace
\midrule 
\addlinespace
\multirow{5}{0.2\textwidth}{Granulate } & Direct metal laser sintering (DMLS) & fast jede Metalllegierung\tabularnewline\addlinespace
\cmidrule{2-3} 
\addlinespace
 & Electron-beam melting (EBM) & Titanlegierungen\tabularnewline\addlinespace
\cmidrule{2-3} 
\addlinespace
 & Selective laser melting (SLM) & Titanlegierungen, Kobalt-Chrom-Legierungen, stainless-steel, Aluminium\tabularnewline\addlinespace
\cmidrule{2-3} 
\addlinespace
 & Selective heat sintering (SHS) & thermoplastisches Pulver\tabularnewline\addlinespace
\cmidrule{2-3} 
\addlinespace
 & Selective laser sintering (SLS) & Thermoplasten, Metallpulver, keramische Pulver\tabularnewline\addlinespace
\midrule 
\addlinespace
\multirow{2}{0.2\textwidth}{Pulverbett mit Inkjetkopf} & Plaster based 3D printing (PP) & Gips mit Wasser als Binder\tabularnewline\addlinespace
\cmidrule{2-3} 
\addlinespace
 & kein einheitlicher Name findbar & Sand/Kunststoff mit Binder\tabularnewline\addlinespace
\midrule 
\addlinespace
Laminiert & Laminated object manufacturing (LOM) & Papier, Metallfolie, Plastikfilm\tabularnewline\addlinespace
\midrule 
\addlinespace
\multirow{2}{0.2\textwidth}[-2mm]{Photoaktivierte Polymerisation} & Stereolithographie (SLA) & \multirow{2}{0.3\textwidth}{Photopoylmere}\tabularnewline\addlinespace
\cmidrule{2-2} 
\addlinespace
 & Digital Light Processing (DLP) & \tabularnewline\addlinespace
\bottomrule
\end{tabular*}
\par\end{centering}

\protect\caption{Übersicht über verschiedene additive Fertigungsverfahren in Anlehnung
an \cite{wikipedia20143Dprinting}. \label{tab:=0000DCbersicht =0000FCber verschiedene additive Fertigungsverfahren}}
\end{table}

Focus on the word "granulate"

example rendering of Table Code

You can download the working example here: Working Lyx example

In this question here, they showed how to use the second optional argument but isn't there an automatic way?

Best Answer

You must count not the number of rows, but the number of lines in case of multiline cells, plus an adjustement corresponding to the number of \addlinespace commands and to the thickness of \midrules. However this is only theoretical. For instance, I chose not to put "granulate" in the middle of its multirow cell, but aligned with "Selective laser melting" in the next column, as to the eye it appears as the vertical centre of the table. But you can try the version "vertically centred" if you wish: just comment the corresponding line and uncomment the line above.

Also, note the centering environment does not exist. It's the \centering command that you have to use.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage{array, multirow, booktabs}
\usepackage{amsmath}

\pagestyle{empty}

\begin{document}

\begin{table}
\centering
\begin{tabular*}{1\textwidth}{@{\extracolsep{\fill}}>{\raggedright}m{0.2\textwidth}>{\raggedright}m{0.4\textwidth}>{\raggedright}m{0.3\textwidth}}
\toprule
\addlinespace
\textbf{Typ} & \textbf{Technologie} & \textbf{Materialien}\tabularnewline\addlinespace
\midrule
\addlinespace
Extrusion & Fused Deposition Molding (FDM) & Thermoplaste (z.B. PLA, ABS), HDPE, eutektische Metalle, Gummi, Ton,
Knetmasse\tabularnewline\addlinespace
\midrule
\addlinespace
Draht & Electron Beam Freeform Fabrication (EBF) & fast jede Metalllegierung\tabularnewline\addlinespace
\midrule
\addlinespace%
%\multirow{13}{0.2\textwidth}[\dimexpr-5\defaultaddspace-4\lightrulewidth]{Granulate } & Direct metal laser sintering (DMLS) & fast jede Metalllegierung\tabularnewline\addlinespace
\multirow{13}{0.2\textwidth}[\dimexpr-2\defaultaddspace + 3\lightrulewidth\relax]{Granulate } & Direct metal laser sintering (DMLS) & fast jede Metalllegierung\tabularnewline\addlinespace
\cmidrule{2-3}
\addlinespace
 & Electron-beam melting (EBM) & Titanlegierungen\tabularnewline\addlinespace
\cmidrule{2-3}
\addlinespace
 & Selective laser melting (SLM) & Titanlegierungen, Kobalt-Chrom-Legierungen, stainless-steel, Aluminium\tabularnewline\addlinespace
\cmidrule{2-3}
\addlinespace
 & Selective heat sintering (SHS) & thermoplastisches Pulver\tabularnewline\addlinespace
\cmidrule{2-3}
\addlinespace
 & Selective laser sintering (SLS) & Thermoplasten, Metallpulver, keramische Pulver\tabularnewline\addlinespace
\midrule
\addlinespace
\multirow{4}{0.2\textwidth}{Pulverbett mit Inkjetkopf} & Plaster based 3D printing (PP) & Gips mit Wasser als Binder\tabularnewline\addlinespace%
\cmidrule{2-3}
\addlinespace
 & kein einheitlicher Name findbar & Sand/Kunststoff mit Binder\tabularnewline\addlinespace
\midrule
\addlinespace
Laminiert & Laminated object manufacturing (LOM) & Papier, Metallfolie, Plastikfilm\tabularnewline\addlinespace
\midrule
\addlinespace
\multirow{2}{0.2\textwidth}[-\defaultaddspace]{Photoaktivierte Polymerisation} & Stereolithographie (SLA) & \multirow{2}{0.3\textwidth}[-\defaultaddspace]{Photopoylmere}\tabularnewline\addlinespace
\cmidrule{2-2}
\addlinespace
 & Digital Light Processing (DLP) & \tabularnewline\addlinespace
\bottomrule
\end{tabular*}
\protect\caption{Übersicht über verschiedene additive Fertigungsverfahren in Anlehnung%
an \cite{wikipedia20143Dprinting}. \label{tab:=0000DCbersicht =0000FCber verschiedene additive Fertigungsverfahren}}
\end{table}

\end{document} 

enter image description here