# Special rule in Siunitx for percentages

The convention used at my workplace is to have spaces between numbers and units except percentages. Is there a way to create such an exception for a single unit throughout the document using the siunitx package?

Here is my MWE:

        \documentclass[a4paper]{article}
range-phrase=--%
]{siunitx}
\sisetup{range-units=single}
\sisetup{separate-uncertainty}
\sisetup{detect-all}
\DeclareSIUnit\weight{w}
\DeclareSIUnit\volume{v}
\sisetup{inter-unit-product=\ensuremath{{\cdot}}}
\begin{document}
In a glass beaker, add sodium hydroxide (\SI{1}{\gram}) and gently pour deionised water (\SI{40}{\milli\liter}).

Let the solution mix on the magnetic stirrer for \SI{120}{\second}.

Now carefully add more water to raise the volume to \SI{100}{\milli\liter} to produce a \SI{1}{\percent} \si{\weight\per\volume} solution.

Is there a way to make \SI{1}{\percent} look like 1\% ?
\end{document}

• IMO percent is a unit and should get the same spacing as the other units. We are just used to seeing 1% all over because people did not adhere to this rule May 20, 2021 at 11:42
• The BIPM list percent, hence I treat it as a unit in siunitx May 20, 2021 at 12:34
• I went against the grain using LaTeX instead of MS Word in my group. I ain't arguing over stuff like this. May 20, 2021 at 12:37
• @daleif IMHO, percent can also be interpreted as a plain constant number, i.e % := 10^{−2}. (No need to involve the concept of a dimensionless unit). So take a := 10^{−2} instead. Would you still write 3 a? :) I think 3% looks slightly better in this case but a "thin space" is not too shabby either. May 20, 2021 at 19:17

You can re-declare the unit such that it applies a dedicated setting for the spacing. Getting the character means we have a little bit of work to do

\documentclass[a4paper]{article}
\usepackage{siunitx}
\catcode\%=12\relax
\DeclareSIUnit[number-unit-product = ]\percent{%}
\catcode\%=14\relax
\begin{document}

\SI{10}{\gram} but \SI{10}{\percent}

\end{document}


In v3, the option name has been updated to quantity-product: the above works with both v2 and v3.

• Is it necessary to change the catcode of %? Can you write instead \DeclareSIUnit[number-unit-product = ]\percent{\%} without messing with catcodes? May 20, 2021 at 12:30
• @SergioLlorente Yes and no - it will work in most cases but using the 'real' character has advantage under some (unusual) circumstances. As I set things up in siunitx to be as robust as I can, I favour inserting a real % (I do it slightly differently in the code) May 20, 2021 at 12:35