GeneralUse a single font for equation labels

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Shai-Avr
Posts: 8
Joined: Tue Aug 22, 2023 11:30 am

Use a single font for equation labels

Post by Shai-Avr »

I use Latex with babel to write Hebrew documents. I have different fonts for Hebrew and English and there is a weird consequence to that. Take a look at this sample code:

Code: Select all

\documentclass[a4paper, 12pt]{extarticle}

\PassOptionsToPackage{no-math}{fontspec}

\usepackage[bidi=basic, layout=tabular]{babel}

\babelprovide[main, import, alph=letters, Alph=letters]{hebrew}
\babelprovide[import]{english}

\babelfont{rm}{TeX Gyre Bonum}
\babelfont[hebrew]{rm}{Arial}

\usepackage{amsmath}

\begin{document}
עוצמת הגל כפונקציה של הזווית נתונה על ידי
\begin{equation}\label{eq:intensity}
    I = I_0 \cos^2 \theta
\end{equation}

לפי משוואה \eqref{eq:intensity} וגם \eqref{eq:intensity2}

\selectlanguage{english}
\begin{equation}\label{eq:intensity2}
    I = I_0 \cos^2 \theta
\end{equation}

According to equation \eqref{eq:intensity2} and \eqref{eq:intensity}
\end{document}
When compiling this code with LuaLatex, I get the following result:
Image
As you can see when I work in Hebrew the labels of equations use the Hebrew font 'Arial' and when I switch to English, it uses the English font 'TeX Gyre Bonum' (I changed the English font so it will be different than the math font). This creates an annoying inconsistency in the document: Math is typeset using its own font, but the labels use different fonts depending on the language I happen to be using right now.

How can I configure babel to use the math font for equation labeling regardless of the selected language? Also, can I configure a specific font for the labels? (The English font or the Hebrew font or maybe an entirely different font, but the important thing is it's the same font for all labels)

I don't know if I should enforce the same font for the referencing of equations as well, or if it's preferred to keep the references the way they are, so they match the current language. I'd like to know what is more correct for a serious article (in university, for example), and if I should maintain the same font in references too, then how can I achieve this?

Recommended reading 2024:

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

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

Post Reply