1

Suppose I have two units: one is simple, like \meter, the other is already a percombination of multiple units: \mega\watt\day\per\kilo\gram. I now would like to combine these in a fraction. How can I "force" siunitx to not move about the different parts of the unit. See MWE below. The last line of the table is what I'm aiming for.

\documentclass[margin=3mm]{standalone}

\usepackage{siunitx}
\usepackage{xfrac}

\DeclareSIUnit[]\myunit{\mega\watt\day\per\kilo\gram}


\begin{document}

\begin{tabular}{l}
  \SI{1}{\meter} \\

  \SI{1}{\myunit} \\

  \SI{1}{\meter\per\myunit}\\

  1 $\frac{\text{m}}{\sfrac{\text{MWd}}{\text{kg}}}$\\
\end{tabular}

\end{document}

enter image description here

4
  • 2
    Unit's don't work like that: \metre\per\myunit gets turned into \metre\per\mega\watt\day\per\kilo\gram internally, then reconstructed for the output. All units are at the same 'level' in that sense.
    – Joseph Wright
    Nov 25, 2019 at 10:03
  • 2
    That can be rearranged: m/(MW d/kg) = kg m/(MW d) Nov 25, 2019 at 10:13
  • @HenriMenke: Yes, but that is what I would like to avoid. The separate units are "meaningful": MWd/kg is the amount of energy release per kilogram of raw material. I don't want the "day" or the "kilogram" to move around... And then, I want to combine this "complex unit" with another unit without breaking up the complex unit...
    – GertVdE
    Nov 25, 2019 at 10:35
  • @JosephWright: okay. Thanks for the feedback. I understand that the behaviour I'm looking for is not compatible with the philosophy of siunitx. So for this one, I'll use \num and add the unit myself hard-coded.
    – GertVdE
    Nov 25, 2019 at 10:36

1 Answer 1

1

I just searched the same issue in SI units and luckily found the answer: refer to: siunitx nested "per" symbols

So what you could do is simple, that is to add parenthesis to your unit. This suits most nested cases.

\SI{1}{\meter\per\ (myunit)}
1
  • 2
    That just forces the formatting, disabling any chance to reformat
    – Joseph Wright
    Jul 4, 2022 at 9:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .