有人能帮我调整以下星号吗?

有人能帮我调整以下星号吗?

今天是我第一次学习如何在 Latex 中制作表格。我想出了以下示例:

在此处输入图片描述

我现在的难题是如何对齐星号。我想将 0.019 的“9”与数字的结束括号 (36.58) 匹配,那么星号应该跟在“9”后面,并且不应该在 36.58 的“)”上方,有人能帮我吗?

\documentclass[11pt,a4paper]{article}
\usepackage{mathtools}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{siunitx}
\usepackage{makecell,graphicx,rotating,array,dcolumn,lscape}
\begin{document}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\def\sym#1{\ensuremath{^{\mathrlap{#1}}}}
\begin{landscape}
{\setlength{\extrarowheight}{1.5pt}
\begin{table}[htbp]
\sisetup{table-align-text-post=false}
  \centering
  \caption{The Results of Future Abnormal Return}
    \begin{tabular}{*{9}{l}}
    \toprule
     \multicolumn{1}{l}{}& \multicolumn{1}{c}{EW1M}& \multicolumn{1}{c}{EW3M}&\multicolumn{1}{c}{EW6M}&\multicolumn{1}{c}{EW12M}&\multicolumn{1}{c}{VW1M} &\multicolumn{1}{c}{VW3M}&\multicolumn{1}{c}{VW6M}&\multicolumn{1}{c}{VW12M}\\
      \multicolumn{1}{c}{} & \multicolumn{1}{c}{(1)} &\multicolumn{1}{c}{(2)} &\multicolumn{1}{c}{(3)}  &       \multicolumn{1}{c}{(4)} & \multicolumn{1}{c}{(5)} & \multicolumn{1}{c}{(6)}& \multicolumn{1}{c}{(7)}& \multicolumn{1}{c}{(8)}\\ \midrule
       Purchaser (NPV) &0.019^{***}&0.021^{***}&0.025^{***}&0.025^{***}&0.017^{***}&0.025^{***}&0.038^{***}&0.060^{***}\\
          &(36.58)&(26.98)&(23.34)&(16.84)&(34.03)&(31.64)&(34.72)&(38.85)\\
          &130,982  &129,738    &128,316    &124,121    &130,982        &129,738    &128,316    &124,121\\
          Purchaser (NPR) &0.019^{***}&0.021^{***}&0.025^{***}&0.025^{***}&0.017^{***}&0.025^{***}&0.038^{***}&0.060^{***}\\
          &(36.57)&(26.99)&(23.37)&(16.89)&(34.03)&(31.64)&(34.72)&(38.85)\\
          &130,904  &129,660    &128,239    &124,051    &130,982        &129,738    &128,316    &124,121\\          
    \end{tabular}%
  \label{tab:addlabel}%
\end{table}}
\end{landscape}
\end{document}

答案1

类型为S( 的列siunitx)。所有不属于数字的元素都必须用括号 ( {...}) 保护。

 \documentclass[11pt,a4paper]{article}
 \usepackage{mathtools}
 \usepackage{booktabs}
 \usepackage{amsmath}
 \usepackage{siunitx}
 \usepackage{makecell,graphicx,rotating,array,lscape}
 \begin{document}
 \def\sym#1{\ensuremath{^{\mathrlap{#1}}}}
 \begin{landscape}
 {\setlength{\extrarowheight}{1.5pt}
 \begin{table}[htbp]
 \sisetup{table-align-text-post=false}
   \centering
   \caption{The Results of Future Abnormal Return}
     \begin{tabular}{l*{8}{S}}
     \toprule
       {}& {EW1M}& {EW3M}&{EW6M}&{EW12M}&{VW1M} &{VW3M}&{VW6M}&{VW12M}\\
       {} & {(1)} &{(2)} &{(3)} & {(4)} & {(5)} & {(6)}& {(7)}& {(8)}\\ \midrule
        Purchaser (NPV) &0.019{$^{***}$}&0.021{$^{***}$}&0.025{$^{***}$}&0.025{$^{***}$}&0.017{$^{***}$}&0.025{$^{***}$}&0.038{$^{***}$}&0.060{$^{***}$}\\
           &{(}36.58{)}&{(}26.98{)}&{(}23.34{)}&{(}16.84{)}&{(}34.03{)}&{(}31.64{)}&{(}34.72{)}&{(}38.85{)}\\
           &130.982  &129.738    &128.316    &124.121    &130.982        &129.738    &128.316    &124.121\\
           Purchaser {(}NPR{)} &0.019{$^{***}$}&0.021{$^{***}$}&0.025{$^{***}$}&0.025{$^{***}$}&0.017{$^{***}$}&0.025{$^{***}$}&0.038{$^{***}$}&0.060{$^{***}$}\\
           &{(}36.57{)}&{(}26.99{)}&{(}23.37{)}&{(}16.89{)}&{(}34.03{)}&{(}31.64{)}&{(}34.72{)}&{(}38.85{)}\\
           &130.904  &129.660    &128.239    &124.051    &130.982        &129.738    &128.316    &124.121\\          
     \end{tabular}%
   \label{tab:addlabel}%
 \end{table}}
 \end{landscape}
 \end{document}

