我正在尝试将下表转换为科学计数法(例如 e^-01),但不起作用。这是我的论文的一个最小工作示例。非常感谢您的帮助!
\documentclass[12pt, oneside]{article}
\usepackage[a4paper,margin=1in]{geometry}
\usepackage{booktabs}
\providecommand{\sci}[1]{\protect\ensuremath{\times 10^{\StrSubstitute[0]{#1}{e}{}}}}
\begin{document}
\begin{table}[h!]
\caption{Gene expression for final candidate genes}\label{tab:final_expression}
\centering
\begin{tabular}{llcccc}
\toprule
& Gene & {$\log(FC)$} & {\textit{t}-stat} & {\textit{p}-value} & {Adj.\textit{p}-value}\\
\midrule
Amplification & PIK3CA & 0.51 & 4.09 & 3.97e-04 & 1.32e-03 \\
& PTK2 & 1.21 & 6.20 & 1.74e-06 & 1.03e-05 \\
& PTK2 & 0.46 & 4.49 & 1.38e-04 & 5.13e-04 \\
\addlinespace
Deletion & FGFR2 & -3.12 & -8.93 & 2.97e-09 & 3.98e-08 \\
& FGFR2 & -2.52 & -7.92 & 2.85e-08 & 2.77e-07 \\
& FGFR2 & -2.51 & -8.03 & 2.20e-08 & 2.22e-07 \\
& FGFR2 & -2.47 & -7.83 & 3.48e-08 & 3.31e-07 \\
& FGFR2 & -2.46 & -7.14 & 1.74e-07 & 1.37e-06 \\
& FGFR2 & -2.45 & -7.72 & 4.47e-08 & 4.13e-07 \\
& FGFR2 & -2.45 & -7.51 & 7.25e-08 & 6.31e-07 \\
& FGFR2 & -2.43 & -7.71 & 4.59e-08 & 4.23e-07 \\
& FGFR2 & -2.42 & -7.65 & 5.32e-08 & 4.81e-07 \\
& FGFR2 & -2.39 & -7.49 & 7.66e-08 & 6.63e-07 \\
& FGFR2 & -2.20 & -6.70 & 5.04e-07 & 3.50e-06 \\
& FGFR2 & -0.94 & -4.39 & 1.83e-04 & 6.60e-04 \\
& FAM101B & -0.93 & -6.11 & 2.17e-06 & 1.26e-05 \\
& P2RY5 & -0.89 & -5.58 & 8.46e-06 & 4.22e-05 \\
& P2RY5 & -0.89 & -7.71 & 4.59e-08 & 4.23e-07 \\
& PDE2A & -0.55 & -3.99 & 5.13e-4 & 1.66e-3 \\
& VPS53 & -0.63 & -5.71 & 6.03e-06 & 3.12e-05 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案1
使用siunitx
及其table-format
键。您不必定义\sci
命令。我还添加了caption
包,以便在标题和表格之间留出合理的间距。
\documentclass[12pt, oneside]{article}
\usepackage[a4paper,margin=1in]{geometry}
\usepackage{booktabs, caption}
\usepackage{siunitx}
\sisetup{table-number-alignment=center, exponent-product=\cdot}
\begin{document}
\begin{table}[h!]
\caption{Gene expression for final candidate genes}\label{tab:final_expression}
\centering
\begin{tabular}{ll*{2}{S[table-format=-1.2]}*{2}{S[table-format=1.2e-2]}}
\toprule
& Gene & {$\log(FC)$} & {\textit{t}-stat} & {\textit{p}-value} & {Adj.\textit{p}-value} \\
\midrule
Amplification & PIK3CA & 0.51 & 4.09 & 3.97e-04 & 1.32e-03 \\
& PTK2 & 1.21 & 6.20 & 1.74e-06 & 1.03e-05 \\
& PTK2 & 0.46 & 4.49 & 1.38e-04 & 5.13e-04 \\
\addlinespace
Deletion & FGFR2 & -3.12 & -8.93 & 2.97e-09 & 3.98e-08 \\
& FGFR2 & -2.52 & -7.92 & 2.85e-08 & 2.77e-07 \\
& FGFR2 & -2.51 & -8.03 & 2.20e-08 & 2.22e-07 \\
& FGFR2 & -2.47 & -7.83 & 3.48e-08 & 3.31e-07 \\
& FGFR2 & -2.46 & -7.14 & 1.74e-07 & 1.37e-06 \\
& FGFR2 & -2.45 & -7.72 & 4.47e-08 & 4.13e-07 \\
& FGFR2 & -2.45 & -7.51 & 7.25e-08 & 6.31e-07 \\
& FGFR2 & -2.43 & -7.71 & 4.59e-08 & 4.23e-07 \\
& FGFR2 & -2.42 & -7.65 & 5.32e-08 & 4.81e-07 \\
& FGFR2 & -2.39 & -7.49 & 7.66e-08 & 6.63e-07 \\
& FGFR2 & -2.20 & -6.70 & 5.04e-07 & 3.50e-06 \\
& FGFR2 & -0.94 & -4.39 & 1.83e-04 & 6.60e-04 \\
& FAM101B & -0.93 & -6.11 & 2.17e-06 & 1.26e-05 \\
& P2RY5 & -0.89 & -5.58 & 8.46e-06 & 4.22e-05 \\
& P2RY5 & -0.89 & -7.71 & 4.59e-08 & 4.23e-07 \\
& PDE2A & -0.55 & -3.99 & 5.13e-4 & 1.66e-3 \\
& VPS53 & -0.63 & -5.71 & 6.03e-06 & 3.12e-05 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}