I am attempting to compile an article using the XeTex engine. In my document I've used the algorithmic
and algpsuedocode
packages in order to describe an algorithm.
Also, the document is meant to contain both Hebrew and English therefore, I've used the polyglossia package and because the algorithm is in english I've put it inside \begin{english}
environment as per polyglossia's documentation. The output contains inverted parentheses in the function's name.
Here is the complete document
\documentclass{article}
\usepackage{algorithm,algpseudocode}
\usepackage{polyglossia}
\usepackage{fontspec}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\newfontfamily{\englishfont}{Latin Modern Roman}
\newfontfamily{\hebrewfont}[Script=Hebrew]{David CLM}
\newfontfamily{\hebrewfontsf}[Script=Hebrew]{Miriam CLM}
\newfontfamily{\hebrewfonttt}[Script=Hebrew]{Miriam Mono CLM}
\begin{document}
\section{אלגוריתם לדוגמה}
\begin{english}
\begin{algorithm}
\caption{Euclid’s algorithm}
\label{euclid}
\begin{algorithmic}[1] % The number tells where the line numbering should start
\Procedure{Euclid}{$a,b$} \Comment{The g.c.d. of a and b}
\State $r\gets a \bmod b$
\While{$r\not=0$} \Comment{We have the answer if r is 0}
\State $a \gets b$
\State $b \gets r$
\State $r \gets a \bmod b$
\EndWhile\label{euclidendwhile}
\State \textbf{return} $b$\Comment{The gcd is b}
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{english}
\end{document}
However as you can see in the output the parentheses are not in the right order.
I don't know much about the internals, however in the file algpsuedocode.sty
I can see the following:
\algdef{SE}[FUNCTION]{Function}{EndFunction}%
[2]{\algorithmicfunction\ \textproc{#1}\ifthenelse{\equal{#2}{}}{}{(#2)}}%
{\algorithmicend\ \algorithmicfunction}%
Could this be the root of the problem?
David
font and can't reproduce the problem with e.g. Arial i.sstatic.net/acqrH.png\begin{english}
environment doesn't take care of everything?(test)
as well?David CLM