1

i would like to have a default round-precision value for \qtyrange that is different from the rest of the package, im having some problem changing it

MWE:

\documentclass{article}
\usepackage{siunitx,xparse}
\let\oldqtyrange\qtyrange
\RenewDocumentCommand\qtyrange{
    O{0} % #1 Precision
    o % #2 options
    m % #3 from
    m % #4 to
    m % #5 unit
}{%
    \oldqtyrange[round-precision={#1}, #2]%
    {#3}{#4}{#5}%
}
\begin{document}
\qtyrange[1]{1}{20}{\micro\metre}
\end{document}

For some reason the compilation is fixed in a loop.

Felipe9
  • 309
  • 2
    Eight years ago, the answer was Do not do this. It would be easier to do \NewDocumentCommand\qtyRange{O{0}O{}mmm}{\qtyrange[round-precision={#1},#2]{#3}{#4}{#5}}. – Qrrbrbirlbel Jan 14 '24 at 01:42
  • 1
    Nowadays, replace \let with \NewCommandCopy, i.e. \NewCommandCopy\oldqtyrange\qtyrange. Closest duplicate I could find: Q682293 – Qrrbrbirlbel Jan 14 '24 at 01:53
  • Oh so the problem was on the second argument! i see, it works now thanks. Also thanks for updating me on that, i just fixed that on my files, i used that so often. – Felipe9 Jan 14 '24 at 02:01

1 Answers1

2

As proposed by @Qrrbrbirlbel

\documentclass{article}
\usepackage{siunitx}
\NewCommandCopy\oldqtyrange\qtyrange
\RenewDocumentCommand\qtyrange{
    O{0} % #1 Precision
    O{} % #2 options % <- fixed -----------------------------
    m % #3 from
    m % #4 to
    m % #5 unit
}{%
    \oldqtyrange[round-precision={#1}, #2]%
    {#3}{#4}{#5}%
}
\begin{document}
\qtyrange[1]{1}{20}{\micro\metre}
\end{document}
Felipe9
  • 309