我正在尝试在 overleaf 中使用大型分析表。我正在使用excel2latex
但它似乎不适合页面。以下是 latex 代码。有人可以帮忙吗?谢谢
\begin {table}[h]
% Table generated by Excel2LaTeX from sheet 'ANOVA_10 VALUES_5519_mean'
\centering
\caption{Add caption}
\begin{tabular}{|c|c|c|c|c|c|c|}
\toprule
\multirow{2}[4]{*}{\textbf{Demographic variables}} & \multirow{2}[4]{*}{\textbf{Values}} & \multicolumn{4}{c|}{\textbf{ANOVA}} & \multicolumn{1}{c|}{\multirow{2}[4]{*}{\textbf{Bonferroni \newline{}Correction\newline{}(0.005)}}} \\
\cmidrule{3-6} & & \textbf{df group} & \textbf{df residual} & \textbf{F} & \multicolumn{1}{p{6.25em}|}{\textbf{Pr(>F)\newline{}(0.05)}} & \\
\midrule
\multicolumn{1}{|c|}{\multirow{10}[20]{*}{\textbf{Gender}}} & HEDONISM & 1 & 5238 & 131.60 & \multicolumn{1}{p{6.25em}|}{<2e-16 ***} & <2e-16 *** \\
\cmidrule{2-7} & SELF\_DIRECTION & 1 & 5238 & 16.86 & \multicolumn{1}{p{6.25em}|}{1.04e-15 ***} & 1.04e-15 *** \\
\cmidrule{2-7} & STIMULATION & 1 & 5238 & 29.16 & \multicolumn{1}{p{6.25em}|}{6.96e-08 ***} & 6.96e-08 *** \\
\cmidrule{2-7} & SECURITY & 1 & 5238 & 0.84 & 0.358 & 0.358 \\
\cmidrule{2-7} & CONFORMITY & 1 & 5238 & 2.12 & 0.146 & 0.146 \\
\cmidrule{2-7} & TRADITION & 1 & 5238 & 5.94 & \multicolumn{1}{p{6.25em}|}{0.0148 *} & 0.0148 * \\
\cmidrule{2-7} & ACHIEVEMENT & 1 & 5238 & 2.01 & 0.157 & 0.157 \\
\cmidrule{2-7} & POWER & 1 & 5238 & 156.80 & \multicolumn{1}{p{6.25em}|}{<2e-16 ***} & <2e-16 *** \\
\cmidrule{2-7} & UNIVERSALISM & 1 & 5238 & 99.48 & 0.152 & 0.152 \\
\cmidrule{2-7} & BENEVOLENCE & 1 & 5238 & 2.05 & 0.700 & 0.700 \\
\midrule
\multirow{10}[20]{*}{\textbf{Age}} & HEDONISM & 2 & 5514 & 73.73 & <2e-16 *** & <2e-16 *** \\
\cmidrule{2-7} & SELF\_DIRECTION & 2 & 5514 & 166.50 & <2e-16 *** & <2e-16 *** \\
\cmidrule{2-7} & STIMULATION & 2 & 5514 & 305.40 & <2e-16 *** & <2e-16 *** \\
\cmidrule{2-7} & SECURITY & 2 & 5514 & 84.20 & <2e-16 *** & <2e-16 *** \\
\cmidrule{2-7} & CONFORMITY & 2 & 5514 & 133.20 & <2e-16 *** & <2e-16 *** \\
\cmidrule{2-7} & TRADITION & 2 & 5514 & 78.67 & <2e-16 *** & <2e-16 *** \\
\cmidrule{2-7} & ACHIEVEMENT & 2 & 5514 & 117.90 & <2e-16 *** & <2e-16 *** \\
\cmidrule{2-7} & POWER & 2 & 5514 & 48.05 & <2e-16 *** & <2e-16 *** \\
\cmidrule{2-7} & UNIVERSALISM & 2 & 5514 & 259.80 & <2e-16 *** & <2e-16 *** \\
\cmidrule{2-7} & BENEVOLENCE & 2 & 5514 & 54.72 & <2e-16 *** & <2e-16 *** \\
\midrule
\multirow{10}[20]{*}{\textbf{Ethnicity}} & HEDONISM & 3 & 5155 & 81.60 & <2e-16 *** & <2e-16 *** \\
\cmidrule{2-7} & SELF\_DIRECTION & 3 & 5155 & 96.47 & <2e-16 *** & <2e-16 *** \\
\cmidrule{2-7} & STIMULATION & 3 & 5155 & 66.69 & <2e-16 *** & <2e-16 *** \\
\cmidrule{2-7} & SECURITY & 3 & 5155 & 52.88 & <2e-16 *** & <2e-16 *** \\
\cmidrule{2-7} & CONFORMITY & 3 & 5155 & 29.95 & <2e-16 *** & <2e-16 *** \\
\cmidrule{2-7} & TRADITION & 3 & 5155 & 23.40 & \multicolumn{1}{p{6.25em}|}{4.9e-15 ***} & 4.9e-15 *** \\
\cmidrule{2-7} & ACHIEVEMENT & 3 & 5155 & 46.30 & <2e-16 *** & <2e-16 *** \\
\cmidrule{2-7} & POWER & 3 & 5155 & 1.78 & 0.149 & 0.149 \\
\cmidrule{2-7} & UNIVERSALISM & 3 & 5155 & 47.13 & <2e-16 *** & <2e-16 *** \\
\cmidrule{2-7} & BENEVOLENCE & 3 & 5155 & 32.16 & <2e-16 *** & <2e-16 *** \\
\midrule
\multicolumn{1}{|c|}{\multirow{10}[20]{*}{\textbf{Education\newline{} level}}} & HEDONISM & 3 & 4722 & 2.95 & 0.031 & 0.031 \\
\cmidrule{2-7} & SELF\_DIRECTION & 3 & 4722 & 8.25 & \multicolumn{1}{p{6.25em}|}{1.78e-05 ***} & 1.78e-05 *** \\
\cmidrule{2-7} & STIMULATION & 3 & 4722 & 11.08 & 3.03e-07 *** & 3.03e-07 *** \\
\cmidrule{2-7} & SECURITY & 3 & 4722 & 2.68 & 0.045 & 0.045 \\
\cmidrule{2-7} & CONFORMITY & 3 & 4722 & 1.51 & 0.211 & 0.211 \\
\cmidrule{2-7} & TRADITION & 3 & 4722 & 5.24 & 0.001 & \cellcolor[rgb]{ .988, .894, .839}\textcolor[rgb]{ .612, 0, .024}{} \\
\cmidrule{2-7} & ACHIEVEMENT & 3 & 4722 & 1.00 & 0.391 & 0.391 \\
\cmidrule{2-7} & POWER & 3 & 4722 & 0.12 & 0.948 & 0.948 \\
\cmidrule{2-7} & UNIVERSALISM & 3 & 4722 & 3.92 & 0.008 & 0.008 \\
\cmidrule{2-7} & BENEVOLENCE & 3 & 4722 & 0.78 & 0.680 & 0.680 \\
\midrule
\newpage
\multicolumn{1}{|c|}{\multirow{10}[20]{*}{\textbf{Income\newline{}level}}} & HEDONISM & 2 & 3856 & 2.34 & 0.097 & 0.097 \\
\cmidrule{2-7} & SELF\_DIRECTION & 2 & 3856 & 2.75 & 0.064 & 0.064 \\
\cmidrule{2-7} & STIMULATION & 2 & 3856 & 0.63 & 0.533 & 0.533 \\
\cmidrule{2-7} & SECURITY & 2 & 3856 & 1.28 & 0.279 & 0.279 \\
\cmidrule{2-7} & CONFORMITY & 2 & 3856 & 1.29 & 0.276 & 0.276 \\
\cmidrule{2-7} & TRADITION & 2 & 3856 & 0.65 & 0.525 & 0.525 \\
\cmidrule{2-7} & ACHIEVEMENT & 2 & 3856 & 0.85 & 0.429 & 0.429 \\
\cmidrule{2-7} & POWER & 2 & 3856 & 1.56 & 0.211 & 0.211 \\
\cmidrule{2-7} & UNIVERSALISM & 2 & 3856 & 1.49 & 0.225 & 0.225 \\
\cmidrule{2-7} & BENEVOLENCE & 2 & 3856 & 0.25 & 0.777 & 0.777 \\
\bottomrule
\end{tabular}%
\label{tab:addlabel}%
\end{table}
答案1
由于您的表中有>
和<
,因此建议使用 来xelatex
运行它。
\documentclass{article}
\usepackage{showframe}
\usepackage[hmargin=2cm]{geometry}
\usepackage{tabularray}
\begin{document}
\begin{tblr}
[
long,
caption={Add caption},
label={tab:addlabel}
]
{
colspec={Q[c,m]Q[c,m]Q[c,m]Q[c,m]Q[c,m]Q[c,m]Q[c,m]},
rows={rowsep=2pt},
columns={colsep=2pt},
cells={font=\small},
column{1}={font=\bfseries\small},
row{1,2}={font=\bfseries\small},
cell{1}{1,2,7}={r=2}{},
cell{1}{3}={c=4}{},
cell{3,13,23,33,43}{1}={r=10}{},
cell{38}{7}={red9},
hline{1,3,13,23,33,43,Z}={.08em},
hline{2}={3-6}{.05em,leftpos=-1,rightpos=-1,endpos},
vlines={0.08em,dashed},
rowhead=2
}
{Demographic\\variables} & Values & ANOVA & & & & {Bonferroni\\Correction\\(0.005)}\\
& & df group & df residual & F & Pr(>F) (0.05) & \\
Gender & HEDONISM & 1 & 5238 & 131.60 & <2e-16 *** & <2e-16 ***\\
& SELF\_DIRECTION & 1 & 5238 & 16.86 & 1.04e-15 *** & 1.04e-15 ***\\
& STIMULATION & 1 & 5238 & 29.16 & 6.96e-08 *** & 6.96e-08 ***\\
& SECURITY & 1 & 5238 & 0.84 & 0.358 & 0.358\\
& CONFORMITY & 1 & 5238 & 2.12 & 0.146 & 0.146\\
& TRADITION & 1 & 5238 & 5.94 & 0.0148 * & 0.0148 *\\
& ACHIEVEMENT & 1 & 5238 & 2.01 & 0.157 & 0.157\\
& POWER & 1 & 5238 & 156.80 & <2e-16 *** & <2e-16 ***\\
& UNIVERSALISM & 1 & 5238 & 99.48 & 0.152 & 0.152\\
& BENEVOLENCE & 1 & 5238 & 2.05 & 0.700 & 0.700\\
Age & HEDONISM & 2 & 5514 & 73.73 & <2e-16 *** & <2e-16 ***\\
& SELF\_DIRECTION & 2 & 5514 & 166.50 & <2e-16 *** & <2e-16 ***\\
& STIMULATION & 2 & 5514 & 305.40 & <2e-16 *** & <2e-16 ***\\
& SECURITY & 2 & 5514 & 84.20 & <2e-16 *** & <2e-16 ***\\
& CONFORMITY & 2 & 5514 & 133.20 & <2e-16 *** & <2e-16 ***\\
& TRADITION & 2 & 5514 & 78.67 & <2e-16 *** & <2e-16 ***\\
& ACHIEVEMENT & 2 & 5514 & 117.90 & <2e-16 *** & <2e-16 ***\\
& POWER & 2 & 5514 & 48.05 & <2e-16 *** & <2e-16 ***\\
& UNIVERSALISM & 2 & 5514 & 259.80 & <2e-16 *** & <2e-16 ***\\
& BENEVOLENCE & 2 & 5514 & 54.72 & <2e-16 *** & <2e-16 ***\\
Ethnicity & HEDONISM & 3 & 5155 & 81.60 & <2e-16 *** & <2e-16 ***\\
& SELF\_DIRECTION & 3 & 5155 & 96.47 & <2e-16 *** & <2e-16 ***\\
& STIMULATION & 3 & 5155 & 66.69 & <2e-16 *** & <2e-16 ***\\
& SECURITY & 3 & 5155 & 52.88 & <2e-16 *** & <2e-16 ***\\
& CONFORMITY & 3 & 5155 & 29.95 & <2e-16 *** & <2e-16 ***\\
& TRADITION & 3 & 5155 & 23.40 & 4.9e-15 *** & 4.9e-15 ***\\
& ACHIEVEMENT & 3 & 5155 & 46.30 & <2e-16 *** & <2e-16 ***\\
& POWER & 3 & 5155 & 1.78 & 0.149 & 0.149\\
& UNIVERSALISM & 3 & 5155 & 47.13 & <2e-16 *** & <2e-16 ***\\
& BENEVOLENCE & 3 & 5155 & 32.16 & <2e-16 *** & <2e-16 ***\\
{Education\\level} & HEDONISM & 3 & 4722 & 2.95 & 0.031 & 0.031\\
& SELF\_DIRECTION & 3 & 4722 & 8.25 & 1.78e-05 *** & 1.78e-05 ***\\
& STIMULATION & 3 & 4722 & 11.08 & 3.03e-07 *** & 3.03e-07 ***\\
& SECURITY & 3 & 4722 & 2.68 & 0.045 & 0.045\\
& CONFORMITY & 3 & 4722 & 1.51 & 0.211 & 0.211\\
& TRADITION & 3 & 4722 & 5.24 & 0.001 & \\
& ACHIEVEMENT & 3 & 4722 & 1.00 & 0.391 & 0.391\\
& POWER & 3 & 4722 & 0.12 & 0.948 & 0.948\\
& UNIVERSALISM & 3 & 4722 & 3.92 & 0.008 & 0.008\\
& BENEVOLENCE & 3 & 4722 & 0.78 & 0.680 & 0.680\\
{Income\\level} & HEDONISM & 2 & 3856 & 2.34 & 0.097 & 0.097\\
& SELF\_DIRECTION & 2 & 3856 & 2.75 & 0.064 & 0.064\\
& STIMULATION & 2 & 3856 & 0.63 & 0.533 & 0.533\\
& SECURITY & 2 & 3856 & 1.28 & 0.279 & 0.279\\
& CONFORMITY & 2 & 3856 & 1.29 & 0.276 & 0.276\\
& TRADITION & 2 & 3856 & 0.65 & 0.525 & 0.525\\
& ACHIEVEMENT & 2 & 3856 & 0.85 & 0.429 & 0.429\\
& POWER & 2 & 3856 & 1.56 & 0.211 & 0.211\\
& UNIVERSALISM & 2 & 3856 & 1.49 & 0.225 & 0.225\\
& BENEVOLENCE & 2 & 3856 & 0.25 & 0.777 & 0.777\\
\end{tblr}
\end{document}