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 have the following code using this font:

\documentclass{minimal}

\usepackage{lettrine}
\usepackage{fontspec,xunicode}

\newfontfamily\EBLettrineFont{EBGaramondInitialsF2}
\renewcommand{\LettrineFontHook}{\EBLettrineFont}

\begin{document}

\lettrine{T}{his} is a test


\end{document}

It works fine with xelatex, but crashes with lualatex:

! Arithmetic overflow.
\LettrineFont ...\divide \@tempcnta by \@tempcntb 
                                                  \advance \@tempcnta by -99...
l.11 \lettrine{T}{his}
                       is a test
? 

What is wrong?

share|improve this question
1  
is this font free available for download? –  Herbert Aug 23 '11 at 11:27
    
When I try to compile your example with lualatex (beta-0.65.0-2011041019 (rev 4033) from Ubuntu's TL2009) I get another error, I get XeTeX is required to compile this document.. –  N.N. Aug 23 '11 at 11:28
    
@Herbert: the link is in the question (where it says "this font"). –  ℝaphink Aug 23 '11 at 11:30
    
@N.N. Up-to-date TL2011 has LuaTeX beta-0.70.1-2011061410 (rev 4277) –  ℝaphink Aug 23 '11 at 11:31
add comment

1 Answer 1

up vote 10 down vote accepted

The lettrine package depends on the font having the character X in order to perform its calculations; and this font, it seems, does not have the character. The lettrine macro in question is \LettrineFont. It constructs a box containing the X in a given font and then measures its height. For this font and this character, LuaTeX reports a box height of 0 pt. A following integer division then fails.

Strictly speaking, the lettrine assumption is fair and the font is at fault for not providing even a minimal set of characters. If you still want to use this font, the easiest way is to modify \LettrineFont to use a character that exists in this font, such as O:

\documentclass{minimal}

\usepackage{lettrine}
\usepackage{fontspec,xunicode}
\usepackage{etoolbox}

\newfontfamily\EBLettrineFont{EBGaramondInitialsF2}
\renewcommand{\LettrineFontHook}{\EBLettrineFont}

\patchcmd{\LettrineFont}{\selectfont X}{\selectfont O}{}{%
  \GenericWarning{}{Patching \protect\LettrineFont\space failed}}

\begin{document}

\lettrine{T}{his} is a test

\end{document}

XeTeX, unlike LuaTeX, returns the height of nonexistent X as 8.10722 pt with this example code, and therefore division by zero does not occur.

share|improve this answer
    
Thank you very much! –  ℝaphink Aug 23 '11 at 11:48
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.