Hebrew in XeTeX


28 Mar 09

HebrewDepending on the operating system and the sofware you use, entering right-to-left scripts can be a real problem. On the Mac it seems Word is not going to offer satisfying RtL anytime soon. Mellel is quite good with Hebrew but is weak or non-existent in tables, images, parallel columns, indexes, etc.

One of the advantages LaTeX offers is the possibility to work with ancient languages without too much trouble. Here are the basic instructions to use Biblical Hebrew in XƎTeX (this works fine on a Mac with Leopard).

Download the

You will need the free SBLHebrew font (make sure you get the latest version!) and Ezra SIL to process it.

This is the code you need to work with Hebrew. As usual in LaTeX other commands and options are available but this works to begin with.

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[12pt]{article}
\TeXXeTstate=1
\usepackage{xltxtra}
\usepackage{bidi}
\defaultfontfeatures{Scale=MatchLowercase}
\setmainfont{Hoefler Text}
\newfontfamily{\sbl}[Script=Hebrew]{SBLHebrew}
\begin{document}

\end{document}

The line \newfontfamily{\sbl}[Script=Hebrew]{SBLHebrew} defines a shortcut to use SBLHebrew. See the information in the fontspec.pdf at pages 5 (3.2) and 26 (6.19.1).

The following two lines were added in the preamble to write right-to-left Hebrew

\TeXXeTstate=1
\usepackage{bidi}

The bidi package, written by François Charette, is not installed by default. You need to get it from CTAN bidi. See the bidi pdf file for more options.

To enter Hebrew text switch to a Hebrew keyboard and type or simply copy paste the text from your Bible software. I prefer the SBLHebrew font. EzraSIL will work fine too. To switch to a Hebrew (or Greek) keyboard see your operating system help files or the Tyndale Unicode Font Kit and the SBL help page.

To write a single word in Hebrew you can just type:

regular text {\sbl ‏ ‏בְּרֵאשִׁ֖ית} regular text

To write several words in Hebrew do the following

regular text \RL{\sbl ‏ ‏בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת} regular text

To write a whole paragraph in RtL use

\setRL
{\sbl
‏‏בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃
וְהָאָ֗רֶץ הָיְתָ֥ה תֹ֨הוּ֙ וָבֹ֔הוּ וְחֹ֖שֶׁךְ עַל־פְּנֵ֣י תְה֑וֹם וְר֣וּחַ אֱלֹהִ֔ים מְרַחֶ֖פֶת עַל־פְּנֵ֥י הַמָּֽיִם׃
וַיֹּ֥אמֶר אֱלֹהִ֖ים יְהִ֣י א֑וֹר וַֽיְהִי־אֽוֹר׃}
}
\setLR

Writing Hebrew with XeTeX works fine with TexShop but not as smoothly with Textmate, even though that is what I used for the test file.

Post new comment

The content of this field is kept private and will not be shown publicly.
Mollom CAPTCHA (play audio CAPTCHA)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.