Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
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 Nov 23 '11 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 Nov 23 '11 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. –  daniel.jackson Nov 23 '11 at 13:20
    
If I delete the \section{} it does compile without the numerals, but the original error is stil there. –  daniel.jackson Nov 23 '11 at 13:23
    
See my answer, do you still get any error with the minimal example that I posted in my answer. –  IRAN Nov 23 '11 at 13:30

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer
    
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. –  daniel.jackson Nov 23 '11 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 Nov 23 '11 at 13:23
    
Not much has changed. Here's the modified file with the output at the bottom: paste.pocoo.org/show/511861 –  daniel.jackson Nov 23 '11 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 Nov 23 '11 at 13:33
    
@daniel.jackson I get no error. –  egreg Nov 23 '11 at 13:34

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}
share|improve this answer
    
I'm getting this error: ! Undefined control sequence. \@sect ...stepcounter {#1}\protected@edef \@svsec {\@seccntformat {#1}\relax... l.10 \section{} –  daniel.jackson Nov 23 '11 at 13:32
    
I do not get that error. Maybe your TeX distribution is not updated. –  IRAN Nov 23 '11 at 13:36
    
Probably. Thanks for trying. –  daniel.jackson Nov 23 '11 at 13:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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