[Tex/LaTex] Is it possible to set per-mode for math and displaymath environment separately in siunitx

math-modesiunitx

I would like to globally define the per-mode of siunitx for math environment and displaymath environment separately. Is this somehow possible?

Here is a MWE:

\documentclass{article}

\usepackage{amsmath}
\usepackage{siunitx}
\sisetup{per-mode=symbol}

\begin{document}
This is an inline equation: $a = \SI{10}{\meter\per\second\squared}$, to show inline behaviour.

And this is the same equation in displaymath environment:
\begin{equation*}
a = \SI{10}{\meter\per\second\squared}
\end{equation*}

\end{document}

This produces:
enter image description here

What I would love to do is something like this:

\documentclass{article}

\usepackage{amsmath}
\usepackage{siunitx}
\sisetup{per-mode-math=symbol,
         per-mode-displaymath=fraction}

\begin{document}
This is an inline equation: $a = \SI{10}{\meter\per\second\squared}$, to show inline behaviour.

And this is the same equation in displaymath environment:
\begin{equation*}
a = \SI{10}{\meter\per\second\squared}
\end{equation*}

\end{document}

Which then should produce the following output:
enter image description here

Best Answer

As Joseph Wright pointed out: The solution here is to use \sisetup{per-mode=symbol-or-fraction} as described in the siunitx manual:

Finally, it is possible for the behaviour of the \per function to depend on the prevailing math style. Setting per-mode to symbol-or-fraction will use the symbol setting for in line math, and the fraction setting when used in \displaystyle math.

So for a MWE:

\documentclass{article}

\usepackage{amsmath}
\usepackage{siunitx}
\sisetup{per-mode=symbol-or-fraction}

\begin{document}
This is an inline equation: $a = \SI{10}{\meter\per\second\squared}$, to show inline behaviour.

And this is the same equation in displaymath environment:
\begin{equation*}
a = \SI{10}{\meter\per\second\squared}
\end{equation*}

\end{document}

Which works as expected: enter image description here