Tengo una mesa que tiene este comando.
\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}%
Recibo este error de látex que no puedo solucionar y necesito hacerlo desaparecer.
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.
Tengo esta parte relevante para la matriz en mi preámbulo
\usepackage{array}
\newcolumntype{P}[1]{>{\raggedleft\arraybackslash}p{#1}}
Respuesta1
r{3.5cm}
es un error. Es solo r
o p{3.5cm}
. Probablemente lo que quieres es
\begin{tabular}{ rc p{5.50cm} p{5.50cm} }
No conozco el diseño de tu página, así que no sé qué encaja, pero recomendaría probar algo como esto.
\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}
Cada una de las X
columnas se establecerá en la mitad del ancho disponible, donde el ancho total \linewidth
incluye tanto las dos primeras columnas ( r
) y ( c
) como las dos segundas X
columnas.
El paquete tabularx
habilita esta funcionalidad.
Para ayudar con las notas, usaría threeparttable
o threeparttablex
. Esto proporciona un mejor espaciado y facilita la composición tipográfica de las marcas correctamente.
Finalmente >{\bfseries}r
usa >
del array
paquete para formatear cada celda de esa columna en negrita, lo que lo hace más fácil si cambias de opinión y da como resultado un código fuente menos desordenado.
[Desafortunadamente, las imágenes no están disponibles debido a un error de Okular-on-X, por lo que le pido que compile o imagine el resultado si desea ver el resultado.]
Respuesta2
En
\begin{tabular}{ r{3.5cm} p{5.50cm} p{5.50cm} }
r
medias right
, p
medias paragraph
de la longitud dada por el argumento de p
. También puedes usar c
for center
y l
for left
. En su código {3.5cm}
, hay r
un error de sintaxis, ya que solo un párrafo puede tener un argumento.
Respuesta3
Me gustaría sugerirle que adopte una tabularx
configuración basada en -, con un ancho objetivo general de \textwidth
para la tabla, automáticonegritaen la columna 1 y el modo matemático automático en la columna 2. Además, proporcione algunos espacios en blanco verticales (a través de una \addlinespace
instrucción) entre los grupos principales de información.
\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}