]> PassiveTeX

2000/12/11version 1.4 2000/11/23version 1.3 2000/10/04version 1.1 2000/09/13A couple of changes to property list 2000/09/12Notes on memory sizes 2000/06/24Checking links 2000/05/30Added conformance and dependency notes 2000/02/07Second version 1999/08/08First version, authored in TEI XML
PassiveTeX Sebastian Rahtz November 2000
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.

Available from . The current version is 1.4, 2000/12/11.

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.

Taking the XML version of the TEI Lite guidelines (teiu5.xml, with DTD teixlite.dtd), we apply an XSL stylesheet (see my page of TEI style sheets), and run it through James Clark's XT XSL processor: java com.jclark.xsl.sax.Driver teiu5.xml tei.xsl teiu5.fo (assuming you have xt.jar, xp.jar and sax.jar on your CLASSPATH ). This creates the new XML file teiu5.fo. We now run XMLTeX on this pdfxmltex teiu5.fo which creates teiu5.pdf. Voila! Actually, we need to do pdfxmltex teiu5.fo again, to resolve page-number references in the table of contents. For a comparison with an HTML rendering of the same document (using XSL again), see teiu5.html on my TEI page.

Installation

The PassiveTeX macros should be downloaded (as a ZIP file, ), 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 (that link gives you a ZIP archive of the system) and install it in the your TeX system. It too is just a set of TeX macro packages. Then you can use it on a file called (eg) teiu5.fo in one of two ways: Build an xmltex format file for pdfTeX with pdftex -ini "&pdflatex" pdfxmltex.ini and process your file with pdflatex "&pdfxmltex" teiu5.fo Or, Make a wrapper file called (eg) teiu5.tex looking like this: \def\xmlfile{teiu5.fo} \input xmltex and run pdfTeX on it as normal with pdflatex teiu5.tex Do not worry, 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: main_memory = 2500000 param_size = 1500 stack_size = 1500 hash_extra = 50000 string_vacancies = 45000 pool_free = 47500 nest_size = 500 save_size = 10000 pool_size = 500000 max_strings = 55000

For reference, the PassiveTeX package consists of the following files: The core xmltex `style' files for XSL FO XML: fotex.xmt fotex.sty Support for direct formatting of TEI XML with xmltex tei.xmt teixml.sty Some support files, shared with JadeTeX: unicode.sty ucharacters.sty mlnames.sty dummyels.sty

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.

LaTeX package dependencies

This setup assumes you have a decent modern TeX setup. The TeX Live 5 CD-ROM is what I use, and it is up to date (see ).

Here is a list of the packages loaded in a typical run of PassiveTeX, with their version numbers where known: amsbsy.sty 1999/11/29 v1.2damsfonts.sty 1997/09/17 v2.2e amsgen.sty 1999/11/30 v2.0 amsmath.sty 2000/03/29 v2.08 AMS math features amsopn.sty 1999/12/14 v2.01 operator names amssymb.sty 1996/11/03 v2.2b amstext.sty 1999/11/15 v2.0 array.sty 1998/05/13 v2.3m Tabular extension package (FMi) article.cls 1999/09/10 v1.4a Standard LaTeX document class bm.sty 1999/07/05 v1.0g Bold Symbol Support (DPC/FMi) color.sty 1999/02/16 v1.0i Standard LaTeX Color (DPC) fontenc.sty (version not available)graphics.sty 1999/02/16 v1.0l Standard LaTeX Graphics (DPC,SPQR)graphicx.sty 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR) hpdftex.def 2000/05/08 v6.70f Hyperref driver for pdfTeXhyperref.sty 2000/05/08 v6.70f Hypertext links for LaTeX ifthen.sty 1999/09/10 v1.1b Standard LaTeX ifthen package (DPC) keyval.sty 1999/03/16 v1.13 key=value parser (DPC)longtable.sty 1998/05/13 v4.09 Multi-page Table package (DPC)multicol.sty 1999/10/21 v1.5w multicolumn formatting (FMi) nameref.sty 2000/05/08 v2.18 Cross-referencing by name of section ot1phv.fd 2000/01/12 PSNFSS-v8.1 scalable font definitions for OT1/phv. pd1enc.def 2000/05/08 v6.70f Hyperref: PDFDocEncoding definition (HO) pifont.sty 2000/01/12 PSNFSS-v8.1 Pi font support (SPQR) rotating.sty 1997/09/26, v2.13 Rotation package size10.clo 1999/09/10 v1.4a Standard LaTeX file (size option)stmaryrd.sty 1994/03/03 St Mary's Road symbol package t1enc.def 1999/12/08 v1.9x Standard LaTeX file t1phv.fd 2000/01/12 PSNFSS-v8.1 scalable font definitions for T1/phv. t1ptm.fd 2000/01/12 PSNFSS-v8.1 font definitions for T1/ptm. t2acmr.fd 1999/01/07 v1.0 Computer Modern Cyrillic font definitions t2aenc.def 1999/11/29 v1.0c Cyrillic encoding definition file t3enc.def (version not available)textcomp.sty 1999/12/08 v1.9x Standard LaTeX package times.sty 2000/01/12 PSNFSS-v8.1 Times font as default roman (SPQR) tipa.sty 1996/06/10 TIPA version 1.0 trig.sty 1999/03/16 v1.09 sin cos tan (DPC) ts1cmr.fd 1999/05/25 v2.5h Standard LaTeX font definitions ts1enc.def 1998/06/12 v3.0d (jk/car/fm) Standard LaTeX file ts1ptm.fd 2000/01/12 PSNFSS-v8.1 font definitions for TS1/ptm. ulem.sty 1997/04/21 umsa.fd 1995/01/05 v2.2e AMS font definitions umsb.fd 1995/01/05 v2.2e AMS font definitions upsy.fd 2000/01/12 PSNFSS-v8.1 font definitions for U/psy. upzd.fd 2000/01/12 PSNFSS-v8.1 font definitions for U/pzd. url.sty 1999/03/28 ver 1.5x Verb mode for urls, etc. Ustmry.fd (version not available) uwasy.fd 1999/05/13 v1.0iWasy-2 symbol font definitions wasysym.sty 1999/05/13 v1.0i Wasy-2 symbol support package

Extensions

PassiveTeX interprets MathML natively (elements must use the MathML namespace). I also support a bookmark element in the fotex namespace, used to make PDF bookmarks. Usage is like this: <xsl:template match="div2"> <xsl:apply-templates select="head"/> <fotex:bookmark xmlns:fotex="http://www.tug.org/fotex" fotex-bookmark-level="2" fotex-bookmark-label="{@id}"> <xsl:value-of select="head"/> </fotex:bookmark> </fo:block> </xsl:template>

Notes on conformance to the XSL draft specification of November 2000 &properties;
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 (latextei.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 latextei.pdf using test/latextei.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

Concerns and problems

Some points to bear in mind Obviously, the XSL FO spec is still a draft. And this system is not conforming precisely to the current draft. This is an experiment 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.

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.

Future directions

Complete the MathML handling Handle more variety in property values (eg colors, fonts) Deal with more complex tables Support SVG. How? By direct intepretation and mapping to raw PDF By translation to MetaPost, and spawning a MetaPost process By pre-processing to existing TeX graphics languages 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@oucs.ox.ac.uk