Search:




  Help

Navigation

Groups

LyX documentation

Edit

Shared groups

Links

LyX /

HebrewOnLinux

Categories: Linux, Hebrew
<< | Page list | >>

Hebrew, LyX and Linux can work together.

1.  Ubuntu 20.04 / Fedora 36 (Xetex)

[Added by Guy Sheffer <guysoft at gmail dot com> on 31 May 2020]. Last updated 28 Oct 2022 to add Fedora 36.
  1. First install lyx, xetex, texlive-lang-arabic, and texlive-lang-other:
# On Ubuntu:
sudo apt install lyx texlive-lang-other texlive-xetex texlive-lang-arabic
# On Fedora:
sudo dnf install lyx gnu-free-{mono,sans,serif}-fonts
  1. Go in to Lyx by typing lyx in the commandline, or your application menu, write something in English and click the view button to see it all works (or CTRL+R)
  2. Type something in Hebrew, its going to show up backwards, and if you click the view button its going to fail and say "Could not find LaTeX command for character". We are going to fix both of these. Just make sure they are indeed not working.
  3. From the title menu go to Document>Settings. Then select the Fonts option on the side-bar. The check checkbox at the top is "Use non-TeX fonts (via XeTex/LuaTex).
  4. Then update the fonts so they support Hebrew, otherwise you will get a missing glyphs error). Set the following:
    • Roman: FreeSerif
    • Sans Serif: FreeSans
    • Typewriter: FreeMono
  5. Now your dialog should look like this:
  1. Save it and back to the menu.
  2. From the title menu go to Tools>Prefrences. Then select the File Handeling>FileFormats option on the side-bar.
  3. In the Settings select Under With non-Tex fonts PDF (XeteX) (If you don't see that option, you might need to select from the title menu Tools>Reconfigure to update your Lyx) . The dialog should look like this:
  1. You should have now the Hebrew working, but its still the backwards. Lets fix that.
  2. From the title menu go to Document>Settings. Then select the Language option on the side-bar. Select Language to be "Hebrew". This unlocks a special language menu.
  3. Now in your document, select the text you wrote in Hebrew and right-click on it. You should see a Language option and select Hebrew. Should look like this:
  1. Thats it! The text should align to the right now.
  2. Click the view button to see it all works (or CTRL+R). Hebrew should work.

2.  Pop!_OS 19.10

[Added by Yitzchak Schwarz <s.y.schwarz@gmail.com> on 8 Jan 2020]

Here's what I did on Pop!_OS 19.10 to get Hebrew working as expected:

I installed LyX and texlive-full from the repositories and culmus-latex-0.7

In Tools->Preferences->Editing I set it to use keyboard map with null as primary and hebrew as secondary
In Tools->Preferences->File Formats->"Default Output Formats"->"With TeX Fonts" I set to "PDF (pdflatex)"

In Document->Settings->Fonts:
I don't use non-TeX fonts (leave it on the default: TeX fonts)
For the Roman, Sans Serif, Typewriter fonts I set them all to Latin Modern fonts because I found through trial and error that they work, though some others might work too. Math I left on automatic.

Since I like to use sans fonts for everything, I set Default family to Sans Serif.

Of course I saved all of the changes I made in Document->Settings as Document Defaults.

In order to be able to render my LyX document that I previously created with a different configuration all I had to do was change the fonts.

It's also important to note that I need to switch back to the non-Hebrew keyboard layout before creating a math closure to prevent strange artifacts from appearing at the beginning of the math closure when exporting to PDF.

3.  Arch Linux

This method is used with the lyx AUR package, texlive comes along with it.

Install the texlive-latex pacman package, and the texlive-langother AUR package, using a package manager like yay.

Optional: install the texlive-culmus AUR package for culmus font support.

In Document Settings -> Document Class you should have the "Hebrew Article" class available. Switch to it, and also switch the language to Hebrew in Document Settings -> Language.

4.  Ubuntu 18.04

[Added by Yuri Chernyavsky <yurac777@gmail.com> on 19 Sep 2018]

Here is a script that enables hebrew for me. Only need to install fonts from culmus-latex package and set HE8 as the encoding.

 #!/bin/sh

 dTEXMFLOCAL="$(kpsewhich -var-value TEXMFLOCAL)"

 mkdir -p "/tmp/HebrewFonts" &&
 cd "/tmp/HebrewFonts" &&
 wget https://sourceforge.net/projects/ivritex/files/culmus-latex/culmus-latex-0.7/culmus-latex-0.7-r1.tar.gz/download -O culmus-latex-0.7-r1.tar.gz &&
 tar -xvzf culmus-latex-0.7-r1.tar.gz &&
 cd culmus-latex-0.7-r1 &&
 sudo mkdir -p "${dTEXMFLOCAL}" &&
 sudo rsync -a "usr/share/texmf/fonts" "${dTEXMFLOCAL}/" &&
 sudo mktexlsr &&
 sudo updmap-sys --enable Map=culmus.map &&
 (
 echo SUCCESS!!! Need to add the following to your preamble before loading babel:
 echo '\def\HeblatexEncoding{HE8}'
 echo '\def\HeblatexEncodingFile{he8enc}'
 )

5.  Method 1 - Ubuntu 12.04+ : Use IvriTeX

If you would like a TeX Live installation with Hebrew support, consider install-tl-ubuntu. It can be run as

 sudo ./install-tl-ubuntu --hebrew

6.  Method 2 - Ubuntu 10.04 (Lucid)

A) Install LyX using the synaptic package manager.
B) Download latest culmus release.(Recommended: not the source-release)
note: Synaptic installation of culmus is general-usage fonts, and not LaTeX fonts. Synaptic's ivritex and texlive-lang-hebrew are not up to date
C) Install culmus:

