# How to convert to odt using xparse and mk4ht oolatex

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?

-

## 1 Answer

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

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