在上表中,我对“职位类别”和“1000 的分布情况...”文本的定位不满意。理想情况下,我希望职位类别文本与文本所在的空白处的中心对齐。目前,它与顶部行对齐过多。
此外,从代码中我无法理解为什么文本“Distribution...”会在它所处的位置截取并且没有与它所写入的单元格的右侧对齐(直到 1870 年)。
\documentclass[12pt]{report}
\usepackage{multirow}
\usepackage{bigstrut}
\makeatletter
\def\hlinewd#1{%
\noalign{\ifnum0=`}\fi\hrule \@height #1 \futurelet
\reserved@a\@xhline}
\makeatother
\begin{document}
\begin{table}[h!]
\centering
\caption{Shift in job distribution 1870 - 1910}
\scriptsize
\begin{tabular}{l|c|c|c|c|c}
\hlinewd{1.25pt}
\multicolumn{1}{c}{\multirow{2}[4]{*}{Job category}} & \multicolumn{5}{p{3.5cm}}{Distribution of 1000 individuals of the overall population} \bigstrut\\
\cline{2-6} \multicolumn{1}{c}{} & 1910 & 1900 & 1888 & 1880 & 1870 \bigstrut\\
\hline
A. Primary production & 277 & 332 & 388 & 406 & 429 \bigstrut[t]\\
Thereof agriculture and cattle industry & 261 & 316 & 374 & 391 & 416 \\
B. Trade and industry & 427 & 417 & 378 & 390 & 367 \\
C. Commerce & 101 & 86 & 73 & 72 & 66 \\
D. Transport & 63 & 51 & 34 & 28 & 18 \\
E. Public administration, science, arts & 57 & 51 & 44 & 43 & 43 \\
F. Changing wage labour & 10 & 6 & 10 & 6 & 7 \\
G. Living off pensions and benefits & 65 & 57 & 73 & 55 & 70 \bigstrut[b]\\
\hlinewd{1.25pt}
\end{tabular}%
\vspace{5pt}
\captionsetup{font={footnotesize}}
\caption*{Source: Steinemann et al. (1921), p. 23, own illustration}
\label{tab:addlabel}%
\end{table}%
\end{document}
答案1
您的固定宽度p
列太窄。您可以计算实际宽度以获得更精确的测量值(如果需要),或者指定接近该值的值(实际宽度约为\scriptsize
133pt):
\documentclass[12pt]{report}
\usepackage{bigstrut,booktabs,siunitx}
\makeatletter
\def\hlinewd#1{%
\noalign{\ifnum0=`}\fi\hrule \@height #1 \futurelet
\reserved@a\@xhline}
\makeatother
\begin{document}
\scriptsize
\newlength{\specialcolwidth}
\settowidth{\specialcolwidth}{\scriptsize 19101900188818801870}
\addtolength{\specialcolwidth}{8\tabcolsep}
\begin{tabular}{l|c|c|c|c|c}
\hlinewd{1.25pt}
\multicolumn{1}{c}{\raisebox{-.5\normalbaselineskip}[0pt][0pt]{Job category}} &
\multicolumn{5}{p{\specialcolwidth}}{Distribution of 1000 individuals of the overall population} \bigstrut\\
\cline{2-6}
\multicolumn{1}{c}{} & 1910 & 1900 & 1888 & 1880 & 1870 \bigstrut\\
\hline
A. Primary production & 277 & 332 & 388 & 406 & 429 \bigstrut[t]\\
Thereof agriculture and cattle industry & 261 & 316 & 374 & 391 & 416 \\
B. Trade and industry & 427 & 417 & 378 & 390 & 367 \\
C. Commerce & 101 & 86 & 73 & 72 & 66 \\
D. Transport & 63 & 51 & 34 & 28 & 18 \\
E. Public administration, science, arts & 57 & 51 & 44 & 43 & 43 \\
F. Changing wage labour & 10 & 6 & 10 & 6 & 7 \\
G. Living off pensions and benefits & 65 & 57 & 73 & 55 & 70 \bigstrut[b]\\
\hlinewd{1.25pt}
\end{tabular}%
\bigskip
\begin{tabular}{ l *{5}{S[table-format=4]} }
\toprule
\multicolumn{1}{c}{\raisebox{-.5\normalbaselineskip}[0pt][0pt]{Job category}} &
\multicolumn{5}{p{\specialcolwidth}}{\centering Distribution of 1000 individuals of the overall population} \\
\cmidrule{2-6}
& 1910 & 1900 & 1888 & 1880 & 1870 \\
\midrule
A. Primary production & 277 & 332 & 388 & 406 & 429 \\
Thereof agriculture and cattle industry & 261 & 316 & 374 & 391 & 416 \\
B. Trade and industry & 427 & 417 & 378 & 390 & 367 \\
C. Commerce & 101 & 86 & 73 & 72 & 66 \\
D. Transport & 63 & 51 & 34 & 28 & 18 \\
E. Public administration, science, arts & 57 & 51 & 44 & 43 & 43 \\
F. Changing wage labour & 10 & 6 & 10 & 6 & 7 \\
G. Living off pensions and benefits & 65 & 57 & 73 & 55 & 70 \\
\bottomrule
\end{tabular}%
\end{document}
答案2
正如 Mico 在他的评论中所说的那样,p{3.5cm}
这还不够\multicolumn
,请将其改为p{4.5cm}
。
然后调整可选参数\multirow
(我将其从 更改4
为8
)。
平均能量损失
\documentclass[12pt]{report}
\usepackage{multirow,caption}
\usepackage{bigstrut}
\makeatletter
\def\hlinewd#1{%
\noalign{\ifnum0=`}\fi\hrule \@height #1 \futurelet
\reserved@a\@xhline}
\makeatother
\begin{document}
\begin{table}[h!]
\centering
\caption{Shift in job distribution 1870 - 1910}
\scriptsize
\begin{tabular}{l|c|c|c|c|c}
\hlinewd{1.25pt}
\multicolumn{1}{c}{\multirow{2}[8]{*}{Job category}} & \multicolumn{5}{p{4.5cm}}{Distribution of 1000 individuals of the overall population} \bigstrut\\
\cline{2-6} \multicolumn{1}{c}{} & 1910 & 1900 & 1888 & 1880 & 1870 \bigstrut\\
\hline
A. Primary production & 277 & 332 & 388 & 406 & 429 \bigstrut[t]\\
Thereof agriculture and cattle industry & 261 & 316 & 374 & 391 & 416 \\
B. Trade and industry & 427 & 417 & 378 & 390 & 367 \\
C. Commerce & 101 & 86 & 73 & 72 & 66 \\
D. Transport & 63 & 51 & 34 & 28 & 18 \\
E. Public administration, science, arts & 57 & 51 & 44 & 43 & 43 \\
F. Changing wage labour & 10 & 6 & 10 & 6 & 7 \\
G. Living off pensions and benefits & 65 & 57 & 73 & 55 & 70 \bigstrut[b]\\
\hlinewd{1.25pt}
\end{tabular}%
\vspace{5pt}
\captionsetup{font={footnotesize}}
\caption*{Source: Steinemann et al. (1921), p. 23, own illustration}
\label{tab:addlabel}%
\end{table}%
\end{document}
输出: