Math & ScienceEuro Symbol in Subscript

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
tho_mi
Posts: 20
Joined: Tue Sep 11, 2012 6:57 pm

Euro Symbol in Subscript

Post by tho_mi »

Hey,

I want to use the Euro symbol (from the eurosym package) in the subscript of a formula, but the symbol isn't as small as expected (contrary to the dollar-symbol).

The code for the formula is the following.

Code: Select all

$E_{\$/\euro}$
Thanks in advance!
Attachments
subscript-euro.png
subscript-euro.png (3.75 KiB) Viewed 15681 times
Last edited by localghost on Sun Feb 09, 2014 6:38 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

hugovdberg
Posts: 133
Joined: Sat Feb 25, 2012 6:12 pm

Euro Symbol in Subscript

Post by hugovdberg »

Using just the eurosym package, $\euro$ will simply output an "e", and to get the "€" symbol in math mode requires some extra effort. The problem is most like in that code, which I presume doesn't cope correctly with the smaller font size in subscript. However, since you didn't provide an MWE we cannot help you with your specific code.
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
tho_mi
Posts: 20
Joined: Tue Sep 11, 2012 6:57 pm

Euro Symbol in Subscript

Post by tho_mi »

Thanks!

I hope my example is OK.

Code: Select all

\documentclass[10pt,mathserif]{beamer}
\usepackage{lmodern}
\usepackage{amsmath,amssymb}
\usepackage[gen]{eurosym}

\begin{document}

\begin{frame}{}
  $E_{\$/\euro}$
\end{frame}

\end{document}
hugovdberg
Posts: 133
Joined: Sat Feb 25, 2012 6:12 pm

Euro Symbol in Subscript

Post by hugovdberg »

Your example is fine, although beamer gives a warning about the 'mathserif' option being obsolete and replaced by 'serif', you might want to look into that.
Back on topic, the gen option to eurosym constructs a euro symbol for fonts that don't include their own symbol, which is why it also works in math mode. However, that implementation is not aware of math mode. Since you already load amsmath in your example you can use the \text command to escape to text mode with the correct fontsize. This can be done each time you come across an euro symbol, or by creating a new command that does it automatically. As an extra bonus you don't need the gen option and thus get the official symbol, instead of a capital C with two bars. Below some example code that replicates the \euro and \EUR{} commands for math mode, simply called \meuro and \MEUR{}, respectively.

Code: Select all

\documentclass[10pt,mathserif]{beamer} %% mathserif is obsolete!!
\usepackage{lmodern}
\usepackage{amsmath,amssymb}
\usepackage{eurosym}


\newcommand{\meuro}{\text{\euro}}
\makeatletter
% Definition taken from eurosym.sty, provides \EUR equivalent for math mode
\newcommand\MEUR[1]{\if@EURleft\text{\euro}\,\fi#1\if@EURleft\else\,\text{\euro}\fi}
\makeatother

\begin{document}

\begin{frame}{}
  $E_{\$/\meuro} = \MEUR{2000}$
\end{frame}

\end{document}
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
tho_mi
Posts: 20
Joined: Tue Sep 11, 2012 6:57 pm

Re: Euro Symbol in Subscript

Post by tho_mi »

Works perfectly, thanks :)
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Euro Symbol in Subscript

Post by cgnieder »

I'd use the textcomp package and it's \texteuro. With the right encoding you can also use € directly:

Code: Select all

\documentclass[10pt]{beamer}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{lmodern,textcomp}
\usepackage{amsmath,amssymb}

\begin{document}

\begin{frame}{}
  \texteuro\ $E_{\$/\text{\texteuro}}$

  € $E_{\$/\text{€}}$
\end{frame}

\end{document}
euro.png
euro.png (2.15 KiB) Viewed 15624 times
Regards
site moderator & package author
hugovdberg
Posts: 133
Joined: Sat Feb 25, 2012 6:12 pm

Euro Symbol in Subscript

Post by hugovdberg »

What is the advantage of the textcomp euro symbol over the eurosym (which claims to provide the official symbol)? It seems to me your solution is exactly the same as mine, except for the package used to get the euro symbol in the first place.
Also I'm not a big fan of trusting on the right encoding, but that might be a personal issue stemming from the frequent switching between windows and ubuntu (and android, but that's just another linux flavour). I kind of like to use plain text and know for sure the system is always going to produce the right document, no matter where I edit or compile the file.
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Euro Symbol in Subscript

Post by cgnieder »

hugovdberg wrote:What is the advantage of the textcomp euro symbol over the eurosym (which claims to provide the official symbol)? It seems to me your solution is exactly the same as mine, except for the package used to get the euro symbol in the first place.
No advantage, just a personal preference. :) (The symbol looks the same with both solutions: it's taken from the font and not designed by either of the packages if I'm not mistaken.)
hugovdberg wrote:Also I'm not a big fan of trusting on the right encoding
Just use unicode for every file and all is fine (well almost). On a more serious note: europeans like me who need to use letters like ä, ö, ü and ß on a regular basis have to take care about input encoding anyway, especially when working together with other people - why not set up all files with unicode in the first place? (Especially when unicode is needed for LualaTeX and XeLaTeX, anyway...)

If you like a more “self-aware” solution Heiko Oberdieks selinput would be a solution:

Code: Select all

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{selinput}
\SelectInputMappings{
  adieresis={ä},
  germandbls={ß},
  Euro={€}
}
\usepackage{lmodern,textcomp}

\begin{document}
€ ä ß
\end{document}
Regards
site moderator & package author
Post Reply