5

In the manual, unless I am mistaken, it says to replace \si by \unit.

But I have this error:

Package siunitx Error: Found prefix part with no unit.

How can I make this document compatible with the new version 3 of siunitx?

\documentclass[aspectratio=1610,10pt,french]{beamer}

\usepackage[french]{babel} 
\usepackage[output-decimal-marker={,}]{siunitx}  

    
\begin{document}
\begin{frame}
%  \sisetup{color = blue}

  \begin{tabular}{l l l}
   kilo $=1000$ & noté \unit{\kilo} &\rule[2mm]{0pt}{5mm} Exemples:\ \unit{\kilo\metre}; \unit{\kilo\gram};% \\
%   hecto $=100$ & \repete{noté} \si{\hecto} &\rule[2mm]{0pt}{5mm}\repete{Exemple:}\ \  \si{\hecto\meter}; \si{\hecto\gram}; \si{\hecto\liter}\\
%   deca $=10$ & \repete{noté} \si{\deca}& \rule[2mm]{0pt}{5mm}\repete{Exemple:}\ \  \si{\deca\meter}; \si{\deca\gram}; \si{\deca\liter}\\
%      déci $=0.1=\dfrac{1}{10}$ & \repete{noté} \si{\deci} & \rule[2mm]{0pt}{5mm}\repete{Exemple:}\ \ \si{\deci\meter}; \si{\deci\gram}; \si{\deci\liter} \\
%   centi $=0.01=\dfrac{1}{100}$ & \repete{noté} \si{\centi} & \rule[2mm]{0pt}{5mm}\repete{Exemple:}\ \ \si{\centi\meter}; \si{\centi\gram}; \si{\centi\liter}\\
%    milli $=0.001=\dfrac{1}{1000}$ & \repete{noté} \si{\milli} & \rule[2mm]{0pt}{5mm}\repete{Exemple:}\ \ \si{\milli\meter}; \si{\milli\gram}; \si{\milli\liter}
  \end{tabular}

\end{frame}
\end{document}
1
  • 4
    \unit{\kilo} is the culprit: a prefix without unit.
    – egreg
    Sep 4, 2021 at 20:44

1 Answer 1

6

First off, you can use \si also with siunitx version 3, but it's deprecated and is present for back compatibility.

Second: a prefix must be followed by a unit; it wasn't enforced in version 2, now it is.

With a little stretch, you can define a \siprefix command:

\documentclass{article}
\usepackage{siunitx}

\NewDocumentCommand{\siprefix}{m}{%
  \unit{#1\nonexistentunitjustforprefixes}%
}
\DeclareSIUnit{\nonexistentunitjustforprefixes}{\relax}

\begin{document}

\siprefix{\kilo}

\end{document}

You could actually do \unit{k}, but this would defy the purpose of the package.

10
  • You say that \si is back compatible but with version 3 \si{\kilo} doesn't work while it worked with version 2!
    – AndréC
    Sep 4, 2021 at 20:57
  • 3
    @AndréC It sort of worked. But the documentation has always been adamant in saying that prefixes must be followed by units.
    – egreg
    Sep 4, 2021 at 21:01
  • If I write \unit{k} instead of \unit{\kilo}, will the result be identical?
    – AndréC
    Sep 4, 2021 at 21:03
  • 2
    @AndréC Just type k.
    – egreg
    Sep 4, 2021 at 21:05
  • ok, can you add this possibility to your answer?
    – AndréC
    Sep 4, 2021 at 21:07

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.