TransWikia.com

Monospaced numbers in invoice2

TeX - LaTeX Asked by invoicer2 on January 20, 2021

I am trying to make an invoice where the entries are all using ttfamily, in the invoice2 package, but can’t seem to get the numbers (as opposed to the table text) in monospace. This is frustrating as it is especially the numbers I want monospaced. How can I get the table to be entirely (or even just for the numbers!) in ttfamily?

A minimum example, where the problem is apparent:

documentclass{article}
usepackage{times}
usepackage{invoice2}
usepackage{eurosym}
begin{document}
ttfamily
 invoiceoptions{vat=.09}
 begin{invoice}[currency-symbol={euro{}}]
 ttfamily
    invoicesingleitem{Ignition!}{4087.99}
    invoiceitem{1.5}{The Art of Computer Programming 1--4}{162.99}
    invoiceitem{20}{The TeXbook}{55.69}
 end{invoice}
end{document}

One Answer

The invoice2 package internally uses the siunitx package to format numbers. If you want to change the font of the numbers you can use siunitx settings, with the command sisetup.

The settings are described in the siunitx manual on page 18. The default mode for numbers is math, which means you can influence the number font by setting the math-rm option, in this case to mathtt.

MWE:

documentclass{article}
usepackage{times}
usepackage{invoice2}
sisetup{math-rm = mathtt}
usepackage{eurosym}
begin{document}
 invoiceoptions{vat=.09}
 begin{invoice}[currency-symbol={euro{}}]
    invoicesingleitem{Ignition!}{4087.99}
    invoiceitem{1.5}{The Art of Computer Programming 1--4}{162.99}
    invoiceitem{20}{The TeXbook}{55.69}
 end{invoice}
end{document}

Result:

enter image description here

If you prefer the Times monospace font then you can also use sisetup{math-rm = texttt}:

enter image description here

Answered by Marijn on January 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP