将 cleveref 包与 hebrew 和 babel 结合使用

将 cleveref 包与 hebrew 和 babel 结合使用

我正在尝试使用希伯来语cleverefbabel。我收到以下错误(第二次运行 Latex 时):

ERROR: Missing number, treated as zero.

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

下面是产生上述错误的最小示例:

\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}

有没有什么办法可以解决这个问题?我不需要任何希伯来语交叉引用,我只在标题和摘要中使用它。

PS-以下是该错误的较长版本:

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.

答案1

如果您只需要希伯来语作为摘要,则可以使用\@@number文件中定义的重新定义rlbabel.def。该文件通过以下方式加载babel

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

原始定义是:

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

重新定义后结果将是:

在此处输入图片描述

\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}

相关内容