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.

Alon
  • 113
  • Welcome to TeX.SX! – Heiko Oberdiek Jul 02 '15 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 Jul 02 '15 at 20:50
  • no no, I will add image – Alon Jul 02 '15 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 Jul 02 '15 at 20:57
  • @cfr I added all the code of the image – Alon Jul 02 '15 at 21:47
  • @cfr I dont understand.. this is all the code that I lyx created.. I have post another code? Thanks. – Alon Jul 02 '15 at 21:56
  • I updated to the tex code. if I remove the \selectlanguage{english}% this is in the correct place but the english text is like a mirror view. – Alon Jul 02 '15 at 23:42
  • I can't get it to compile at all... I guess it needs lualatex but it still doesn't like it: it keeps telling me to use TeX--XeT or an e-TeX engine! – cfr Jul 03 '15 at 00:24
  • I've tidied up a bit by deleting some obsolete comments. You might like to do the same. Are you compiling with pdfTeX, XeTeX, LuaTeX or what? Your original code suggested lualatex but the new code suggests pdflatex or latex. – cfr Jul 03 '15 at 00:55
  • I use pdflatex. this is what lyx generate. – Alon Jul 03 '15 at 01:01
  • LyX can use XeTeX or LuaTeX rather than pdfTeX. See the link at the end of my answer below. XeLaTeX seems to be your best option here and should make this much, much easier. – cfr Jul 03 '15 at 01:18

2 Answers2

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.

cfr
  • 198,882
  • 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 Dec 19 '16 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 Dec 19 '16 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