3

Everything is very squished together, does anybody have any suggestions on what I can do? enter image description here

Here is my code for the table:

\begin{table}[h!]
\centering
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\hline
\textit{\textbf{l (m)}} & \textit{\textbf{$\overline{t}$$_{10}$}\:(s)}} & \textit{\textbf{$\Delta t_{10}\:(s)$}} & \textit{\textbf{$T\:(s)$}} & \textit{\textbf{$\Delta T\:(s)$}} & \textit{\textbf{$l^2$\:$(m^2)$}} & \textit{\textbf{$T^2\:(m\:s^2)$}} & \textit{\textbf{$\Delta T^2\:l\:(m\:s^2)$}} & \textit{\textbf{$\sigma \: (s)$}} \\ \hline
0.450                   & 15.414                                        & 0.1739                                 & 1.541                      & 0.01739                           & 0.2025                                          & 1.069                             & 0.02412                                     & 0.1168                            \\ \hline
0.400                   & 14.84                                         & 0.3927                                 & 1.483                      & 0.03927                           & 0.1600                                          & 0.8810                            & 0.04661                                     & 0.1916                            \\ \hline
0.350                   & 14.75                                         & 0.6523                                 & 1.475                      & 0.06523                           & 0.1225                                          & 0.7613                            & 0.06733                                     & 0.3522                            \\ \hline
0.300                   & 14.38                                         & 0.09190                                & 1.437                      & 0.009190                          & 0.0900                                          & 0.6200                            & 0.00793                                     & 0.0566                            \\ \hline
0.250                   & 14.18                                         & 0.5368                                 & 1.418                      & 0.05368                           & 0.0625                                          & 0.5029                            & 0.03807                                     & 0.3006                            \\ \hline
0.200                   & 13.82                                         & 0.2223                                 & 1.381                      & 0.02223                           & 0.0400                                          & 0.3819                            & 0.01229                                     & 0.1302                            \\ \hline
-0.200                  & 13.79                                         & 0.2098                                 & 1.379                      & 0.02098                           & -0.0400                                         & -0.3805                           & -0.01157                                    & 0.1170                            \\ \hline
-0.250                  & 14.24                                         & 0.1223                                 & 1.424                      & 0.01223                           & -0.0625                                         & -0.5070                           & -0.00870                                    & 0.07902                           \\ \hline
-0.300                  & 14.55                                         & 0.2556                                 & 1.455                      & 0.02556                           & -0.0900                                         & -0.6352                           & -0.02231                                    & 0.1646                            \\ \hline
-0.350                  & 14.56                                         & 0.4752                                 & 1.456                      & 0.04752                           & -0.1225                                         & -0.7419                           & -0.04843                                    & 0.2631                            \\ \hline
-0.400                  & 14.84                                         & 0.1492                                 & 1.484                      & 0.01492                           & -0.1600                                         & -0.8810                           & -0.01771                                    & 0.08889                           \\ \hline
-0.450                  & 15.41                                         & 0.2191                                 & 1.541                      & 0.02191                           & -0.2025                                         & -1.069                            & -0.03034                                    & 0.1271                            \\ \hline
\end{tabular}
\end{table}

the result is a squidged table.

  • Please tell us what m and s mean. E.g., are they the symbols for "meter" and "second", respectively? – Mico Apr 06 '23 at 16:42
  • Incidentally, \textbf and \textit are text-mode commands; they have no effect on material that's rendered in math mode. – Mico Apr 06 '23 at 16:44
  • 1
    Yes, @Mico, meter and second. For context its an experiment on a physical pendulum. To linaerise the graph, im plotting T^2l vs l and the unit for T^2 l is meter seconds squared. – Neal Batra Apr 06 '23 at 16:45
  • There are countless threads on the issue. Check these (and the links) out for some inspiration: https://tex.stackexchange.com/questions/112343/beautiful-table-samples https://tex.stackexchange.com/questions/604496/how-to-generate-beautiful-tables-in-latex – Ingmar Apr 06 '23 at 17:32

