It would probably be better to redirect the multiple questions from years ago to an up-to-date answer.
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}
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.
babel
is rather painful.