9

Is there a way to make the siunitx package output a unit with a single slash using per-mode=symbol and fallback to per-mode=reciprocal when there is more than one slash?

\documentclass{article}
\usepackage{siunitx}

\begin{document}
\SI{1}{\metre\per\second}            % would output 1 m/s
\SI{1}{\ampere\per\metre\per\second} % would output 1 A m-1 s-1
\end{document}
3
  • 3
    Welcome to TeX.SX! You can set the options for each command when you use it: \SI[per-mode=symbol]{1}{\meter\per\second}... I don't know an automatic way :-)
    – darthbith
    Jun 9, 2014 at 21:25
  • 2
    Welcome to TeX.SX! You got +1 from me for a perfect MWE :)
    – yo'
    Jun 9, 2014 at 21:30
  • 1
    My question is quite similar to the second part of this one. I opened a new enhancement request on github.com/josephwright/siunitx.
    – biozic
    Jun 10, 2014 at 11:10

1 Answer 1

3

Not very automatic, but helpful if you have to write it many times. You can define a new unit like

\DeclareSIUnit\Ms{m/s}

and use it like

\SI{1}{\Ms}

whenever you need.

\documentclass{article}
\usepackage{siunitx}
\DeclareSIUnit\Ms{m/s}
%\sisetup{per-mode=symbol}

\begin{document}
\SI{1}{\metre\per\second}            

\SI{1}{\Ms}            % would output 1 m/s

\SI{1}{\ampere\per\metre\per\second} % would output 1 A m-1 s-1
\end{document}

enter image description here

But if you have other instances of such cases, you have to define one for each of them.

0

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.