1

I have created a table of the first 20 values of the number-theoretic functions and σ. What I'd like to know is whether I have done this "correctly." In other words, is the table below the best way to display the first few values of these two functions?

\documentclass[]{article}
\usepackage{booktabs}
\begin{document}
\begin{table}[ht]
\belowcaptionskip1ex
\caption{The functions $\tau$ and $\sigma$}
\centering
\begin{tabular}{c r r r r r r r r r r r r r r r r r r r r}
\hline
\toprule 
{$n$} & {$1$} & {$2$} & {$3$} & {$4$} & {$5$} & {$6$} & {$7$} & {$8$} & {$9$} & {$10$} 
& {$11$} & {$12$} & {$13$} & {$14$} & {$15$} & {$16$} & {$17$} & {$18$} & {$19$} & {$20$} \\
\midrule
$\tau(n)$ & $1$ & $2$ & $2$ & $3$ & $2$ & $4$ & $2$ & $4$ & $3$ & $4$ & $2$ 
& $6$ & $2$ & $4$ & $4$ & $5$ & $2$ & $6$ & $2$ & $6$ \\
$\sigma(n)$ & $1$ & $3$ & $4$ & $7$ & $6$ & $12$ & $8$  & $15$ & $13$ & $18$ 
& $12$ & $28$ & $14$ & $24$ & $24$ & $31$ & $18$ & $39$ & $20$  & $42$ \\
\bottomrule
\end{tabular}
\label{Table:tauandsigma}
\end{table}    
\end{document}
Werner
  • 603,163
the_fox
  • 547
  • Given how wide this table is I would suggest either two tables or adding another three rows below to split the table into [1, 10] and [11, 20]. This would also allow for the table to be properly centred as its currently further to the right since its so large – Willoughby Mar 02 '21 at 15:28
  • Sorry, I forgot to mention that I am using the fullpage package, so the table I have seems to fit just about right. (At first, I had only values up to $n=12$, but I then put in some more.) – the_fox Mar 02 '21 at 15:33
  • Its still not quite centred (although I did have to use a ruler to check). Also numbers don't need to be in maths mode, nor are the {} necesarry that you have for the first row,. – Willoughby Mar 02 '21 at 16:08
  • Ok about the brackets, but I need the math mode. I am using babel since I am writing in Greek, so the appearance of a number is different depending on whether it is in math mode or not. – the_fox Mar 02 '21 at 16:28
  • You could always do the whole thing with an array environment and then everything is in math mode – Willoughby Mar 02 '21 at 16:40
  • You are right by the way that it extends a little into the right margin. It's almost negligible (it looks like maybe 1 or 2 mm), but I wonder if there's anything I can do to compress the table into fitting within the specified margins. – the_fox Mar 02 '21 at 17:10
  • I'm not too good with tables but you can probably decrease the padding or you could just decrease the font size – Willoughby Mar 02 '21 at 17:30

1 Answers1

3

You are right, your question is opinion based :-). It looks quite good.

Anyway, just to show an another possibility to write your table:

\documentclass[]{article}
\usepackage{geometry}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage[skip=1ex]{caption}

\begin{document} \begin{table}[ht] \caption{The functions $\tau$ and $\sigma$} \centering \begin{tabular}{>{$}c<{$} {5}{S[table-format= 1.0]} S[table-format= 2.0] S[table-format= 1.0] {13}{S[table-format=2.0]}
} \toprule n & {1} & {2} & {3} & {4} & {5} & {6} & {7} & {8} & {9} & {10} & {11} & {12} & {13} & {14} & {15} & {16} & {17} & {18} & {19} & {20} \ \midrule \tau(n) & 1 & 2 & 2 & 3 & 2 & 4 & 2 & 4 & 3 & 4 & 2 & 6 & 2 & 4 & 4 & 5 & 2 & 6 & 2 & 6 \ \sigma(n) & 1 & 3 & 4 & 7 & 6 & 12 & 8 & 15 & 13 & 18 & 12 & 28 & 14 & 24 & 24 & 31 & 18 & 39 & 20 & 42 \ \bottomrule \end{tabular} \label{Table:tauandsigma} \end{table} \end{document}

enter image description here

Zarko
  • 296,517
  • Could you explain a little what *{9}{S[table-format= 1.0]} for instance does? – the_fox Mar 02 '21 at 17:07
  • format numbers in its columns: 1 integer, 0 decimals. – Zarko Mar 02 '21 at 18:00
  • @Zarko: Wouldn't something like *{5}{S[table-format= 1.0]} S[table-format=2.0] S[table-format=1.0]*{13}{S[table-format=2.0]} be more accurate, since column 7 also contains a two digit number? I'd also combine this with @{} in order to avoid the overfull box warning. – leandriis Mar 02 '21 at 18:30
  • @leandriis, you are right. I will correct this ASAP. – Zarko Mar 02 '21 at 18:49