在此处输入图片描述

答案2

由于您加载了该dcolumn包,我建议您利用它的D列类型将 8 个数据列中的(大多数)数字与其小数点标记对齐。

在此处输入图片描述

\documentclass[11pt,a4paper]{article}
\usepackage{mathtools,booktabs,array,dcolumn,lscape}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro

\begin{document}
\begin{landscape}
\begin{table}[htbp]
  \centering
  \caption{The Results of Future Abnormal Return}
  \label{tab:addlabel}
  \medskip
    \begin{tabular}{@{} l *{8}{d{2.5}} @{}}
      \toprule
      & \mc{EW1M}& \mc{EW3M}&\mc{EW6M}&\mc{EW12M}&\mc{VW1M} &\mc{VW3M}&\mc{VW6M}&\mc{VW12M}\\
      & \mc{(1)} &\mc{(2)} &\mc{(3)}  & \mc{(4)} & \mc{(5)} & \mc{(6)}& \mc{(7)}& \mc{(8)}\\ 
      \midrule
      Purchaser (NPV) &0.019^{***}&0.021^{***}&0.025^{***}&0.025^{***}&0.017^{***}&0.025^{***}&0.038^{***}&0.060^{***}\\
      &(36.58)&(26.98)&(23.34)&(16.84)&(34.03)&(31.64)&(34.72)&(38.85)\\
      &\mc{130,982}  &\mc{129,738} &\mc{128,316} &\mc{124,121} &\mc{130,982} &\mc{129,738} &\mc{128,316} &\mc{124,121}\\
      \addlinespace
      Purchaser (NPR) &0.019^{***}&0.021^{***}&0.025^{***}&0.025^{***}&0.017^{***}&0.025^{***}&0.038^{***}&0.060^{***}\\
      &(36.57)&(26.99)&(23.37)&(16.89)&(34.03)&(31.64)&(34.72)&(38.85)\\
      &\mc{130,904} &\mc{129,660} &\mc{128,239} &\mc{124,051} &\mc{130,982} &\mc{129,738} &\mc{128,316} &\mc{124,121}\\    
      \bottomrule      
    \end{tabular}
\end{table}
\end{landscape}
\end{document}

答案3

可能是以下代码。我已将星号放在其他列中。

