Polyglossia used in LyX

bidihebrewlyxpolyglossia

I am writing a Hebrew document that also contains in-line English text. For that, I am using polyglossia to facilitate multilingual typesetting.

A MWE is:

\documentclass{article}
\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\setmainfont{Times New Roman}
\newfontfamily\hebrewfont{David CLM}
% \usepackage{bidi} % really needed?
\begin{document}
פונקציה מקבוצה 
\LRE{\textenglish{X}}
 לקבוצה 
\LRE{\textenglish{Y}}
 מסומנת $f:X\to Y$.
\end{document}

output
I want to be able to produce this scheme of LaTeX file with LyX's Export to LaTeX (XeTeX) tool.

I prefer achieving this goal with the LyX GUI, and not by writing the necessary commands in the Latex preamble found in the Documents settings.

At the moment the settings in LyX->Preferences->Language read the following:

preferences window

It looks like one has control over what command should be used to start an English environment. In this case it is \selectlanguage{$$lang}. But these settings rather produce the following environment when English is inserted in a separate line

\begin{english}%
⟨the English text⟩
\end{english}%

and the following when English is inserted as in-line:

\textenglish[variant=american]{the English text}

So, I have three questions:

  1. Why is the variant=american option there for the inline English? I can't see anywhere in the settings where it is called.
  2. Where the \selectlanguage{$$lang} has its effect?
  3. I am looking at the exported pdf file, and the left-to-right and right-to-left issue is dealt fine, without surrounding \textenglish{} with \LRE{⟨...⟩}. Is there a real need for the bidi package here? If the answer is yes, then how do I instruct LyX to work with the bidi package?

Best Answer

Ad 1. variant=american is set in LyX' language definition file for English. This is also actually the default variant for polyglossia English.

Ad 2. Nowehere. This is only used with babel. With polyglossia, LyX always use polyglossia's own language switching commands (the <language> environment)

Ad 3. No. Polyglossia automatically loads bidi (or luabidi) for RTL languages.

Related Question