# Using AMS Euler Font for a portion of a document

I have not used different fonts in a single document before. Therefore, this is a question by an amateur/(or a first-time user).

I want to use AMS Euler font just for a portion of my document. After spending some time on TeX.sx I came up with the following code.

\documentclass[12pt]{report}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{epstopdf}
\usepackage{theorem}
\usepackage{euscript}

\newcommand*{\myfont}{\fontfamily{AMSEuler}\selectfont}

\begin{document}
Using default font: $$\frac{dy}{dx}$$
\begin{myfont}
Using AMSEuler: $$\frac{dy}{dx}$$
\end{myfont}
Back to default font: $$\frac{dy}{dx}$$
\end{document}


The following is the output. It does not look like the AMS Euler font to me. Am I right? If so, how can I select and use AMS Euler font?

NEW EDIT based on comment: I changed the last few lines. However, the output is still the same. The reason is (IMHO) there is no "AMSEuler". Therefore, the question remains. May be, it is not possible to use AMS Euler font this way.

\begin{document}
Using default font: $$\frac{dy}{dx}$$
\myfont{%
Using AMSEuler: $$\frac{dy}{dx}$$
}
Back to default font: $$\frac{dy}{dx}$$
\end{document}

-
Well... for starters you defined \myfont as a command, but you're using it as an environment. You might want to fix that before anything else. –  kahen Oct 8 '11 at 19:27
@kahen: Thanks. I edited the code accordingly. –  Sony Oct 8 '11 at 19:46
you're correct that "AMSEuler" isn't defined by that name anywhere. the font itself may be referenced in other places, but the canonical code to enable its use (which i copied) is in the file ueur.fd, which is part of the amsfonts collection. i'm not even sure where you got the name "AMSEuler"; it's a reasonable name, but it isn't used anywhere in the ams documentation for these fonts, which is the canonical source, and it also doesn't appear in the comprehensive symbols list. –  barbara beeton Oct 8 '11 at 20:05
@barbarabeeton: You are right. I am just wondering if it is possible to use the AMS Euler font the way I envisioned. (I.e., replace "AMSEuler" with the "correct phrase".) Perhaps, it is not possible. –  Sony Oct 8 '11 at 20:23
is it possible to use the euler roman consistently for juat part(s) of a document? undoubtedly; it has been done with other fonts for examples in manuals. i'm just not sure where to look, to "borrow" the code, and digging for that takes time., which i'm short of right now. –  barbara beeton Oct 8 '11 at 20:27

not a complete solution, but one that will allow you to use euler roman in the same way as you would use fraktur:

\documentclass[12pt]{report}

\DeclareMathAlphabet\EuRoman{U}{eur}{m}{n}
\SetMathAlphabet\EuRoman{bold}{U}{eur}{b}{n}
\newcommand{\eurom}{\EuRoman}

\begin{document}
Using default font: $$\frac{dy}{dx}$$

Using AMSEuler: $$\frac{\eurom{dy}}{\eurom{dx}}$$

Using AMSEuler: {\boldmath$$\frac{\eurom{dy}}{\eurom{dx}}$$}

More Euler: $\eurom{EULER}$
\end{document}


EDIT: The complete definition of the "standard" math fonts cam be found in the file fontmath.ltx which is part of the core code that is compiled into the latex format.

enabling an alternate math alphabet involves replicating at least parts of that file, substituting the euler roman for the math italic; it could be as simple as redefining the "letters" complement, which is

\DeclareSymbolFont{letters}     {OML}{cmm} {m}{it}
\SetSymbolFont{letters}  {bold}{OML}{cmm} {b}{it}


but it's possible that (perhaps much) more is involved, especially if the euler digits are wanted in addition to the letters. if i can find time, i will make some experiments, but the prospects are uncertain, as i am preparing for the upcoming tug meeting.

-

In ConTeXt, one can switch bodyfont in the middle of a document, which changes the math font as well. Here is an example using pagella-euler typescript (which sets pagella as the text font and euler as the math font) and euler typescript (which sets euler as the text and math font).

\startbuffer
Sample \math{\frac {dy}{dx} \sum_{i} \alpha_i}
\stopbuffer

\def\ShowSample#1%
{\framed[frame=off,offset=5pt]{\bold{Font: #1} {\switchtobodyfont[#1] \getbuffer}}}

\usetypescript[pagella-euler]
\usetypescript[euler]

\starttext
\ShowSample{}

\ShowSample{pagella-euler}

\ShowSample{euler}

\ShowSample{}
\stoptext


This gives

-
This is nice. What is the best way to learn ConTeXt? (ConTeXt garden is not the place to be.) –  Sony Nov 12 '11 at 1:21
@Sony: I think that reading "ConTeXt: an excursion" and "The ConTeXt manual" are the best way to learn ConTeXt. There is also an old document "LaTeX in proper ConTeXt" which is useful when migrating from LaTeX. –  Aditya Nov 15 '11 at 17:37

This is a partial solution that I developed (Thanks to TeX.sx) for temporary use. (I hope Barbara Beeton will revisit when she has time.)

\documentclass[12pt]{report}
\DeclareMathAlphabet\EuRoman{U}{eur}{m}{n}
\SetMathAlphabet\EuRoman{bold}{U}{eur}{b}{n}
\newcommand{\euler}{\EuRoman}
{\catcode\ =\active\global\let =\ }
\everymath{\catcode\ =\active}
\renewcommand{\baselinestretch}{1.2}

\begin{document}
Using default font: This is a fraction: $$\frac{23}{24}$$

Using AMS Euler: $$\euler{This is a fraction: \frac{23}{24}}$$

Back to default font: This is a fraction: $$\frac{23}{24}$$
\end{document}


The following is the output.

-