Latex-Fehler: Paket-Array-Fehler: Ungültiges Pream-Token (3,5 cm): c' verwendet

Latex-Fehler: Paket-Array-Fehler: Ungültiges Pream-Token (3,5 cm): c' verwendet

Ich habe eine Tabelle, die diesen Befehl hat.

\begin{table}[ht]
  \centering
  \centering\caption{Table features}
\begin{tabular}{ r{3.5cm} p{5.50cm} p{5.50cm} }
\toprule
          & \multicolumn{1}{r}{} & \textbf{Income components } & \textbf{Determined in GETTSIM tax and transfer model?} \\
    \midrule
    \textbf{1} & \multicolumn{1}{r}{} & \textbf{Earned income} & No \\
          & +     & Self-employed income & No \\
          & +     & Capital income & No \\
          & +     & Rental income & No \\
          & +     & Other incomes (pensions)* & No \\
    \textbf{2} & - & \textbf{Social security contributions} & Yes \\
          & \multicolumn{1}{r}{} & \textbf{ (Old-age pensions+ employee unemployment insurance+ employee health insurance)} & \multicolumn{1}{r}{} \\
          & -     & Income tax & Yes \\
          & -     & Capital income tax & Yes \\
          & -     & Alimony advance payments & Yes \\
    \textbf{3} & +     & \textbf{Child benefit} & Yes \\
          & +     & Child-raising allowance (Child enhanced or additional Income) & Yes \\
          & +     & Unemployment benefits (no endogen. labor supply) & Yes \\
          & +     & Maternity allowance & Yes \\
    \textbf{4} & +     & \textbf{Housing allowance (HA)} & Yes \\
          & +     & Supplementary child allowance & Yes \\
          & +     & Social assistance for employable persons (SGB II) & Yes \\
          & +     & Social assistance for unemployable persons (SGB XII) & No \\
          & =     & \textbf{Net household income} & No \\
    \bottomrule
    \end{tabular}%

  {\raggedright \textit{Notes}:  \footnotesize \*{*}Nevertheless, the model predicts the (updated earning points for pension claims). This table refers to the latest features at the time of writing this paper, end of 2021. Supplementary child benefits (Kinderzuschlag) is also referred to as Child Enhanced or Additional Income.\par}
  \label{Tab:table1}
\end{table}%

Ich erhalte diesen Latex-Fehler, den ich nicht beheben kann. Ich muss ihn verschwinden lassen

