8

I am trying to use the cleveref package with babel and Hebrew. I get the following error (on the second run of Latex):

ERROR: Missing number, treated as zero.

--- TeX said ---
<to be read again> 
                   \beginL 
l.18 And \cref{eq1,eq2}
----------------

Below is a minimal example that produces the above error:

\documentclass{article}

\usepackage[hebrew,english]{babel}
\usepackage{cleveref}

\begin{document}

\begin{equation}
  \alpha = 1
  \label{eq1}
\end{equation}

\begin{equation}
  \beta = 1
  \label{eq2}
\end{equation}

And \cref{eq1,eq2}.

\end{document}

Is there any workaround for this issue? I don't need any Hebrew cross-references, I just use it in the title and abstract.

PS - Below is a longer version of the error:

ERROR: Missing number, treated as zero.

--- TeX said ---
<to be read again> 
                   \beginL 
\@tempa ->\beginL 
              1\endL 
\@cref@countercmp ...@countstackb }\ifnum \@tempa 
                                                  <\@tempb \relax \def \cref...

\@cmp ...b }{\@countstackb }\fi \@cref@countercmp 
                                                  \fi \fi \fi \fi \expandaft...

\@cref@stack@insert ...f@elem }{#2}{\cref@result }
                                                  \ifnum \cref@result =2\rel...

\cref@stack@insert ...@stack@insert {}{#1}{#2}{#3}
                                                  \cref@stack@pop {#3}
<argument> ...andafter \cref@stack@insert \@tempa 
                                                  \cref@isstackfull {\@refsu...

\@whilesw #1\fi #2->#1#2
                        \@iwhilesw {#1#2}\fi \fi 
\cref@stack@sort ...@tempa \cref@isstackfull {#1}}
                                                  \expandafter \endgroup \ex...
<argument> ... {\@refsubstack }{\cref@countercmp }
                                                  \else \cref@processgroup {...

\@whilesw #1\fi #2->#1#2
                        \@iwhilesw {#1#2}\fi \fi 
\@cref ...nt types}\@cref@stackfullfalse \fi \fi }
                                                  \endgroup 
l.20 And \cref{eq1,eq2}
                       .
--- HELP ---
This is usually caused by a LaTeX command expecting but not finding
either a number or a length as an argument. You may have omitted an
argument, or a square bracket in the text may have been mistaken for
the beginning of an optional argument. This error is also caused by
putting \protect in front of either a length command or a command such
as \value that produces a number.
5

If you only need hebrew for the abstract you can use a redefinition of \@@number which is defined in the file rlbabel.def. The file is loaded by babel:

\makeatletter
 \def\@@number#1{#1}
\makeatother

The original definition is:

\def\@@number#1{\ifmmode\else\beginL\fi#1\ifmmode\else\endL\fi}

With this redefinition the result will be:

enter image description here

\documentclass{article}
\usepackage[hebrew,english]{babel}
\usepackage{cleveref}

\makeatletter
\def\@@number#1{#1}
\makeatother
\begin{document}

\begin{equation}
  \alpha = 1
  \label{eq1}
\end{equation}

\begin{equation}
  \beta = 1
  \label{eq2}
\end{equation}

And \cref{eq1,eq1}.
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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