0

I have some issues with the vertical alignment of \makecell headers for a longtable. Basically, what I'm trying to achieve is that the single lettera A, B and E are vertically centered while the other cells remain at the bottom. I've increased the row height to show the effect.

enter image description here

MWE:

\documentclass[10pt]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{newpxtext}
    \linespread{1.05}
\usepackage[left=32.5mm, right=25mm, top=25mm, bottom=20mm]{geometry}
\usepackage{multirow}
\usepackage{makecell}
\usepackage{longtable}
\usepackage{ragged2e}
\newcolumntype{P}[1]{>{\RaggedRight\hspace{0pt}}p{#1}}
\newcolumntype{M}[1]{>{\centering}p{#1}}
\usepackage{pdflscape}
\newcommand{\rotl}{\rotatebox{90}}

\begin{document}

\begin{landscape}
    \setlength\tabcolsep{3.3pt}
    \renewcommand{\arraystretch}{1.3}
    \centering\footnotesize
    \begin{longtable}{|M{1.4cm}|M{1.4cm}|P{2.2cm}|P{1.5cm}|P{2cm}|M{0.4cm}|P{2cm}|M{0.4cm}|P{2cm}|M{0.4cm}|M{0.4cm}|P{2cm}|P{1.6cm}|P{1.5cm}|M{0.4cm}|M{0.4cm}|c|}
        \hline
        \multicolumn{2}{|c|}{} &  &  &  &  & \multicolumn{5}{c|}{IST Zustand} &  &  & \multicolumn{4}{c|}{optimierter Zustand} \\
        \cline{7-10} \cline{14-16}
        \multicolumn{2}{|c|}{\makecell[b]{Prozesselement/\\Funktion}} & \makecell[c]{mögliche Feheler} & \makecell[c]{Fehlerfolge} & \makecell[b]{Fehlerursache} & \makecell[c]{B} & \makecell[b]{Vermeidungs-\\maßnahme} & \makecell[c]{A} & \makecell[b]{Entdeckungs-\\maßnahme} & \makecell[c]{E} & \rotl{RPZ} & \multicolumn{1}{l|}{\makecell[b]{empfohlene\\Abstellmaßnahme}} & \makecell[b]{Verantwort-\\lich/Termin} & \makecell[b]{umgesetzte\\Maßnahme} & \makecell[t]{A} & E & \rotl{RPZ} \\[3mm]
        \hline
    \end{longtable}
\end{landscape}

\end{document}
2
  • Do you want "B" to be vertically centered with respect to the two lines of "Vermeidungs-\\maßnahme" or with respect to "Vermeidungs-\\maßnahme" and "IST-Zustand"?
    – leandriis
    May 13, 2020 at 18:30
  • 1
    Like that? i.stack.imgur.com/Saahd.png (\multicolumn{2}{|c|}{\makecell[c]{Prozesselement/\\Funktion}} & \makecell[c]{\\mögliche Feheler} & \makecell[c]{\\Fehlerfolge} & \makecell[c]{\\Fehlerursache} & \makecell[c]{B} & \makecell[c]{Vermeidungs-\\maßnahme} & \makecell[c]{A} & \makecell[c]{Entdeckungs-\\maßnahme} & \makecell[c]{E} & \rotl{RPZ} & \multicolumn{1}{l|}{\makecell[c]{empfohlene\\Abstellmaßnahme}} & \makecell[c]{Verantwort-\\lich/Termin} & \makecell[c]{umgesetzte\\Maßnahme} & \makecell[c]{A} & E & \rotl{RPZ} \\ )
    – leandriis
    May 13, 2020 at 18:34

1 Answer 1

1

You don't really need al this plethora of \makecells:

\documentclass[10pt, german]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{rotating}
\usepackage{newpxtext}
    \linespread{1.05}
\usepackage[left=32.5mm, right=25mm, top=25mm, bottom=20mm]{geometry}
\usepackage{multirow}
\usepackage{makecell}
\usepackage[column=O]{cellspace}
\setlength{\cellspacetoplimit}{4pt}
\setlength{\cellspacebottomlimit}{3pt}
\usepackage{longtable}
\usepackage{ragged2e}
\newcolumntype{P}[1]{>{\RaggedRight\hspace{0pt}}O{m{#1}}}
\newcolumntype{M}[1]{O{>{\centering}m{#1}}}
\usepackage{pdflscape}
\newcommand{\rotl}{\rotatebox[origin=c]{90}}
\newcommand{\nl}{\newline}

\begin{document}

\begin{landscape}
    \setlength\tabcolsep{3pt}
    \renewcommand{\arraystretch}{1.3}
    \centering\footnotesize%
    \begin{longtable}{|M{1.4cm}|M{1.4cm}|P{2.2cm}|P{1.5cm}|P{2cm}|M{0.4cm}|P{2cm}|M{0.4cm}|P{2cm}|M{0.4cm}|M{0.4cm}|P{2.3cm}|P{1.5cm}|P{1.5cm}|M{0.4cm}|M{0.4cm}|c|}
        \hline
        \multicolumn{2}{|c|}{} & & & & & \multicolumn{5}{c|}{IST Zustand} & & & \multicolumn{4}{c|}{optimierter Zustand} \\
        \cline{7-10} \cline{14-16}
        \multicolumn{2}{|c|}{\makecell{Prozesselement/\\Funktion}} & \nl mögliche Feheler & \nl Fehlerfolge & \nl Fehlerursache & B & Vermeidungs\-maßnahme & A & Entdeckungs\-maßnahme & E & \rotl{ RPZ} & \centering empfohlene\nl Abstellmaßnahme & Verantwort\-lich/Termin &umgesetzte\nl Maßnahm & A & E & \rotl{RPZ} \\
        \hline
    \end{longtable}
\end{landscape}

\end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.