2 Answers2

7

I'd like to suggest that you start by getting rid of all vertical rules and most horizontal rules. Next, use the macros \toprule, \midrule, \addlinespace, and \bottomrule instead of \hline, as is done in the example code below. Never forget that whitespace can be every bit as effective at providing a visual separator as a solid line does.

Next, use the machinery of the siunitx package -- specifically, its S column type -- to align the numbers on their respective decimal markers. Finally, do provide some more structure to the header material; I suggest you list the variables in one row and their units of measurement in a second row, where you'd use the \unit macro (also provided by the siunitx package) to format the units according to typographically well established standards.

Does the table now look less squished than it did before?

enter image description here

\documentclass{article}
\usepackage{geometry} % set text block size parameters as appropriate
\usepackage{amsmath,array,booktabs,siunitx}
\newcolumntype{T}[1]{S[table-format=#1,group-digits=false]}

\begin{document}

\begin{table}[h!] \centering \begin{tabular}{@{} T{-1.3} T{2.3} T{1.4} T{1.3} T{1.5} T{-1.4} T{-1.4} T{-1.5} T{1.5} @{}} \toprule {$l$} & {$\bar{t}{10}$} & {$\Delta t{10}$} & {$T$} & {$\Delta T$} & {$l^2$} & {$T^2$} & {$\Delta T^2,l$} & {$\sigma$}\ {(\unit{\meter})} & {(\unit{\second})} &{(\unit{\second})} & {(\unit{\second})} & {(\unit{\second})} & {(\unit{\meter\squared})} & {(\unit{\second\squared})} & {(\unit{\meter\second\squared})} & {(\unit{\second})}\ \midrule 0.450 & 15.414& 0.1739 & 1.541 & 0.01739 & 0.2025 & 1.069 & 0.02412 & 0.1168 \ 0.400 & 14.84 & 0.3927 & 1.483 & 0.03927 & 0.1600 & 0.8810 & 0.04661 & 0.1916 \ 0.350 & 14.75 & 0.6523 & 1.475 & 0.06523 & 0.1225 & 0.7613 & 0.06733 & 0.3522 \ \addlinespace 0.300 & 14.38 & 0.0919 & 1.437 & 0.00919 & 0.0900 & 0.6200 & 0.00793 & 0.0566 \ 0.250 & 14.18 & 0.5368 & 1.418 & 0.05368 & 0.0625 & 0.5029 & 0.03807 & 0.3006 \ 0.200 & 13.82 & 0.2223 & 1.381 & 0.02223 & 0.0400 & 0.3819 & 0.01229 & 0.1302 \ \addlinespace -0.200 & 13.79 & 0.2098 & 1.379 & 0.02098 & -0.0400 & -0.3805 & -0.01157 & 0.1170 \ -0.250 & 14.24 & 0.1223 & 1.424 & 0.01223 & -0.0625 & -0.5070 & -0.00870 & 0.07902\ -0.300 & 14.55 & 0.2556 & 1.455 & 0.02556 & -0.0900 & -0.6352 & -0.02231 & 0.1646 \ \addlinespace -0.350 & 14.56 & 0.4752 & 1.456 & 0.04752 & -0.1225 & -0.7419 & -0.04843 & 0.2631 \ -0.400 & 14.84 & 0.1492 & 1.484 & 0.01492 & -0.1600 & -0.8810 & -0.01771 & 0.08889\ -0.450 & 15.41 & 0.2191 & 1.541 & 0.02191 & -0.2025 & -1.069 & -0.03034 & 0.1271 \ \bottomrule \end{tabular} \end{table}

\end{document}

Mico
  • 506,678
3
  • I would round numbers, for example to four decimals
  • for table use tblr and prescribed equal width to all columns
\documentclass{article}
\usepackage{geometry}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}

\begin{document} \begin{table}[h!] \sisetup{round-integer-to-decimal, round-mode=places, round-precision = 4, table-format= 1.4 } \begin{tblr}{colspec = { *{9}{X[c, si]} @{}}, row{1} = {guard, mode=math}, row{2} = {guard, mode=text}, row{3-Z}= {rowsep=0pt}, row{odd[3-Z]} = {abovesep=1ex}, } \toprule l & \bar{t}{10} & \Delta t{10} & T & \Delta T & l^2 & T^2 & \Delta T^2 & \sigma \ (\unit{\meter}) & (\unit{\second}) & (\unit{\second}) & (\unit{\second}) & (\unit{\second}) & (\unit{\meter\square\second}) & (\unit{\meter\square\second}) & (\unit{\meter\square\second}) & (\unit{\second}) \ \midrule 0.450 & 15.414 & 0.1739 & 1.541 & 0.01739 & 0.2025 & 1.069 & 0.02412 & 0.1168 \ 0.400 & 14.84 & 0.3927 & 1.483 & 0.03927 & 0.1600 & 0.8810 & 0.04661 & 0.1916 \ 0.350 & 14.75 & 0.6523 & 1.475 & 0.06523 & 0.1225 & 0.7613 & 0.06733 & 0.3522 \ 0.300 & 14.38 & 0.09190 & 1.437 & 0.009190 & 0.0900 & 0.6200 & 0.00793 & 0.0566 \ 0.250 & 14.18 & 0.5368 & 1.418 & 0.05368 & 0.0625 & 0.5029 & 0.03807 & 0.3006 \ 0.200 & 13.82 & 0.2223 & 1.381 & 0.02223 & 0.0400 & 0.3819 & 0.01229 & 0.1302 \ -0.200 & 13.79 & 0.2098 & 1.379 & 0.02098 & -0.0400 & -0.3805 & -0.01157 & 0.1170 \ -0.250 & 14.24 & 0.1223 & 1.424 & 0.01223 & -0.0625 & -0.5070 & -0.00870 & 0.07902 \ -0.300 & 14.55 & 0.2556 & 1.455 & 0.02556 & -0.0900 & -0.6352 & -0.02231 & 0.1646 \ -0.350 & 14.56 & 0.4752 & 1.456 & 0.04752 & -0.1225 & -0.7419 & -0.04843 & 0.2631 \ -0.400 & 14.84 & 0.1492 & 1.484 & 0.01492 & -0.1600 & -0.8810 & -0.01771 & 0.08889 \ -0.450 & 15.41 & 0.2191 & 1.541 & 0.02191 & -0.2025 & -1.069 & -0.03034 & 0.1271 \ \bottomrule \end{tblr} \end{table} \end{document}

enter image description here

Zarko
  • 296,517
  • Do check the labels and units in columns 6, 7, and 8. For sure, it's got to be meter times squared second, not meter per squared second. – Mico Apr 06 '23 at 17:31
  • Thank you all so much, these tables are so nice. – Neal Batra Apr 06 '23 at 17:49
  • @Mico, you are right! I should look table which OP provide, not only mess of column headers code ... Corrected now. Thank you very much for note! – Zarko Apr 06 '23 at 18:59
  • Hey @Zarko, how do I add T^2l and delta T^2l to this? I tried to edit it in the document but it just says no pdf produced.

    edit - I tried editing a bit more but i'm not sure where to add my data, and adding T^2 l and delta T ^2 l makes the table go out of the page.

    – Neal Batra Apr 06 '23 at 20:35
  • @NealBatra, as far as I see, columns width T^2 and \Delta ^2 already exist in table. Do you like to add new columns to table? Without to see what you doing, I can't say what is going wrong. BTW, your table is quite wide and you not provide any information about your document page layout. – Zarko Apr 06 '23 at 22:09
  • @Zarko I am an idiot, theres no better way to put it. I spent 3 hours trying to fix this and I just realised that where you put T^2 and delta T^2 it was meant to say T^2 l and delta T^2 l. It's fixed now. Many Thanks haha and sorry about that. – Neal Batra Apr 06 '23 at 22:14