\documentclass[11pt,a4paper]{article}
\usepackage{mathtools}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{siunitx}
\usepackage{makecell,graphicx,rotating,array,dcolumn,lscape}
\begin{document}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\def\sym#1{\ensuremath{^{\mathrlap{#1}}}}
\begin{landscape}
{\setlength{\extrarowheight}{1.5pt}
\begin{table}[htbp]
\sisetup{table-align-text-post=false}
  \centering
  \caption{The Results of Future Abnormal Return}
    \begin{tabular}{*{9}{r@{}>{$}l<{$}}}
    \toprule
     \multicolumn{2}{l}{}& \multicolumn{2}{c}{EW1M}& \multicolumn{2}{c}{EW3M}&\multicolumn{2}{c}{EW6M}&\multicolumn{2}{c}{EW12M}&\multicolumn{2}{c}{VW1M} &\multicolumn{2}{c}{VW3M}&\multicolumn{2}{c}{VW6M}&\multicolumn{2}{c}{VW12M}\\
      \multicolumn{2}{c}{} & \multicolumn{2}{c}{(1)} &\multicolumn{2}{c}{(2)} &\multicolumn{2}{c}{(3)}  &       \multicolumn{2}{c}{(4)} & \multicolumn{2}{c}{(5)} & \multicolumn{2}{c}{(6)}& \multicolumn{2}{c}{(7)}& \multicolumn{2}{c}{(8)}\\ \midrule
       Purchaser (NPV) &&0.019&^{***}&0.021&^{***}&0.025&^{***}&0.025&^{***}&0.017&^{***}&0.025&^{***}&0.038&^{***}&0.060&^{***}\\
          &&(36.58)&&(26.98)&&(23.34)&&(16.84)&&(34.03)&&(31.64)&&(34.72)&&(38.85)\\
          &&130,982  &&129,738    &&128,316    &&124,121    &&130,982        &&129,738    &&128,316    &&124,121\\
          Purchaser (NPR) &&0.019&^{***}&0.021&^{***}&0.025&^{***}&0.025&^{***}&0.017&^{***}&0.025&^{***}&0.038&^{***}&0.060&^{***}\\
          &&(36.57)&&(26.99)&&(23.37)&&(16.89)&&(34.03)&&(31.64)&&(34.72)&&(38.85)\\
          &&130,904  &&129,660    &&128,239    &&124,051    &&130,982        &&129,738    &&128,316    &&124,121\\          
    \end{tabular}%
  \label{tab:addlabel}%
\end{table}}
\end{landscape}
\end{document}

上述代码的结果

答案4

我作为评论发布给 OP 的解决方案保持较长的数字在小数点处对齐(如果这是所需的......)

\documentclass[11pt,a4paper]{article}
\usepackage{mathtools}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{siunitx}
\usepackage{makecell,graphicx,rotating,array,dcolumn,lscape}
\begin{document}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\def\sym#1{\ensuremath{^{\mathrlap{#1}}}}
\begin{landscape}
{\setlength{\extrarowheight}{1.5pt}
\begin{table}[htbp]
\sisetup{table-align-text-post=false}
  \centering
  \caption{The Results of Future Abnormal Return}
    \begin{tabular}{l *{8}{d{3}}} %%<======== aligns all the numbers on the decimal
    \toprule
     \multicolumn{1}{l}{}& \multicolumn{1}{c}{EW1M}& \multicolumn{1}{c}{EW3M}&\multicolumn{1}{c}{EW6M}&\multicolumn{1}{c}{EW12M}&\multicolumn{1}{c}{VW1M} &\multicolumn{1}{c}{VW3M}&\multicolumn{1}{c}{VW6M}&\multicolumn{1}{c}{VW12M}\\
      \multicolumn{1}{c}{} & \multicolumn{1}{c}{(1)} &\multicolumn{1}{c}{(2)} &\multicolumn{1}{c}{(3)}  &       \multicolumn{1}{c}{(4)} & \multicolumn{1}{c}{(5)} & \multicolumn{1}{c}{(6)}& \multicolumn{1}{c}{(7)}& \multicolumn{1}{c}{(8)}\\ \midrule
       Purchaser (NPV) &0.019^{***}&0.021^{***}&0.025^{***}&0.025^{***}&0.017^{***}&0.025^{***}&0.038^{***}&0.060^{***}\\
          &(36.58)&(26.98)&(23.34)&(16.84)&(34.03)&(31.64)&(34.72)&(38.85)\\
          &130,982  &129,738    &128,316    &124,121    &130,982        &129,738    &128,316    &124,121\\
          Purchaser (NPR) &0.019^{***}&0.021^{***}&0.025^{***}&0.025^{***}&0.017^{***}&0.025^{***}&0.038^{***}&0.060^{***}\\
          &(36.57)&(26.99)&(23.37)&(16.89)&(34.03)&(31.64)&(34.72)&(38.85)\\
          &130,904  &129,660    &128,239    &124,051    &130,982        &129,738    &128,316    &124,121\\          
    \end{tabular}%
  \label{tab:addlabel}%
\end{table}}
\end{landscape}
\

结束{文档} 在此处输入图片描述

相关内容