2

How to include a single hebrew word in an english paragraph using babel and pdflatex? I don't want a new paragraph or start from the right when switching to hebrew. If possible, I would like to continue using pdflatex and babel.

\documentclass{article}
\usepackage[utf8x]{inputenc}
\usepackage[hebrew,english]{babel}


\begin{document}

hello world גופן ברירת מחדל hello again

\end{document}

Is there any hack/solution? Thank you very much.

kromuchi
  • 2,187
  • Neither pdftex nor xetex switch the writing direction automatically and it must be marked explicitly up (or resort to luatex). And even so, hebrewis somewhat problematic because you must install a separate package - see https://tex.stackexchange.com/questions/113367/how-do-i-add-hebrew-support-to-texlive-on-windows-with-pdftexbabel/113385 . – Javier Bezos Sep 20 '18 at 14:44
  • See also: https://tex.stackexchange.com/a/468920/61644 (which doesn't work for me). – Davislor Jan 12 '19 at 07:20

1 Answers1

0

In theory, it’s possible to get something like your set-up to work. In practice, even the last maintainer of that package says to switch to XeTeX and polyglossia.

In that package, the command is \texthebrew. Example:

\documentclass[varwidth=10cm, preview]{standalone}
\usepackage{fontspec}
\usepackage{polyglossia}

\setdefaultlanguage{english}
\setotherlanguage{hebrew}

%\defaultfontfeatures{ Scale=MatchUppercase, Ligatures = TeX }

\newfontfamily\hebrewfont{Frank Ruehl CLM}
\newfontfamily\hebrewfontsf{Simple CLM}
\newfontfamily\hebrewfonttt{Miriam Mono CLM}

\begin{document}
hello world \texthebrew{גופן ברירת מחדל} hello again
\end{document}

Hello, world?

It is also possible to get Hebrew to work with babel by loading \babelprovide[import]{hebrew} and then a command such as \babelfont[hebrew]{rm}{Frank Ruehl CLM}. If some package you need is incompatible with polyglossia, that might work better for you.

Davislor
  • 44,045
  • alright, apparently switching seems to be the only practical thing. The only drawback is there are still some incompatibilities of packages with xelatex/polyglossia that worked with pdflatex. – kromuchi Jan 17 '19 at 09:27
  • @kromuchi Admittedly, I haven’t been able to get Hebrew to work the way I want in PDFTeX, but in theory there should be packages floating around to do it. – Davislor Jan 17 '19 at 09:30
  • @kromuchi Which packages are you having problems with? There might be a fix or a replacement for them. – Davislor Jan 17 '19 at 09:32
  • In general, a few packages need different options or the order is important. Currently, the most challenging thing is to find a compatible version of polyglossia/bidi and koma script (with the current versions, some commands don't work (I created a ticket on sourceforge which is now also linked here: https://github.com/bidi-tex/bidi/issues/1) – kromuchi Feb 18 '19 at 15:11
  • You can also get Babel to work with Hebrew by loading \babelprovide[import]{hebrew} and then selecting a \babelfont. If the problem is Pollyglossia, that might work for you. – Davislor Feb 18 '19 at 15:15