4

I'm creating an invoice document using LaTeX that is supposed to have any currency symbol in the document. However, when converting to PDF, the signs never show up, most likely because I'm not using the correct packages. Can anyone point me in the right direction here? Do I need to install a list of packages and fonts in order to use these characters in my document? The document is created in Python and the currency signs are grabbed from a hash table. I'm on a Linux machine if that matters.

Say if I just wanted a document to print these characters, how would I accomplish that? Is there a font or package that contains all of these?:

ден ₪ ₹ ع.د ₲ ฿ ₩ ¥ ؋

  • 1
    Welcome to TeX-sx! Which font(s) are you using for your typesetting? – Joseph Wright Feb 3 '15 at 16:28
  • Whatever the default font is. – avoliva Feb 3 '15 at 16:32
  • search currency in this list – Symbol 1 Feb 3 '15 at 17:00
  • There were no results. :( – avoliva Feb 3 '15 at 17:50
5

Use a font that supplies the glyphs:

\documentclass{article}
\usepackage{fontspec}

\setmainfont{Linux Libertine O} % or whatever
\newfontfamily{\currencies}{FreeSerif}[Scale=MatchUppercase]

\begin{document}

{\currencies ден ₪ ₹ ع.د ₲ ฿ ₩ ¥ ؋}

\end{document}

enter image description here

A different approach (but just for single glyphs) that takes the glyph from the current font, if it exists, or from the fall back \currencies:

\documentclass{article}
\usepackage{fontspec}

\setmainfont{Linux Libertine O} % or whatever
\newfontfamily{\currencies}{FreeSerif}[Scale=MatchUppercase]

\newcommand{\curr}[1]{%
  {\iffontchar\font`#1 #1\else\currencies#1\fi}%
}

\begin{document}

\curr{₪}
\curr{₹}
\curr{¥}
\curr{₩}
\curr{฿}
\curr{₲}
\curr{؋}

\end{document}

enter image description here

You may even avoid using \curr by loading newunicodechar:

\documentclass{article}
\usepackage{fontspec}
\usepackage{newunicodechar}

\setmainfont{Linux Libertine O} % or whatever
\newfontfamily{\currencies}{FreeSerif}[Scale=MatchUppercase]

\newcommand{\curr}[1]{%
  {\iffontchar\font`#1 #1\else\currencies#1\fi}%
}
\newunicodechar{₪}{\curr{₪}}
\newunicodechar{₹}{\curr{₹}}
\newunicodechar{¥}{\curr{¥}}
\newunicodechar{₩}{\curr{₩}}
\newunicodechar{฿}{\curr{฿}}
\newunicodechar{₲}{\curr{₲}}
\newunicodechar{؋}{\curr{؋}}

\begin{document}

₪ ₹ ¥ ₩ ฿ ₲ ؋

\end{document}
  • I'll try this out! – avoliva Feb 3 '15 at 18:18
4

Since you compile with XeLaTeX, you have a number of currency symbols in the font fontawesome. The package fontawesome helps using this font, unfortunately it defines commands for version 3.1 of the fonts, which had no currency symbols.

You can download the latest version (4.3) of the fonts here and use the preamble of the following code; which defiines commands and some aliases to use them in a .tex file:

\documentclass[12pt,a4paper]{article}
\usepackage{fontspec}
\usepackage{booktabs}
\usepackage{array}
\usepackage[x11names]{xcolor}
\usepackage{fontawesome}

\makeatletter
\expandafter\def\csname faicon@mobile\endcsname {\symbol{"F10B}} \def\faMobile {{\FA\csname faicon@mobile\endcsname}}
\expandafter\def\csname faicon@eur\endcsname {\symbol{"F153}} \def\faEur {{\FA\csname faicon@eur\endcsname}}
\expandafter\def\csname faicon@gbp\endcsname {\symbol{"F154}} \def\faGbp {{\FA\csname faicon@gbp\endcsname}}
\expandafter\def\csname faicon@usd\endcsname {\symbol{"F155}} \def\faUsd {{\FA\csname faicon@usd\endcsname}}
\expandafter\def\csname faicon@inr\endcsname {\symbol{"F156}} \def\faInr {{\FA\csname faicon@inr\endcsname}}
\expandafter\def\csname faicon@jpy\endcsname {\symbol{"F157}} \def\faJpy {{\FA\csname faicon@jpy\endcsname}}
\expandafter\def\csname faicon@rub\endcsname {\symbol{"F158}} \def\faRub {{\FA\csname faicon@rub\endcsname}}
\expandafter\def\csname faicon@krw\endcsname {\symbol{"F159}} \def\faKrw {{\FA\csname faicon@krw\endcsname}}
\expandafter\def\csname faicon@btc\endcsname {\symbol{"F15A}} \def\faBtc {{\FA\csname faicon@btc\endcsname}}
\expandafter\def\csname faicon@try\endcsname {\symbol{"F195}} \def\faTry {{\FA\csname faicon@try\endcsname}}
\expandafter\def\csname faicon@ils\endcsname {\symbol{"F20B}} \def\faIls {{\FA\csname faicon@ils\endcsname}}

%%Aliases
\expandafter\def\csname faicon@bitcoin\endcsname {\faBitcoin} \def\faBitcoin {\faBtc}
\expandafter\def\csname faicon@dollar\endcsname {\faDollar} \def\faDollar {\faUsd}
\expandafter\def\csname faicon@euro\endcsname {\faEuro} \def\faEuro {\faEur}
\expandafter\def\csname faicon@ruble\endcsname {\faRuble} \def\faRuble {\faRub}
\expandafter\def\csname faicon@rupee\endcsname {\faRupee} \def\faRupee {\faInr}
\expandafter\def\csname faicon@shekel\endcsname {\faShekel} \def\faShekel {\faIls}
\expandafter\def\csname faicon@sheqel\endcsname {\faSheqel} \def\faSheqel {\faIls}
\expandafter\def\csname faicon@turkish-lira\endcsname {\faTurkishLira} \def\faTurkishLira {\faTry}
\expandafter\def\csname faicon@won\endcsname {\faWon} \def\faWon {\faKrw}
\expandafter\def\csname faicon@yen\endcsname {\faYen} \def\faYen {\faJpy}

\makeatother

    \begin{document}

    \begin{center}
    \Huge

    \fontspec{fontawesome.otf}
    \begin{tabular}{>{\color{Turquoise1}}c >{\color{HotPink3}} c >{\color{DarkSeaGreen2}}c }
    \toprule
 \faEur& \faGbp & \faUsd\\
 \faRupee & \faYen & \faRuble \\
 \faWon & \faShekel & \faTurkishLira \\
  & \faBtc\\
  \bottomrule
\end{tabular}
\end{center}
\end{document} 

enter image description here

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.