在表中对齐乘以 10 的幂的十进制数

在表中对齐乘以 10 的幂的十进制数

我怎样才能使表中的十进制数对齐,同时知道这些数字乘以 10 的幂。

在此处输入图片描述

\begin{table}[h]
\caption{Gradient of the log-likelihood using analytical expression and Matlab central finite differences approximation}
\label{tab:Gradient}
\begin{center}   
\begin{tabular}{lll}
\toprule
Gradient & SCKF\textsubscript{analytical} & SCKF\textsubscript{central} \\
\midrule
Gradient w.r.t $\bm{a_e}$      & $1.63076989\cdot10^4$  & $1.63076989\cdot 10^4$ \\
Gradient w.r.t $\bm{\kappa_e}$ & $-0.37241217\cdot10^4$ & $-0.37241217\cdot 10^4$ \\
Gradient w.r.t $\bm{a_i}$      & $0.24443907\cdot10^4$  & $0.24443907\cdot 10^4$ \\
Gradient w.r.t $\bm{\kappa_i}$ & $-0.13204648\cdot10^4$ & $-0.13204648\cdot 10^4$ \\
Gradient w.r.t $\bm{c}$        & $0.01407282\cdot10^4$  & $0.01407282\cdot 10^4$ \\
Gradient w.r.t $\bm{d}$        & $0.38486354\cdot10^4$  & $0.38486354\cdot 10^4$ \\
Gradient w.r.t $\bm{\epsilon}$ & $-4.01712927\cdot10^4$ & $-4.01712927\cdot 10^4$ \\
Gradient w.r.t $\bm{\kappa_s}$ & $1.15246120\cdot10^4$  & $1.15246120\cdot 10^4$ \\
Gradient w.r.t $\bm{\tau}$     & $-0.00272403\cdot10^4$ & $-0.00272403\cdot 10^4$ \\
\bottomrule
\end{tabular}
\end{center}
\end{table}

答案1

这是一个具有简化代码的解决方案,基于siunitx并且第一列看起来更美观:

\documentclass{article} %
\usepackage[utf8]{inputenc}%
\usepackage{booktabs, multirow, makecell, caption}%
\usepackage{mathtools}
\usepackage{siunitx}

\begin{document}

\begin{table}[h]
  \sisetup{table-format = -1.8e2, table-number-alignment=center}
  \caption{Gradient of the log-likelihood using analytical expression and Matlab central finite differences approximation}
  \label{tab:Gradient}
  \centering
  \begin{tabular}{>{\boldmath$}l<{$}SS}
    \toprule
    \multicolumn{1}{c}{\makecell[c]{Gradient \\[-1ex]w.r.t. }} & {SCKF\textsubscript{analytical}} & {SCKF\textsubscript{central}} \\
    \midrule
    \multirowcell{9}{\begin{matrix*}[l]a_e \\ \kappa_e \\ a_i \\ \kappa_i \\ c \\ d \\ ϵ\\ \kappa_s \\ τ\end{matrix*}} & 1.63076989e4 & 1.63076989e4 \\
                                                & -0.37241217e4 & -0.37241217e4 \\
                                                & 0.24443907e4 & 0.24443907e4 \\
                                                & -0.13204648e4 & -0.13204648e4 \\
                                                & 0.01407282e4 & 0.01407282e4 \\
                                                & 0.38486354e4 & 0.38486354e4 \\
                                                & -4.01712927e4 & -4.01712927e4 \\
                                                & 1.15246120e4 & 1.15246120e4 \\
                                                & -0.00272403e4 & -0.00272403e4 \\
    \bottomrule
  \end{tabular}
\end{table}

\end{document} 

在此处输入图片描述

答案2

包裹siunitx是你的朋友:

\documentclass{article}
\usepackage{bm}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{siunitx}
\sisetup{
  exponent-product=\cdot,
}

\begin{document}
\begin{table}
  \centering
  \caption{Gradient of the log-likelihood using analytical expression
    and Matlab central finite differences approximation}
  \label{tab:Gradient}
  \begin{tabular}{
    l
    S[table-format=-1.8e1]
    S[table-format=-1.8e1]
  }
    \toprule
    Gradient & SCKF\textsubscript{analytical} & SCKF\textsubscript{central} \\
    \midrule
    Gradient w.r.t $\bm{a_e}$      &  1.63076989e4 &  1.63076989e4 \\
    Gradient w.r.t $\bm{\kappa_e}$ & -0.37241217e4 & -0.37241217e4 \\
    Gradient w.r.t $\bm{a_i}$      &  0.24443907e4 &  0.24443907e4 \\
    Gradient w.r.t $\bm{\kappa_i}$ & -0.13204648e4 & -0.13204648e4 \\
    Gradient w.r.t $\bm{c}$        &  0.01407282e4 &  0.01407282e4 \\
    Gradient w.r.t $\bm{d}$        &  0.38486354e4 &  0.38486354e4 \\
    Gradient w.r.t $\bm{\epsilon}$ & -4.01712927e4 & -4.01712927e4 \\
    Gradient w.r.t $\bm{\kappa_s}$ &  1.15246120e4 &  1.15246120e4 \\
    Gradient w.r.t $\bm{\tau}$     & -0.00272403e4 & -0.00272403e4 \\
    \bottomrule
  \end{tabular}
\end{table}
\end{document}

结果

相关内容