1

I am trying to use the tabu environment as I have heard it is sort of the latest and greatest in table making. I am having a weird issue where the text is spilling in the cells below when using multirow. I have included a MWE below (I have not cleaned up the usepackages just in case there are some issues there - I may have things in there that are conflicting or redundant. Some of the things under the TABLE STUFF comment is from other experiments. Essentially I am trying to just find the easiest table solution.

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[nottoc]{tocbibind}
\usepackage{tocloft}
\usepackage[hidelinks]{hyperref}
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=black
}
%%%%%TABLE STUFF
\usepackage{makecell}
\usepackage[flushleft]{threeparttable}
\usepackage{multirow}
\usepackage{booktabs,caption}
\usepackage{array}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1\textwidth}}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}m{#1\textwidth}}
\usepackage{tabularx}
\usepackage{tabulary}
\usepackage{tabu}
\begin{document}
    \tableofcontents
    \newpage
    \listoffigures
    \newpage
    \listoftables

    \newpage
    \begingroup
\renewcommand{\arraystretch}{1.5}
\begin{tabu} to \textwidth {X X X X X}
                \toprule 
    Quantity & Symbol & Defining Equation & SI Unit & Units Definition \\ \midrule
    mass  & m & \multirow{4}{\linewidth}{Basic physical units defined arbitrarily and maintained in standardization laboratories}  & kilogram (kg)  \\
    length  & l &  & meter (m) \\ 
    time  & t &  & second (s)  \\
    current  & I &  & ampere (A)  \\
    force  & F & F = mass * acceleration  & newton (N)  & 1 N = 1 kgms-2 \\
    energy  & E & E = Force * length  & joule (J)  & 1 J = 1 kgm2 s-2 \\
    power  & P & P = E / t  & watt (W)  & 1 W = 1 J/s \\
    frequency  & f, v & number per second  & hertz (Hz)  & 1 Hz = 1 s-1 \\
    charge  & Q & Q = I t  & coulomb (C)  & 1 C = 1 A s \\
    potential  & V & V = E / Q  & volt (V)  & 1 V = 1 J/C \\
    \multirow{2}{*}[-1.05ex]{absorbed dose}  & D & E absorbed from ionizing radiation per kg  & gray (Gy)  & 1 Gy = 1 J / kg \\
    &  &  &  & 1 Gy = 100 rads \\
    exposure  & X & Q liberated by ionizing radiation per kg of air  & C kg-1  & roentgen, R (old) \\
    &  &  &  & 1 R = 2.58x10-4 C/kg \\
    activity  & A & disintigrations of radioactive material per t  & becquerel (Bq)  & 1 Bq = 1 s-1 \\
    &  &  &  & 1 Ci (curie, old) = 3.7x1010 Bq \\
    \bottomrule 
\end{tabu}
\endgroup

\end{document}
5
  • 1
    Please keep in mind that the tabu package is currently unmaintained. (See: github.com/tabu-issues-for-future-maintainer/tabu) I'd recomment tabularx instead.
    – leandriis
    Sep 12, 2019 at 13:08
  • Also keep in mind that the hyperref package should generally (with a few exceptions) be the last package in a preamble.
    – leandriis
    Sep 12, 2019 at 13:14
  • Will your table become longer than it currently is, so will you need a pagebreak within the table? And would you be willing to change (decrease) the margins of your document?
    – leandriis
    Sep 12, 2019 at 13:14
  • For typesetting the si units, you might be interested in the siunitx package.
    – leandriis
    Sep 12, 2019 at 13:16
  • Thanks for these comments, the table will not increase in length. Thanks for the suggestion on siunitx, I will take a look!
    – thatguy14
    Sep 12, 2019 at 14:07

2 Answers 2

1

Update

I have added the before missing \multirow command and also improved the alignment of the units definitions of "absorbed dose", "activity" and "exposure". This way, the table can easily fit into a single page without decreasing the margins or the font size.

enter image description here

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}

\usepackage{makecell}

\usepackage{multirow}
\usepackage{booktabs,caption}
\usepackage{array}

\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{tabularx}

\usepackage{siunitx}

\usepackage{pdflscape} % For second example only
%% \usepackage{geometrx} % Used for the third screenshot
\begin{document}
{\renewcommand{\arraystretch}{1.5}
\begin{tabularx}{\linewidth}{l l L l L}
                \toprule 
    Quantity & Symbol & Defining Equation & SI Unit & Units Definition \\ \midrule
    mass  & m & \multirow{4.5}{=}{Basic physical units defined arbitrarily and maintained in standardization laboratories}  & kilogram (kg)  \\
    length  & l &  & meter (m) \\ 
    time  & t &  & second (s)  \\
    current  & I &  & ampere (A)  \\
    \\
    force  & F & F = mass * acceleration  & newton (\si{\newton})  & \SI{1}{\newton} = \SI{1}{\kilogram\meter\per\square\second} \\ 
    energy  & E & E = Force * length  & joule (\si{\J})  & \SI{1}{\J} = \SI{1}{\kg\square\m\per\square\s} \\
    power  & P & P = E / t  & watt (W)  & 1 W = 1 J/s \\
    frequency  & f, v & number per second  & hertz (Hz)  & 1 Hz = 1 s-1 \\
    charge  & Q & Q = I t  & coulomb (C)  & 1 C = 1 A s \\
    potential  & V & V = E / Q  & volt (V)  & 1 V = 1 J/C \\
    \makecell[tl]{absorbed\\ dose}  & D & E absorbed from ionizing radiation per kg  & gray (Gy)  & 1 Gy = 1 J / kg \newline 1 Gy = 100 rads \\
    exposure  & X & Q liberated by ionizing radiation per kg of air  & C kg-1  & roentgen, R (old) \newline 1 R = 2.58x10-4 C/kg \\
    activity  & A & disintigrations of radioactive material per t  & becquerel (Bq)  & 1 Bq = 1 s-1 \newline 1 Ci (curie, old) = 3.7x1010 Bq\\
    \bottomrule 
\end{tabularx}}

    \end{document}

