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.

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}
| improve this answer | |

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.