1

I have some legacy LaTeX files that use the siunitx and units package. A minum working example is below:

\documentclass{article}
\usepackage{siunitx}
\usepackage{units}      % Line 3
\begin{document}
$1\unit{F}$
\end{document}

These files work well on most platforms, like Fedora 37 and Overleaf. However, on Debian 12, I receive this error:

$ pdflatex a.tex
...
! Package siunitx Error: Package 'units' incompatible.

For immediate help type H <return>.
 ...                                              
                                                  
l.4 \begin{document}
                    
? 

If I comment Line 3 of my LaTeX file, it works on Debian. However, after this change the file no longer works on other platforms. The error I get (on Fedora 37) is:

! Undefined control sequence.
l.5 $1\unit
           {F}$
? 

Is there a way to modify my LaTeX file so it works on all platforms? Otherwise, is there anything wrong with my Debian 12 LaTeX installation? (Please let me know if I should re-post this question on Super User etc.) I am installing LaTeX on Debian 12 using:

apt-get install texlive-full

The version of the installed texlive-science package is 2022.20230122-4

3
  • I don't know the details of the document you mention. But jumping from one package to another for the same usage seems like bad practice to me. I have never used the units package, only siunitx. So my suggestion would be to migrate all the units in your document to one of the two packages and stop struggling. Check the log after compiling that document on both Fedora and Debian, compare the version of the siunitx package in each case, that may give you a clue.
    – Aradnix
    Commented Jul 8, 2023 at 20:34
  • 1
    Take in account that in the most recent releases of siunitx the usual commands \SI{}{} and \si{} have been replaced by \qty{}{} and `\unit{}, respectively. That may be the cause.
    – Aradnix
    Commented Jul 8, 2023 at 20:36
  • 1
    Note what is important here is the version of siunitx you have: this has next-to-nothing to do with your OS version.
    – Joseph Wright
    Commented Jul 8, 2023 at 20:44

1 Answer 1

1

siunitx was first released in 2008, with the intention that anyone picking it up would move away from older packages. For v2, it was possible to load both siunitx and units: I adjusted this in v3 to have better command names. Presuming you are happy to use the v3 names, you could do

\usepackage{siunitx}
\ifdefined\unit\else
  \NewDocumentCommand\unit{m}{\si{#1}}
\fi

to allow you to use siunitx to provide \unit whether you have v2 or v3.

You must log in to answer this question.

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