PassiveTeX
1. Summary
- PassiveTeX is a library of TeX macros which can be used to process an XML document which results from an XSL transformation to formatting objects.
- PassiveTeX provides a rapid development environment for experimenting with XSL FO, using a reliable pre-existing formatter
- Running PassiveTeX with the pdfTeX variant of TeX generates high-quality PDF files in a single operation.
- PassiveTeX shows how TeX can remain the formatter of choice for XML, while hiding the details of its operation from the user.
2. How does it work?
PassiveTeX relies heavily on work by David Carlisle
(his namespace-aware XML parser written in
TeX, xmltex
), and was developed from my
JadeTeX
macros for processing DSSSL via Jade.
3. Installation
The PassiveTeX macros should be downloaded (as a ZIP file,
passivetex.zip), unpacked, and installed in a TeX system (eg in
texmf/tex/latex/passivetex
) in the normal place where you put
macros. Consult your local documentation or local expert if you do not know
how to install a new package; on a web2c-based system, don't forget to
run mktexlsr
when you have the files in place,
to update the file lookup table.
What about that pdfxmltex
command we saw in the last section?
You don't have it on your system? You need to download
xmltex from CTAN
and install it in the your TeX system.
It too is just a set of TeX macro packages.
IMPORTANT NOTE. You need a
copy of xmltex.tex latex than 2001/11/30.
teiu5.fo
in one of two ways:
- Build an
xmltex
format file for pdfTeX withpdftex -ini "&pdflatex" pdfxmltex.iniand process your file withpdflatex "&pdfxmltex" teiu5.foThe commandpdfxmltex
used above is just a script which doestex -fmt=pdfxmltex -progname=pdfxmltexOr, -
Make a wrapper file called (eg)
teiu5.tex
looking like this:\def\xmlfile{teiu5.fo} \input xmltexand run pdfTeX on it as normal withpdflatex teiu5.tex
xmltex
knows how to find the PassiveTeX macros as
it needs them. You will likely need to increase TeX memory
values (in the file texmf.cnf
if you use a Web2c-based TeX);
I use:
NOTE: TeX has a limit
on the length of line it can read,
and some .fo files you generate may cause
TeX to die with an message about increasing buf_size.
If you get that, edit your
texmf.cnf
file, increase the size of buf_size
(mine is
200000), and remake any format files.
3.1. LaTeX package dependencies
This setup assumes you have a decent modern TeX setup. The TeX Live 6 CD-ROM is what I use, and it is up to date (see http://www.tug.org/texlive/).
4. LICENSE
Copyright 2003 Sebastian Rahtz/Oxford University (sebastian.rahtz@oucs.ox.ac.uk)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and any associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5. Extensions
bookmark
element in the
fotex
namespace, used to make PDF bookmarks. Usage is like this:
6. Notes on conformance to the XSL specification
6.1. Properties needed for basic conformance
6.2. Properties needed for full conformance
6.3. Properties needed for extended conformance
7. Sample files
- The TEI Lite description (teiu5.xml) converted PDF as teiu5.pdf
- A TEI test file (exercise.xml) converted to PDF as exercise.pdf
- A physics paper (teimath.xml) containing a fair amount of MathML markup, originally translated from LaTeX into XML. It is used extensively as an example in the LaTeX Web Companion. Here we see it converted to teimath.pdf using test/teimath.xsl
- James Tauber prepared a simple XSL spec (darkness.xsl) for Joseph Conrad's Heart of Darkness, which I ran to PDF as darkness.pdf
8. Concerns and problems
- This is an experimental system to check whether the idea works. Expect something more polished eventually.
- You need a modern TeX setup (like teTeX or TeX Live) to get to grips with it.
- Quite a few flow objects and characteristics are not dealt with yet. I will add support for more things as needed or requested.
- I do not have any objective check that what I think XSL FOs are supposed to do is actually right :-}
- I have only worked so far with the TEI Lite (XML version) and Docbook DTDs, and probably misinterpreted half of what they say.
9. Things for LaTeX users to remember
- No use is made of LaTeX high-level constructs. No sections,
no lists, no cross-refs, no bibliographies; on the other hand,
some extensions in the
fotex:
namespace are supported (eg to get Acrobat bookmarks) - XSL FO's underlying character set is Unicode; by default, entities are mapped to their Unicode position;
- All vertical and horizontal space is explicit in the specification
- Page and line breaking is left to TeX: the rest is up to you.
10. Future directions
- Complete the MathML handling
- Handle more variety in property values (eg colors, fonts)
- Deal with more complex tables
- Support SVG. How? In any case, SVG fragments need to be recognized directly to perform in-line graphical functions (setting text at an angle?)
- Use Unicode-based TeX variant (Omega) to handle non-Latin material more naturally
I will be very glad to discuss details with anyone. Contact me (Sebastian Rahtz) as sebastian.rahtz@it.ox.ac.uk