Why can’t I use the Euro symbol (€) with siunitx

eurosymsiunitxsymbols

I was just trying to define my own Euro (€) unit with \DeclareSIUnit{\myeuro}{€}, but couldn't get it to work. In the process I made the following MWE with a few different attempts that all don't seem to work. Anyone has an idea what could be going on and how to fix this?

\documentclass{article}
\usepackage{eurosym,textcomp,siunitx}
\DeclareSIUnit{\myalpha}{\alpha} %alpha just for comparison
\DeclareSIUnit{\myeuro}{€}
\DeclareSIUnit{\myeuroo}{\euro}
\DeclareSIUnit{\myeurooo}{\texteuro}

\begin{document}
Unicode symbol (€), euro (\euro) and texteuro (\texteuro)
all work fine in text, but for some reason I can't
use them in the qty command of siunitx:\\
Line 1: \qty{5}{\alpha}\\
Line 2: \qty{5}{\myalpha}\\
Line 3: \qty{5}{€}\\
Line 4: \qty{5}{\euro}\\
Line 5: \qty{5}{\texteuro}\\
Line 6: \qty{5}{\myeuro}\\
Line 7: \qty{5}{\myeuroo}\\
Line 8: \qty{5}{\myeurooo}\\
\end{document}

Screenshot

Best Answer

\documentclass{article}
\usepackage{eurosym,textcomp,siunitx}
\DeclareSIUnit{\myeuro}{\text{€}}
\DeclareSIUnit{\myeuroo}{\text{\euro}}
\DeclareSIUnit{\myeurooo}{\text{\texteuro}}
\begin{document}
Line 1: \qty{5}{\myeuro}\\
Line 2: \qty{5}{\myeuroo}\\
Line 3: \qty{5}{\myeurooo}\\
\end{document}

enter image description here

Related Question