0

I'm trying to use Hebrew in my document, but there seems to be a conflict (probably with some of the packages) which prevents me from doing so. The .tex I'm writing is using a custom .cls, which looks like this.

\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesClass{thesis}[2015/02/10, Template]

%%%% thesis options %%%%%%%

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{thesis}}

\newcommand{\@sizeoption@err}{\ClassError{thesis}
  {Cannot use size option \CurrentOption} 
  {The thesis class requires (and automatically loads) 12pt text}}

\DeclareOption{12pt}{\@sizeoption@err}
\DeclareOption{10pt}{\@sizeoption@err}

\newcommand{\@psizeoption@err}{\ClassError{thesis}
  {Cannot use paper size option \CurrentOption} 
  {The thesis class requires (and automatically loads) A4 paper}}

\DeclareOption{a5paper}{\@psizeoption@err}
\DeclareOption{b5paper}{\@psizeoption@err}
\DeclareOption{letterpaper}{\@psizeoption@err}
\DeclareOption{legalpaper}{\@psizeoption@err}
\DeclareOption{executivepaper}{\@psizeoption@err}
\DeclareOption{landscape}{\@psizeoption@err}

\ProcessOptions\relax
\LoadClass[12pt,a4paper,oneside,hebrew]{article}


%%%%%%%%%%% encoding, page layout %%%%%%%%%%%%%%%%

\RequirePackage[utf8]{inputenc}
\RequirePackage{culmus} % Hebrew fonts

\RequirePackage[a4paper,lmargin=3.5cm,rmargin=3.0cm,
                tmargin=3.25cm,bmargin=3.25cm]{geometry} %showframe