Original answer:

Here are three versions of your table:

enter image description here

enter image description here

enter image description here

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}

\usepackage{makecell}

\usepackage{multirow}
\usepackage{booktabs,caption}
\usepackage{array}

\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{tabularx}

\usepackage{siunitx}

\usepackage{pdflscape} % For second example only
%% \usepackage{geometrx} % Used for the third screenshot
\begin{document}
{\renewcommand{\arraystretch}{1.5}
\begin{tabularx}{\linewidth}{l l L l L}
                \toprule 
    Quantity & Symbol & Defining Equation & SI Unit & Units Definition \\ \midrule
    mass  & m & Basic physical units defined arbitrarily and maintained in standardization laboratories  & kilogram (kg)  \\
    length  & l &  & meter (m) \\ 
    time  & t &  & second (s)  \\
    current  & I &  & ampere (A)  \\
    force  & F & F = mass * acceleration  & newton (\si{\newton})  & \SI{1}{\newton} = \SI{1}{\kilogram\meter\per\square\second} \\ 
    energy  & E & E = Force * length  & joule (\si{\J})  & \SI{1}{\J} = \SI{1}{\kg\square\m\per\square\s} \\
    power  & P & P = E / t  & watt (W)  & 1 W = 1 J/s \\
    frequency  & f, v & number per second  & hertz (Hz)  & 1 Hz = 1 s-1 \\
    charge  & Q & Q = I t  & coulomb (C)  & 1 C = 1 A s \\
    potential  & V & V = E / Q  & volt (V)  & 1 V = 1 J/C \\
    \makecell[tl]{absorbed\\ dose}  & D & E absorbed from ionizing radiation per kg  & gray (Gy)  & 1 Gy = 1 J / kg \\
    &  &  &  & 1 Gy = 100 rads \\
    exposure  & X & Q liberated by ionizing radiation per kg of air  & C kg-1  & roentgen, R (old) \\
    &  &  &  & 1 R = 2.58x10-4 C/kg \\
    activity  & A & disintigrations of radioactive material per t  & becquerel (Bq)  & 1 Bq = 1 s-1 \\
    &  &  &  & 1 Ci (curie, old) = 3.7x1010 Bq \\
    \bottomrule 
\end{tabularx}}


\begin{landscape}
\noindent
{\renewcommand{\arraystretch}{1.5}
\begin{tabularx}{\linewidth}{l l L l l}
                \toprule 
    Quantity & Symbol & Defining Equation & SI Unit & Units Definition \\ \midrule
    mass  & m & Basic physical units defined arbitrarily and maintained in standardization laboratories  & kilogram (kg)  \\
    length  & l &  & meter (m) \\ 
    time  & t &  & second (s)  \\
    current  & I &  & ampere (A)  \\
    force  & F & F = mass * acceleration  & newton (\si{\newton})  & \SI{1}{\newton} = \SI{1}{\kilogram\meter\per\square\second} \\ 
    energy  & E & E = Force * length  & joule (\si{\J})  & \SI{1}{\J} = \SI{1}{\kg\square\m\per\square\s} \\
    power  & P & P = E / t  & watt (W)  & 1 W = 1 J/s \\
    frequency  & f, v & number per second  & hertz (Hz)  & 1 Hz = 1 s-1 \\
    charge  & Q & Q = I t  & coulomb (C)  & 1 C = 1 A s \\
    potential  & V & V = E / Q  & volt (V)  & 1 V = 1 J/C \\
    \makecell[tl]{absorbed\\ dose}  & D & E absorbed from ionizing radiation per kg  & gray (Gy)  & 1 Gy = 1 J / kg \\
    &  &  &  & 1 Gy = 100 rads \\
    exposure  & X & Q liberated by ionizing radiation per kg of air  & C kg-1  & roentgen, R (old) \\
    &  &  &  & 1 R = 2.58x10-4 C/kg \\
    activity  & A & disintigrations of radioactive material per t  & becquerel (Bq)  & 1 Bq = 1 s-1 \\
    &  &  &  & 1 Ci (curie, old) = 3.7x1010 Bq \\
    \bottomrule 
\end{tabularx}}
\end{landscape}

\end{document}

If your table gets longer and you need a pagebreak within the table, I'd suggest to replace tabularx with xltabular.

3
  • Hi sorry, all 3 versions of that table do not have a multirow for the long sentence at the top which is the problem I am trying to overcome.
    – thatguy14
    Sep 12, 2019 at 14:06
  • @thatguy14: Sorry, I removed the multirow command because I didn't get its purpose. I just now came to realize that you wanted the text in the third column to continue for mass, lenght, tie and current. I will add an update in a minute.
    – leandriis
    Sep 12, 2019 at 14:16
  • @thatguy14: I have added an update.
    – leandriis
    Sep 12, 2019 at 14:23
0

Leandriis comments made me realize that this is due to the fact that the table could not extend past 1 page and this overrun was due to this (i.e., the table was too big for 1 page so it compressed it). This was fixed by either changing the font size or increasing the margins

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .