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.

Trying to use the lettrine package in XeLaTeX with the Georg Duffner's EB Garamond font results in:

! Bad USV code (-2411)

Trial and error shows that the problem comes with these two lines in lettrine.sty:

\smash{\llap{\mbox{\L@ante}\raisebox{\L@lraise}{\usebox{\L@lbox}}%
       \hskip \the\L@Findent}}

These lines, in the original lettrine.sty file, are enclosed within $ $ and thus typeset in math mode. I removed the $ $ and the problem disappeared.

Question: Is there any reason why these two lines should be in math mode, given that they don't do anything about math?

share|improve this question
    
I can't see any reason, and and the documented source doesn't give any clue. On the other hand the error indicates a badly encoded unicode input file. The math version of smash typesets the expression four times including script and scriptscript size so it may have caused some font loading code to be loaded, otherwise I can't see how the error could be affected by this. –  David Carlisle Mar 11 '13 at 20:35
1  
Apparently, lettrine's author thought that \smash works only in math mode, which is untrue. –  egreg Mar 11 '13 at 20:46
    
FWIW, I've had a similar problem with EB Garamond, but without lettrine. I suspect the problem may lie in mt-EBGaramond.cfg (the microtype configuration), as renaming this file 'cures' the (my) problem, as does omitting microtype altogether. Using LuaTeX also cures. –  Brent.Longborough May 7 '13 at 11:55
add comment

1 Answer

Apparently the author of lettrine was thinking that \smash works only in math mode. There are problems when using it outside math mode, since it doesn't start a paragraph as it could be expected. However the code in the definition of \@lettrine is

\def\@lettrine[#1]#2#3{%
  \setcounter{L@lines}{\theDefaultLines}%
  <...omitted code...>
  \noindent\leavevmode
  \parshape=\L@parshape
  $\smash{\llap{\mbox{\L@ante}\raisebox{\L@lraise}{\usebox{\L@lbox}}%
          \hskip \the\L@Findent}}$%
  \usebox{\L@tbox}}

and the \noindent would already make TeX switch to horizontal mode (and the \leavevmode is redundant). We can see that no math mode material is used in the argument to \smash.

Thus there's no risk in removing the $; but it's better to stop the search for other \parshape specifications that could cause \smash to be expanded prematurely. Thus I propose the following patch:

\usepackage{lettrine}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@lettrine}{$}{\relax}{}{}
\patchcmd{\@lettrine}{$}{}{}{}
\makeatother

that is, changing the first $ into \relax and removing the second $.

The patch should do nothing if the \@lettrine macro is changed in a package revision (provided it doesn't inject $ in other places of the same macro).

share|improve this answer
1  
I agree with this analysis. I have just uploaded to CTAN a new version (1.64) correcting this bug following egreg's suggestions. Thanks to all of you! –  user27392 Mar 14 '13 at 16:15
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.