
Como posso alinhar números com unidades em uma tabela? Tento com siunitx mas não funciona:
\begin{table}
\centering
\caption{Caption goes here.}
\begin{tabular}[t]{lS}
\toprule
Substance & Amounts \\ \midrule
A & 1 $mL$ \\
B & 100 $mg$ \\
C & 0.5 $mg$ \\
D & 82 $\mu L$ \\
E & 0.1 $g$ \\bottomrule
\end{tabular}
\end{table}
Eu também faria isso manualmente se houvesse possibilidade, já que escrevo não preciso de muitas tabelas. desde já, obrigado
Responder1
Algo assim?
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{siunitx,booktabs,array}
\begin{document}
\begin{table}
\centering
\caption{Caption goes here.}
\begin{tabular}[t]{ @{}
l
S[table-format=2.1]
@{\,}
s[table-unit-alignment=left]
@{} }
\toprule
Substance & \multicolumn{2}{c@{}}{Amounts} \\
\midrule
A & 1 & \milli\liter \\
B & 100 & \milli\gram \\
C & 0.5 & \milli\gram \\
D & 82 & \micro\liter \\
E & 0.1 & \gram \\
\bottomrule
\end{tabular}
\end{table}
\end{document}