Eu tenho uma tabela que tem esse 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}%
Recebo este erro de látex que não consigo corrigir, e preciso fazê-lo 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.
Eu tenho essa parte relevante para a matriz no meu preâmbulo
\usepackage{array}
\newcolumntype{P}[1]{>{\raggedleft\arraybackslash}p{#1}}
Responder1
r{3.5cm}
é um erro. É apenas r
ou p{3.5cm}
. Provavelmente o que você quer é
\begin{tabular}{ rc p{5.50cm} p{5.50cm} }
Não conheço o layout da sua página, então não sei o que se encaixa, mas recomendo tentar algo assim
\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 X
coluna será definida com metade da largura disponível, onde a largura total \linewidth
inclui as duas primeiras colunas ( r
) e ( c
) e as duas segundas X
colunas.
O pacote tabularx
habilita essa funcionalidade.
Para ajudar com as notas, eu usaria threeparttable
ou threeparttablex
. Isso proporciona melhor espaçamento e facilita a composição correta das marcas.
Finalmente >{\bfseries}r
usa >
o array
pacote para formatar cada célula daquela coluna em negrito, o que torna mais fácil se você mudar de ideia e resulta em um código-fonte menos confuso.
[Infelizmente, as imagens não estão disponíveis devido a um bug do Okular-on-X, então peço que você compile ou imagine a saída se quiser ver o resultado.]
Responder2
Em
\begin{tabular}{ r{3.5cm} p{5.50cm} p{5.50cm} }
r
média right
, p
média paragraph
do comprimento dado pelo argumento de p
. Você também pode usar c
for center
e l
for left
. No seu código {3.5cm}
, r
há um erro de sintaxe, pois apenas um parágrafo pode ter um argumento.
Responder3
Eu gostaria de sugerir que você adote uma tabularx
configuração baseada em -, com uma largura alvo geral de \textwidth
para a tabela, automáticaem negritona coluna 1 e modo matemático automático na coluna 2. Além disso, forneça alguns espaços em branco verticais (por meio de uma \addlinespace
instrução) entre os principais grupos de informações.
\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}