
Wie kann ich Zahlen in einer Tabelle mit Einheiten ausrichten? Ich habe es mit siunitx versucht, aber es funktioniert nicht:
\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}
Ich würde es auch manuell machen, wenn es eine Möglichkeit gibt, da ich nicht viele Tabellen schreiben muss. Vielen Dank im Voraus
Antwort1
Etwas wie das?
\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}