3

Is \ref supposed to work in math mode? If hyperref and bidi are loaded, it generates errors:

\documentclass{article}
\usepackage{hyperref}
\usepackage{bidi}
\begin{document}

Testing labels with \verb+hyperref+ and \verb+bidi+.

\section{This is a section}
\label{sec}

\begin{equation}
    a = b \label{eq} 
\end{equation}

In text mode everything works fine.  Referencing equation~\ref{eq} in section~\ref{sec}.

But if we try to do it in math mode, we get errors:  $\ref{eq}$

$\ref{sec}$

\[
\ref{eq}
\]

\[
\ref{sec}
\]

\end{document}
  • And is \ref -- which essentially returns a text-mode contents -- supposed to work in math mode? – yo' Feb 28 '13 at 0:21
  • @tohecz It does work if no extra packages are loaded. Is that just a fluke? – Ari Brodsky Feb 28 '13 at 0:26
2

This issue is now fixed in version 12.2 of bidi package which is now on CTAN. Please for future, do not report bidi issues here; it is very hard for us to search Internet and hunt down who has got problem and who has not. Instead, please do as stated in README file of bidi package.

1

I don't know why it happens, but enclosing \ref in \mbox seems to cure the disease:

$\mbox{\ref{sec}}$
1

it seems that the combination of hyperref and bidi doesn't like xrefs in math. you can \usepackage{amstext} and then \text{\ref{...}}.

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