22

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.
  • 4
    Nothing in the eurosym package documentation suggests that you should use math mode for producing the Euro symbol €. – egreg Apr 26 '13 at 21:24
31

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

  • 1
    Really great! I didn't knew about the mapping to get the character recognition. – Svend Tveskæg Apr 27 '13 at 5:40
11

A little less work than @egreg's solution: just use \text when in math mode:

\documentclass{article}

\usepackage{eurosym}
\usepackage{amsmath}

\begin{document}
Here's \euro{} in text.

Now in math, inline $\text{\euro}$ and displayed:
\begin{equation*}
\text{\euro}5 + \text{\euro}5 = \text{\euro}10.
\end{equation*}
\end{document}

enter image description here

Edit: define a new macro to save a little typing:

\newcommand{\meuro}{\text{\euro}}
...
\begin{equation*}
\meuro 5 + \meuro 5 = \meuro 10.
\end{equation*}
  • Thank you, I will probably use this for now, but since I do want to start increasing my LaTeX "programming" skills, I will definitely be trying to find time to absorb @egreg's solution. – Brady Trainor Apr 27 '13 at 0:32
  • @BradyTrainor egreg's solution is definitely the way to go! It is really good (I think) -- not that Ethan Bolker's solution isn't good, but the other is very good. – Svend Tveskæg Apr 27 '13 at 5:32
3

If you use the eurosym package along with its command \euro you'll get the Euro symbol.

Try running this:

\documentclass{article}    
\usepackage{eurosym}

\begin{document}     
\noindent Sample with eurosym: \euro  \\
Sample with e: $e$

\end{document}

And you'll get this output:

enter image description here

As you can see, there is a big difference between $e$ and \euro.

Writing $\euro$ does not produce the euro sign, but rather just and 'e'.

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.