2

I am encoutering an issue when trying to use the table formatting provided by siunitx in a AASTeX document.

\documentclass{aastex631}
\let\tablenum\relax
\usepackage{siunitx}

\begin{document} 
    
\begin{tabular}{S[table-format = 1.2e2]|S[table-format = 1.2e2]}
 1.23e45 & 6.78e9 \\
\end{tabular}

\end{document}

(the \let\tablenum\relax is already here to solve some conflicts between the two, as described in AASTeX Author Guide

I am simply trying to define two columns with siunitx formatting and I get the following error:

Misplaced alignment tab character &.
You have placed an alignment tab character '&' in the wrong place. If you want to align something, you must write it inside an align environment such as \begin{align} … \end{align}, \begin{tabular} … \end{tabular}, etc. If you want to write an ampersand '&' in text, you must write \& instead.

If I replace aastex631 by article in the first line or if I only define one S column, the issue disappears. But in my real case, I need to use aastex631 AND to define at least three S columns.

Do you know where the issue could come from, and how I could solve it?

Thanks in advance!

6
  • Welcome to TeX.SE. It seems that aastex631 is require that you should have installed obsolete revtex4-1 class. I you not forced (for some reason) to use aastex632, rather use article.
    – Zarko
    Jul 8, 2022 at 10:54
  • Thanks for your answer. Unfortunately, I really have to use aastex631. Howver, I could work with an alternative to siunitx to write scientific format in tables.
    – NuMat
    Jul 8, 2022 at 11:13
  • Try with dcolumn package.
    – Zarko
    Jul 8, 2022 at 12:18
  • Hi. I work for the AAS Journals. The error I get with your MWE is different from the one you list. My compile specs are: siunitx 2020/02/25 v2.8b; XeTeX, Version 3.141592653-2.6-0.999993 (TeX Live 2021) (or pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021) ! Missing } inserted. <inserted text> } l.8 1.23e45 & 6.78e9 \\
    – Gus
    Jul 8, 2022 at 13:46
  • @Gus most people will be on siunitx v 3 by now, you are still on 2.x in texlive 2021? You must be on an early, not updated, texlive 2021, my tl2021 has siunitx v 3 2021-05-17 Jul 8, 2022 at 15:20

1 Answer 1

4

The class makes the & active and disturbs the parsing of siunitx. It seems to work if you add a \relax

\documentclass{aastex631}
\let\tablenum\relax
\usepackage{siunitx}
\begin{document}

\begin{tabular}{S[table-format = 1.2e2]|S[table-format = 1.2e2]}
 1.23e45 \relax & 6.78e9 \\
\end{tabular}

\end{document}
1
  • Thanks! That's working. To complete, it seems we need a \relax at the end of each siunitx cell (except the last one of course) e.g., `1.23e45 \relax & 1.23e45 \relax & 1.23e45 \` I am wondering if there is a way to automatize the process (not having to add by hand every time), but I will work with this workaround for now.
    – NuMat
    Jul 9, 2022 at 11:22

You must log in to answer this question.

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