a. Extract the downloaded file to a folder
b. apply "sudo make" via the terminal
c. apply "sudo make install" via the terminal

D) Launch LyX
E) Go to (Top side menu) Document -> Settings... :

a. in the Document Class tab (menu on the left side of the window), Set Document Class to "article (Hebrew)".
b. in the Language tab (menu on the left side of the window), Set Language to "Hebrew", Set encoding to "other: Hebrew (CP 1255)".

F) Go to (Top side menu) Tools -> Preferences ->
a. (in the left side menu) Language Settings and make sure Right-To-Left (RTL) support is enabled. You might want to toggle the "Cursor movement" from Logical to Visual. That will change the behavior of the cursor in math-mode
(The next steps are optional)

You can use LyX-keyboard mapping instead of Linux-keyboard mapping for Hebrew.For some people, that is more continent, as you do not have to change keyboard-layout when you switch into math-mode. 
b. Editing->Keyboard/Mouse -- mark "Use keyboard map" and set the "First" to 'null' and the "Second" to 'hebrew'. 
c. Editing->Shortcut -- Press on "New" button and in the "Function" field write 'language hebrew", and then set shortcut key as you desire. This key will toggle Hebrew\English. Note: for me, 'language english' worked and 'language hebrew' didn't. See Amir Rachum's Article

G) Write some text, Press Ctrl+D, an output file should be generated (if not, some errors will pop up).
H) If all went well, that's it, you're done.

Note: You do not need to change the system keyboard layout when typing hebrew in LyX, you can leave it on "USA".

Another note: if the output is pixelated in close-up, see "Problem - Bitmap output" below.


7.  Method 3 - General

NOTE: The last 2 commands are ubuntu 7.04/7.10-specific, but might work on other distros.

There are many tutorials, most of them are too old, about how to do that. Some of them cause Hebrew to work, but the generated documents are fuzzy, or just not pretty enough.

