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.

Both tex4ht and htlatex compile documents with package xparse.

But mk4ht oolatex doesn't. Running it on a document as simple as:

\documentclass{article}
\usepackage{xparse}
\begin{document}
a
\end{document}

raises these errors:

! Missing number, treated as zero.
<to be read again>
                   ^
l.30 \catcode`\^^
                 A=\catcode`\%

and

! Missing number, treated as zero.
<to be read again>
                   ^
l.479 \Gin@codes

How can I fix that?

share|improve this question
add comment

1 Answer

up vote 8 down vote accepted

The problem is an assumption in the LaTeX core graphics package. Early on, it includes the lines

\edef\Gin@codes{%
 \catcode`\noexpand\^^A\the\catcode`\^^A\relax
 \catcode`\noexpand\"\the\catcode`\"\relax
 \catcode`\noexpand\*\the\catcode`\*\relax
 \catcode`\noexpand\!\the\catcode`\!\relax
 \catcode`\noexpand\:\the\catcode`\:\relax}
\catcode`\^^A=\catcode`\%

which are intended to save category codes of various items, then alter the catcode of ^^A (which is then used to set up some debug code). The problem is that the ^^A input syntax only works if ^ is a math superscript character (catcode 7). That's almost always the case, but running mk4ht oolatex sets the category code of ^ to 12 ('other').

(You see the issue with xparse as it loads expl3, and that in turn loads graphics. However, you can see the issue just loading graphics alone, so this is not an xparse issue per se.)

Some information on how tex4ht handles super- and subscripts can be found in trouble shooting section on tex4ht site. For suppression of subscripts redefinitions, you can use no^ command line option. So for your file, this should compile without errors:

mk4ht oolatex filename "xhtml, no^"

For overview of available options, see this article

share|improve this answer
1  
I cannot test it now, but there is command line option no^ for tex4ht which suppresses making ^ active. but I don't know if oolatex supports this option –  michal.h21 Jan 23 '13 at 19:44
1  
Running mk4ht oolatex filename "xhtml, no^", sample file compiles without errors. –  michal.h21 Jan 23 '13 at 19:53
    
@JosephWright can't possibly be a bug in graphics:-) More to the point the same ^^ convention is used in doc.sty inputenc latexsym and several other parts of the base latex distribution –  David Carlisle Jan 23 '13 at 20:09
1  
@DavidCarlisle Not a bug perhaps, but odd that the code is defensive about some things but leaves others which could be covered. Take a look at Heiko's standard lead-in for a really serious example of catcode paranoia. –  Joseph Wright Jan 23 '13 at 20:41
    
yes graphics could add ^ to the characters it normalises, but the assumption that ^ is superscript during package loading is all over the latex code, just as the assumption that \ is the escape character, you have to stop somewhere. Babel delays its shorthands to begin{document} with good reason. –  David Carlisle Jan 23 '13 at 21:02
show 1 more 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.