&-Zeichen blockiert vertikale Zentrierung

Tabellen und Grafiken erstellen und anordnen


Tom
Forum-Anfänger
Forum-Anfänger
Beiträge: 12
Registriert: Fr 8. Feb 2013, 22:10

&-Zeichen blockiert vertikale Zentrierung

Beitrag von Tom »

Liebe Latex-Freunde,

ich habe ein kleines Problem mit einer Tabelle. Ich habe hier nur den Tabellenkopf angegeben. Mein Problem ist, dass die multirow-Einträge wie z.B. "Verfahren", "Roboter-Typbezeichnung" usw. nicht vertikal zentriert werden. Das hängt meiner Ansicht nach mit den &-Zeichen zusammen, die ja als Platzhalter für die 2. Zeile verwendet werden müssen:
\documentclass[a4paper, 12pt]{scrreprt}

\usepackage[latin1]{inputenc}

\usepackage[T1]{fontenc}

\usepackage{rotating}

\usepackage{multirow}

\usepackage{array}

\usepackage{graphicx}

\usepackage{eurosym}

\begin{document}

\begin{sidewaystable}[htbp]
  \centering
  \caption{Beispieltabelle}
		\scalebox{.5}{
    \begin{tabular}{|>{\centering\arraybackslash} m{4cm}|>{\centering\arraybackslash} m{4cm}|>{\centering\arraybackslash} m{1,5cm}|>{\centering\arraybackslash} m{3cm}|>{\centering\arraybackslash} m{2cm}|>{\centering\arraybackslash} m{1,3cm}|>{\centering\arraybackslash} m{2,5cm}|>{\centering\arraybackslash} m{3,0cm}|>{\centering\arraybackslash} m{2,8cm}|>{\centering\arraybackslash} m{2,5cm}|>{\centering\arraybackslash} m{2,5cm}|>{\centering\arraybackslash} m{2,0cm}|>{\centering\arraybackslash} m{2,3cm}|>{\centering\arraybackslash} m{2cm}|}
    \hline
    \multirow{2}{*}{\parbox{5.4cm}{\centering \textbf{Verfahren}}} & 
		\multirow{2}{*}{\parbox{6cm}{\centering \textbf{Roboter-\newline Typbezeichnung}}} & 
		\multirow{2}{*}{\parbox{1.5cm}{\centering \textbf{Achs-\newline anzahl}}} & 
		\multirow{2}{*}{\parbox{3cm}{\centering \textbf{Steuerungsart}}} & 
		\multirow{2}{*}{\parbox{2cm}{\centering \textbf{Nennlast\newline [kg]}}} & 
		\multirow{2}{*}{\parbox{1.3cm}{\centering \textbf{Reich-\newline weite\newline [mm]}}} & 
		\multirow{2}{*}{\parbox{2.2cm}{\centering \textbf{Wiederhol-\newline genauig-\newline keit\newline [mm]}}} & 
		\multicolumn{3}{c|}{\centering \textbf{Kapitaleinsatz}} & 
		\multirow{2}{*}{\parbox{2.5cm}{\centering \textbf{Nutzungs-\newline dauer\newline [Jahre]}}} & 
		\multicolumn{3}{c|}{\centering \textbf{Energiekosten (Strom)}} \\
\cline{8-10}
\cline{12-14}
          & & & & & & & \textbf{\centering Anschaffungs-\newline kosten\newline [\euro]} & 
					\centering \textbf{\centering Planungs-/\newline Installations-\newline kosten\newline [\euro/h]} & 
					\centering \textbf{\centering Schulungs-\newline kosten\newline [\euro]} & & 
					\centering \textbf{\centering Strom-\newline preis\newline [ct/kWh]} & 
					\centering \textbf{\centering Anschluss-\newline leistung\newline [kVA]} & 
					\textbf{\centering Energie-\newline kosten-\newline satz\newline [\euro/h]} \\
\hline
\end{tabular}
		}
  \label{tab:Beispieltabelle}
\end{sidewaystable}

\end{document}

Wisst ihr wie ich dieses Problem lösen kann? Vielen Dank schon mal im Voraus!

Viele Grüße,
Tom

esdd
Forum-Meister
Forum-Meister
Beiträge: 2561
Registriert: So 7. Feb 2010, 16:36

Beitrag von esdd »

Hallo,

hier ist ein Vorschlag ohne multirow
\documentclass[12pt]{scrreprt} 
\usepackage[T1]{fontenc}
\usepackage{selinput}
\SelectInputMappings{adieresis={ä},germandbls={ß},Euro={€}}
\usepackage[ngerman]{babel}
\usepackage{microtype}

