3

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: )

  • Are you sure your file is saved as UTF-8 encoded? The error message seems to point to a different encoding – egreg Dec 8 '13 at 11:55
  • Yes, you were right. It was encoded Cp1252. I changed it to UTF-8 and now it works. Thank you very much! – Angelo.Hannes Dec 8 '13 at 12:03
3

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.

  • if I add this to the other \usepackage declarations, the whole template gets changed. Can I use the package only for the verbatim block? – Angelo.Hannes Dec 8 '13 at 11:28
  • @Angelo.Hannes What font packages are you using? – egreg Dec 8 '13 at 11:31
  • I am a absolute newbie in Latex, and don't know how to answer your question :'-( I added all \usepackage declarations to my answer. Does this help? – Angelo.Hannes Dec 8 '13 at 11:37
  • @Angelo.Hannes That's good. – egreg Dec 8 '13 at 11:39
  • Thanks for your update. Now the template remains the same. But the Euro sign is still not shown. – Angelo.Hannes Dec 8 '13 at 11:42

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.