0

I am using siunitx, and I have a column which contains numeric values along with units, it results in this enter image description here

where the units are overflowing on the right side. How do I stretch the table to fit?

MWE:

\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}

\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{bm}
\DeclareSIUnit\year{yr}

\begin{document}
    \begin{table}[h]
        \centering
        \begin{tabular}{l l c S[table-format=2.3]}
            \toprule
            Sensor  &Parameter  &Variable   &{Value}\\
            \midrule
            \multirow{2}{*}{Accelerometer}
            &Noise Density  &-  &60\si{\micro\g\per\sqrt{\hertz}}\\
            &Bias Stability &-  &15\si{\micro\g}\\
            Compass &Noise Variance &$\nu_c$    &0.01\si{(\degree)\squared} \\
            {dvl}   &Noise Variance &$\bm\nu_{dvl}$ &0.01\si{(\meter\per\second)\squared} \\
            {gnss}  &Noise Variance &$\bm\nu_p$ &5\si{(\meter)\squared} \\
            \multirow{2}{*}{Gyroscope}
            &Noise Density  &-  &0.01\si{\degree\per\second\per\sqrt\hertz}\\
            &Bias Stability &-  &10\si{\degree\per\hour}\\
            Magnetometer    &Noise Std. Dev.    &$\nu_m$    &3.35\si{\nano\tesla}\\
            \bottomrule
        \end{tabular}
    \end{table}
\end{document}
2
  • 2.3 is used to space the width of the column. Thus you need to add space for more decimals.
    – daleif
    Jul 1, 2021 at 19:51
  • Though, I would not do it like this. I would add the units to the parameter column within () 's
    – daleif
    Jul 1, 2021 at 19:52

1 Answer 1

1

I would use a separate column for the units, skip alignment of values and fix the spacing between the two columns:

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{bm}
\usepackage{booktabs}
\usepackage{collcell}
\usepackage{siunitx}
\DeclareSIUnit\year{yr}

\begin{document}
  \begin{table}[h]
    \centering
    \begin{tabular}{@{} l l c S[table-parse-only, table-alignment = right] @{\,} >{\collectcell\si} l <{\endcollectcell} @{}}
      \toprule
      Sensor  &Parameter  &Variable   &{Value}\\
      \midrule
      Accelerometer
      &Noise Density  &-  &60 & \micro\g\per\sqrt{\hertz}\\
      &Bias Stability &-  &15 &\micro\g \\
      Compass &Noise Variance &$\nu_c$  &0.01 & (\degree)\squared \\
      {dvl}   &Noise Variance &$\bm\nu_{dvl}$ &0.01 & (\meter\per\second)\squared \\
      {gnss}  &Noise Variance &$\bm\nu_p$ &5 & (\meter)\squared \\
      Gyroscope
      &Noise Density  &-  &0.01 & \degree\per\second\per\sqrt\hertz\\
      &Bias Stability &-  &10 & \degree\per\hour \\
      Magnetometer  &Noise Std. Dev.  &$\nu_m$  &3.35 & \nano\tesla \\
      \bottomrule
    \end{tabular}
  \end{table}
\end{document}

You must log in to answer this question.

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