LaTeX: Tables and Columns and Units, oh my

  • Context: LaTeX 
  • Thread starter Thread starter NeoDevin
  • Start date Start date
  • Tags Tags
    Columns Latex Units
Click For Summary
SUMMARY

This discussion focuses on creating a LaTeX table where all entries in a column share the same units using the siunitx package. The initial attempt resulted in an error due to incorrect syntax with the \bgroup command. The successful solution involves using the S column type with the syntax S<{\, \si{\centi m}}, which effectively applies the unit to all entries in the specified column, provided the numbers are of equal length.

PREREQUISITES
  • Familiarity with LaTeX document preparation system
  • Understanding of the siunitx package for units in LaTeX
  • Basic knowledge of table formatting in LaTeX
  • Experience with LaTeX error troubleshooting
NEXT STEPS
  • Explore advanced features of the siunitx package for unit formatting
  • Learn about LaTeX table customization techniques
  • Investigate error handling and debugging in LaTeX documents
  • Study best practices for presenting scientific data in LaTeX
USEFUL FOR

Researchers, scientists, and academic writers who need to format tables in LaTeX while maintaining consistent unit representation across columns.

NeoDevin
Messages
334
Reaction score
2
I'm trying to make a table in LaTeX in which all the entries of a column have the same units, without having to type them for each column. (Before you say it, yes, I know I could just put the units in the column heading, but I don't want to).

I tried:
Code:
\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{center}\begin{tabular}{|>{\SI\bgroup}c<{\egroup{\centi m}}|c|c|c|}\hline
0.1 & 0.2 & 0.3 & 0.4 \\ \hline
0.5 & 0.6 & 0.7 & 0.8 \\ \hline
\end{tabular}\end{center}
\end{document}

Which gives:
Code:
! Package siunitx Error: Invalid character `\bgroup ' in numerical input.

Any suggestions?
Thanks in advance.
 
Physics news on Phys.org
Figured it out.

If anyone else is interested
Code:
\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{center}\begin{tabular}{|S<{\, \si{\centi m}}|c|c|c|}\hline
0.1 & 0.2 & 0.3 & 0.4 \\ \hline
0.5 & 0.6 & 0.7 & 0.8 \\ \hline
\end{tabular}\end{center}
\end{document}
Works as long as the numbers are all the same length.
 

Similar threads

  • · Replies 0 ·
Replies
0
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 2 ·
Replies
2
Views
6K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
6K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
3
Views
3K