5

I am not able to write in Hebrew with latex. Every time I try to compile the process ends with a question mark. The following is an example of the document I am using:

\documentclass[dvips, a4paper, hebrew,italian,10pt]{book}


\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[hebrew,italian]{babel}
\usepackage{fontenc}

\begin{document}

תשץצסןנ

\end{document}

Any help?

4
  • Welcome to TeX.SX! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it).
    – Jesse
    Sep 20, 2014 at 10:09
  • Does ivritex.sourceforge.net help?
    – cfr
    Sep 20, 2014 at 17:27
  • I would appreciate an update. Non of the solutions works for me. I am writing an English book and try to add a sentence in Hebrew
    – Uri
    Aug 21, 2021 at 17:05
  • As of 2021, see the answers to this question.
    – Davislor
    Aug 22, 2021 at 5:53

5 Answers 5

5

I was able to find a solution here by finferflu who used package cjhebrew.

The code is

\documentclass{article}
\usepackage[pdftex]{graphicx}
\usepackage[T1]{fontenc}
\usepackage{pslatex}
\usepackage[hebrew,english]{babel}

\usepackage{cjhebrew}
\begin{document}
\begin{cjhebrew}
br+syt br' 'lhym 't h+smym w't h'r.s;
\end{cjhebrew}


\begin{flushright}
When God began to create heaven and earth, 
\end{flushright}
\end{document}

and the output is

enter image description here

Another possibility, for a more extended use of Hebrew(as a document language for instance) is to use XeLaTeX and polyglossia package as suggested by @egreg at Help getting started with Hebrew in babel

\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{hebrew}
\setmainfont{Times New Roman}
% \newfontfamily{\hebrewfont}{New Peninim MT}
\begin{document}
\title{שלום עולם}
\author{שלום עולם}
\maketitle

העיר מקודשת ליהדות, לנצרות ולאסלאם, והיוותה מרכז חיי העם היהודי בימי
קדם ומושא געגועיו בזמן שהייתו בגלות. משום מרכזיותה בעולמם של המאמינים,
הייתה העיר מוקד למלחמות וסכסוכים הנמשכים עד עצם היום הזה. מאז סוף המאה
ה-19 התפתחו סביב העיר העתיקה שכונות העיר החדשה, המהוות כיום את רובה
המוחלט של העיר. במרכזה של ירושלים השלמה עומד הר הבית, שמפריד בין מערב
ירושלים למזרח ירושלים.

בשנת 1981 הוכרזה העיר העתיקה של ירושלים כאתר מורשת עולמית על ידי ארגון
אונסק"ו של האומות המאוחדות, והיא נמצאת ברשימת האתרים בסיכון.


\end{document}

enter image description here

6
  • I already knew the "cjhebrew" package and that is good if you have to write short sentences, but since in that way it takes to long to write entire chapters, I was looking for a way to write hebrew in a non "coded way" and be able to paste hebrew writings directly in latex.
    – Billy
    Sep 20, 2014 at 10:42
  • I just copied and pasted the code you wrote with the polyglossia package but the result is the same, the compiler ends the process with a useless question mark, no explanation given.
    – Billy
    Sep 20, 2014 at 11:09
  • @Billy:First of all, you have to set your editor's encoding to utf8. Secondly did you run it using XeLaTeX?
    – Thanos
    Sep 20, 2014 at 11:18
  • I did that, and tried that too.
    – Billy
    Sep 20, 2014 at 12:53
  • And yet it's not working? Can you upload in your question the .log file?
    – Thanos
    Sep 20, 2014 at 15:46
3

You will need to install culmus-latex in order to Hebrew font support. Afterwards, the following example should compile find and display Hebrew correctly:

\documentclass{article}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[english,hebrew]{babel}
\begin{document} 
שלום \L{World}!
\end{document}
3
  • 1
    Thanks, but I use windows and apparently I can't install culmus. Any other suggestion? I am quite desperate.
    – Billy
    Sep 20, 2014 at 16:29
  • I found an .exe of culmus for windows and installed it. Now the compiler says that "jeru10" is missing, and I am not able to find this font anywhere.
    – Billy
    Sep 20, 2014 at 17:35
  • You should add \usepackage{culmus}. It will force LaTeX to use the Culmus fonts instead of the old one (jeru stands for the old Jerusalem font from Ivritex).
    – Guy
    Sep 30, 2014 at 21:31
3

