1

I am using the experimental environment of chemmacros spectroscopy module. Right now I am running \sisetup{} for every instance of the environment and was now wondering if there is a way to circumvent calling it every single time.

In my MWE I will just use one of the settings as an example.

\documentclass{scrbook}

\usepackage{chemmacros}
\chemsetup{modules=spectroscopy}

\sisetup{
    round-mode = figures
}

\begin{document}
    \num{3.456789}

    \begin{experimental}
        \sisetup{round-mode=off}
        \num{3.456789} % I use \val{}, but this is for comparison
    \end{experimental}

\end{document}

Basically, I would like to run \sisetup{} once for all experimental environments.

1 Answer 1

2

You could use the package etoolbox to automatically set \sisetup{round-mode=off} at the beginning of the experimental environment:

\documentclass{scrbook}

\usepackage{chemmacros}
\chemsetup{modules=spectroscopy}

\sisetup{
    round-mode = figures
}

\usepackage{etoolbox}
\AtBeginEnvironment{experimental}{\sisetup{round-mode=off}}

\begin{document}
    \num{3.456789}

    \begin{experimental}
%        \sisetup{round-mode=off}
        \num{3.456789} % I use \val{}, but this is for comparison
    \end{experimental}

    \num{3.456789}

\end{document}
3
  • I was about to answer the same :)
    – cgnieder
    Commented Oct 20, 2017 at 14:43
  • @clemens sorry :) Commented Oct 20, 2017 at 14:44
  • @samcarter nevermind
    – cgnieder
    Commented Oct 20, 2017 at 23:20

You must log in to answer this question.

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