2

I'm having this MWE and want to horizontally and vertically center the x's in the last row (the numbers are for debugging purpose only). I've tried an appraoch with

\newlength{\xlength}
\settowidth{\xlength}{x}

and in column type defintion

>{\centering\arraybackslash}m{\xlength} 

But it doesn't do the trick. What's wrong? What should I do. MWE:

\documentclass[12pt,a4paper,BCOR5mm]{scrbook}

\usepackage{booktabs}
\usepackage{multirow}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{rotating}
\usepackage{colortbl}

\newcommand\rota[1]{\rotatebox{90}{#1\ }}
\newcommand*\dimension[2]{\multicolumn{#1}{D}{\rota{#2}}}
\newcommand*\charakteristik[1]{\multicolumn{1}{C}{\rota{#1}}}

\begin{document}

%\begin{spacing}{0.8}
\newlength{\sep}
\setlength{\sep}{1.5pt}
\setlength{\tabcolsep}{\sep}
\setlength{\extrarowheight}{5pt}

%/Fonts#Sizing_text
\newcolumntype{O}{>{\small}p{1.6cm}}
\newcolumntype{D}{>{\small}c}
\newcolumntype{C}{>{\scriptsize}c}

\definecolor{Gray}{gray}{0.9}
\newcolumntype{W}{>{\columncolor{white}}C}
\newcolumntype{G}{>{\columncolor{Gray}}C}

\begin{longtabu}{O*{22}{WG}W}
\toprule
& \dimension{6}{Plattform} & \dimension{3}{Multi-User} 
& \dimension{2}{Export} & \dimension{2}{Import} 
& \dimension{4}{Benutzerführung} & \dimension{2}{Sprachen}
& \dimension{3}{Kollaboration} & \dimension{3}{Kosten} 
& \dimension{3}{Support} & \dimension{3}{Registrierung} 
& \dimension{2}{Canvas Typen} & \dimension{2}{Custom Canvas} 
& \dimension{10}{Finanzübersicht}\\ 
\cmidrule(r{1.5pt}){1-10} 
\cmidrule(l{1.5pt}r{1.5pt}){11-20} 
\cmidrule(l{1.5pt}r{1.5pt}){21-30} 
\cmidrule(l{1.5pt}r{1.5pt}){31-40} 
\cmidrule(l{1.5pt}){41-46} 

& \charakteristik{Windows} & \charakteristik{Mac} 
& \charakteristik{Linux} & \charakteristik{Webbrowser} 
& \charakteristik{iOS} & \charakteristik{Android}
& \charakteristik{keine} & \charakteristik{seriell} 
& \charakteristik{parallel}& \charakteristik{Daten} 
& \charakteristik{Grafik}& \charakteristik{kein} 
& \charakteristik{Daten}& \charakteristik{Daten} 
& \charakteristik{Grafik}& \charakteristik{kein} 
& \charakteristik{Daten}& \charakteristik{Windows} 
& \charakteristik{Mac} & \charakteristik{Linux} 
& \charakteristik{Webbrowser} & \charakteristik{iOS} 
& \charakteristik{Android}& \charakteristik{keine} 
& \charakteristik{seriell} & \charakteristik{parallel}
& \charakteristik{Daten} & \charakteristik{Grafik}
& \charakteristik{kein} & \charakteristik{Daten}
& \charakteristik{Daten} & \charakteristik{Grafik}
& \charakteristik{kein} & \charakteristik{Daten}
& \charakteristik{kein} & \charakteristik{Daten}
& \charakteristik{Daten} & \charakteristik{Grafik}
& \charakteristik{kein} & \charakteristik{Daten}
& \charakteristik{Daten}& \charakteristik{Daten} 
& \charakteristik{Daten}& \charakteristik{Daten} 
& \charakteristik{Grafik} \\ \midrule

1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 0 & 1 & 2 & 3 & 4 & 5 & 6 \\
Long name that can be word wraped if needed & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x \\
\end{longtabu}
\end{document}

1 Answer 1

1

Define the first column to be a m column like

\newcolumntype{O}{>{\small}m{1.6cm}}

BTW, why you are using longtabu when just longtable would do the job? Also, there is no support to tabu package as claimed by its author.

\documentclass[12pt,a4paper,BCOR5mm]{scrbook}

\usepackage{booktabs}
\usepackage{multirow}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{rotating}
\usepackage{colortbl}

\newcommand\rota[1]{\rotatebox{90}{#1\ }}
\newcommand*\dimension[2]{\multicolumn{#1}{D}{\rota{#2}}}
\newcommand*\charakteristik[1]{\multicolumn{1}{C}{\rota{#1}}}

\begin{document}

%\begin{spacing}{0.8}
\newlength{\sep}
\setlength{\sep}{1.5pt}
\setlength{\tabcolsep}{\sep}
\setlength{\extrarowheight}{5pt}

%/Fonts#Sizing_text
\newcolumntype{O}{>{\small}m{1.6cm}}
\newcolumntype{D}{>{\small}c}
\newcolumntype{C}{>{\scriptsize}c}

\definecolor{Gray}{gray}{0.9}
\newcolumntype{W}{>{\columncolor{white}}C}
\newcolumntype{G}{>{\columncolor{Gray}}C}

\begin{longtabu}{O*{22}{WG}W}
\toprule
& \dimension{6}{Plattform} & \dimension{3}{Multi-User}
& \dimension{2}{Export} & \dimension{2}{Import}
& \dimension{4}{Benutzerführung} & \dimension{2}{Sprachen}
& \dimension{3}{Kollaboration} & \dimension{3}{Kosten}
& \dimension{3}{Support} & \dimension{3}{Registrierung}
& \dimension{2}{Canvas Typen} & \dimension{2}{Custom Canvas}
& \dimension{10}{Finanzübersicht}\\
\cmidrule(r{1.5pt}){1-10}
\cmidrule(l{1.5pt}r{1.5pt}){11-20}
\cmidrule(l{1.5pt}r{1.5pt}){21-30}
\cmidrule(l{1.5pt}r{1.5pt}){31-40}
\cmidrule(l{1.5pt}){41-46}

& \charakteristik{Windows} & \charakteristik{Mac}
& \charakteristik{Linux} & \charakteristik{Webbrowser}
& \charakteristik{iOS} & \charakteristik{Android}
& \charakteristik{keine} & \charakteristik{seriell}
& \charakteristik{parallel}& \charakteristik{Daten}
& \charakteristik{Grafik}& \charakteristik{kein}
& \charakteristik{Daten}& \charakteristik{Daten}
& \charakteristik{Grafik}& \charakteristik{kein}
& \charakteristik{Daten}& \charakteristik{Windows}
& \charakteristik{Mac} & \charakteristik{Linux}
& \charakteristik{Webbrowser} & \charakteristik{iOS}
& \charakteristik{Android}& \charakteristik{keine}
& \charakteristik{seriell} & \charakteristik{parallel}
& \charakteristik{Daten} & \charakteristik{Grafik}
& \charakteristik{kein} & \charakteristik{Daten}
& \charakteristik{Daten} & \charakteristik{Grafik}
& \charakteristik{kein} & \charakteristik{Daten}
& \charakteristik{kein} & \charakteristik{Daten}
& \charakteristik{Daten} & \charakteristik{Grafik}
& \charakteristik{kein} & \charakteristik{Daten}
& \charakteristik{Daten}& \charakteristik{Daten}
& \charakteristik{Daten}& \charakteristik{Daten}
& \charakteristik{Grafik} \\ \midrule

1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 0 & 1 & 2 & 3 & 4 & 5 & 6 \\
Long name that can be word wraped if needed & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x & x \\
\end{longtabu}
\end{document}

enter image description here

2
  • I'm using longtabu because I wanted to use the X columntype for the first column to make it fit to \textwidth see. But then the table is too wide. Is there is any dynamic aproach?
    – Sebastian
    Aug 27, 2015 at 23:30
  • @Sebastian I too have no idea why longtabu doesn't keep X columns. Looks like a bug. As you know there is no support provided for tabu according to its author. Hence I have added a ltablex solution to your other linked question (It seemed appropriate there).
    – user11232
    Aug 28, 2015 at 0:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .