Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using XeLaTeX for writing texts in Hebrew. Now I have been trying to use the KOMA document classes. After applying a few changes (like changing the font used for chapter, section, ... headlines to a fonts that also contains Hebrew) everything seems to be working very nicely, except for one minor annoyance:

I am getting the following error messages:

! Package polyglossia Error:
The current roman font does not contain the Hebrew script!
Please define \hebrewfont with \newfontfamily.
See the polyglossia package documentation for explanation.
Type H <return> for immediate help.
...

The errors refer to lines where new sections are being defined. The funny thing is that this error message even occurs when the text is entirely in Hebrew and contains no Latin or any other non-Hebrew characters whatsoever.

So, does anyone know what the problem is and how to get rid of it?

Here is a short example:

% !TEX encoding = UTF-8 Unicode
% !TEX TS-program = xelatex
\documentclass[14pt]{scrbook}
\pagestyle{empty}
\TeXXeTstate=1
\usepackage{polyglossia}

\setdefaultlanguage{hebrew}
\setmainfont[Mapping=tex-text]{Adobe Hebrew}
\newfontfamily\hebrewfont[Scale=0.80,Script=Hebrew]{Adobe Hebrew}

\setkomafont{section}{\hebrewfont}

\begin{document}

\section{מה הבעיה?}

\section{יש פתרון?}

\end{document}
share|improve this question
2  
Can you please add to your question a minimal working example illustrating the problem? –  Gonzalo Medina Jul 18 '11 at 23:20
add comment

1 Answer

up vote 3 down vote accepted

At first: I doubt a bit that you actually want to use \setkomafont. This will also reset the size of font in the section title to the normal size. Better use \addtokomafont.

At second: The source of your problem is that – regardless what you do with \setkomafont –inside the \section command the KOMA-classes issue a \sffamily. So temporarly there is a switch to this font and as the active language is hebrew and your current \sffamily font doesn't know the hebrew script you get an error. You can remove the \sffamily in the section titles by redefining \sectfont.

\renewcommand*\sectfont{\normalcolor\bfseries}

But imho the better solution is (as hebrew is your main language) is to set the main fonts to fonts that know the script:

\documentclass[14pt]{scrbook}
\pagestyle{empty}
\TeXXeTstate=1
\usepackage{polyglossia}

\setdefaultlanguage{hebrew}
\setmainfont[Mapping=tex-text]{Ezra SIL}
\setsansfont[Mapping=tex-text]{Ezra SIL}
\setmonofont[Mapping=tex-text]{Ezra SIL}

\begin{document}
\section{abc}

abc
\end{document}
share|improve this answer
    
Thanks a lot for your answer. Now everything works perfectly. But anyway, I still don't quite understand why my override with \setkomafont{section}{\hebrewfont} worked and still resulted in an error (at least this seems obvious now, since \setsansfont was not set properly). So, I guess, it was just a half-override. –  Moked Jul 19 '11 at 13:24
    
\section contains two font commands: \sectfont which is used in all other sectioning commands too and which contains the problematic \sffamilyand \size@section which is specific to \section. Your \setkomafont changes the second. Btw: as I just realized you can redefine \sectfont also through \setkomafont by using \setkomafont{disposition}{...} –  Ulrike Fischer Jul 19 '11 at 14:06
    
Now I got it. Thanks a lot! –  Moked Jul 19 '11 at 14:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.