\RequirePackage{fancyhdr}
     \pagestyle{fancy}
     \renewcommand{\sectionmark}[1]{% 
     \markboth{\chaptername~\thesection:~#1}{}}
     \fancyhead[RO,L]{\thepage}
     \fancyhead[CO,C]{}
     \fancyhead[LO,R]{\textit{\nouppercase{\leftmark}}}
     \fancyfoot[RO,R]{}
     \fancyfoot[LO,L]{}
     \fancyfoot[CO,C]{}
     \renewcommand{\headrulewidth}{0pt}
     % \fancypagestyle{plain}{% 
    %\fancyhf{}} % clear all header and footer fields 

% Please do not change line spreading:
\linespread{1.4}

% Literature to ToC
\RequirePackage[nottoc]{tocbibind}

% Fixing an error with Headheight
\setlength{\headheight}{15pt}

%%%%%%%% headings %%%%%%%%%%%%%%%

\usepackage{titlesec}
\titleclass{\section}{top}
\assignpagestyle{\section}{plain}
    \titleformat{\section}
     {\bfseries\large}
     {\thesection.}
    {1em}
    {\bfseries}
    \titlespacing*{\section}{0pt}{2\baselineskip}{1\baselineskip}
    %
     \titleformat{\subsection}
     {\bfseries}
     {\thesubsection}
    {.7em}
    {\bfseries}
    \titlespacing*{\subsection}{0pt}{1\baselineskip}{.5\baselineskip}
    %
     \titleformat{\subsubsection}
     {\bfseries}
     {\thesubsubsection}
    {.7em}
    {\bfseries}
    \titlespacing*{\subsubsection}{0pt}{.5\baselineskip}{2pt}
    %
    \titleformat{\paragraph}[runin]
    {\normalfont\itshape}
    {}
    {7.5mm}
    {}
    \titlespacing*{\paragraph}{0pt}{0pt}{7.5mm}


%%%%%%%% footnotes (to match doc-style footnotes) %%%%%%%%

\renewcommand\@makefntext[1]{%
    \noindent
    {\@makefnmark}~#1} 

%%%%%%%% Stop first page vom breaking for introductory quote %%%%%%%%
%%%%%%%% Use begin{absolutelynopagebreak} and end{...}       %%%%%%%%

\newenvironment{absolutelynopagebreak}
{\par\nobreak\vfil\penalty0\vfilneg
    \vtop\bgroup}
{\par\xdef\tpd{\the\prevdepth}\egroup
    \prevdepth=\tpd}

%%%%%%%% font issues: text & math %%%%%%%%

\RequirePackage[english,ngerman,hebrew]{babel}

\RequirePackage[T1]{fontenc}
\RequirePackage{textcomp}
\usepackage[scaled=0.86]{berasans}
\usepackage[scaled=0.86]{beramono}
\RequirePackage[sc]{mathpazo}
\RequirePackage{amssymb}
\RequirePackage{amsmath}
\usepackage{amstext}
\usepackage{tipa}
\renewcommand\textipa[1]{% CM Typewriter IPA
    {\fontfamily{cmtt}\fontsize{12}{12}\fontencoding{T3}\selectfont #1}}


%%%%%%%% required packages %%%%%%%%%

\RequirePackage{xcolor}
\RequirePackage{graphicx}
\RequirePackage{enumitem}
    \setlist{itemsep=0pt,parsep=0pt,topsep=6pt}
\RequirePackage[longnamesfirst]{natbib}
    \bibpunct[:~]{(}{)}{;}{a}{}{,}
    \setlength{\bibsep}{0pt}
    \setlength{\bibhang}{1cm}
    \renewcommand*{\bibfont}{\interlinepenalty 10000\relax} % Clean Directory

%%%%%%%%% linguistics %%%%%%%%%%%%%%%%%

\IfFileExists{stmaryrd.sty}%
   {\RequirePackage{stmaryrd}}%
   {\newcommand{\llbracket}{\ensuremath{\left [\!\left [}}%
     \newcommand{\rrbracket}{\ensuremath{\right ]\!\right ]}}}
\IfFileExists{cgloss4e.sty}%
    {\RequirePackage{cgloss4e} \nosinglegloss}
    {\newcommand{\gll}{}\newcommand{\glll}{}\newcommand{\trans}{}}
\IfFileExists{linguex.sty}%
    {\RequirePackage{linguex}
    \setlength{\Exindent}{0pt}
    \setlength{\Exlabelwidth}{0pt}
    \setlength{\Exlabelsep}{12mm}
    \setlength{\SubExleftmargin}{9mm}
    \def\refdash{}
    \def\firstrefdash{}
    \setlength{\Extopsep}{6pt}
    \let\eachwordone=\it
    \let\eachwordtwo=\rm
    \let\eachwordthree=\it}
    {\newcommand{\ex.}{}\newcommand{\exg.}{}%
     \newcommand{\a.}{}\newcommand{\b.}{}\newcommand{\c.}{}}
\IfFileExists{cgloss.sty}%
    {\RequirePackage{cgloss}}{}
\IfFileExists{qtree.sty}%
    {\RequirePackage[nocenter]{qtree}%
    \linethickness{.7pt}}{}

It's quite long, but as for an excuse, I didn't write most of this but the department for linguistics (again...). So, this is what I tried, in order:

As far as I understand, this should have been all I had to do to use Hebrew characters, with the test string being "אַ נאַר קען אַמאָל זאָגן אַ גלײַך װאָרט". Unfortunately, all I get are these warnings:

  1. No hyphenation patterns were preloaded for(babel) the language `Hebrew' into the format.

This should have been fixed by using this advice - Babel warns of lack of hyphenation patterns for Hebrew – but that doesn't seem to work. Which is probably related to these other warnings (and the problem as a whole).

  1. No file HE8pplx.fd. on input line 8.
  2. Font shape HE8/pplx/m/n' undefined(Font) usingHE8/cmr/m/n' instead
  3. Font shape HE8/pplx/bx/n' undefined(Font) usingHE8/pplx/m/n' instead
  4. Font shape HE8/pplx/m/it' undefined(Font) usingHE8/pplx/m/n' instead
  5. pdflatex.exe: \pdfrestore: missing \pdfsave

As soon as I get rid of the Hebrew text and "hebrew" in \RequirePackage[english,ngerman,hebrew]{babel} and \LoadClass[12pt,a4paper,oneside,hebrew]{article}, everything is working again just fine.

So, here's an MWE, that does work as soon as the respective lines are commented out of the .cls) and the Hebrew text is commented out in the .tex.

\documentclass{thesis}

% \DeclareFontEncoding{HE8}{}{} % Tried this and the following two, did not work.
% \DeclareFontFamily{HE8}{cmr}{} 
% \DeclareFontShape{HE8}{cmr}{m}{n} {<-> frank}{}
% \makeatletter\chardef\l@hebrew=255 \makeatother % Hack for Hebrew. Not working!

\begin{document}

\thispagestyle{plain}
\tableofcontents
\clearemptydoublepage

\begin{absolutelynopagebreak}
\begin{flushright}
    % אַ נאַר קען אַמאָל זאָגן אַ גלײַך װאָרט \\
    A nar ken a mol zogen a gleich vort. \\ \footnotesize \textit{– Yiddish proverb}
\end{flushright}

\section{Abstract}
\end{absolutelynopagebreak}

\noindent Nothing here.

\end{document}

What I could find out, is that the problem seems to lie "only" with babel: - Having added "hebrew" to \LoadClass doesn't seem to interfere with anything. - Having added "culmus" as a required package doesn't seem to interfere with anything. - Adding \selectlanguage{hebrew} (obviously) doesn't solve the problem.

The warnings mentioned above (that prevent a .pdf from being created) only occur as soon as "hebrew" is added to babel and Hebrew characters are in the document. Adding "hebrew" to babel without Hebrew characters doesn't produce a single warning/error. Using Hebrew characters inside the text without having added "hebrew" to babel produces a lot (!) of errors, of course.

The sample provided by the package is - in contrast - working just fine. That sample looks like this:

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

% The culmus package sets the default Hebrew font (frankruehl or david)
% and the scaling (1.2 by default). This can be configured using the 
% package options.
%\usepackage{culmus}
%\usepackage[use-david]{culmus}
%\usepackage[use-david,legacy-size]{culmus}
%\usepackage[legacy-size]{culmus}

%\def\culmuselliniascale{1.1} % set scaling for a specific font
% or set scaling for all fonts:
%\makeatletter
%\def\culmus@scale{1.1}
%\makeatother

\begin{document}
\selectlanguage{hebrew}
גופן ברירת מחדל
אבגדהוזחטיךכלםמןנסעףפץצקרשת \textbf{בולט} \emph{מודגש}

\fontfamily{aharoni}\selectfont
אהרוני
אבגדהוזחטיךכלםמןנסעףפץצקרשת \textbf{בולט} \emph{מודגש}

\fontfamily{miriam}\selectfont
מרים
אבגדהוזחטיךכלםמןנסעףפץצקרשת \textbf{בולט} \emph{מודגש}

\fontfamily{david}\selectfont
דוד
אבגדהוזחטיךכלםמןנסעףפץצקרשת \textbf{בולט} \emph{מודגש}

\fontfamily{frank}\selectfont
פרנק-ריהל
אבגדהוזחטיךכלםמןנסעףפץצקרשת \textbf{בולט} \emph{מודגש}

(...)
\end{document}

I would have guessed, that maybe something went wrong when I installed Culmus, but that doesn't seem to be the case. Which is odd, for after all, one of the warnings is

No file HE8pplx.fd. on input line (i.e. 8, in my case)

Therefore I already tried reinstalling Culmus, but the problem persists. Which is unfortunate, for I'd need the "frank" font-family provided by the package.

A noticeable difference between the example provided by Culmus and my own .tex lies in the encoding. As far as I understand, the encoding shouldn't be too much of a problem when using Hebrew. And:

  • Changing \RequirePackage[utf8]{inputenc} to \RequirePackage[cp1255]{inputenc} does produce lots and lots of errors and
  • Changing \RequirePackage[utf8]{inputenc} to \RequirePackage[utf8x]{inputenc} doesn't seem to change anything.
  • Changing the encoding locally doesn't solve the problem either.

That's another reason why I'd really like to stick with utf8, besides the obvious advantages. The problem, as it seems, seems to be related to a package incompatibility that I am unable to find.

Addendum: "cjhebrew" does work, but it's just horrible to write even a single line of Hebrew text (for it doesn't use Hebrew characters directly). So this isn't an option really.

  • What does kpsewhich HE8pplx.fd give you? It looks like fonts are not installed or not installed correctly. – cfr Feb 28 '15 at 22:18
  • I've never used kpsewhich until now, but when running kpsewhich HE8pplx.fd in the console, it doesn't return anything, neither a message nor an error: C:\Program Files\MiKTeX 2.9\miktex\bin\x64>kpsewhich HE8pplx.fd is followed by C:\Program Files\MiKTeX 2.9\miktex\bin\x64>. The installation of culmusmiktex0.2.2.exe went smoothly, according to the installer. – al-aSak Feb 28 '15 at 22:30
  • Workaround: I am now using Xe(La)TeX with Polyglossia, for I haven't found a solution to this particular problem. Guess what? XeTeX works like a charm. – al-aSak Mar 1 '15 at 3:34
  • It means the font is not installed or not installed correctly. Either you have to figure out where to get the font. Or you have to figure out what is requesting that font/use a different font. But XeTeX or LuaTeX is probably more straightforward! – cfr Mar 1 '15 at 14:14
  • Like I said, the fonts should be installed correctly, according to file structure, Culmus and the sample .tex that compiles nicely. All I could tell, is that the problem seems to be related to some part of the custom .cls. Having invested about 10 hours to find that incompatibility, I decided to switch to XeTex. Took another few hours, but it was well worth the time. – al-aSak Mar 1 '15 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.