# Is it possible to set per-mode for math and displaymath environment separately in siunitx?

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:

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:

• Did you see per-mode = symbol-or-fraction in the manual? – Joseph Wright Jul 9 '15 at 13:52
• @JosephWright: That is exactly what I wanted. Thank you! – Wamseln Jul 9 '15 at 13:56

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: