![多列表格的格式化](https://linux22.com/image/409962/%E5%A4%9A%E5%88%97%E8%A1%A8%E6%A0%BC%E7%9A%84%E6%A0%BC%E5%BC%8F%E5%8C%96.png)
我创建了下表:
\begin{landscape}
\begin{table}
\footnotesize
\caption{Faktorladungsstruktur und Kommunalitäten der EFA mit ML-Extraktion und Varimax-Rotation}
\setlength{\tabcolsep}{3.5pt}
%{\renewcommand{\arraystretch}{1.3}
%\scalebox{0.65}{%
\begin{tabularx}{\linewidth}{X*{8}{S[table-format=2.2]}}
\toprule
& \multicolumn{7}{c}{Faktorladungen} & {Kommunalität} \\ \cmidrule(r){2-8} \cmidrule(l){9-9}
Items & {1} & {2} & {3} & {4} & {5} & {6} &{7}&{$h^2$}\\ \midrule
17. I will keep up with fashions in hair and clothing & 0.84 & & & && & & 0.73 \\
11. I will have people comment often about how attractive I look. & 0.81 & & & && & & 0.72 \\
23. I will achieve the \enquote{look} I've been after.& 0.72 & & & && & & 0.59 \\
18. I will have many expensive possessions.& 0.71 & & & && & & 0.62 \\
29. My image will be one others find appealing.& 0.65 & & & && & & 0.50 \\
05. I will successfully hide the signs of aging.& 0.47 & & & & && & 0.36 \\
30. I will have enough money to buy everything I want. & 0.44 &&& 0.45 &&&& 0.47 \\
15. I will work to make the world a better place. & & 0.80 &&&&&& 0.68 \\
09. I will work for the betterment of society. & & 0.75 &&&&&& 0.59 \\
27. I will help people in need. & & 0.74 &&&&&& 0.63 \\
21. I will help others improve their lives. & & 0.73 &&&&&& 0.63 \\
03. I will assist people who need it, asking nothing in return. & & 0.52 &&&&&& 0.34 \\
25. I will continue to grow and learn new things.& &&&&&&& 0.34 \\
14. I will share my life with someone I love. & && 0.73 &&&&& 0.60 \\
20. I will have committed, intimate relationships. & && 0.73 &&&&& 0.57 \\
26. I will have deep, enduring relationships. & && 0.71 &&&&& 0.58 \\
02. I will feel that there are people who really love me, and whom I love. & && 0.54 &&&&& 0.37 \\
07. At the end of my life, I will look back on my life as meaningful and complete. & &&&&&&& 0.36 \\
08. I will have good friends that I can count on.& &&&&&&& 0.27 \\
12. I will have a job that pays very well.& &&& 0.88 &&&& 0.86 \\
06. I will be financially successful. & &&& 0.80 &&&& 0.80 \\
24. I will be rich. & 0.44 &&& 0.51 &&&& 0.57 \\
10. My name will be known by many people. & 0.40 &&&& 0.71 &&& 0.79 \\
04. I will be recognized by lots of different people. & &&&& 0.70 &&& 0.64 \\
16. I will be admired by many people. & 0.43 &&&& 0.60 &&& 0.63 \\
19. I will know and accept who I really am. & &&&&& 0.67 && 0.55 \\
13. I will gain increasing insight into why I do the things I do. & &&&&& 0.48 && 0.36 \\
01. I will choose what I do, instead of being pushed along by life. & &&&&&&& 0.19 \\
22. I will be famous. & 0.46 &&&&&& 0.72 & 0.82 \\
28. My name will appear frequently in the media. & 0.42 &&&&&& 0.71 & 0.74 \\
\midrule[\heavyrulewidth]
Varianzaufklärung in \% & 14.71 & 10.50 & 8.13 & 7.52 & 5.89 & 4.91 & 4.52 &{Gesamt}\\
\end{tabularx}
\end{table}
\end{landscape}
现在它看起来像这样:
你们对如何将单词“Faktorladungen”置于列中央(其中显示 1 2 3 等)有什么建议吗?另外,如何将 h² 置于单词“Kommunalitäten”下方的中央。
顺便问一下,你会把“items”这个词放在哪里?你觉得可以吗?放在哪里?还是会把它放在其他地方?
我正在使用 \documentclass[paper=a4, pagesize, fontsize=11pt]{scrartcl}。
我希望你能帮我解决我的问题。非常感谢。
海伦娜
答案1
以下是我的建议。与原始代码相比,我做了以下更改:
- 替换
\multicolumn{8}...
为& \multicolumn{7}...
更正“Faktorladungen”的位置 - 删除了比例框,因为这会导致整个文档的字体大小不一致
- 删除
\renewcommand{\arraystretch}{1.3}
以节省空间 - 更改了值
\tabcolsep
以节省更多空间 - 将表格旋转为横向,因为它不适合纵向页面
- 用于
tabularx
使桌子和可用空间一样宽 - 添加了
siunitx
类型S
列以改进数字的对齐 - 删除所有
$
数字 - 删除了,
\newgeometry
因为即使不大幅减小边距,表格也能适应页面 - 减小字体大小以
\footnotesize
确保表格适合页面。
根据评论中Mico的建议,我还增加了以下修改:
- 删除了多余的
\multicolumn
,因为类型列中Kommunalität
的一组非数字条目会自动水平居中{}
S
- 替换
\bottomrule
为\midrule[\heavyrulewidth]
改善间距 - 删除了
\newline
最后一行的
\documentclass[paper=a4, pagesize, fontsize=11pt]{scrartcl}
\usepackage{geometry}
\usepackage{booktabs}
\usepackage{csquotes}
\usepackage{tabularx}
\usepackage{siunitx}
\usepackage{pdflscape}
\begin{document}
\begin{landscape}
\begin{table}
\footnotesize
\caption{Faktorladungsstruktur und Kommunalitäten der EFA mit ML-Extraktion und Varimax-Rotation}
\setlength{\tabcolsep}{3.5pt}
%{\renewcommand{\arraystretch}{1.3}
%\scalebox{0.65}{%
\begin{tabularx}{\linewidth}{X*{8}{S[table-format=2.2]}}
\toprule
& \multicolumn{7}{c}{Faktorladungen} & {Kommunalität} \\ \cmidrule(r){2-8} \cmidrule(l){9-9}
Items & {1} & {2} & {3} & {4} & {5} & {6} &{7}&{$h^2$}\\ \midrule
17. I will keep up with fashions in hair and clothing & 0.84 & & & && & & 0.73 \\
11. I will have people comment often about how attractive I look. & 0.81 & & & && & & 0.72 \\
23. I will achieve the \enquote{look} I've been after.& 0.72 & & & && & & 0.59 \\
18. I will have many expensive possessions.& 0.71 & & & && & & 0.62 \\
29. My image will be one others find appealing.& 0.65 & & & && & & 0.50 \\
05. I will successfully hide the signs of aging.& 0.47 & & & & && & 0.36 \\
30. I will have enough money to buy everything I want. & 0.44 &&& 0.45 &&&& 0.47 \\
15. I will work to make the world a better place. & & 0.80 &&&&&& 0.68 \\
09. I will work for the betterment of society. & & 0.75 &&&&&& 0.59 \\
27. I will help people in need. & & 0.74 &&&&&& 0.63 \\
21. I will help others improve their lives. & & 0.73 &&&&&& 0.63 \\
03. I will assist people who need it, asking nothing in return. & & 0.52 &&&&&& 0.34 \\
25. I will continue to grow and learn new things.& &&&&&&& 0.34 \\
14. I will share my life with someone I love. & && 0.73 &&&&& 0.60 \\
20. I will have committed, intimate relationships. & && 0.73 &&&&& 0.57 \\
26. I will have deep, enduring relationships. & && 0.71 &&&&& 0.58 \\
02. I will feel that there are people who really love me, and whom I love. & && 0.54 &&&&& 0.37 \\
07. At the end of my life, I will look back on my life as meaningful and complete. & &&&&&&& 0.36 \\
08. I will have good friends that I can count on.& &&&&&&& 0.27 \\
12. I will have a job that pays very well.& &&& 0.88 &&&& 0.86 \\
06. I will be financially successful. & &&& 0.80 &&&& 0.80 \\
24. I will be rich. & 0.44 &&& 0.51 &&&& 0.57 \\
10. My name will be known by many people. & 0.40 &&&& 0.71 &&& 0.79 \\
04. I will be recognized by lots of different people. & &&&& 0.70 &&& 0.64 \\
16. I will be admired by many people. & 0.43 &&&& 0.60 &&& 0.63 \\
19. I will know and accept who I really am. & &&&&& 0.67 && 0.55 \\
13. I will gain increasing insight into why I do the things I do. & &&&&& 0.48 && 0.36 \\
01. I will choose what I do, instead of being pushed along by life. & &&&&&&& 0.19 \\
22. I will be famous. & 0.46 &&&&&& 0.72 & 0.82 \\
28. My name will appear frequently in the media. & 0.42 &&&&&& 0.71 & 0.74 \\
\midrule[\heavyrulewidth]
Varianzaufklärung in \% & 14.71 & 10.50 & 8.13 & 7.52 & 5.89 & 4.91 & 4.52 &{Gesamt}\\
\end{tabularx}
\end{table}
\end{landscape}
\end{document}