We recommend this way: (these are Ubuntu oriented instructions, but will probably work on Debian as well)

  • First of all, do not install tetex, it is not maintained any more; install texlive instead.
  • Trying to install ivritex package (as most tutorials suggest) will fail, because ivritex depends on tetex.
  • Instead, install texlive-font-utils.
  • Then, install culmus fonts (and other Hebrew fonts):
$ sudo aptitude install culmus culmus-fancy xfonts-efont-unicode xfonts-efont-unicode-ib xfonts-intl-european msttcorefonts
$ sudo make CULMUSDIR=/usr/share/fonts/X11/Type1/ TEXMFDIR=/usr/share/texmf-texlive/
$ sudo make install CULMUSDIR=/usr/share/fonts/X11/Type1/ TEXMFDIR=/usr/share/texmf-texlive/

The last 2 commands are ubuntu 7.04/7.10-specific, but might work on other distros; if not, try to remove the CULMUSDIR=... (until the end of the line) and see if the make recognizes the right directories instead.

Now your Hebrew documents should look much better!

8.  Problem - Bitmap output

Following the instruction in this page I managed to produce hebrew pdf, but with bitmap font (not vector one). After looking at other sites, I found out I had to add "\usepackage{culmus}" (or "\usepackage[use-david]{culmus}" - matter of taste) to the preamble. Perhaps this will help others as well.

8.1  Nikud/Vowels

Going beyond the use of consonants to add Nikud, or vowel points, to Hebrew seems to cause a fair amount of difficulty.

  • set your document encoding to utf8x (in the language tab of the document's preferences)
  • add \errorcontextlines=10 to your document's preamble

This should remove the errors requesting you activate the combine option.

9.  LyX 2.1+ with unicode

It is fairly simple to get LyX to display and print fully pointed Hebrew with recent versions. (The set up below also allows the use of fully accented polytonic Greek.)

This set up requires the use of XeTeX, so ensure that your LyX installation supports this output method first.

The use of the Cardo font for the display of Hebrew and Greek is strongly recommended, as it has an extensive character set. See http://scholarsfonts.net/cardofnt.html

If you want to use sans serif or monospaced foreign characters, then the installation of FreeSans and FreeMono is recommended. See https://www.gnu.org/software/freefont/

Open Document → Settings. Under the "Fonts" tab, select "Use non-TeX fonts (via XeTeX/LuaTeX)". Select Cardo as the Roman font, FreeSans for Sans Serif, and FreeMono for Typewriter.

If using biblatex, you will also need to switch from babel to polyglossia. In the Document → Settings → LaTeX Preamble tab, add:

\usepackage{polyglossia}
\usepackage[style=verbose,natbib=true,citestyle=verbose,backend=biber,url=false,doi=false,isbn=false]{biblatex}
\addbibresource{some.bib}

\newfontfamily\greekfont{BABEL Unicode}

The first line ensures polyglossia is used, instead of babel. The second line uses biblatex for bibliographies, which is much more flexible than bibtex,
but can be safely removed. Change the settings to suit your needs (see the excellent biblatex manual.) If not using biblatex, then remove the third line,
which sets the source bib file.

The newfontfamily command is an example of how a font may be selected to typeset a particular language, overriding the main document font.

In order for LyX to recognize your new language(s) for the first time:

  1. Insert some text in the new language;
  2. Select that text;
  3. Go to Edit → Text Style → Customized...;
  4. From the "Language;" dropdown, choose the appropriate language (for this tutorial, presumably either "Hebrew" or "Greek (polytonic)").

Once the language has been set up for the first time, it will appear as an item in the Edit menu,
or in the pop-up when you select some text and right-click on it.

You should now be able to enter both Greek and Hebrew and set the language in LyX. The text will be properly hyphenated.
The Hebrew will also be displayed and typeset properly as right-to-left text.
(If you don't set the language to Hebrew, the text will not display or be typeset correctly.)

10.  References

11.  Categories

Linux
Hebrew

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2024-08-09 09:18 UTC