2

I am using TeXworks (Windows 10, MiKTeX), compiling (XeLatex) a document that contains several languages, but attached is a simplified MWE which contains only Hebrew and English. Inside the Hebrew environment, I would like to be able to control most of the properties of the label, primarily its position and style: altering the position from the typical right to the left, and controlling style through independent control of size, a different font, boldface, color, etc. I followed the comments and solutions provided in the forum, but the position of the label does not change. Here is my code:

\documentclass[12pt]{article}
\usepackage[a4paper,vmargin=2cm,hmargin=2cm,showframe=false]{geometry}
\usepackage{fontspec}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{polyglossia}
\usepackage{bidi}

\makeatletter\chardef\l@hebrew=255 \makeatother %removes the Hebrew hyphenation problem/warning

\setmainlanguage{english}

\setotherlanguages{hebrew} 

\newfontfamily\hebrewfont[Mapping=tex-text,Script=Hebrew,Scale=1,FakeBold=0]{Taamey Frank CLM}


\title{Hebrew and English Math AND Text in \LaTeX}

\begin{document}
\maketitle
This is a mainly English document which contains other languages.

\section{Hebrew and English}
Here's some Hebrew and English text:

\begin{hebrew}
שיוויון פשוט:\newline

\begingroup
\makeatletter
\input{leqno.clo}
\makeatother
\begin{equation}
\label{1}
a=b
\end{equation}
\endgroup

\end{hebrew}
\end{document} 

Any help would be greatly appreciated!

Gideon
  • 111
  • 2
  • Do you want the equation number always on the left or only sometimes on the left? – David Purton Feb 01 '18 at 10:31
  • You can change the format of the equation number by redefining \tagform@. See amsmath-xetex-bidi.def for its definition when bidi is loaded. See also https://tex.stackexchange.com/a/240365/87678 and https://tex.stackexchange.com/a/61768/87678 – David Purton Feb 01 '18 at 10:43
  • To put the equation temporarily on the left you can use \let\veqno\leqno after your \begingroup – David Purton Feb 01 '18 at 10:45

1 Answers1

1

If you always want numbers on the left, load bidi with the leqno option. Otherwise you can change it whenever you want by setting \veqno be equal to \leqno.

You can change the equation number style by redefining \theequation. (See also the amsmath \numberwithin macro.)

You can change the format of the tag by redefining \tagform@. Note that bidi also redefines this in amsmath-xetex-bidi.def.

Silly MWE

\documentclass{article}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguages{hebrew} 
\newfontfamily\hebrewfont[Script=Hebrew]{SBL BibLit}
\begin{document}
\section{Hebrew and English}
Here's some Hebrew and English text:

\begin{hebrew}
שיוויון פשוט:

\begingroup
\renewcommand{\theequation}{\emph{\thesection}\textcolor{green}{.}\textbf{\arabic{equation}}}
\makeatletter
\def\tagform@#1{\maketag@@@{\Large\if@nonlatin\beginR\fi\textcolor{blue}{+}\kern\z@\ignorespaces#1\unskip\@@italiccorr\textcolor{red}{+}\if@nonlatin\endR\fi}}
\makeatother
\let\veqno\leqno
\begin{equation}
\label{1}
a=b
\end{equation}
\endgroup

\end{hebrew}

See equation \ref{1}.
\end{document} 

enter image description here

David Purton
  • 25,884
  • Thank you so much! A very simple and clear solution that actually works! Much obliged, Gideon – Gideon Feb 01 '18 at 14:13
  • @Gideon you should accept answers that you think fit best to your questions. This way, other users will know that this is a suitable answer to your question. :) – Jasper Habicht Feb 05 '18 at 19:14