I'm looking for a way to switch between symbolic and textual formatting of currency - e.g. $5 vs 5 dollars. Additionally, I want to choose which currency to display and change between currencies as needed.

This is what I had in mind, but maybe there are better solutions. Is there a way to achieve a set-up where any numbers I want displayed as currency I write as \money{5}, for example, and then I can change the currency as needed using a command. Something like \setcurrency[textual]{dollars} for example? Later, I might want to switch to \setcurrency[symbolic]{pounds}.

One challenge is this code would have to know when to use the singular 'dollar' or 'pound'. For describing single units.

Here is a basic MWE of the output I want:

\$1 and \$5.

1 dollar and 5 dollars.

\textsterling1 and \textsterling5.

1 pound and 5 pounds.

enter image description here

And here is a mock-up of the solution I had in mind:

\setcurrency[symbolic]{dollars}\money{1} and \money{5}.

\setcurrency[textual]{dollars}\money{1} and \money{5}.

\setcurrency[symbolic]{pounds}\money{1} and \money{5}.

\setcurrency[textual]{pounds}\money{1} and \money{5}.

Additionally, I like how the siunitx package allows you to format the way the number is displayed. If there was a way of including this functionality that would be an added bonus.

I'm only looking for the functionality I've described above. But, I can think of a super-charged version that is able to take \money{1.35} with the options \setcurrency[fulltextual]{euros}, and return 'one euro and thirty-five cents'. That would be really cool. Maybe a package already exists to do what I'm asking?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.