3

Trying to compile a simple document using polyglossia with Hebrew as the default language:

\documentclass[a4paper]{article}
\TeXXeTstate=1
\usepackage{amsmath, amssymb}
\usepackage{polyglossia}
\setdefaultlanguage[calendar=hebrew, numerals=hebrew]{hebrew}
\setotherlanguage{english}
\setmainfont{David CLM}
\usepackage[noend]{algpseudocode}

\begin{document}
\section{}
  שלום
  \begin{english}
    Procedure(A)
    \begin{algorithmic}[1]
      \State $A = 0$
    \end{algorithmic}
  \end{english}
\end{document}

Results in this using XeTeX:

! Missing \endcsname inserted.
<to be read again> 
                   \relax 
l.15     \begin{algorithmic}[1]

If I set the default language to English and other language to Hebrew it works fine though.

5
  • 1
    This is due to numerals=hebrew. If you delete it, no error happens. I am not sure about details. You can make a bug report at github.com/reutenauer/polyglossia/issues
    – IRAN
    Commented Nov 23, 2011 at 12:18
  • Also there is no need for \TeXXeTstate=1. And it is much safer to load algpseudocode package before loading polyglossia package.
    – IRAN
    Commented Nov 23, 2011 at 12:19
  • @VafaKhalighi: as a matter of fact I wanted numerals=arabic but that doesn't compile at all. Deleting the numerals also doesn't compile. Commented Nov 23, 2011 at 13:20
  • If I delete the \section{} it does compile without the numerals, but the original error is stil there. Commented Nov 23, 2011 at 13:23
  • See my answer, do you still get any error with the minimal example that I posted in my answer.
    – IRAN
    Commented Nov 23, 2011 at 13:30

2 Answers 2

3

A workaround can be the following code to be put in the preamble:

\usepackage{etoolbox}
\makeatletter
\let\ORI@arabic\@arabic
\expandafter\pretocmd\csname\string\algorithmic\endcsname
  {\let\@arabic\ORI@arabic}{}{}
\renewcommand{\theALG@storecount}{\ORI@arabic\c@ALG@storecount}
\makeatother

The strange code is meant to inject the code in the "real" macro that does the work intended for \algoritmic.

5
  • Should this be put in a specific location in the preamble (before/after polygossia/algorithmic etc)? I tried several positions but all resulted in the same error. Commented Nov 23, 2011 at 13:20
  • After loading algorithmic. Just put the loading of etoolbox with the other packages and rest of the code before \begin{document}.
    – egreg
    Commented Nov 23, 2011 at 13:23
  • Not much has changed. Here's the modified file with the output at the bottom: paste.pocoo.org/show/511861 Commented Nov 23, 2011 at 13:27
  • bidi package automatically loads biditools package (the programming infrastructure of bidi package) that provides some tools similar to what etoolbox provides. Hence there is no need to load etoolbox, instead change \pretocmd to \bidi@pretocmd.
    – IRAN
    Commented Nov 23, 2011 at 13:33
  • @daniel.jackson I get no error.
    – egreg
    Commented Nov 23, 2011 at 13:34
1

Since, in the comment you said that you want arabic numerals, then changing your minimal example to the following works without problems with arabic numerals:

\documentclass[a4paper]{article}
\usepackage{amsmath, amssymb}
\usepackage[noend]{algpseudocode}
\usepackage{polyglossia}
\setdefaultlanguage[calendar=hebrew]{hebrew}
\setotherlanguage{english}
\setmainfont{David CLM}

\begin{document}
\section{}
  שלום
  \begin{english}
    Procedure(A)
    \begin{algorithmic}[1]
      \State $A = 0$
    \end{algorithmic}
  \end{english}
\end{document}
2
  • I'm getting this error: ! Undefined control sequence. \@sect ...stepcounter {#1}\protected@edef \@svsec {\@seccntformat {#1}\relax... l.10 \section{} Commented Nov 23, 2011 at 13:32
  • I do not get that error. Maybe your TeX distribution is not updated.
    – IRAN
    Commented Nov 23, 2011 at 13:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .