Since I had some annoying warnings with XeLaTeX and Polyglossia, I tried my luck with LuaLaTeX. Unfortunately Polyglossia simply returns a complaint in a warning:
Package polyglossia Warning: Hebrew is not supported with LuaTeX.
(Any ideas in comment are welcome to fix this!)
So I tried the bidi
feature of babel
:
\documentclass{article}
\usepackage[nil,bidi=basic]{babel}
\babelprovide[import=en-GB,main]{british}
\babelprovide[import=he]{hebrew}
\babelfont{rm}[Language=Default,Ligatures=TeX]{Times New Roman}
\babelfont{sf}[Language=Default]{Times New Roman}
\babelfont{tt}[Language=Default]{Courier New}
\babelfont[hebrew]{rm}[Script=Hebrew,Language=Default,Ligatures=TeX,Contextuals=Alternate]{SBL Hebrew}
\begin{document}
Random text.
\begin{otherlanguage}{hebrew}
בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃
\end{otherlanguage}
\end{document}
However, this way some diacritics are missing in Hebrew (in this case the dagesh in the shin):
How could I fix this strange mistake? I'm using MikTeX 2.9.7219 portable on Windows 7 64 bit, everything is updated as of 2 days ago.
The reason for using the Language=Default
option:
Language 'Hebrew' not available for font 'DejaVu Sans' with script 'Hebrew'
The reason for defining serif and mono fonts even when not using it:
Why babel produce warnings about \rmfamily and \ttfamily with \babelfont
luahbtex
has lua, it is luatex + harfbuzz library. In miktex there is also a harftex variant which is similar. But I don't know if the newest luaotfload code will still work with it - it is target against luahbtex. For a texlive system you can get luahbtex from w32tex.org.