0

I just started using LateX, this table stays on the right no matter what. How can I center it by using the left space? Code Result

5
  • 4
    It looks as if your table is too wide for the linewidth. I thik I'd switch rows and columns
    – Patricio
    Mar 16 at 14:35
  • 1
    Welcome to Tex.SE! Posting pictures of code is not a good idea as it means all the effort in finding solutions is left to the people here, could you copy and paste a small example that can compile please, starting with your \documentclass{} and ending with \end{document}, you can use the lipsum package to generate filler text
    – JamesT
    Mar 16 at 14:35
  • 1
    Please never post images of code, no-one wants to re-type your example in order to test it. As Patricio already mentioned, your table is wider than the text width and thus of course will not be centered in relation to it.
    – daleif
    Mar 16 at 14:43
  • 1
    Unrelated but it is better to just write $63 \pm 1$ instead of 63 $\pm$ 1 the whole thing is a mathematical object to be typeset, not just \pm. Additionally, you should have a look at the siunitx package to format units and table data.
    – daleif
    Mar 16 at 14:45
  • Thank you all! Next time I'll write the code in the question, sorry :)
    – TommyTx3
    Mar 16 at 14:58

2 Answers 2

1
\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}

Result

0

Without interchanges of columns and rows:

enter image description here

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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.