# why this math mode in lettrine

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?

-
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
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

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).

-
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