| Math Department | Ben Gurion University | Contact us |
To create Hebrew documents using LaTeX you need to be able to do the following things:
We provide a commented sample file that shows the main things one needs to do. Following is the output of Hebrew LaTeX run on this file.
Here is the LaTeX sample file
\documentclass{article}
\usepackage[english,hebrew]{babel}
\usepackage{amsmath}
\usepackage[dvips]{graphicx}
\begin{document}
\section{ענו על 4 שאלות בחלק זה}
\L{Here is a short left to write part inside a hebrew part}
\emph{יש לענות ''נכון" או ''לא נכון". לנמק
בקצרה תוך צטוט מדויק של מה שמסתמכים עליו או לספק דוגמת נגד. }
\unsethebrew
With unset hebrew you can now write in the usual left to write mode.
Inside this you can still put a few \R{מלים בעברית}
\sethebrew
1. אם $L$ שפה אינסופית ולכל מספר $n$ יש לפחות מלה אחת $w$ ב-$L$ שארכה מקיים
$n\le |w|\le n+7$ אז $L$ בהכרח חסרת הקשר.
$$L=\{w\in \{0,1\}^*:C_0(w)=C_1(w) \text{ םגו }
|W|> 0\}$$
דוגמה לשמוש בגרפיקה:
\bigskip
\unsethebrew
\begin{center}
\includegraphics[width=7cm]{b.eps}
\end{center}
\sethebrew
\end{document}
Here is the output produced with this file.

At the moment 3 methods are being used in order to edit Hebrew files (if you are a windows user you could of course also consider some windows text editor, which we will not mention here, but then you probably use word for writing hebrew, which is fine if you aim to die young).
Until the end of this section we attempt to explain the advantages and disadvantages of each system. The main reason for using any of these methods is probably a matter of personal taste. vim and gvim are extensions of vi, so if you are used to vi you should probably choose vim. If you use emacs you may like the emacs method better. Finally, LyX is a WYSIWYG editor producing hebrew. It solves many of the problems in the other two methods but using it requires to learn something really new. Also, LyX does not support at the moment the fancier LaTeX styles, such as AMSLaTeX.
The main difficulty in writing Hebrew LaTeX is quite visible from the sample file above: The hebrew lines are ``reversed''. That means that the direction of writing has to be reversed between Hebrew and Latin or Mathmatics. Each system has its own way of overcoming this difficulty:
To be able to use the vim system you first of all need to create a file called .vimrc containing the follwing lines:
map <F5> :set norl nohkmap<CR> map <F8> :set rl hkmap<CR> imap <F5> <ESC>:set norl nohkmap<CR>a imap <F8> <ESC>:set rl hkmap<CR>a
You could copy the rest of your .exrc file on this file, or you can put the lines instead in your .exrc file.
Now, when you want to edit a Hebrew file, follow these steps:
xterm -fn heb10x20 xterm -fn heb8x13Some of these commands may not work on some of the computers.
vim file.tex
You start editing the file in Latin mode. Here is a screenshot of this
mode:

When you want to write in Hebrew you switch to Hebrew mode by giving
the command F8 (that is, the function key F8 at the top of the
keyboard). Here is how Hebrew mode looks like:

When you want to switch back to Latin you press the function key F5. Both these keys work both in and out of insert mode and leave you in the same mode. It is clear that you can choose different keys by changing the .vimrc file.
This system is based on the emacs system for writing hebrew developed by Alexander Rezinsky. It was addapted for writing LaTeX by Amnon Besser for personal use. In the future there may be some effort to improve on this system but at the moment it is left in its fairly primitive state. In particular, there may be uncontrolable font problems (i.e., that I don't know how to solve) on some systems. In this case, you could either ask the computer lab to solve the problem or give up and try something else.
To use the system you have to add the following lines to your .emacs file.
To edit a file, start emacs by giving the command ``emacs -fn heb10x20'' or ``emacs -fn heb8x13'' (you can also use xemacs if you like). This will start an emacs window that looks just like an ordinary window but with Hebrew fonts in addition to Latin fonts. (On some of the newer linux systems, entering the font on the command line does not work for some reason. Instead, enter emacs as usual and then give the command "ESC-x set-default-font RET heb8x13 RET" where ESC-x means you have to press the escape key and then the x key, and RET means you have to press the return key).
Editing is done in exactly the same way as in ordinary emacs. The only difference is that the key ``f3'' switches on/off Hebrew mode. In Hebrew mode the line is moved to the right with each new character.
You have to tell the computer whether a given line is Hebrew or Latin. The rule is simple: A line that starts with a space or a backslash is a Latin line. Any other line is a Hebrew line.
Here is a screenshot of a file edited with emacs.

LyX is a WYSIWYG editor for LaTeX. If you would like to learn to use it the easiest thing is to run the command ``lyx'', then from the help menu go to the tutorial and start learning.
LyX has support for hebrew. If you want to use this you will have to add the following lines to your lyxrc file.
\kbmap true \kbmap_primary null \kbmap_secondary hebrew \font_encoding default \bind "F12" "language hebrew" \rtl true \latex_command elatex \pdflatex_command "pdfelatex" \screen_font_roman "-*-fixed" \screen_font_sans "-*-fixed" \screen_font_typewriter "-*-fixed" \screen_font_menu "-*-fixed" \screen_font_encoding "iso8859-8" \screen_font_popup "-*-fixed"
or something similar if you know what you are doing.
Here is a screenshot of editing with LyX

This section describes how to produce dvi or pdf from your LaTeX source file. For files prepared using emacs you should also read the next section. In LyX you generate the dvi and pdf either from within the system, or operating on files in the same way as described below.
If you created the file ``final.tex'' using the instruction above, you should run the command ``elatex final'' which will create the file ``final.dvi''. You can view and print this file just as you would do with any other dvi file. The program elatex is an extended version of LaTeX which is available on solaris machines (such as silver and amber) and Linux machines.
If you would like to create a pdf file instead of a dvi file, you should give the command ``pdfelatex final''. This will creat a file ``final.pdf''. Using pdf is particularly recommended for preparing problem sheets to be posted on the internet. If you prepare a pdf file of your problem sheet you can send it via email to the office and it will be posted soon after that.
To run Hebrew LaTeX on files produced using the emacs system you need to add the following lines to your .cshrc file
alias holatex ~bessera/public_latex/holatex alias pdfholatex ~bessera/public_latex/pdfholatex alias revlon ~bessera/public_latex/revlon
Now, use the command ``holatex final'' instead of ``elatex final'' to produce a dvi file and ``pdfholatex final'' instead of ``pdfelatex final'' to produce a pdf file. If you need to send someone a Hebrew LaTeX file in standard form create this new file by giving the command "revlon file.tex > newfile.tex"
| Math Department | Ben Gurion University | Contact us |