\usepackage{rotating}
\usepackage{eurosym}
\usepackage{ragged2e}
\usepackage{array}

\newcolumntype{M}[1]{>{\hspace{0pt}\Centering\arraybackslash}m{#1}}

\begin{document} 

\begin{sidewaystable}[htbp] 
  \centering 
  \caption{Beispieltabelle}\label{tab:Beispieltabelle}
  \scalebox{.5}{%
    \begin{tabular}{%
      |M{4cm}|M{4cm}|M{1.5cm}|M{3cm}|M{2cm}|M{1.3cm}|M{2.5cm}%
      |M{3.0cm}|M{2.8cm}|M{2.5cm}|%
       M{2.5cm}%
      |M{2.0cm}|M{2.3cm}|M{2.2cm}|} 
      \hline
      \textbf{Verfahren}&\textbf{Roboter-Typbezeichnung}&\textbf{Achs"-anzahl} &
      \textbf{Steuerungsart} & \textbf{Nennlast[kg]}&\textbf{Reichweite [mm]} &
      \textbf{Wiederholgenauigkeit [mm]} & 
      \multicolumn{3}{|@{}c@{}|}{%
        \begin{tabular}{@{}M{3,0cm}|M{2.8cm}|M{2.5cm}@{}}
          \multicolumn{3}{c}{\textbf{Kapitaleinsatz}}\\
          \hline
          \textbf{Anschaffungskosten [\euro]}&
          \textbf{Planungs-/Installations"-kosten [\euro/h]} &
          \textbf{Schulungskosten [\euro]}
        \end{tabular}%
      }&
      \textbf{Nutzungsdauer [Jahre]} &
      \multicolumn{3}{|@{}c@{}|}{%
        \begin{tabular}{@{}M{2.0cm}|M{2.3cm}|M{2.2cm}@{}}
          \multicolumn{3}{c}{\textbf{Energiekosten (Strom)}}\\
          \hline
          \textbf{Strompreis [ct/kWh]}&
          \textbf{Anschlussleistung [kVA]} &
          \textbf{Energie"-kosten"-satz [\euro/h]}
        \end{tabular}%
      }\\ 
      \hline 
    \end{tabular}% 
  }%
\end{sidewaystable}

\end{document}
Gruß
Elke

Tom
Forum-Anfänger
Forum-Anfänger
Beiträge: 12
Registriert: Fr 8. Feb 2013, 22:10

Beitrag von Tom »

Hallo Elke,

das ist schon fast die Lösung! Das einzige was noch nicht so hinhaut ist, dass die horizontalen und vertikalen Striche der integrierten Tabellen noch nicht bis zum Rand gehen. Außerdem sind die Einträge unten auch nicht zentriert. Ich habe deine Lösung mal auf mein Dokument umgemünzt (das microtype-Paket hat Fehler ausgegeben, darum habe ich es weggelassen) und das kommt raus:

\documentclass[a4paper, 12pt]{scrreprt}

\usepackage[latin1]{inputenc}

\usepackage[T1]{fontenc}

\usepackage[ngerman]{babel}

\usepackage{rotating}

\usepackage{multirow}

\usepackage{array}
\newcolumntype{M}[1]{>{\hspace{0pt}\Centering\arraybackslash}m{#1}}

\usepackage{ragged2e}

\usepackage{graphicx}

\usepackage{eurosym}

\begin{document}

\begin{sidewaystable}[htbp]
  \centering
  \caption{Add caption}
		\scalebox{.5}{
    \begin{tabular}{|M{5,4cm}|M{6cm}|M{1,5cm}|M{3cm}|M{2cm}|M{1,3cm}|M{2,2cm}|M{3,0cm}|M{2,8cm}|M{2,5cm}|M{2,5cm}|M{2cm}|M{2,3cm}|M{2cm}|}
    \hline
    \textbf{Verfahren}&
		\textbf{Roboter-\newline Typbezeichnung}&
		\textbf{Achs-\newline anzahl}&
		\textbf{Steuerungsart}&
		\textbf{Nennlast\newline [kg]}&
		\textbf{Reich-\newline weite\newline [mm]}&
		\textbf{Wiederhol-\newline genauig-\newline keit\newline [mm]}&
		\multicolumn{3}{@{}c@{}|}{
			\begin{tabular}{@{}M{3,0cm}|M{2,8cm}|M{2,5cm}@{}}
				\multicolumn{3}{c}{\textbf{Kapitaleinsatz}}\\
				\hline
				\textbf{Anschaffungs-\newline kosten\newline [\euro]}&
				\textbf{Planungs-/\newline Installations-\newline kosten\newline [\euro/h]}&
				\textbf{Schulungs-\newline kosten\newline [\euro]}
			\end{tabular}
		}&
		\textbf{Nutzungs-\newline dauer\newline [Jahre]}& 
		\multicolumn{3}{@{}c@{}|}{
			\begin{tabular}{@{}M{2cm}|M{2,3cm}|M{2cm}@{}}
				\multicolumn{3}{c}{\textbf{Energiekosten (Strom)}}\\
				\hline
				\textbf{Strom-\newline preis\newline [ct/kWh]}&
				\textbf{Anschluss-\newline leistung\newline [kVA]}&
				\textbf{Energie-\newline kosten-\newline satz\newline [\euro/h]}
			\end{tabular}
		}\\
		\hline
    Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo \\
		\hline
    Hallo/Halli-\newline Hallo/Halli-\newline Hallo/Hallo/Hallo/\newline Hallo/Hallo/\newline Hallo/Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo \\
		\hline
		\multirow{2}[4]{*}{Hallo} & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo \\
		\cline{2-14}
          & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo \\
		\hline
    Hallo/Halli-\newline Hallo/Halli-\newline Hallo/Hallo/Hallo/\newline Hallo/Hallo/\newline Hallo/Hallo & 
		\multicolumn{13}{@{}c@{}|}{
		\begin{tabular}{@{}M{6cm}|M{1,5cm}|M{3cm}|M{2cm}|M{1,3cm}|M{2,2cm}|M{3,0cm}|M{2,8cm}|M{2,5cm}|M{2,5cm}|M{2cm}|M{2,3cm}|M{2cm}@{}}
			Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo \\
			\hline
			Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo
		\end{tabular}
		}\\
		\hline
    \end{tabular}%
		}
  \label{tab:addlabel}%
\end{sidewaystable}%

\end{document}
Ich hoffe du kannst mir nochmal weiterhelfen, vielen Dank schon mal im Voraus!

Viele Grüße,
Tom

Benutzeravatar
Johannes_B
Moderator
Moderator
Beiträge: 5079
Registriert: Do 1. Nov 2012, 14:55
Kontaktdaten:

Beitrag von Johannes_B »

In Elkes Code sehe ich kein einziges newline, bei dir sind es gefühlt Tausende. Diese sind unnötig. Elkes Tabelle sieht super aus, wenn man mal davon absieht, dass vertikale Linien in Tabellen eher schlecht sind.
Microtype liefert dir einen Fehler? Wäre ganz interessant zu erfahren, welcher Fehler da kommt, oder? Bei mir läuft Elkes Beispiel problemlos durch.

Vielleicht solltest du mal ein Update machen.
TeXwelt - Fragen und Antworten Schaut vorbei und stellt Fragen.
LaTeX-Vorlagen?

Der Weg zum Ziel: Ruhe bewahren und durchatmen, Beiträge und unterstützende Links aufmerksam lesen, Lösungsansätze verstehen und ggf. nachfragen.

esdd
Forum-Meister
Forum-Meister
Beiträge: 2561
Registriert: So 7. Feb 2010, 16:36

Beitrag von esdd »

Lass die \newline weg. Wenn du Einfluss auf die Worttrennung nehmen willst, dann verwende Trennhilfen. Wie das geht, findest du u.a. hier auf Seite 19 in einem Artikel von Ulrike Fischer.

Mit den vertikalen Linien hat Johannes Recht, aber ich gehe davon aus, dass du auf diese nicht verzichten willst.

Hier ist mal noch ein Vorschlag, wieder mit multirow. Je nach tatsächlichem Inhalt, ist die Tabelle mit viel manueller Anpassung und Bastelei verbunden:
\documentclass[a4paper, 12pt]{scrreprt} 

\usepackage[latin1]{inputenc} 
\usepackage[T1]{fontenc} 
\usepackage[ngerman]{babel} 
\usepackage{rotating} 

\usepackage{multirow} 
\usepackage{ragged2e}
\usepackage{array} 
\newcolumntype{M}[1]{>{\hspace{0pt}\Centering\arraybackslash}m{#1}} 
\usepackage{eurosym} 

\begin{document} 

\begin{sidewaystable}[htbp] 
  \centering 
  \caption{Add caption}\label{tab:addlabel}%
  \scalebox{.5}{ 
    \begin{tabular}{|M{5,4cm}|M{6cm}|M{1,5cm}|M{3cm}|M{2cm}|M{1,3cm}|M{2,2cm}|M{3,0cm}|M{2,8cm}|M{2,5cm}|M{2,5cm}|M{2cm}|M{2,3cm}|M{2cm}|} 
      \hline 
      \multirow{2}{5.4cm}[-\ht\strutbox]{\Centering\textbf{Verfahren}}&
      \multirow{2}{6cm}[-\ht\strutbox]{\Centering\textbf{Roboter-Typbezeichnung}}&
      \multirow{2}{1.5cm}[-\ht\strutbox]{\Centering\textbf{Achs\-anzahl}}& 
      \multirow{2}{3cm}[-\ht\strutbox]{\Centering\textbf{Steuerungsart}}& 
      \multirow{2}{2cm}[-\ht\strutbox]{\Centering\textbf{Nennlast [kg]}}& 
      \multirow{2}{1.3cm}[-\ht\strutbox]{\Centering\textbf{Reich\-weite [mm]}}& 
      \multirow{2}{2.2cm}[-\ht\strutbox]{\Centering\textbf{Wiederhol\-genauigkeit [mm]}}&
      \multicolumn{3}{|c|}{\Centering\textbf{Kapitaleinsatz}}&
      \multirow{2}{2.5cm}[-\ht\strutbox]{\Centering\textbf{Nutzungs\- dauer [Jahre]}}&
      \multicolumn{3}{|c|}{\Centering\textbf{Energiekosten (Strom)}}\\
      \cline{8-10} 
      \cline{12-14}
      &&&&&&&
           \textbf{Anschaffungs\-kosten [\euro]}& 
           \textbf{Planungs-Installations\-kosten [\euro/h]}& 
           \textbf{Schulungs\-kosten [\euro]}&
          &
           \textbf{Strom\-preis [ct/kWh]}& 
           \textbf{Anschluss\-leistung [kVA]}& 
           \textbf{Energie\-kostensatz [\euro/h]}\\
      \hline 
      Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo \\ 
      \hline 
      Hallo/Halli"-Hallo/Halli"-Hallo/Hallo/Hallo/""Hallo/Hallo/""Hallo/Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo \\ 
      \hline 
      \multirow{2}[4]{*}{Hallo} & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo \\ 
        \cline{2-14} 
        & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo & Hallo \\ 
      \hline 
      \multirow{2}[4]{5.4cm}[-\ht\strutbox]{\Centering Hallo/Halli"-Hallo/Halli"-Hallo/Hallo/Hallo/""Hallo/Hallo/""Hallo/Hallo}
        &\multirow{2}{*}{Hallo} &\multirow{2}{*}{Hallo} & \multirow{2}{*}{Hallo} &\multirow{2}{*}{Hallo} &\multirow{2}{*}{Hallo} &\multirow{2}{*}{ Hallo} &\multirow{2}{*}{Hallo} & \multirow{2}{*}{Hallo} &\multirow{2}{*}{Hallo}& \multirow{2}{*}{Hallo}& \multirow{2}{*}{Hallo}& \multirow{2}{*}{Hallo} & \multirow{2}{*}{Hallo}\\
        &&&&&&&&&&&&&\\
        \cline{2-14}
        &\multirow{2}{*}{Hallo} &\multirow{2}{*}{Hallo} & \multirow{2}{*}{Hallo} &\multirow{2}{*}{Hallo} &\multirow{2}{*}{Hallo} &\multirow{2}{*}{ Hallo} &\multirow{2}{*}{Hallo} & \multirow{2}{*}{Hallo} &\multirow{2}{*}{Hallo}& \multirow{2}{*}{Hallo}& \multirow{2}{*}{Hallo}& \multirow{2}{*}{Hallo} & \multirow{2}{*}{Hallo}\\
        &&&&&&&&&&&&&\\
      \hline 
    \end{tabular}% 
  } 
\end{sidewaystable}% 

\end{document} 
Gruß
Elke

Tom
Forum-Anfänger
Forum-Anfänger
Beiträge: 12
Registriert: Fr 8. Feb 2013, 22:10

Beitrag von Tom »

Hallo Elke,

vielen Dank für deine Lösung! Ich habe \newline jetzt weggelassen und viele multirows gebastelt und jetzt schauts ganz gut aus! Und ja, die vertikalen Linien brauch ich, denn sonst sieht das ganze besch... aus :wink:

Danke für deine Hilfe!

Viele Grüße,
Tom

Antworten