Package array Error: Illegal pream-token (3.5cm): `c' used.

./main.tex, 881‬
See the array package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.881 ...{tabular}{ r{3.5cm} p{5.50cm} p{5.50cm} }
                                              
Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.

Ich habe diesen Array-relevanten Teil in meiner Präambel

\usepackage{array}
\newcolumntype{P}[1]{>{\raggedleft\arraybackslash}p{#1}}

Antwort1

r{3.5cm}ist ein Fehler. Es ist einfach roder p{3.5cm}. Wahrscheinlich möchten Sie

 \begin{tabular}{ rc p{5.50cm} p{5.50cm} }

Ich kenne Ihr Seitenlayout nicht und weiß daher nicht, was passt, aber ich würde empfehlen, so etwas auszuprobieren

\documentclass{article}
\usepackage{array,booktabs,tabularx,threeparttablex}
\begin{document}
\begin{table}[ht]
  \centering
  \begin{threeparttable}
    \caption{Table features}
    \begin{tabularx}\linewidth{ >{\bfseries} rc XX }
      \toprule
      & & \textbf{Income components } & \textbf{Determined in GETTSIM tax and transfer model?} \\
      \midrule
      1 & & \textbf{Earned income} & No \\
      & +     & Self-employed income & No \\
      & +     & Capital income & No \\
      & +     & Rental income & No \\
      & +     & Other incomes (pensions)\tnote{*} & No \\
      2 & - & \textbf{Social security contributions} & Yes \\
      & & \textbf{ (Old-age pensions+ employee unemployment insurance+ employee health insurance)} & \\
      & -     & Income tax & Yes \\
      & -     & Capital income tax & Yes \\
      & -     & Alimony advance payments & Yes \\
      3 & +     & \textbf{Child benefit} & Yes \\
      & +     & Child-raising allowance (Child enhanced or additional Income) & Yes \\
      & +     & Unemployment benefits (no endogen. labor supply) & Yes \\
      & +     & Maternity allowance & Yes \\
      4 & +     & \textbf{Housing allowance (HA)} & Yes \\
      & +     & Supplementary child allowance & Yes \\
      & +     & Social assistance for employable persons (SGB II) & Yes \\
      & +     & Social assistance for unemployable persons (SGB XII) & No \\
      & =     & \textbf{Net household income} & No \\
      \bottomrule
    \end{tabularx}
    
    \footnotesize
    \begin{tablenotes}[para]
      \item[] \textit{Notes}
      \item[*] Nevertheless, the model predicts the (updated earning points for pension claims). This table refers to the latest features at the time of writing this paper, end of 2021. Supplementary child benefits (Kinderzuschlag) is also referred to as Child Enhanced or Additional Income.
    \end{tablenotes}
    \label{Tab:table1}
  \end{threeparttable}
\end{table}
\end{document}

Die XSpalten werden jeweils auf die halbe zur Verfügung stehende Breite eingestellt, wobei die Gesamtbreite \linewidthsowohl die ersten beiden Spalten ( r) und ( c) als auch die zweiten beiden XSpalten umfasst.

Das Paket tabularxermöglicht diese Funktionalität.

Zur Unterstützung bei den Anmerkungen würde ich entweder threeparttableoder verwenden threeparttablex. Dadurch ergibt sich ein besserer Abstand und die Markierungen können leichter richtig gesetzt werden.

Finally >{\bfseries}rverwendet >das arrayPaket, um jede Zelle in dieser Spalte fett zu formatieren. Dies erleichtert die Arbeit, falls Sie Ihre Meinung ändern, und führt zu einem übersichtlicheren Quellcode.

[Leider sind aufgrund eines Okular-on-X-Fehlers keine Bilder verfügbar. Ich bitte Sie daher, die Ausgabe entweder zu kompilieren oder sich vorzustellen, wenn Sie das Ergebnis sehen möchten.]

Antwort2

In \begin{tabular}{ r{3.5cm} p{5.50cm} p{5.50cm} } rbedeutet right, pbedeutet paragraphdie Länge, die durch das Argument von gegeben ist p. Sie können auch cfor centerund lfor verwenden left. In Ihrem Code {3.5cm}folgt rein Syntaxfehler, da nur ein Absatz ein Argument haben kann.

Antwort3

Ich möchte vorschlagen, dass Sie ein tabularx-basiertes Setup übernehmen, mit einer Gesamtzielbreite von \textwidthfür die Tabelle, automatischfettgedrucktin Spalte 1 und den automatischen Mathematikmodus in Spalte 2. Sorgen Sie außerdem dafür, dass \addlinespacezwischen den Hauptinformationsgruppen einige vertikale Leerzeichen (mittels einer Anweisung) vorhanden sind.

Bildbeschreibung hier eingeben

\documentclass{article}
\usepackage{tabularx,booktabs}
\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}

\begin{document}
\begin{table}[ht]

\caption{Table features} \label{Tab:table1}

\smallskip
\begin{tabularx}{\textwidth}{@{}
    >{\bfseries}l %% automatic **bold-facing**
    >{$}c<{$}     %% automatic math mode
    P{7cm} % allow automatic line-breaking
    >{\raggedright\arraybackslash}X @{}}

\toprule
& & \textbf{Income components} & \textbf{Determined in GETTSIM tax and transfer model?} \\
\midrule
1 &   & \textbf{Earned income} & No \\
  & + & Self-employed income & No \\
  & + & Capital income & No \\
  & + & Rental income & No \\
  & + & Other incomes (pensions)* & No \\
\addlinespace

2 & - & \textbf{Social security contributions} & Yes \\
  &   & (Old-age pensions + employee unemployment insurance + employee health insurance) &  \\
  & - & Income tax & Yes \\
  & - & Capital income tax & Yes \\
  & - & Alimony advance payments & Yes \\
\addlinespace

3 & + & \textbf{Child benefit} & Yes \\
  & + & Child-raising allowance (Child enhanced or additional Income) & Yes \\
  & + & Unemployment benefits (no endogen. labor supply) & Yes \\
  & + & Maternity allowance & Yes \\
\addlinespace

4 & + & \textbf{Housing allowance (HA)} & Yes \\
  & + & Supplementary child allowance & Yes \\
  & + & Social assistance for employable persons (SGB II) & Yes \\
  & + & Social assistance for unemployable persons (SGB XII) & No \\
\addlinespace

  & = & \textbf{Net household income} & No \\
\bottomrule
\end{tabularx}

\smallskip
\raggedright 
\footnotesize
* Nevertheless, the model predicts the (updated earning points for pension claims). 

\textit{Notes}: This table refers to the latest features at the time of writing this paper, end of 2021. Supplementary child benefits (Kinderzuschlag) is also referred to as Child Enhanced or Additional Income.
  
\end{table}%

\end{document}

verwandte Informationen