2

I have the following simple document

\documentclass[a4paper,10pt]{article}

\usepackage{siunitx}

\begin{document}

\si{\metre_{1}\tothe{1/2}}

\bigskip

% \si{\metre_{1}\tothe{-\frac{1}{2}}}

\bigskip

% \si{\per\metre_{1}\tothe{\frac{1}{2}}}

\bigskip

% \si{\per\raiseto{\frac{1}{2}}\metre_{1}}

\end{document}

Is there any reason why the three bottom lines failes to compile? Is there any way to make it work?

Expected output:

enter image description here

  • \tothe is (roughly) \textsuperscript, so you have to wrap math contents in $...$. – Phelype Oleinik Sep 3 at 17:46
  • I do not quite understand, this also fails in equations and so. Which part needs to be wrapped in math mode? Wrapping \frac in $...$ makes the document compile but breaks the formating – N3buchadnezzar Sep 3 at 17:48
  • The part in the argument of \tothe: \si{\metre_{1}\tothe{$-\frac{1}{2}$}}. How does it break formatting? For me the output looks like in your picture. – Phelype Oleinik Sep 3 at 17:50
  • @PhelypeOleinik So using \per to obtain an negative exponent is impossible? If possible I would like to avoid hardcoding whether I use negative powers or /. Using your method I obtain i.imgur.com/6SK9IPq.png, which unfortunately does match the desired ouput. See the image in my post. – N3buchadnezzar Sep 3 at 17:54
  • 1
    If you mean (simplified) \metre\tothe{-1\per2}, I think it is not supported (although it works, but doesn't produce the output you want). siunitx's parsing mechanism doesn't get into the argument of \tothe, as it accepts anything inside it. For siunitx to understand that \per\metre\tothe{1\per2} is mathematically equal to \metre\tothe{-1\per2} it would require a lot of parsing, and it would need a really large understanding of math, which is probably not in the scope of the package (yet). \si{\metre_{1}\tothe{$-\frac{1}{2}$}} matches your picture, though... – Phelype Oleinik Sep 3 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.