如何使两个位于同一行的子表居中

如何使两个位于同一行的子表居中

我遇到了一个问题,因为我无法将两个位于同一行的表格居中。我尝试了很多次,使用了不同的方法,但都没有用。我使用的代码如下:

\begin{table}[h]
\begin{subtable}[c]{.5\textwidth}
\centering
\raggedright
\begin{tabular}{c c}
\toprule
\multicolumn{2}{c}{\textbf{Event Window +/-1 days}} \\
\midrule
Min.    & -0.0238395 \\
1st Qu. & -0.0020889 \\
Median  & +0.0005291 \\
Mean    & +0.0006262 \\
3rd Qu. & +0.0048530 \\
Max.    & +0.0190593 \\
\bottomrule
\end{tabular}
\end{subtable}%
\begin{subtable}[c]{.5\textwidth}
\centering
\raggedright
\begin{tabular}{c c}
\toprule
\multicolumn{2}{c}{\textbf{Event Window +/-5 days}} \\
\midrule
Min.    & -0.019635 \\
1st Qu. & -0.002735 \\
Median  & +0.001202  \\
Mean    & +0.000585 \\
3rd Qu. & +0.003947 \\
Max.    & +0.013458 \\
\bottomrule
\end{tabular}
\end{subtable}
\caption{Descriptive and Explorative analysis for SIX Exchange Swiss Performance Index. Source: \cite{rproject2008xx} output}
\label{table:SPI MSCI beta}
\end{table}

我每次得到的结果如下: 在此处输入图片描述

有人能帮助我吗?

答案1

\raggedright杀死\centering。所以删除它们会起作用

\documentclass{article}
\usepackage{subcaption}
\usepackage{booktabs}
\begin{document}
\begin{table}[h]
\begin{subtable}[c]{.5\textwidth}
\centering
\begin{tabular}{c c}
\toprule
\multicolumn{2}{c}{\textbf{Event Window +/-1 days}} \\
\midrule
Min.    & -0.0238395 \\
1st Qu. & -0.0020889 \\
Median  & +0.0005291 \\
Mean    & +0.0006262 \\
3rd Qu. & +0.0048530 \\
Max.    & +0.0190593 \\
\bottomrule
\end{tabular}
\end{subtable}%
\begin{subtable}[c]{.5\textwidth}
\centering
\begin{tabular}{c c}
\toprule
\multicolumn{2}{c}{\textbf{Event Window +/-5 days}} \\
\midrule
Min.    & -0.019635 \\
1st Qu. & -0.002735 \\
Median  & +0.001202  \\
Mean    & +0.000585 \\
3rd Qu. & +0.003947 \\
Max.    & +0.013458 \\
\bottomrule
\end{tabular}
\end{subtable}
\caption{Descriptive and Explorative analysis for SIX Exchange Swiss Performance Index. Source: [something] output}
\label{table:SPI MSCI beta}
\end{table}
\end{document}

在此处输入图片描述

相关内容