[Tex/LaTex] How to display Euro sign in verbatim mode

symbolsverbatim

I need to display the Dollar and Euro sign in verbatim mode. This is the code I got:

\begin{verbatim}
fr_FR: 123 456,78 €
de_DE: 123.456,78 €
en_US: $ 123,456.78
\end{verbatim}

It works with the Dollar sign, but not with the Euro sign. I tried escaping but that didn't work either. Any thoughts?

I reduced the document to the following lines. And there is still no Euro sign:

\documentclass[10pt,a4paper,compsoc]{IEEEtran}


\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}

\begin{document}

\begin{verbatim}
fr_FR: 123 456,78 €
de_DE: 123.456,78 €
en_US: $ 123,456.78
\end{verbatim}

\end{document}

Eclipse also shows an Error:

Keyboard character used is undefined \end{verbatim} (followed by: )

Best Answer

There is no Euro symbol in the standard fonts, so textcomp is required. However, the glyph in the European Modern fonts is ugly and wrong; with Latin Modern it's better.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{textcomp}
\begin{document}
\begin{verbatim}
fr_FR: 123 456,78 €
de_DE: 123.456,78 €
en_US: $ 123,456.78
\end{verbatim}
\end{document}

enter image description here

There's nothing to do other than loading textcomp if you use IEEEtran, because in this case Courier is employed.

\documentclass[10pt,a4paper,compsoc]{IEEEtran}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}

\begin{document}
\begin{verbatim}
fr_FR: 123 456,78 €
de_DE: 123.456,78 €
en_US: $ 123,456.78
\end{verbatim}
\end{document}

enter image description here

Don't use the cmex10 option to amsmath: it's only for compatibility with very old TeX distributions.