0

I have created the following table using this online tool:

\documentclass[a4paper,10pt]{article}

\usepackage[utf8]{inputenc}
\usepackage{tabularx}

\begin{document}

\begin{table}[]
\centering
\begin{tabularx}{1.5\textwidth}{|c|c|c|c|X|}
\hline
\textbf{\begin{tabular}[c]{@{}c@{}}Unit\\ Name\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Unit\\ Symbol\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Dimension\\ Symbol\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Quantity\\ Name\end{tabular}}    & \multicolumn{1}{c|}{\textbf{Definition}}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               \\ \hline
second                                                       & \textbf{s}                                                     & T                                                                   & time                                                                & The second, symbol s, is the SI unit of time. It is defined by taking the fixed numerical value of the caesium frequency $\Delta \nu_{Cs}$, the unperturbed ground-state hyperfine transition frequency of the caesium-133 atom, to be 9192631770 when expressed in the unit Hz, which is equal to $s^{−1}$.                                                                                                                                                                                                                                           \\ \hline
metre                                                        & \textbf{m}                                                     & L                                                                   & length                                                              & The metre, symbol m, is the SI unit of length. It is defined by taking the fixed numerical value of the speed of light in vacuum c to be 299792458 when expressed in the unit $m s^{−1}$, where the second is defined in terms of $\Delta \nu_{Cs}$.                                                                                                                                                                                                                                                                                                   \\ \hline
kilogram                                                     & \textbf{kg}                                                    & M                                                                   & mass                                                                & The kilogram, symbol kg, is the SI unit of mass. It is defined by taking the fixed numerical value of the Planck constant h to be $6.62607015 10^{−34}$ when expressed in the unit $J s$, which is equal to $kg m s^{-1}$, where the metre and the second are defined in terms of c and $\Delta \nu_{Cs}$.                                                                                                                                                                                                                                                  \\ \hline
ampere                                                       & \textbf{A}                                                     & I                                                                   & \begin{tabular}[c]{@{}c@{}}electric\\ current\end{tabular}          & The ampere, symbol A, is the SI unit of electric current. It is defined by taking the fixed numerical value of the elementary charge e to be $1.602176634 10^{−19}$ when expressed in the unit C, which is equal to $A s$, where the second is defined in terms of $\Delta \nu_{Cs}$.                                                                                                                                                                                                                                                                  \\ \hline
kelvin                                                       & \textbf{K}                                                     & $\Theta$                                                            & \begin{tabular}[c]{@{}c@{}}thermo-\\dynamic\\ temperature\end{tabular} & The kelvin, symbol K, is the SI unit of thermodynamic temperature. It is defined by taking the fixed numerical value of the Boltzmann constant k to be $1.380649 10^{−23}$ when expressed in the unit $J K^{−1}$, which is equal to $kg m^{2} s^{−2} K^{−1}$, where the kilogram, metre and second are defined in terms of h, c and $\Delta \nu_{Cs}$.                                                                                                                                                                           \\ \hline
mole                                                         & \textbf{mol}                                                   & N                                                                   & \begin{tabular}[c]{@{}c@{}}amount of\\ substance\end{tabular}       & The mole,  symbol  mol, is the SI unit of amount of substance. One mole contains exactly $6.022 140 76 10^{23}$ elementary entities. This number is the fixed numerical value of the Avogadro constant, $N_{A}$, when expressed in the unit $mol^{−1}$ and is called the Avogadro number. The  amount of substance, symbol n, of a system is a measure  of  the number of specified elementary entities. An elementary entity may be an atom, a molecule, an ion, an  electron, any other particle or specified group of particles. \\ \hline
candela                                                      & \textbf{cd}                                                    & J                                                                   & \begin{tabular}[c]{@{}c@{}}luminous\\ intensity\end{tabular}        & The candela, symbol cd, is the SI unit of luminous intensity in a given direction. It is defined by taking the fixed numerical value of the luminous efficacy of monochromatic radiation of frequency $540 10^{12}$ Hz, $K_{cd}$, to be 683 when expressed in the unit $lm W^{−1}$, which is equal to $cd sr W^{−1}$, or $cd sr kg^{−1} m^{−2} s^{3}$, where the kilogram, metre and second are defined in terms of h, c and $\Delta \nu_{Cs}$.                                                                                                        \\ \hline
\end{tabularx}
\caption{Definitions of the SI units and their associated dimensions.}
\label{table: SI-definitions}
\end{table}

