# [XeTeX] Images in LTR text

musa furber musaf at runbox.com
Sun Nov 6 15:26:16 CET 2005

On Nov 5, 2005, at 3:49 PM, Jonathan Kew wrote:

> On 5 Nov 2005, at 1:19 am, musa furber wrote:
>
>> When I use insert an image into a stream of LTR text,
>
> (I assume you meant RTL here...)

Correct.

> Are you inserting the image using \XeTeXpicfile, or are you using
> some higher-level LaTeX construction?

I was using

\hspace{-1em}\xspace}

>> the image is drawn from LTR (against the flow of the RTL text) so
>> it ends up drawing over the previous characters.
>>
>> Is this how things are supposed to and should be? If so, can
>> anyone recommend a solution?
>
> Hmm.... can't say I'd really considered it!
>
> In a quick test with \XeTeXpicfile in a line of Arabic text, I see
>
> You should be able to avoid the issue by surrounding the image with
> \beginL...\endL, so that XeTeX knows it is a left-to-right segment.
> I tried:
>
>     \hbox{\beginL \XeTeXpicfile "mypic.jpg"\endL}
>
> within Arabic text, and this seems to work fine. (Without the \hbox
> around the image, it seems to come out wrongly spaced.... this is
> probably a bug that I should investigate. In practice, I always box
> images, as I usually want to get their dimensions, etc.)

I replaced my macro with

\baselineskip \endR}
\hspace{-1em}\xspace
}

and things work just fine. Thanks. I would prefer not having to have
to include \beginR...\endR since it means having to create two sets
of macros for ligatures that are common in Islamic texts.

Regards,
Musa