siunitx:(-0.123)和貼文文字的組合為 1.234*** 給出無用的結果

siunitx:(-0.123)和貼文文字的組合為 1.234*** 給出無用的結果

請考慮以下 MWE:

\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{|S[table-format=-1.3,
                  table-space-text-pre ={(-},  % hasn't  effect ?
                  table-space-text-post={***},% hasn't  effect ?
                  input-symbols={( )},
                  explicit-sign,
                  parse-numbers=false,
                 ]|}
\hline
  1.248\textsuperscript{***}  \\
(-0.124)                        \\
\hline
\end{tabular}
\end{document}

它給

在此輸入影像描述

有沒有辦法獲得可用的結果?

答案1

這個問題可以透過將括號(前部分和後部分)放在大括號中來解決:

\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{|S[table-format=-1.3,
                  table-space-text-pre ={(},
                  table-space-text-post={\textsuperscript{***}},
                  explicit-sign,
                 ]|}
\hline
  1.248\textsuperscript{***} \\
{(}-0.124{)}                 \\
\hline
\end{tabular}
\end{document}

它編譯時不會發出有關\hboxes 溢出的警告。

結果

大括號保護括號符號被解析為不確定性符號。可以更改不確定性的輸入符號以避免表體中的花括號:

\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{|S[table-format=-1.3,
                  table-space-text-pre ={(},
                  table-space-text-post={\textsuperscript{***}},
                  explicit-sign,
                  input-open-uncertainty={[},
                  input-close-uncertainty={]},
                 ]|}
\hline
  1.248\textsuperscript{***} \\
(-0.124)                     \\
\hline
\end{tabular}
\end{document}

如果你想去掉表體中額外的大括號,那麼括號

相關內容