3

The following creates a perfect english document with some greek letters:

\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[polutonikogreek,english]{babel}

\begin{document}
English or \textgreek{ανηρ} text.
\end{document}

However, when I add this, It gets all upset about the hebrew characters being invalid characters.:

\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[polutonikogreek,hebrew,english]{babel}

\begin{document}
English or \textgreek{ανηρ} text.

And this גהר.
\end{document}

I have tried changing And this גהר., guessing there might be something like And this \texthebrew{גהר}. but I guess there is not?

I wonder if anyone can point me in the right direction. (In case it matters, I am trying to stuff this in a beamer document. The above is jut my MWE)


This related question does not answer the question for Hebrew: How to use both English and Greek (Tex Live & pdflatex) and even Hebrew easily in one document

This related question uses polyglossa instead of babel for xelatex users Perfect example document (template) for English, Greek and Hebrew (XeLaTeX)

5
  • 1
    I made the experience that pdfLaTeX+babel do not work well with Hebrew. I strongly suggest to use XeLaTeX+polyglossia.
    – Christian
    Apr 17, 2017 at 7:56
  • @christian I am testing out texpad for iOS which doesn't support xelatex (they say its something about licensing, I'm not sure why).
    – Jay
    Apr 17, 2017 at 10:45
  • Do you have a font for Hebrew in texpad?
    – Christian
    Apr 17, 2017 at 14:58
  • I changed the inputenc from utf to utf8x and now I get the error that the Hebrew letters are not available in T1 - so I think the problem are the missing fonts. Can you use culmus-latex in texpad?
    – Christian
    Apr 17, 2017 at 16:13
  • Did you try \usepackage[T1,HE8]{fontenc}?
    – Christian
    Apr 17, 2017 at 16:54

1 Answer 1

2

I think the main problem is that the Hebrew fonts are missing. After installing the Hebrew fonts from CTAN, the following code compiles with pdfLaTeX (using texlive) without any errors:

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

\begin{document}
  English or \textgreek{ανηρ} text.

  And this \foreignlanguage{hebrew}{גהר}.
\end{document}

Please note that I also changed the input encryption to utf8x. Unfortunately, the above puts "גהר" at the right end of the line (since Hebrew is written from right to left).

A really dirty hack to solve this problem using this answer could be to use the calc package and define the command \inlinehebrew in the following way:

\usepackage{calc}
\newcommand{\inlinehebrew}[1]{%
  \parbox{\widthof{\foreignlanguage{hebrew}{#1}}}{\foreignlanguage{hebrew}{#1}}}  

Then

And this \inlinehebrew{גהר}.

generates the following output

And this גהר.

but, since it includes a parbox, it breaks many things and can only be used for very short texts.

Let me add two remarks in passing:

  • Although not applicable in your situation: Because of the hassles involved in the above solution, I strongly recommend using Xe(La)TeX and polyglossia for writing Hebrew in LaTeX.
  • Instead of using the (old) Hebrew fonts linked above, it might be better to use culmus-latex which uses the culmus fonts which in opinion look nicer.
2
  • I agree polyglossa and xelatex work a lot better, however sadly xelatex is not supported by texpad on iOS.
    – Jay
    Apr 17, 2017 at 23:02
  • The above should work with pdfLaTeX. Does it work in texpad?
    – Christian
    Apr 18, 2017 at 6:31

You must log in to answer this question.

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