[Tugindia] Tex-XML conversion

Radhakrishnan CV cvr at river-valley.org
Tue Jul 13 10:58:05 CEST 2010

On Tue, Jul 13, 2010 at 8:24 AM, Varaprasad B <malliurs_80 at yahoo.com> wrote:
> Dear All,
>  Can anybody help me, how to convert from tex to xml?
>  Is there any guideline to create templates in Latex?

It is a non-trivial process and can't be explained in a mail.  You
have to devise the technology yourself to translate LaTeX into XML
marked up as per a specific DTD. There are no easy ways or off the
shelf packages to do it especially when LaTeX allows to use umpteen
number of packages with myriad commands with a variety of argument
patterns.  To complicate the matter further, the authors themselves
can write their own simple to very complex macros and use macros
inside macros in a nested fashion making the situation still more
complex. So, you need to devise a methodology which is convenient to
you to approach the problem based on your skills, expertise and

You can write your own custom filter in any of the mainstream
languages like Java, C, C++, python, perl etc that can read the LaTeX
sources and translate to the custom XML. Remember, it is not a simple
search and replacement.

Secondly, you can adopt/customize LaTeX2Html or similar software to
write out XML.

Thirdly, you can make use of TeX compiler itself to read the LaTeX and
write out the XML. This is the method adopted by TeX4ht.

And lastly, Omega has an sgml mode which can be made use of to write
out XML/MathML with the help of custom packages. The downside: the
documentation is rudimentary or near nil and the engine is buggy.

Hope the above information might be of help to you.

Best regards

More information about the tugindia mailing list