I just started using LateX, this table stays on the right no matter what. How can I center it by using the left space?
2 Answers
\documentclass{article}
\usepackage{siunitx,booktabs}
\sisetup{uncertainty-mode=separate}
\begin{document}
\begin{table}
\centering
\begin{tabular}{cSS}
\toprule
{$N$} & {diametro (\unit{\mm})} & {$\cos\theta$ ($\qty[print-unity-mantissa = false]{e-6}{\radian}$)} \\\midrule
7 & 48\pm1 & 99990\pm1\\
6 & 63\pm1&99983\pm1\\
5&74\pm1&99977\pm1\\
4&88\pm1&99967\pm1\\
3&95\pm1&99962\pm1\\
2&103\pm1&99955\pm1\\
1&109\pm1&99949\pm1\\\bottomrule
\end{tabular}
\caption{Caption}
\label{tab:my_label}
\end{table}
\end{document}
Without interchanges of columns and rows:
By use of tabularray
table and enabled two line text in the first column:
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{siunitx}
\begin{document}
\begin{table}
\small
\sisetup{uncertainty-mode = separate,
tight-spacing}
\begin{tblr}{hline{1,2,Z},
colspec = {@{} Q[c,m] *{7}{X[c, si={table-format=5.0(1)}]} @{}},
colsep = 3pt,
row{1} = {guard}
}
$N$ & 7 & 6 & 5 & 4 & 3 & 2 & 1 \\
{diametro\\ (\unit{\mm})}
& 48(1) & 63(1) & 74(1) & 88(1) & 95(1) &103(1) & 109(1) \\
{$\cos\theta$\\ (\qty{e-6}{\radian})}
& 99990(1) & 99983(1) & 99977(1) & 99967(1) & 99962(1) & 99955(1) & 99949(1) \\
\end{tblr}
\caption{Caption}
\label{tab:my_label}
\end{table}
\end{document}
\documentclass{}
and ending with\end{document}
, you can use thelipsum
package to generate filler text$63 \pm 1$
instead of63 $\pm$ 1
the whole thing is a mathematical object to be typeset, not just\pm
. Additionally, you should have a look at thesiunitx
package to format units and table data.