# RTL captions with newfloat?

Is it that the float package begins to show its age? I cannot get it to work right with XeLaTeX. Here is an example:

\documentclass{article} % compile with xelatex
\usepackage{float}
\usepackage{polyglossia}
\setmainlanguage{hebrew}
\setotherlanguage{english}
\newfontfamily\hebrewfont[Script=Hebrew]{Ezra SIL}% or{SBL Hebrew}

\newfloat{thingy}{htbp}{lot}[section]
\begin{document}
\begin{thingy}
$E = m c^2$
\begin{hebrew}\setRTL\caption{This caption should be set RTL}\end{hebrew}
\end{thingy}
\end{document}

-
AFAIK this has nothing to due with "age", but is due to way float is processing the \caption's in general. Apparently it stores the caption and places it depending on the layout of this float time. This also makes the position of \caption irrelevant. –  Martin Scharrer Feb 14 '11 at 7:46

Version 1.1.6 of the bidi package (available today on CTAN and perhaps tomorrow by updating TeXLive 2010) adds support for the float package and hence captions inside RTL mode will be RTL and captions inside LTR mode will be LTR. Your code should be changed into:

\documentclass{article} % compile with xelatex
\usepackage{float}
\usepackage{polyglossia}
\setmainlanguage{hebrew}
\setotherlanguage{english}
\newfontfamily\hebrewfont[Script=Hebrew]{Ezra SIL}% or{SBL Hebrew}

\newfloat{thingy}{htbp}{lot}[section]
\begin{document}
\begin{thingy}
$E = m c^2$
\caption{This caption should be set RTL}
\end{thingy}
\end{document}

So this clearly means that you do not need to surround \caption by a hebrew environment and \setRTL command.

-
a tip: you can use backticks ` to mark your inline code as I did in my edit. –  Hendrik Vogt Feb 14 '11 at 8:19
thanks for acting so quickly on this. I am currently in the process of installing TeX live 2010 to see whether it works for me. –  Yossi Gil Feb 14 '11 at 20:49
I finally managed to install TeX live 2010, and with version 1.1.16, polyglossia 2010/07/15 v1.2.0, the caption is still problematic, the caption is still LTR. –  Yossi Gil Feb 16 '11 at 14:54
Yossi Gil: No, it is not. Perhaps you can email me your tex file, the pdf output and your log file. My email address should be in bidi documentation. Also note than in your example here, you only use English words not Hebrew ones and so the direction of each English word will be LTR. This is done by ICU. I need to see an example where you only have used bidi and float packages, so no polyglossia. –  IRAN Feb 16 '11 at 16:53
I just mailed you the files. Thanks. Yossi –  Yossi Gil Feb 17 '11 at 19:29