3

The title pretty much says it all. I am writing up a paper that needs to be in revtex4, but for some reason both the siunitx and dcolumn packages are not working correctly. If I comment out my document class and go with article, everything is fine. Furthermore, the units from siunitx work in revtex4, just not the number column align.

The example below works for me, but when I comment out the article class and go with revtex4, I get errors starting with the warning: Column d is already defined on input line 8, then \inaccessible on line 16.

%\documentclass[aps, superscriptaddress, twocolumn, nofootinbib]{revtex4}
\documentclass{article}

\usepackage{siunitx}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1}}

\begin{document}

Here are units that work \si{\micro\metre\joule}.

Example using S tab

\begin{tabular}{S[tabformat=3.2]}% syntax for siunitx v2; for v1 use "tabformat"
555 \\
7.77 \\
99.9
\end{tabular}

Example using d tab

\begin{tabular}{d{3.2}}
555 \\
7.77 \\
99.9
\end{tabular}

\end{document}

I can't be the first to have this issue with revtex4, so I'm open to suggestions to fix my problem.

  • 2
    Welcome to TeX.SX! It should be table-format and not tabformat. – egreg Sep 11 '18 at 15:18
  • @egreg Well, tabformat is v1 syntax :) – Joseph Wright Sep 11 '18 at 15:45
2

Use table-format (tabformat is no longer valid and nobody should use siunitx version 1).

For dcolumn, you get the warning

Package array Warning: Column d is already defined

which is self-explaining. On the other hand, this doesn't happen with revtex4-1, which is the current version.

\documentclass[aps, superscriptaddress, twocolumn, nofootinbib]{revtex4-1}

\usepackage{siunitx}
\usepackage{dcolumn}

\usepackage{lipsum} % for mock text

\newcolumntype{d}[1]{D{.}{.}{#1}}

\begin{document}

Here are units that work \si{\micro\metre\joule}.

Example using S tab

\begin{tabular}{S[table-format=3.2]}
555 \\
7.77 \\
99.9
\end{tabular}

Example using d tab

\begin{tabular}{d{3.2}}
555 \\
7.77 \\
99.9
\end{tabular}

\lipsum

\end{document}

enter image description here

If you really need revtex4, then change the name for the new column type, say

\newcolumntype{e}[1]{D{.}{.}{#1}}

and then use

\begin{tabular}{e{3.2}}
  • The d column seems to be defined by revtex4 but not by revtex4-1. – Dai Bowen Sep 11 '18 at 15:29
  • @DaiBowen Indeed! Thanks, I fixed the answer. – egreg Sep 11 '18 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.