Latex - 使用多列的单元格宽度不均匀
Latex - Uneven cell width using multicolumn
我正在尝试在 Latex 中制作一个 table,但我不知道如何制作包含在多列中的三个 cells/columns(AR%、t-test、Patell Z)同样宽。提前致谢!
附上 table/code 的照片。
\newpage
\begin{center}
\normalsize
Table 7: Abnormal returns
\end{center}
% Please add the following required packages to your document preamble:
% \usepackage[table,xcdraw]{xcolor}
% If you use beamer only pass "xcolor=table" option, i.e. \documentclass[xcolor=table]{beamer}
\begin{table}[!htbp] \centering
\centerline{%
\normalsize
\renewcommand{\arraystretch}{1.2}
\begin{tabular}{ccccc}
\hline
N & Day & \multicolumn{3}{c}{} \
\multicolumn{2}{c}{} & \multicolumn{3}{c}{\textbf{Abnormal Average Returns}} \
\vspace{} \
\multicolumn{2}{c}{} & \overline{AR}\%& \textbf{t-test}& \textbf{Patell Z}\
\cline{3-5}
1800 & \textbf{-5} & 0,04 & 0,03 & 0,05 \
1800 & \textbf{-4} & 0,03 & 0,02 & 0,05 \
1800 & \textbf{-3} & 0,03 & 0,03 & 0,03 \
1800 & \textbf{-2} & 0,03 & 0,03 & 0,03 \
1800 & \textbf{-1} & 0,03 & 0,03 & 0,03 \
\rowcolor[HTML]{EFEFEF}
1800 & \textbf{0} & 0,03 & 0,03 & 0,03 \
1800 & \textbf{1} & 0,03 & 0,03 & 0,03 \
1800 & \textbf{2} & 0,03 & 0,03 & 0,03 \
1800 & \textbf{3} & 0,03 & 0,03 & 0,03 \
1800 & \textbf{4} & 0,03 & 0,03 & 0,03 \
1800 & \textbf{5} & 0,03 & 0,03 & 0,03 \
\hline
\end{tabular}
}
\vspace{0,3cm}
\begin{tablenotes}
\footnotesize
Note: REWRITE
\end{tablenotes}
\end{table}
我建议使用 tabularray
包。这使得合并单元格变得非常容易:
\documentclass{article}
\usepackage{tabularray}
\usepackage{xcolor}
\begin{document}
\begin{tblr}{
colspec={
c
Q[halign=c,mode=math,font=\boldmath]
Q[1.5cm,halign=c]
Q[1.5cm,halign=c]
Q[1.5cm,halign=c]
},
row{8}={bg=gray!20!white},
row{1}={mode=text},
row{1-2}={font=\bfseries},
cell{2}{3}={mode=math,font=\boldmath}
}
\hline
\SetCell[r=2]{} N & \SetCell[r=2]{} Day & \SetCell[c=3]{} Abnormal Average Returns & & \
\cline{3-5}
& & \overline{AR}\,\% & t-test & Patell Z\
\hline
1800 & -5 & 0,04 & 0,03 & 0,05 \
1800 & -4 & 0,03 & 0,02 & 0,05 \
1800 & -3 & 0,03 & 0,03 & 0,03 \
1800 & -2 & 0,03 & 0,03 & 0,03 \
1800 & -1 & 0,03 & 0,03 & 0,03 \
1800 & 0 & 0,03 & 0,03 & 0,03 \
1800 & 1 & 0,03 & 0,03 & 0,03 \
1800 & 2 & 0,03 & 0,03 & 0,03 \
1800 & 3 & 0,03 & 0,03 & 0,03 \
1800 & 4 & 0,03 & 0,03 & 0,03 \
1800 & 5 & 0,03 & 0,03 & 0,03 \
\hline
\end{tblr}
\end{document}
我正在尝试在 Latex 中制作一个 table,但我不知道如何制作包含在多列中的三个 cells/columns(AR%、t-test、Patell Z)同样宽。提前致谢!
附上 table/code 的照片。
\newpage
\begin{center}
\normalsize
Table 7: Abnormal returns
\end{center}
% Please add the following required packages to your document preamble:
% \usepackage[table,xcdraw]{xcolor}
% If you use beamer only pass "xcolor=table" option, i.e. \documentclass[xcolor=table]{beamer}
\begin{table}[!htbp] \centering
\centerline{%
\normalsize
\renewcommand{\arraystretch}{1.2}
\begin{tabular}{ccccc}
\hline
N & Day & \multicolumn{3}{c}{} \
\multicolumn{2}{c}{} & \multicolumn{3}{c}{\textbf{Abnormal Average Returns}} \
\vspace{} \
\multicolumn{2}{c}{} & \overline{AR}\%& \textbf{t-test}& \textbf{Patell Z}\
\cline{3-5}
1800 & \textbf{-5} & 0,04 & 0,03 & 0,05 \
1800 & \textbf{-4} & 0,03 & 0,02 & 0,05 \
1800 & \textbf{-3} & 0,03 & 0,03 & 0,03 \
1800 & \textbf{-2} & 0,03 & 0,03 & 0,03 \
1800 & \textbf{-1} & 0,03 & 0,03 & 0,03 \
\rowcolor[HTML]{EFEFEF}
1800 & \textbf{0} & 0,03 & 0,03 & 0,03 \
1800 & \textbf{1} & 0,03 & 0,03 & 0,03 \
1800 & \textbf{2} & 0,03 & 0,03 & 0,03 \
1800 & \textbf{3} & 0,03 & 0,03 & 0,03 \
1800 & \textbf{4} & 0,03 & 0,03 & 0,03 \
1800 & \textbf{5} & 0,03 & 0,03 & 0,03 \
\hline
\end{tabular}
}
\vspace{0,3cm}
\begin{tablenotes}
\footnotesize
Note: REWRITE
\end{tablenotes}
\end{table}
我建议使用 tabularray
包。这使得合并单元格变得非常容易:
\documentclass{article}
\usepackage{tabularray}
\usepackage{xcolor}
\begin{document}
\begin{tblr}{
colspec={
c
Q[halign=c,mode=math,font=\boldmath]
Q[1.5cm,halign=c]
Q[1.5cm,halign=c]
Q[1.5cm,halign=c]
},
row{8}={bg=gray!20!white},
row{1}={mode=text},
row{1-2}={font=\bfseries},
cell{2}{3}={mode=math,font=\boldmath}
}
\hline
\SetCell[r=2]{} N & \SetCell[r=2]{} Day & \SetCell[c=3]{} Abnormal Average Returns & & \
\cline{3-5}
& & \overline{AR}\,\% & t-test & Patell Z\
\hline
1800 & -5 & 0,04 & 0,03 & 0,05 \
1800 & -4 & 0,03 & 0,02 & 0,05 \
1800 & -3 & 0,03 & 0,03 & 0,03 \
1800 & -2 & 0,03 & 0,03 & 0,03 \
1800 & -1 & 0,03 & 0,03 & 0,03 \
1800 & 0 & 0,03 & 0,03 & 0,03 \
1800 & 1 & 0,03 & 0,03 & 0,03 \
1800 & 2 & 0,03 & 0,03 & 0,03 \
1800 & 3 & 0,03 & 0,03 & 0,03 \
1800 & 4 & 0,03 & 0,03 & 0,03 \
1800 & 5 & 0,03 & 0,03 & 0,03 \
\hline
\end{tblr}
\end{document}