1

I am using LYX.

when I am writing a file in lyx that combines hebrew(RTL) and english(LTR) sometimes I write lines that start in english word this line and only this line that starts with english word start in the left. The problem is that I want all my file to be RTL. it appears when I use section/subsection/regular...

how can I put all the lines in the right and don't matter which lang I use??

My problem is not put all the section in right. if I right only in english and I put it on the right using the paragraph setting it is ok. the problem is when I want to start the section with english word and then write in hebrew and all the section align to right.

I want the word description in this image to be above the right "תיאור" word... (not reverse the words..)

1

Thanks.

edit - this is all the file for the image.

  %% LyX 2.1.3 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\RequirePackage{fix-cm}
\documentclass[english,hebrew]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9,cp1255]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=1cm,bmargin=2cm,lmargin=1cm,rmargin=1cm}
\usepackage{fixltx2e}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\usepackage{theorem}
\theorembodyfont{\upshape}
\newtheorem{theorem}{\R{îùôè}}[section]
\AtBeginDocument{\make@lr\thetheorem}

% The following chunk fixes export with XeTeX.
% It is needed because polyglossia is used by default
% and \make@lr is only defined by babel.
\@ifundefined{make@lr}
{\def\make@lr#1{\begingroup
    \toks@=\expandafter{#1}%
    \edef\x{\endgroup
  \def\noexpand#1{\noexpand\@number{\the\toks@}}}%
  \x}}{\relax}

\@ifundefined{date}{}{\date{}}
\makeatother

\usepackage{babel}
\begin{document}
\begin{description}
\item [{רואית}] הלימ הלימ
\selectlanguage{english}%
\item [{\inputencoding{latin9}description}] \inputencoding{cp1255}\R{הלימ
הלימ הלימ}\selectlanguage{hebrew}%
\end{description}

\end{document}

if I remove the \selectlanguage{english}% the item goes to the correct place but the english text is like a mirror view.

11
  • Welcome to TeX.SX! Commented Jul 2, 2015 at 19:36
  • Just to make sure I understand when you say that you want all your file to be RTL: Meaning, if you type the word "hello" it will be typed and output as "olleh" ?
    – scottkosty
    Commented Jul 2, 2015 at 20:50
  • no no, I will add image
    – Alon
    Commented Jul 2, 2015 at 20:50
  • I added image. I want the word description in this image to be above the right "תיאור" word... (not reverse the words..)
    – Alon
    Commented Jul 2, 2015 at 20:57
  • @cfr I added all the code of the image
    – Alon
    Commented Jul 2, 2015 at 21:47

2 Answers 2

1

It is much easier to typeset languages such as Hebrew with one of the newer TeX engines because you have access to fontspec, polyglossia, bidi... and so on.

Here's the output I think you want:

RTL with English tag

Here's my code, which has to be compiled with XeLaTeX:

\documentclass{article}% egreg's preamble from https://tex.stackexchange.com/a/139006/
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{hebrew}
\setotherlanguage{english}
\setmainfont{Pfennig}
\newfontfamily{\hebrewfont}{Pfennig}

\begin{document}
  \begin{description}
    \item [\textenglish{description-}] {מילה מילה מילה}
    \item [{תיאור }] מילה מילה מילה
  \end{description}
\end{document}

This is based on egreg's answer.

LyX can be configured to use XeTeX as an engine according to its documentation. Instructions are available on the LyX wiki.

2
  • Eventually I wrote my Tex code in similar fashion to the code that you presented here. My discomfort with this solution is that I need to use tags (such as textenglish, in your case) in order to reverse the order of English words. The optimal solution IMO is that Tex engines would detect Hebrew/English directions by default.
    – Dor
    Commented Dec 19, 2016 at 17:10
  • @Dor Well, it would normally detect it if you are using Polyglossia etc. At least, that's my understanding. However, I don't really think it should do so. Indeed, I think it probably ought not. I certainly would not want the engine to detect this, as you suggest. And, of course, you have to specify the engine. TeX obviously cannot and never will. pdfTeX is presumably a similar story. So you are talking XeTeX/LuaTeX. But this kind of stuff should not be in the engine anyway.
    – cfr
    Commented Dec 19, 2016 at 23:33
0

Lyx 2.2 support rtl and ltr without any additional code, only : - from document setting select hebrew. - select your fonts. Now you can write hebrew or english.

Regards

1
  • But if you write sentence in english this is on the left and not on the right
    – Alon
    Commented Jul 12, 2015 at 8:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .