antoinelejay / currency

LaTeX package for dealing with currencies
4 stars 2 forks source link

Font specification does not apply to the monetary amount #9

Closed maxpowis closed 1 year ago

maxpowis commented 1 year ago

I have a document with montserrat font applied as

\usepackage{fontspec}
\setmainfont{montserrat}
\setsansfont{montserrat}
\setmonofont{montserrat}

However only the monetary amounts displayed with the currency package do not follow that font specification.

Hereafter a snippet that show the issue where the font is applied to the monetary symbol but not the numbers:

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass[10pt, a4paper]{beamer}

\usepackage{xunicode}
\usepackage{fontspec}

\usepackage{currency}
\DefineCurrency{EUR}{name={euro}, plural={euros}, symbol={\texteuro}, iso={EUR}, kind=iso, base=2}
\DefineCurrency{USD}{name={dollar}, plural={dollars}, symbol={\textdollar}, iso={USD}, kind=iso, base=2}
\CurrencySetup{kind=symbol}

\begin{document}

Symbol font changes but not the font of the number \\
\dEUR{4.2} = \dUSD{4.97} \\
\dEUR[font=\fontspec{Montserrat}]{4.2} = \dUSD[font=\fontspec{Montserrat}]{4.97} \\
\dEUR[font=\fontspec{montserrat}]{4.2} = \dUSD[font=\fontspec{montserrat}]{4.97}

\end{document}

Herafter a screenshot of the output compiled with xetex:

image

antoinelejay commented 1 year ago

The package relies on siunitx so that this is feature of this package to have possibly different font for the figures and for the units. You may use e.g. mode=text (see the siunitx documentation at Section 4.2):

\CurrencySetup{kind=symbol,mode=text}

maxpowis commented 1 year ago

Thanks for the answer. Works perfectly with that adaptation. Now sure how well it was documented because I have tried lots of options before creating this issue.

antoinelejay commented 1 year ago

Dear Max,

yes, sorry if the doc is unclear. By the way, currency relies on siunitx and this package has been subject to many releases. In particular, I think that the option I gave you is actually rather recent, in any ways posterior to the currency package.

Best regards Antoine

On 20 Oct 2023, at 15:59, Max Powis @.***> wrote:

Thanks for the answer. Works perfectly with that adaptation. Now sure how well it was documented because I have tried lots of options before creating this issue.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.