[XeTeX] XeTeX, fancy headers and htlatex

Robert Spence spence at saar.de
Tue Jan 30 17:03:26 CET 2007


Rene,

On 30 Jan 2007, at 15:29 , Rene Borgella wrote:
> Now, my next problem/question . . .
>
> How do I get htlatex to work with XeTex? My former setup (Gerben's
> i-installer and then MacTex) worked well when I went from Latex to  
> html.
>    I have just tried going from XeTex to html using htlatex on the
> command line, and I get this message in terminal:
---%<-----
Can you post a minimal example (or even a torture test) showing what  
kind of contents you need to typeset?  As I said in my last posting
[30 Jan 2007, Re: [XeTeX] LaTeX to Xetex conversion query],
it's possible to process the same input file with htlatex and with  
XeTeX, but you need to do a bit of fiddling.  Which specific features  
of XeTeX do you need, apart from the UTF-8 input encoding?  How many  
of those features become unnecessary when you're producing HTML?

The example below shows that you're trying to execute the htlatex  
command _WITHOUT_ any special parameters; in order to do the basic  
typesetting, htlatex then immediately calls pdfTeXk (not XeTeX)!
>
> ic017245:~/Desktop/tex_testng rene$ cd /Users/rene/Desktop/tex_testng/
> ic017245:~/Desktop/tex_testng rene$ htlatex field_notes2.tex
> This is pdfTeXk, Version 3.141592-1.40.1 (Web2C 7.5.6)
>  %&-line parsing enabled.
> entering extended mode
-----%<-----
[several lines of output omitted]
-----%<-----
> (/usr/local/texlive/2007/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
> !
>  ********************************************
>  * XeTeX is required to compile this document.
>  * Sorry!
>  ********************************************.
> \RequireXeTeX ...********************************}
>                                                   \endgroup \fi
> l.18 \RequireXeTeX
>
> I am not sure, but this seems to say that somehow XeTeX isn't being
> properly called.  Is that correct?

You've already got htlatex to use pdfTeXk, which excludes using XeTeX:

> FWIW, I am mostly interested in having some method where I can write
> documents that will work well for printing and can easily convert  
> to html.

I'm not sure whether there's a way of doing exactly what you want,  
i.e. executing htlatex and getting it to use XeTeX instead of pdfTeXk.

My workaround was simply to have two logical alternatives built into  
the document to be processed, in the form of an if-then-else structure:
_IF_ you're using XeTeX to produce PDF output,
_THEN_ you take up the standard XeTeX options such as
   \usepackage{fontspec,xunicode}
   and so on,
_ELSE_ you take up the PDF options that work most sensibly in  
conjunction with htlatex to produce HTML (e.g.
   \usepackage[utf8x]{inputenc}
   \usepackage[T1]{fontenc}
   \usepackage{lmodern}
)

You then run
EITHER
xelatex -output-driver='xdvipdfmx' <filename>
to produce PDF output
OR ELSE
htlatex <filename.tex> "mycfg.cfg,xhtml,uni-html4" " -cunihtf -utf8"
to produce HTML output.

I don't know of a better way of doing this, but would be delighted to  
be told of one.

"Hope This Helps"/"Hopeful regards",
-- Rob Spence



More information about the XeTeX mailing list