# How to change \EUR to serif font?

In my document I use a sans serif font for everything except math. How can I change the \EUR macro provided by the eurosym package so that something like \EUR{1234} print the numbers (and the symbol?) in serif font?

MWE

\documentclass[a4paper]{article}
\usepackage{eurosym}

\renewcommand{\familydefault}{\sfdefault}

\begin{document}
I'm just a test line \EUR{12345}. % I want this to be serif font...

I'm just a test line \euro $$12345$$. % ...like this!
\end{document}


Screenshot

• A simple (maybe not the best) solution is to define a shortcut for the commands \textrm{\EUR{12345}}. Or if you are not going to use it many times, simply type like that. – Sigur Dec 24 '19 at 19:01

You can redefine the command on preamble, inserting the Roman font family (\rmfamily).

\documentclass[a4paper]{article}
\usepackage{eurosym}

\renewcommand{\familydefault}{\sfdefault}

\makeatletter
%% from eurosym.sty
\def\EUR#1{{\rmfamily\if@EURleft\euro\,\fi#1\if@EURleft\else\,\euro\fi}}
\makeatother

\begin{document}

I'm just a test line \EUR{12345}. % ...like this!
\end{document}


Or maybe define a new command, eg, \rmEUR so you don't loose the default one.

• you are switching to \rmfamily for all the following text. – Ulrike Fischer Dec 24 '19 at 20:30
• @UlrikeFischer, ops, well observed. Edited. – Sigur Dec 24 '19 at 20:56

Instead of loading eurosym, you can load textcomp and use the command \texteuro, or just type in €. If the current 8-bit legacy font has that symbol (and most of the ones in a modern TeX distribution do), it will use that. Otherwise, the package will try to fake it with C and =.

With a modern TeX engine, you can load fontspec and use the Unicode character. The \texteuro command still works, for backward compatibility. Only a few publishers still do not support modern fonts in 2019.

You might find the \EUR command useful enough to define yourself:

\documentclass{article}
\usepackage{fontspec} % Or:
%\usepackage[T1]{fontenc}
%\usepackage{textcomp}
%\usepackage[utf8]{inputenc}

\usepackage{parskip} % Removes the paragraph indentation.

\DeclareRobustCommand\EUR[1]{€\thinspace #1}

\begin{document}
\EUR{10} \textbf{\EUR 10} \textit{\EUR{10} \textbf{\EUR{10}}} \\
\textsf{\EUR{10} \textbf{\EUR 10} \textit{\EUR{10} \textbf{\EUR{10}}}}
\end{document}


This uses the Euro symbol from the current font, followed by a thin, non-breaking space. If you would rather use the German convention of putting the symbol after the amount, do it that way instead. (#1\thinspace €) If you want to switch conventions within the same document, that would be more complicated.