Ошибка Latex: Ошибка массива пакетов: Недопустимый pream-токен (3,5 см): использован c'

Ошибка Latex: Ошибка массива пакетов: Недопустимый pream-токен (3,5 см): использован c'

У меня есть таблица с этой командой.

\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}%

Я получаю эту ошибку латекса, которую не могу исправить, и мне нужно заставить ее исчезнуть

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.

У меня в преамбуле есть эта часть, относящаяся к массиву

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

решение1

r{3.5cm}ошибка. Это просто rили p{3.5cm}. Вероятно, то, что вы хотите, это

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

Я не знаю макет вашей страницы, поэтому не знаю, что подойдет, но я бы рекомендовал попробовать что-то вроде этого

\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}

Ширина каждого столбца Xбудет установлена ​​на половину доступной ширины, при этом общая ширина \linewidthвключает как первые два столбца ( r) и ( c), так и вторые два Xстолбца.

Пакет tabularxобеспечивает эту функциональность.

Чтобы облегчить работу с примечаниями, я бы использовал или threeparttable. threeparttablexЭто обеспечивает лучший интервал и облегчает правильный набор знаков.

Наконец, >{\bfseries}rиспользуется >пакет arrayдля форматирования каждой ячейки в этом столбце жирным шрифтом, что упрощает задачу, если вы передумаете, и приводит к менее загроможденному исходному коду.

[К сожалению, изображения недоступны из-за ошибки Okular-on-X, поэтому я прошу вас либо скомпилировать, либо представить себе вывод, если вы хотите увидеть результат.]

решение2

В \begin{tabular}{ r{3.5cm} p{5.50cm} p{5.50cm} } rmeans right, pозначает paragraphдлину, заданную аргументом p. Вы также можете использовать cfor centerи lfor left. В вашем коде {3.5cm}after rесть синтаксическая ошибка, так как аргумент может быть только у абзаца.

решение3

Я хотел бы предложить вам использовать tabularxнастройку, основанную на -, с общей целевой шириной \textwidthдля таблицы, автоматическойжирный шрифтв столбце 1 и автоматический математический режим в столбце 2. Кроме того, предусмотрите вертикальные пробелы (с помощью \addlinespaceинструкции) между основными группами информации.

введите описание изображения здесь

\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}

Связанный контент