Misplaced \omit. in Tabelle nach centering :-/

Tabellen und Grafiken erstellen und anordnen


DK999

Misplaced \omit. in Tabelle nach centering :-/

Beitrag von DK999 »

Hi Leute!
Habe ein sehr merkwürdiges Problem.
Um Tabellen in der Breite zu beschränken und zeitgleich jedoch ein centering zu bekommen, habe ich mir einen eigenen columntype definiert
\newcolumntype{x}[1]{%
>{\centering\hspace{0pt}}p{#1}}
In meiner Tabelle klappt das auch wunderbar, nur die letzte Spalte will einfach nicht damit funktionieren.
\begin{table}[h]
\begin{tabular}{c|x{2cm}|x{2cm}|x{2cm}|x{2cm}|x{2cm}|p{2cm}|}
  \cline{2-7}
 & Minimum 6 Mbit/s bei 2m & EMV & Leitung > 2m & im \textmu C & Strom-verbrauch Zusatzhardware & Schaltungs-aufwand \\ \firsthline
\multicolumn{1}{|c|}{\ac{i2c}} & - - & - - & - - & \checkmark & & + +\\ \hline
\multicolumn{1}{|c|}{\ac{spi}} & + + & - - & - - & \checkmark & & - -\\ \hline
\multicolumn{1}{|c|}{ccTalk} & - - & + + & + + & $\times$ & + & +\\ \hline
\multicolumn{1}{|c|}{EIA-485} & + + & + + & + + & $\times$ & \checkmark & + +\\ \hline
\multicolumn{1}{|c|}{RS232} & - - & - - & + & \checkmark & & - -\\ \hline
\multicolumn{1}{|c|}{CAN} & - - & + + & + + & $\times$ & - - & +\\ \hline
\end{tabular}
\caption{Bewertung Datenbus}
\label{tab:Datenbus_Bewertung}
\end{table}
Das funktioniert
\begin{table}[h]
\begin{tabular}{c|x{2cm}|x{2cm}|x{2cm}|x{2cm}|x{2cm}|x{2cm}|}
  \cline{2-7}
 & Minimum 6 Mbit/s bei 2m & EMV & Leitung > 2m & im \textmu C & Strom-verbrauch Zusatzhardware & Schaltungs-aufwand \\ \firsthline
\multicolumn{1}{|c|}{\ac{i2c}} & - - & - - & - - & \checkmark & & + +\\ \hline
\multicolumn{1}{|c|}{\ac{spi}} & + + & - - & - - & \checkmark & & - -\\ \hline
\multicolumn{1}{|c|}{ccTalk} & - - & + + & + + & $\times$ & + & +\\ \hline
\multicolumn{1}{|c|}{EIA-485} & + + & + + & + + & $\times$ & \checkmark & + +\\ \hline
\multicolumn{1}{|c|}{RS232} & - - & - - & + & \checkmark & & - -\\ \hline
\multicolumn{1}{|c|}{CAN} & - - & + + & + + & $\times$ & - - & +\\ \hline
\end{tabular}
\caption{Bewertung Datenbus}
\label{tab:Datenbus_Bewertung}
\end{table}
Der Code gibt plötzlich eine riesen Fehlermeldung aus
! Misplaced \omit.
\multispan ->\omit
\@multispan
l.138 ...dware & Schaltungs-aufwand \\ \firsthline
I expect to see \omit only after tab marks or the \cr of
an alignment. Proceed, and I'll ignore this case.
! Misplaced \noalign.
\hline ->\noalign
{\ifnum 0=`}\fi \hrule \@height \arrayrulewidth \futurelet...
l.138 ...dware & Schaltungs-aufwand \\ \firsthline
I expect to see \noalign only after the \cr of
an alignment. Proceed, and I'll ignore this case.
! Misplaced \omit.
\multispan ->\omit
\@multispan
l.139 \multicolumn{1}{|c|}{\ac{i2c}}
& - - & - - & - - & \checkmark & & + +\...
I expect to see \omit only after tab marks or the \cr of
an alignment. Proceed, and I'll ignore this case.
! Extra alignment tab has been changed to \cr.
<recently read> \endtemplate
l.139 \multicolumn{1}{|c|}{\ac{i2c}} &
- - & - - & - - & \checkmark & & + +\...
You have given more \span or & marks than there were
in the preamble to the \halign or \valign now in progress.
So I'll assume that you meant to type \cr instead.
! Misplaced \noalign.
\hline ->\noalign
{\ifnum 0=`}\fi \hrule \@height \arrayrulewidth \futurelet...
l.139 ...& - - & - - & \checkmark & & + +\\ \hline
I expect to see \noalign only after the \cr of
an alignment. Proceed, and I'll ignore this case.
! Misplaced \omit.
\multispan ->\omit
\@multispan
l.140 \multicolumn{1}{|c|}{\ac{spi}}
& + + & - - & - - & \checkmark & & - -\...
I expect to see \omit only after tab marks or the \cr of
an alignment. Proceed, and I'll ignore this case.
! Extra alignment tab has been changed to \cr.
<recently read> \endtemplate
l.140 \multicolumn{1}{|c|}{\ac{spi}} & + + &
- - & - - & \checkmark & & - -\...
You have given more \span or & marks than there were
in the preamble to the \halign or \valign now in progress.
So I'll assume that you meant to type \cr instead.
! Misplaced \noalign.
\hline ->\noalign
{\ifnum 0=`}\fi \hrule \@height \arrayrulewidth \futurelet...
l.140 ...& - - & - - & \checkmark & & - -\\ \hline
I expect to see \noalign only after the \cr of
an alignment. Proceed, and I'll ignore this case.
! Misplaced \omit.
\multispan ->\omit
\@multispan
l.141 \multicolumn{1}{|c|}{ccTalk}
& - - & + + & + + & $\times$ & + & +\\ \h...
I expect to see \omit only after tab marks or the \cr of
an alignment. Proceed, and I'll ignore this case.
! Extra alignment tab has been changed to \cr.
<recently read> \endtemplate
l.141 \multicolumn{1}{|c|}{ccTalk} & - - & + + &
+ + & $\times$ & + & +\\ \h...
You have given more \span or & marks than there were
in the preamble to the \halign or \valign now in progress.
So I'll assume that you meant to type \cr instead.
! Misplaced \noalign.
\hline ->\noalign
{\ifnum 0=`}\fi \hrule \@height \arrayrulewidth \futurelet...
l.141 ...- & + + & + + & $\times$ & + & +\\ \hline
I expect to see \noalign only after the \cr of
an alignment. Proceed, and I'll ignore this case.
! Misplaced \omit.
\multispan ->\omit
\@multispan
l.142 \multicolumn{1}{|c|}{EIA-485}
& + + & + + & + + & $\times$ & \checkmar...
I expect to see \omit only after tab marks or the \cr of
an alignment. Proceed, and I'll ignore this case.
! Extra alignment tab has been changed to \cr.
<recently read> \endtemplate
l.142 ...lumn{1}{|c|}{EIA-485} & + + & + + & + + &
$\times$ & \checkmark & +...
You have given more \span or & marks than there were
in the preamble to the \halign or \valign now in progress.
So I'll assume that you meant to type \cr instead.
! Misplaced \noalign.
\hline ->\noalign
{\ifnum 0=`}\fi \hrule \@height \arrayrulewidth \futurelet...
l.142 ... + & $\times$ & \checkmark & + +\\ \hline
I expect to see \noalign only after the \cr of
an alignment. Proceed, and I'll ignore this case.
! Misplaced \omit.
\multispan ->\omit
\@multispan
l.143 \multicolumn{1}{|c|}{RS232}
& - - & - - & + & \checkmark & & - -\\ \hline
I expect to see \omit only after tab marks or the \cr of
an alignment. Proceed, and I'll ignore this case.
! Extra alignment tab has been changed to \cr.
<recently read> \endtemplate
l.143 ...c|}{RS232} & - - & - - & + & \checkmark &
& - -\\ \hline
You have given more \span or & marks than there were
in the preamble to the \halign or \valign now in progress.
So I'll assume that you meant to type \cr instead.
! Misplaced \noalign.
\hline ->\noalign
{\ifnum 0=`}\fi \hrule \@height \arrayrulewidth \futurelet...
l.143 ...- & - - & + & \checkmark & & - -\\ \hline
I expect to see \noalign only after the \cr of
an alignment. Proceed, and I'll ignore this case.
! Misplaced \omit.
\multispan ->\omit
\@multispan
l.144 \multicolumn{1}{|c|}{CAN}
& - - & + + & + + & $\times$ & - - & +\\ \hline
I expect to see \omit only after tab marks or the \cr of
an alignment. Proceed, and I'll ignore this case.
! Extra alignment tab has been changed to \cr.
<recently read> \endtemplate
l.144 ...CAN} & - - & + + & + + & $\times$ & - - &
+\\ \hline
You have given more \span or & marks than there were
in the preamble to the \halign or \valign now in progress.
So I'll assume that you meant to type \cr instead.
Bin schon seit ein paar Stunden am googlen aber leider keinen Schritt weiter gekommen :-/

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

Beitrag von esdd »

Nimm entweder

\newcolumntype{x}[1]{>{\centering\hspace{0pt}\arraybackslash}p{#1}}
oder
\usepackage{ragged2e}
\newcolumntype{x}[1]{>{\Centering\hspace{0pt}}p{#1}}
Ungetestet, da dein Code kein lauffähiges Minimalbeispiel ist.

Gruß
Elke

DK999

Beitrag von DK999 »

Danke
\newcolumntype{x}[1]{>{\centering\hspace{0pt}\arraybackslash}p{#1}}
hat funktioniert! :)

Antworten