\end{document}

I copied it into my .tex where it produces the following outputoutput:

Now I have two questions:

  • How do I center the entire table horizontally to fit my page? I have currently set the table width to 1.5\textwidth, but this need not necessarily be the final value.(As long as the right-most column looks nice, I'm happy.)

  • How do I center the contents of the first four columns to their respective cells? Not just center horizontally (which it is already), but also vertically.

EDIT:

  • added documentclass & packages used

  • fixed all errors (only warnings and badboxes left relating to the too-wide table)

  • 2
    a table of width {1.5\textwidth} can't be centred with \centering as it is wider than the text block. Di you really want to make it stick in to the margins? – David Carlisle Apr 06 '20 at 19:36
  • What are you wanting to happen in that last column? That's a lot of text, and it's going to throw everything else off. I would suggest moving that last column to be bullet points that come after your table. – Teepeemm Apr 06 '20 at 19:41
  • when this table is only \textwidth wide, it is longer than the page. So yes it should stick past the margin. – Douglas James Bock Apr 06 '20 at 19:42
  • Please make your code compilable. Which documentclass do you use? Do you use the geometrypackage? If yo, please also include the corresponding settings into your example code. – leandriis Apr 06 '20 at 19:45
  • there is only about an inch of table missing to the right... – Douglas James Bock Apr 06 '20 at 19:45
  • I wouldn't recommend it but put \makebox[0pt]{\begin{tabular}....\end{tabular} then the width will be hidden and it will over-print the margins (many publications would not accept such a setting) there are several answers on site showing this. Similarly I wouldn't vertically centre (makes the table harder to read) but if you want that make teh X column use m not p by redefining \tabularxcolumn – David Carlisle Apr 06 '20 at 19:47
  • please fix your example so people can run it and see the issue. – David Carlisle Apr 06 '20 at 19:49
  • also I get ! Package inputenc Error: Unicode character − (U+2212) not set up for use with LaTeX – David Carlisle Apr 06 '20 at 19:50
  • also ! Please use \mathaccent for accents in math mode. – David Carlisle Apr 06 '20 at 19:54
  • \begin{table}[] isn't strictly an error but it generates a warning LaTeX Warning: No positions in optional float specifier. LaTeX catches this as its natural meaning would be to not allow the table to be positioned anywhere. – David Carlisle Apr 06 '20 at 19:57
  • Since you are writing a table about the SI units, why not use the siunitx package to properly typeset thouse units? – leandriis Apr 06 '20 at 20:00
  • why have you code like $mol\textasciicircum{}\{−1\}\$ this sets mol in math italic instead of roman then literally typesets ^{-1} rather than a superscript -1 then typesets a literal $ instead of ending math mode, making the following text all math italic as you can see in the image you post above. – David Carlisle Apr 06 '20 at 20:04
  • @David Carlisle: thanks for pointing all these improvements. I have not yet come around to fixing these, as I am stuck on my centering issues. However they should be irrelevant to the questions I asked. – Douglas James Bock Apr 06 '20 at 20:11
  • 1
    No they are not irrelevant, you are asking people to run your code and if you get any error then you should not even look at the generated pdf. It is at most useful for debugging. You could not ask anyone to post an answer without fixing all those errors. Code in answers can't generate tex errors if this site is to be useful at all. – David Carlisle Apr 06 '20 at 20:14
  • To make your table fit into the textblock of a standard article, you could try to rotate your table to a landscape oriented page and slightly reduce the font size. – leandriis Apr 06 '20 at 20:16

0 Answers0