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 use accentuated letters with the lettrine package like:

\lettrine{É}{lisée} avait vu le pouvoir de Dieu sur la vie d'Élie.

With luatex (which is my normal rendering engine), it works fine. However, when I try to use TeX4HT to build HTML from it, I get:

! Missing \endcsname inserted.
<to be read again> 
                   \protect 
l.805 \lettrine{É}{lisée}
                            avait vu le pouvoir de Dieu sur la vie d'Élie.

I have already added these two lines when building with htlatex:

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

and I call htlatex with:

htlatex sagesse_lulu.tex 'xhtml,charset=utf-8' ' -cunihtf -utf8 -cvalidate'
share|improve this question
    
I can run simple document with lettrine without compilation errors, can you post complete example? –  michal.h21 Aug 5 '12 at 10:10

1 Answer 1

up vote 5 down vote accepted

This simple example runs without errors:

\documentclass{article}
\makeatletter
\@ifpackageloaded{tex4ht}{
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
}{
\usepackage{fontspec}
}
\makeatother
\usepackage[]{lettrine}
\begin{document}
\lettrine{É}{lisée} avait vu le pouvoir de Dieu sur la vie d'Élie. avait vu le pouvoir de Dieu sur la vie d'Élie. avait vu le pouvoir de Dieu sur la vie d'Élie. avait vu le pouvoir de Dieu sur la vie d'Élie.
avait vu le pouvoir de Dieu sur la vie d'Élie. avait vu le pouvoir de Dieu sur la vie d'Élie. avait vu le pouvoir de Dieu sur la vie d'Élie.
avait vu le pouvoir de Dieu sur la vie d'Élie. avait vu le pouvoir de Dieu sur la vie d'Élie. avait vu le pouvoir de Dieu sur la vie d'Élie.
avait vu le pouvoir de Dieu sur la vie d'Élie. avait vu le pouvoir de Dieu sur la vie d'Élie.
\end{document}

However, output looks bad, because there is no tex4ht configuration for \lettrine. Simple configuration can look like this: file lettrine.4ht

\NewConfigure{lettrine}{4}
\renewcommand\lettrine[2]{%
\leavevmode 
\a:lettrine#1\b:lettrine\c:lettrine#2\d:lettrine
}
\Configure{lettrine}{\ifvmode \ShowPar\fi \HCode{<span class="lettrine-init">}}{\Tg</span>}{\Tg<span class="lettrine-line">}{\Tg</span>}
\Css{.lettrine-init{
font-size:2em;
}}

\Css{.lettrine-line{
font-variant:small-caps;
}}

This file is called automatically when you usepackage lettrine.

We created configurable hooks with \NewConfigure{lettrine}{4}. This creates four hooks, named \a:lettrine ... \d:lettrine Then we redefined \lettrine command to put these hooks. Rest of the file is default configuration for tags and css information for their styling. You can redefine them in custom cfg file

share|improve this answer
    
This is great! I've been looking for an explanation like this one, and was using some horrible sed hacks instead. Is there a reference for such usage of TeX4HT somewhere? –  ℝaphink Aug 5 '12 at 13:09
    
I'm wondering now if the problem I had was because I still had auxiliary files from a previous PDF build. Auxiliary files tend to cause conflicts between rendenders. –  ℝaphink Aug 5 '12 at 13:25
    
There is only little documentation - in LaTeX web companion, there are some chapters that goes into depth, there are also good articles on CVR's blog - cvr.cc/tex/tex4ht but I think that I learned the trick with \a:configname from source codes of various .4ht files –  michal.h21 Aug 5 '12 at 14:15
    
it could be aux files, if one was writen in luatex using utf8 and then read by pdftex, it causes sometimes errors –  michal.h21 Aug 5 '12 at 14:17
    
I wonder if it would be interesting to get a standard lettrine.4ht added to TeX4HT. –  ℝaphink Aug 7 '12 at 20:54

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.