Skip to content

Instantly share code, notes, and snippets.

@RazerM
Last active December 14, 2015 21:19
Show Gist options
  • Save RazerM/5150731 to your computer and use it in GitHub Desktop.
Save RazerM/5150731 to your computer and use it in GitHub Desktop.
LaTeX: Number aligned table #snippet
%Needs \usepackage{float} for {H}
\begin{table}[H]
\centering
% table-format is defined as a.b where a is number of figures before decimal point, b is number of decimal places
\begin{tabular}{S[table-format=1]S[table-format=2.1]} %First S sets format for both columns, but each can have different table-format
\toprule
{ Distance (\si{\metre}) } & { Speed (\si{mi\per\hour}) }\\ %Non-number input must be surrounded with { }
\midrule
0 & 0 \\
1 & 1.1 \\
2 & 3.2 \\
3 & 5.7 \\
4 & 9.6 \\
5 & 12.4 \\
\bottomrule
\end{tabular}
\caption{Car speed test}
\label{tab:speed-test}
\end{table}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment