I suspect the answer is a straight 'No', but nothing ventured... I have a table of time periods (minutes and hours), and a couple of the periods involve the fraction 1/2. I generally use the \SI macro of the siunitx package for numbers and units, as it gives a nice spacing between the number and the unit. I could use 0.5 rather than the fraction 1/2, but in this particular case the fraction is more aesthetically and stylistically pleasing. I have tried using the \nicefrac{1}{2} macro within the first brackets of the \SI{*number*}{*unit*} macro, but it does not seem to work. Is there another way of achieving the same objective?

MWE as follows:


A nice fraction: 2\nicefrac{1}{2}.

Some time periods:




The above all works fine.

% This, however, does not:

% \SI{2\nicefrac{1}{2}}{\minute}

  • 3
    \SI[fraction-function=\nicefrac,quotient-mode = fraction]{1/2}{\minute} would work if the num is only a quotient. But I have no idea how to add the "2" before it. Addition: Well \SI[fraction-function=\nicefrac,quotient-mode = fraction,product-units = single,output-product={\,}]{2x1/5}{\minute} seems to work. – Ulrike Fischer Oct 13 '14 at 10:06
  • 1
    But 2x1/5 is naturally mathematically dubious ... – Ulrike Fischer Oct 13 '14 at 10:12
  • 1
    Your solution also works perfectly @Ulrike_Fischer, but I've gone with Joseph's because of its simplicity. – Mark Birtwistle Oct 13 '14 at 20:30

For cases where you want to do things beyond the understanding of the siunitx internals, you can turn the parser off

\SI[parse-numbers = false]{2\nicefrac{1}{2}}{\minute}
| improve this answer | |

The option fraction-function=\nicefrac option will do just that, but you'll need to load the package nicefrac and set quotient-mode = fraction as well.



    quotient-mode = fraction,

    \nicefrac{1}{3} \num{1/3}


| improve this answer | |
  • This works well for numbers. I tried it with \si{\kilogram / \square \meter}, which gives different results :-( – Jan Feb 8 '19 at 7:06

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.