我无法使用 siunitx 对齐文档中的角度值。如果我不使用\ang{}
siunitx 中的命令,数字才会正确对齐。我制作了一个小型的最小工作示例来展示这个问题:
\documentclass[
12pt,
DIV=12,
paper=A4,
parskip=half,
]{scrreprt}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{siunitx}
\sisetup{locale = DE}
\begin{document}
\begin{table}[h]
\caption{Align the following numbers}
\begin{tabularx}{\textwidth}{S[table-format=+2.2]}
\toprule
\textbf{Values} \\
\midrule
\ang{70,50} \\
\ang{40,50} \\
\ang{20,50} \\
\ang{-4,40} \\
\ang{0,50} \\
\bottomrule
\end{tabularx}
\label{tab:Test1}
\end{table}
\begin{table}[h]
\caption{Align the following numbers}
\begin{tabularx}{\textwidth}{S[table-format=+2.2]}
\toprule
\textbf{Values} \\
\midrule
70,50 \\
40,50 \\
20,50 \\
-4,40 \\
0,50 \\
\bottomrule
\end{tabularx}
\label{tab:Test2}
\end{table}
\end{document}
答案1
像这样吗?
\documentclass[12pt]{scrreprt}
\usepackage{booktabs}
\usepackage[locale = DE]{siunitx}
\begin{document}
\begin{tabular}{ @{} S[table-format = -1.2 \unit{\degree},
table-align-text-after = false] @{} }
\toprule
{\textbf{Values}} \\
\midrule
70,50 \unit{\degree} \\
40,50 \unit{\degree} \\
20,50 \unit{\degree} \\
-4,40 \unit{\degree} \\
0,5 \unit{\degree} \\
\bottomrule
\end{tabular}
\end{document}