5

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

1 Answer 1

8
\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

2
  • So it seems siunitx somehow puts all units in math mode? At least when I try \(\euro\) it gives me the same weird lowercase "e". But in any case, this works perfectly, thanks!
    – MaxD
    Commented Apr 13, 2023 at 18:56
  • 2
    The output is in math mode as standard: the recommendation is that any text-only symbols should be inserted in \text.
    – Joseph Wright
    Commented Apr 13, 2023 at 19:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .