4

I want to see how various chemical equations look using the euler or eulervm font, but I can't seem to figure out how to do it (or if it's even possible).

The documentation for chemformula indicates that I can set font by using a font-family parameter with \setchemformula .

I have used this code in the header of my tex file

\usepackage{eulervm} 
\setchemformula{font-family=eulervm}

This is in the body of the document.

\begin{equation} \label{keqequation}
    \dfrac{\ch{[B][K]}}{\ch{[A]}} = K_{eq}
\end{equation}

enter image description here

You can see that the K_{eq} is in eulervm font, but the [K] is not.

I have also tried:

\setchemformula{font-family=euler}
\setchemformula{font-family=euler-vm}

without success

I can, however, change the font using

\setchemformula{font-family=lmss}

which suggests that I'm not doing anything horribly wrong.

Any thoughts on how to pull this off?

Also, I know that I could get the euler font simply by NOT using chemformula's \ch command in this situation, but there will be other times when I want to use the features of the \ch command, so I'd like to know if it's possible to use euler inside of \ch.

Thanks for any thoughts!

Here is a complete stripped down version of what I described above.

\documentclass[11pt,letterpaper]{article}
\usepackage{amsmath}
\usepackage{chemformula}
\usepackage{eulervm}
\setchemformula{font-family=eulervm}
\begin{document}
\begin{equation} \label{keqequation}
   \dfrac{\ch{[B][K]}}{\ch{[A]}} = K_{eq}
\end{equation}

\end{document}

  • Welcome! Please always post a complete, compilable minimal document rather than mere fragments of code as it is much harder to work with the latter. – cfr Jan 17 '16 at 20:09
  • The problem, I think, is that eulervm does not provide a font in the output encoding chemformula requires. So chemformula looks for a font in OT1 or T1 encoding but Euler doesn't support that. Also, the family name is not euler-vm or euler but zeur, for example, But unless chemforuma can use encoding U, I think you are out of luck here. – cfr Jan 17 '16 at 20:18
  • Note that chemformula letters will generally look like maths operators e.g. if you compare \sin, you'll see it uses the same font. – cfr Jan 17 '16 at 20:20
  • 1
    @cfr sorry about that. I edited the post. Thank you. – user36476 Jan 17 '16 at 20:20
  • Unfortunately, there's no usable version of Euler for OT1 or T1 encoding. The fonts have and in the slots for [ and ] – egreg Jan 17 '16 at 20:44
3

You can do it, but you need extra care, because the available Euler fonts have quite a nonstandard layout.

\documentclass[11pt,letterpaper]{article}
\usepackage{amsmath}
\usepackage{eulervm}
\usepackage{chemformula}

\makeatletter
\@ifundefined{zeu@@Scale}{\let\zeu@@Scale\@empty}{}
\DeclareFontFamily{OT1}{zeur}{}
\DeclareFontShape{OT1}{zeur}{m}{n}{
   <9-> \zeu@@Scale zeurm10
   <6-9> \zeu@@Scale zeurm7
   <-6> \zeu@@Scale zeurm5
}{}
\DeclareFontShape{OT1}{zeur}{b}{n}{
   <9-> \zeu@@Scale zeurb10
   <6-9> \zeu@@Scale zeurb7
   <-6> \zeu@@Scale zeurb5
}{}
\DeclareFontShape{OT1}{zeur}{bx}{n}{<->ssub * zeur/b/n}{}
\makeatother

\setchemformula{font-family=zeur}

\begin{document}

\begin{equation} \label{keqequation}
\dfrac{[\ch{B}][\ch{K}]}{[\ch{A}]} = K_{eq}
\end{equation}

\end{document}

The brackets must be outside \ch, because the Euler font doesn't have them in the standard slots.

enter image description here

If you have the Neo Euler font (see https://github.com/khaledhosny/euler-otf), you can use it with unicode-math:

\documentclass[11pt,letterpaper]{article}
\usepackage{amsmath}
\usepackage[math-style=upright]{unicode-math}
\usepackage{chemformula}

\setmathfont{Neo Euler}
\setchemformula{font-spec={Neo Euler}}


\begin{document}
\begin{equation} \label{keqequation}
\dfrac{\ch{[B][K]}}{\ch{[A]}} = K_{eq}
\end{equation}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.