<div dir="ltr">Or use \bidi@newrobustcmd:<div><br></div><div>\bidi@newrobustcmd*{\ArabicScript}[1]{\RL{\@Latinfalse\ArabicFont #1}}<br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Sep 28, 2014 at 6:20 AM, Zdenek Wagner <span dir="ltr"><<a href="mailto:zdenek.wagner@gmail.com" target="_blank">zdenek.wagner@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">2014-09-27 22:12 GMT+02:00 Mike Maxwell <<a href="mailto:maxwell@umiacs.umd.edu">maxwell@umiacs.umd.edu</a>>:<br>
> On 9/27/2014 12:24 AM, Vafa Khalighi wrote:<br>
>><br>
>> Well, I suppose you do not use low-level commands like \RL to typeset say<br>
>> Arabic. Do you?<br>
><br>
><br>
> We have been; perhaps relevant is the fact that we're typesetting small<br>
> amounts of text in various right-to-left scripts in the middle of a bunch of<br>
> left-to-right text (a grammar).<br>
><br>
>> One usually defines an environment like:<br>
>><br>
>> \newfontfamily\arabicfont[ExternalLocation,Script=Arabic]{amiri-regular}<br>
>> \newenvironment{arabtext}{\begin{RTL}\@Latinfalse\arabicfont}{\end{RTL}<br>
>><br>
>> or if you are defining commands:<br>
>><br>
>> \newcommand*{\textarab}[1]{\RL{\@Latinfalse\arabicfont #1}}<br>
><br>
><br>
> Ok, tried that; it (and also my original attempt at redefining \RL) fails<br>
> for some reason in captions.  The minimal example is<br>
<br>
</span>Your definition is fragile but a robust macro is needed inside<br>
\caption. Use \DeclareRobustCommand instead of \newcommand, the syntax<br>
is the same.<br>
<div><div class="h5">> ---------------<br>
> \documentclass{report}<br>
> \usepackage{fontspec}<br>
> \newfontfamily\ArabicFont[Script=Arabic]{Scheherazade}<br>
><br>
> \usepackage{bidi}<br>
> \makeatletter<br>
> \@Latintrue<br>
> \newcommand*{\ArabicScript}[1]{\RL{\@Latinfalse\ArabicFont #1}}<br>
> \makeatother<br>
><br>
> \begin{document}<br>
><br>
> \begin{table}<br>
> \caption{{\ArabicScript{دن}}}<br>
> \end{table}<br>
> \end{document}<br>
> -----------<br>
><br>
> The error msg is<br>
>     ! Incomplete \iffalse; all text was ignored after line 15.<br>
>     <inserted text><br>
>                     \fi<br>
>     <*> RLBug.xetex<br>
> --<br>
>         Mike Maxwell<br>
>         <a href="mailto:maxwell@umiacs.umd.edu">maxwell@umiacs.umd.edu</a><br>
>         "My definition of an interesting universe is<br>
>         one that has the capacity to study itself."<br>
>         --Stephen Eastmond<br>
><br>
><br>
><br>
</div></div>> --------------------------------------------------<br>
> Subscriptions, Archive, and List information, etc.:<br>
>  <a href="http://tug.org/mailman/listinfo/xetex" target="_blank">http://tug.org/mailman/listinfo/xetex</a><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
Zdeněk Wagner<br>
<a href="http://hroch486.icpf.cas.cz/wagner/" target="_blank">http://hroch486.icpf.cas.cz/wagner/</a><br>
<a href="http://icebearsoft.euweb.cz" target="_blank">http://icebearsoft.euweb.cz</a><br>
</font></span></blockquote></div><br></div>