As of 2021, this question is badly in need of an update. It would probably be better to redirect the multiple questions from years ago to an up-to-date answer, but I’m not sure which one.

In the Modern Toolchain

In 2021, I would recommend switching to Babel in LuaLaTeX, although any combination of Babel or Polyglossia with LuaLaTeX or XeLaTeX should work. Here is a template you can use in LuaLaTeX:

\documentclass[a4paper,italian,10pt]{book}
\tracinglostchars=3
\usepackage[bidi=basic, layout=sectioning.tabular]{babel}
\usepackage{unicode-math}
\usepackage{microtype}

\babelprovide[import=he, onchar=fonts ids]{hebrew}

\babelfont{rm}
          {NewComputerModern10-Book}
\babelfont{sf}
          {NewComputerModernSans10-Book}
\babelfont{tt}
          {NewComputerModernMono10-Book}
\setmathfont{NewCMMath-Book}

\begin{document}
Italiano e תשץצסןנ.
\end{document}

Although Javier Bezos is the maintainer of Babel and the authority on how it works, there are three or four little tweaks I would add to his answer, from personal experience.

In PDFLaTeX

Some publishers and professors still don’t want to upgrade from 8-bit fonts in the 2020s. In theory, there is a package called IvriTeX that should enable the [hebrew] option of babel to work. In practice, even its last maintainer said years ago that it’s better to switch to XeTeX. Since then, LuaLaTeX support for Hebrew has improved greatly.

The culmus-latex package at the same site works as well. Copy the files under texmf in the archive to your texmf-local directory (which you can normally find with kpsewhich --var-value=TEXMFLOCAL), then run

texhash
updmap-sys --enable Map=culmus.map

Use sudo or whatever permission you need on your system to update your texmf-local directory.

\documentclass[a4paper,10pt,hebrew,italian]{book}
\tracinglostchars=3
\usepackage[T1]{fontenc}
\usepackage[use-david]{culmus}
\usepackage[utf8x]{inputenc}
\usepackage{babel}

\pagestyle{empty}

\begin{document}
\begin{otherlanguage}{hebrew}

קדם ומושא געגועיו בזמן שהייתו בגלות. משום מרכזיותה בעולמם של המאמינים,
הייתה העיר מוקד למלחמות וסכסוכים הנמשכים עד עצם היום הזה. מאז סוף המאה
ה-\L{19} התפתחו סביב העיר העתיקה שכונות העיר החדשה, המהוות כיום את רובה
המוחלט של העיר. במרכזה של ירושלים השלמה עומד הר הבית, שמפריד בין מערב
ירושלים למזרח ירושלים.

בשנת \L{1981}  הוכרזה העיר העתיקה של ירושלים כאתר מורשת עולמית על ידי ארגון
אונסק"ו של האומות המאוחדות, והיא נמצאת ברשימת האתרים בסיכון.

\end{otherlanguage}

Italiano e \R{תשץצסןנ}.
\end{document}

Culmus David sample

Note that, with this implementation, you must wrap Arabic numerals and other LTR text within Hebrew paragraphs in \L commands, and short blurbs of RTL text within LTR paragraphs in \R. RTL in math mode belongs inside a \hmbox. Attempting to switch between LTR and RTL languages with \foreignlanguage or \selectlanguage on the same line will not work, but changing the language for entire paragraphs with \begin{otherlanguage} will.

Given the lack of hyphenation patterns for Hebrew, you might want to also load \usepackage{microtype} and set \emergencystretch 3em to improve the spacing of long words LaTeX is unable to hyphenate. Neither of these will harm paragraphs that lay out nicely without them.

1

Try switching between the "hebrew" and "italian" position in the class and babel commands. This is your code with the changes marked:

\documentclass[dvips, a4paper, italian, hebrew ,10pt]{book} % <- here

\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[italian, hebrew]{babel} % <- and here
\usepackage{fontenc}

\begin{document}

תשץצסןנ

\end{document}

I get the same errors as you when I copy your code to Texmaker on windows with culmus-latex installed, and everything works fine when changing places. It seems like the problem is having "hebrew" as the first language.

1
  • Without reply from OP we will never know if this works at all. :(
    – awllower
    Jul 19, 2016 at 11:08
0

It worked for me using the following code:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\begin{document}
\title{שלום עולם}
\author{שלום עולם}
\maketitle

הצלחתי 

\end{document}

You must log in to answer this question.

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