Currency formatting with siunitx

For historical reasons due to the fact that usually the \mathrm font is OT1 encoded, the command \mathsterling does \mathit{\mathchar"7024}} (that is it uses the dollar sign, which in the italic OT1 font is a pound sign).

Fix the wrong definition.

\documentclass[a4paper,12pt]{article}
\usepackage{fontspec}
\usepackage{libertine}
\usepackage{siunitx}

\renewcommand{\mathsterling}{\mathrm{\mathchar"70A3}}

\begin{document}
The \pounds\ pounds macro behaves as expected

And this is \pounds40434.5345

The dollar prefix works fine:
\SI[round-precision=2,round-mode=places,round-integer-to-decimal]{34324}[\$]{}

But the pounds prefix is imperialistic:
\SI[round-precision=2,round-mode=places,round-integer-to-decimal]{34324}[\pounds]{}

But straight pound sign is ok:
\SI[round-precision=2,round-mode=places,round-integer-to-decimal]{34324}[£]{}

\end{document}

enter image description here


I can propose a \Pounds macro, with a (numerical) optional argument: if there's no argument, it is the same a \pounds; if there's a number it adds a formatted number, preceded by an unbreakable thin space:

\documentclass[a4paper,12pt]{article}
\usepackage{fontspec}
\usepackage{libertine}
\usepackage{siunitx}
\usepackage{xparse}

\NewDocumentCommand\Pounds{o}{%
\pounds\IfNoValueTF{#1}%
{\relax}{\,\num[round-precision=2,round-mode=places,round-integer-to-decimal]{#1}}}

\begin{document}

But the pounds prefix is imperialistic:
\Pounds[34324]

\Pounds34324

\end{document} 

enter image description here

Tags:

Siunitx