4

When expressing a value such as 90 percent by weight, I have seen papers use all of these formats:

  • 90 wt%
  • 90 wt.%
  • 90-wt %
  • 90 wt.-%
  • 90 wt. percent
  • 90 weight percent

There are probably still more. How can I use the siunitx package to handle these formats without manually reformatting to fit each style?

8

Define a new unit name:

\documentclass{article}

\usepackage{siunitx}

\DeclareSIUnit{\wtpercent}{wt\%}
%\DeclareSIUnit{\wtpercent}{wt.\%}
%\DeclareSIUnit{\wtpercent}{wt\%}
%\DeclareSIUnit{\wtpercent}{wt~\%}
%\DeclareSIUnit{\wtpercent}{wt-\%}
%\DeclareSIUnit{\wtpercent}{wt.~percent\%}
%\DeclareSIUnit{\wtpercent}{weight~percent}

\begin{document}

\SI{90}{\wtpercent} 

\end{document}

You can then choose the one you need by switching commented lines.

If you also want to support the form with the hyphen between the number and the unit, you have to use a personal command:

\documentclass{article}

\usepackage{siunitx}

\DeclareSIUnit{\wtpercent}{wt\%}
%\DeclareSIUnit{\wtpercent}{wt.\%}
%\DeclareSIUnit{\wtpercent}{wt\%}
%\DeclareSIUnit{\wtpercent}{wt-\%}
%\DeclareSIUnit{\wtpercent}{wt.~percent\%}
%\DeclareSIUnit{\wtpercent}{weight~percent}
\NewDocumentCommand{\SIwt}{O{}m}{\SI[#1]{#2}{\wtpercent}

% for the hyphen between the number and the unit
% uncomment the following lines and comment out
% all preceding ones
%\DeclareSIUnit{\wtpercent}{wt~\%}
%\NewDocumentCommand{\SIwt}{O{}m}{\SI[number-unit-separator={-},#1]#2}{\wtpercent}}

\begin{document}

\SIwt{90}

\end{document}

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.