我有一個包含此命令的表。
\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} }
r
means中right
,是由參數給定的長度的p
平均值。您也可以使用for和for 。在您的程式碼中,後面是語法錯誤,因為只有段落可以有參數。paragraph
p
c
center
l
left
{3.5cm}
r
答案3
我想建議您採用基於 - 的設置,表格的tabularx
總體目標寬度為,自動\textwidth
粗體字\addlinespace
在第 1 列中,自動數學模式在第 2 列。
\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}