[Tex/LaTex] eurosym seems to not be working

symbols

I just tried the eurosym package for the first time, and when I try $\euro$, I simply get e. I have tried looking on line, for instance http://www.theiling.de/eurosym.html and on CTAN.

Seems to suggest that I should not be getting simply the letter e. I could see perhaps the convention switching to being simply the letter $e$, but would expect

  1. that to be mentioned in some site associated with eurosym; and
  2. why bother using eurosym to simply write the letter e.

Best Answer

There is no reason why in general one should write $\euro$ for getting the Euro € symbol. Just \euro in text mode works.

It might be a problem in case you need to use the symbol in math mode. The package doesn't cope with this case and effectively $\euro$ simply produces e.

A workaround is to modify the standard definition:

\usepackage{eurosym}
\usepackage{amstext} % for \text
\DeclareRobustCommand{\officialeuro}{%
  \ifmmode\expandafter\text\fi
  {\fontencoding{U}\fontfamily{eurosym}\selectfont e}}

Complete example:

\documentclass{article}

\usepackage{eurosym}
\usepackage{amstext} % for \text
\DeclareRobustCommand{\officialeuro}{%
  \ifmmode\expandafter\text\fi
  {\fontencoding{U}\fontfamily{eurosym}\selectfont e}}

\begin{document}
\euro{} in text mode

$\euro$ in math mode
\end{document}

enter image description here


A completely different problem that is not addressed by the package and by your question is how to make the Euro symbol searchable in the PDF file.

This can be obtained by defining a proper mapping of the character in the font.

\documentclass{article}
\usepackage{ifpdf,eurosym,amstext}
\DeclareRobustCommand{\officialeuro}{%
  \ifmmode\expandafter\text\fi
  {\fontencoding{U}\fontfamily{eurosym}\selectfont{}e}}

\makeatletter
\ifpdf\ifdefined\pdffontattr
  \immediate\pdfobj stream {
    /CIDInit /ProcSet findresource begin
    12 dict begin
    begincmap
    /CIDSystemInfo
    << /Registry (TeX)
    /Ordering (Euro)
    /Supplement 0
    >> def
    /CMapName /TeX-Euro-0 def
    /CMapType 2 def
    1 begincodespacerange
    <00> <FF>
    endcodespacerange
    1 beginbfchar
    <65> <20AC>
    endbfchar
    endcmap
    CMapName currentdict /CMap defineresource pop
    end
    end
  }
  {\edef\@tempa#1#2{%
     \noexpand\fontseries{#1}\noexpand\fontshape{#2}\noexpand\selectfont
     \pdffontattr\font{/ToUnicode \the\pdflastobj\space 0 R}}
   \fontencoding{U}\fontfamily{eurosym}%
   \@tempa{m}{n}\@tempa{m}{sl}\@tempa{m}{ol}
   \@tempa{bx}{n}\@tempa{bx}{sl}
  }
\fi\fi
\makeatother

\begin{document}
\euro{} in text mode

$\euro$ in math mode
\end{document}

enter image description here

The image is taken from my PDF viewer and shows that both appearances of € are properly recognized. Here is the first line copied from the PDF file and simply pasted:

€ in text mode

Related Question