4

So I'm trying to have my units in a nice fraction. I want to set per-mode=fraction globally via \sisetup{}. However it just doesn't do anything.

Here's a snippet (with my full preamble, in case there is any conflict that causes this):

\documentclass[11pt,
paper=a4,                   
footinclude,
oneside
]{scrbook}
\usepackage{mathtools}
\usepackage[ngerman]{babel}
\usepackage{graphicx}
\usepackage{caption}
\usepackage[european]{circuitikz}
\usepackage{float}
\usepackage{pgfplots}
\usepackage{amssymb}
\usepackage{siunitx}

\sisetup{exponent-product = \cdot, output-decimal-marker = {,}, per-mode = fraction}

\XeTeXinputencoding latin-1

\begin{document}

... much stuff

\begin{equation}
  U_T = \frac{k_B T}{e} \;  \xrightarrow{T=300K} \;  \frac{\SI{1,38e-25}{Vs \per K} \cdot \SI{300}{K}}{\SI{1,609e-19}{C}} = \SI{26}{mV}\;.
\end{equation}

Dabei ist $k_B$ die Boltzmann-Konstante und $e$ der Betrag der Elektronenladung. Für typische Werte gilt:

\begin{equation}
  U_D = \SI{26}{mV} \cdot ln \left( \frac{\SI{e16}{1 \per cm^3} \cdot \SI{2e16}{1 \per cm^3}}{\left( \SI{e10}{1 \per m^3} \right)^2} \right) = \SI{0,715}{V}
\end{equation}

...even more stuff

\end{document}

Using xelatex.

4

I guess this feature requires the usage of defined units instead of just text input. Compare the following two expressions:

\documentclass[11pt,
paper=a4,                   
footinclude,
oneside
]{scrbook}
\usepackage{mathtools}
\usepackage[ngerman]{babel}
\usepackage{graphicx}
\usepackage{caption}
\usepackage[european]{circuitikz}
\usepackage{float}
\usepackage{pgfplots}
\usepackage{amssymb}
\usepackage{siunitx}
\sisetup{exponent-product = \cdot, output-decimal-marker = {,}, per-mode = fraction}

\begin{document}


    $\SI{1}{\per cm^3}$
    $\SI{1}{\per\centi\meter\cubed}$

\end{document}

enter image description here


EDIT:

As Steven B. Segletes mentioned in his comment it might be a good idea to combine this with the option fraction-function=\dfrac in order to make those display style.

  • You might also alert the readers to the option fraction-function=\dfrac in order to make those display style. – Steven B. Segletes Jul 11 '16 at 18:06
  • 1
    @StevenB.Segletes Like this? Please feel free to edit if your intention was something different. – user36296 Jul 11 '16 at 19:43
  • The $\SI{1}{\per\centi\meter\cubed}$ style solution perfectly solved my problem. I'm still contemplating whether I want to have the fraction-function=\dfrac feature, but still thanks for the input. Sometimes you just have to understand how the system works to make it run. :) – Skyline Jul 11 '16 at 20:08

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.