summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/xmltex/passivetex/passivetex.xml
blob: 87ddc55816fc54b66bd084431477da0a9ae062ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
<?xml version="1.0"?>
<!DOCTYPE TEI.2 SYSTEM "http://www.oucs.ox.ac.uk/dtds/tei-oucs.dtd" [
 <!ENTITY properties SYSTEM "properties.xml">
]>
<TEI.2>
  <teiHeader>
    <fileDesc>
      <titleStmt>
        <title>PassiveTeX</title>
      </titleStmt>
      <publicationStmt>
        <p> </p>
      </publicationStmt>
      <sourceDesc>
        <p></p>
      </sourceDesc>
    </fileDesc>
    <revisionDesc>
      <list>
        <item><date>2000/12/11</date>version 1.4 </item>
        <item><date>2000/11/23</date>version 1.3 </item>
        <item><date>2000/10/04</date>version 1.1 </item>
        <item><date>2000/09/13</date>A couple of changes to property list</item>
        <item><date>2000/09/12</date>Notes on memory sizes</item>
        <item><date>2000/06/24</date>Checking links</item>
        <item><date>2000/05/30</date>Added conformance and dependency notes</item>
        <item><date>2000/02/07</date>Second version</item>
        <item><date>1999/08/08</date>First version, authored in TEI XML</item>
      </list>
    </revisionDesc>
  </teiHeader>
  <text>
<front>
<titlePage>
<docTitle>
 <titlePart type="main">PassiveTeX</titlePart>
</docTitle>
<docAuthor>Sebastian Rahtz</docAuthor>
<docDate>November  2000</docDate>
</titlePage>
</front>
<body>
<div>
<head>Summary</head>
<list type="unordered">
<item>
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. 
</item>
<item>
PassiveTeX provides a rapid development environment for experimenting
with XSL FO, using a reliable pre-existing formatter
</item>
<item>
Running PassiveTeX with the pdfTeX variant of TeX generates high-quality
PDF files in a single operation.
</item>
<item>
PassiveTeX shows how TeX can remain the formatter of choice for XML, while
hiding the details of its operation from the user.
</item>
</list>
<p>
Available from <xptr
		     url="http://users.ox.ac.uk/~rahtz/passivetex/"/>.
		     The current version is 1.4, 2000/12/11.
</p>
</div>
<div><head>How does it work?</head>
<p>
PassiveTeX relies heavily on work by David Carlisle
(his namespace-aware XML parser written in 
TeX, <code>xmltex</code>), and was developed from my
<xref url="http://www.tug.org/applications/jadetex/">JadeTeX</xref>
macros for processing DSSSL via Jade.
</p>
<p>
Taking the XML version of the TEI Lite guidelines
(<xref url="test/teiu5.xml">teiu5.xml</xref>, with DTD
<xref url="test/teixlite.dtd">teixlite.dtd</xref>), we apply an XSL stylesheet
(see my page of <xref url="http://users.ox.ac.uk/~rahtz/tei">TEI style sheets</xref>),
and run it through James Clark's XT XSL processor:
<eg>
  java com.jclark.xsl.sax.Driver teiu5.xml tei.xsl teiu5.fo
</eg>
(assuming you have <code>xt.jar</code>, <code>xp.jar</code> and <code>sax.jar</code>
on your CLASSPATH ). This creates  the new XML file
<xref url="test/teiu5.fo">teiu5.fo</xref>. We now run XMLTeX on this
<eg>
 pdfxmltex teiu5.fo
</eg>
which creates <xref url="test/teiu5.pdf">teiu5.pdf</xref>. Voila! 
Actually, we need to do
<eg>
 pdfxmltex teiu5.fo
</eg>
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 <xref url="http://users.ox.ac.uk/~rahtz/tei/teiu5.html">teiu5.html</xref>
on my TEI page. </p>
</div>
<div>
<head>Installation</head>
<p>
The PassiveTeX macros should be downloaded (as a ZIP file,
<xptr url="passivetex.zip"/>), unpacked, and installed in a TeX system (eg in 
<code>texmf/tex/latex/passivetex</code>) 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 <code>mktexlsr</code> when you have the files in place,
	  to update the file lookup table.
</p>
<p>
What about that <code>pdfxmltex</code> command we saw in the last section? 
You don't have it on your system? You need to download 
<xref url="ftp://ftp.tex.ac.uk/tex-archive/macros/xmltex/base.zip">xmltex</xref> 
(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) <code>teiu5.fo</code> in one of two ways:
<list type="ordered">
<item>Build an <code>xmltex</code> format file for pdfTeX with
<eg>
pdftex -ini "&amp;pdflatex" pdfxmltex.ini
</eg>
and process your file with
<eg>
pdflatex "&amp;pdfxmltex" teiu5.fo
</eg>
Or,
</item>
<item>
Make a wrapper file called (eg) <code>teiu5.tex</code> looking like this:
<eg>
\def\xmlfile{teiu5.fo}
\input xmltex
</eg>
and run pdfTeX on it as normal with
<eg>
pdflatex teiu5.tex
</eg> 
</item>
</list>
Do not worry, <code>xmltex</code> knows how to find the PassiveTeX macros as
it needs them. You will likely need to increase TeX memory
values (in the file <code>texmf.cnf</code> if you use a Web2c-based TeX);
I use:
<eg>
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
</eg>
</p>
<p>
For reference, the PassiveTeX package consists of the following files:
<list>
<item>The core xmltex `style' files for XSL FO XML:
<eg>
 fotex.xmt
 fotex.sty
</eg>
</item>
<item>
Support for direct formatting of TEI XML with xmltex
<eg>
 tei.xmt        
 teixml.sty
</eg>
</item>
<item>
Some support files, shared with JadeTeX:
<eg>
 unicode.sty
 ucharacters.sty
 mlnames.sty 
 dummyels.sty
</eg>
</item>
</list>
</p>
<p>
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
<code>texmf.cnf</code> file,  increase the size of <code>buf_size</code> (mine is
200000), and remake any format files.
</p>
<div><head>LaTeX package dependencies</head>
<p>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 <xptr url="http://www.tug.org/texlive/"/>).
</p>
<p> Here is a
	    list of the packages loaded in a typical run of
	    PassiveTeX, with their version numbers where known:
<table  rend="rules">
<row><cell>  amsbsy.sty </cell><cell>   1999/11/29 v1.2d</cell></row>
<row><cell>amsfonts.sty </cell><cell>   1997/09/17 v2.2e</cell></row>
<row><cell>  amsgen.sty </cell><cell>   1999/11/30 v2.0</cell></row>
<row><cell> amsmath.sty </cell><cell>   2000/03/29 v2.08 AMS math features</cell></row>
<row><cell>  amsopn.sty </cell><cell>   1999/12/14 v2.01 operator names</cell></row>
<row><cell> amssymb.sty </cell><cell>   1996/11/03 v2.2b</cell></row>
<row><cell> amstext.sty </cell><cell>   1999/11/15 v2.0</cell></row>
<row><cell>   array.sty </cell><cell>   1998/05/13 v2.3m Tabular extension package (FMi)</cell></row>
<row><cell> article.cls </cell><cell>   1999/09/10 v1.4a Standard LaTeX document class</cell></row>
<row><cell>      bm.sty </cell><cell>   1999/07/05 v1.0g Bold Symbol Support (DPC/FMi)</cell></row>
<row><cell>   color.sty </cell><cell>   1999/02/16 v1.0i Standard LaTeX Color (DPC)</cell></row>
<row><cell> fontenc.sty </cell><cell>   (version not available)</cell></row>
<row><cell>graphics.sty </cell><cell>   1999/02/16 v1.0l Standard LaTeX Graphics (DPC,SPQR)</cell></row>
<row><cell>graphicx.sty </cell><cell>   1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)</cell></row>
<row><cell> hpdftex.def </cell><cell>   2000/05/08 v6.70f Hyperref driver for pdfTeX</cell></row>
<row><cell>hyperref.sty </cell><cell>   2000/05/08 v6.70f Hypertext links for LaTeX</cell></row>
<row><cell>  ifthen.sty </cell><cell>   1999/09/10 v1.1b Standard LaTeX ifthen package (DPC)</cell></row>
<row><cell>  keyval.sty </cell><cell>   1999/03/16 v1.13 key=value parser (DPC)</cell></row>
<row><cell>longtable.sty </cell><cell>   1998/05/13 v4.09 Multi-page Table package (DPC)</cell></row>
<row><cell>multicol.sty </cell><cell>   1999/10/21 v1.5w multicolumn formatting (FMi)</cell></row>
<row><cell> nameref.sty </cell><cell>   2000/05/08 v2.18 Cross-referencing by name of section</cell></row>
<row><cell>  ot1phv.fd </cell><cell>   2000/01/12 PSNFSS-v8.1 scalable font definitions for OT1/phv.</cell></row>
<row><cell>  pd1enc.def </cell><cell>   2000/05/08 v6.70f Hyperref: PDFDocEncoding definition (HO)</cell></row>
<row><cell>  pifont.sty </cell><cell>   2000/01/12 PSNFSS-v8.1 Pi font support (SPQR) </cell></row>
<row><cell>rotating.sty </cell><cell>   1997/09/26, v2.13 Rotation package</cell></row>
<row><cell>  size10.clo </cell><cell>   1999/09/10 v1.4a Standard LaTeX file (size option)</cell></row>
<row><cell>stmaryrd.sty </cell><cell>   1994/03/03 St Mary's Road symbol package</cell></row>
<row><cell>   t1enc.def </cell><cell>   1999/12/08 v1.9x Standard LaTeX file</cell></row>
<row><cell>   t1phv.fd </cell><cell>   2000/01/12 PSNFSS-v8.1 scalable font definitions for T1/phv.</cell></row>
<row><cell>   t1ptm.fd </cell><cell>   2000/01/12 PSNFSS-v8.1 font definitions for T1/ptm.</cell></row>
<row><cell>  t2acmr.fd </cell><cell>   1999/01/07 v1.0 Computer Modern Cyrillic font definitions</cell></row>
<row><cell>  t2aenc.def </cell><cell>   1999/11/29 v1.0c Cyrillic encoding definition file</cell></row>
<row><cell>   t3enc.def </cell><cell>   (version not available)</cell></row>
<row><cell>textcomp.sty </cell><cell>   1999/12/08 v1.9x Standard LaTeX package</cell></row>
<row><cell>   times.sty </cell><cell>   2000/01/12 PSNFSS-v8.1 Times font as default roman (SPQR) </cell></row>
<row><cell>    tipa.sty </cell><cell>   1996/06/10 TIPA version 1.0</cell></row>
<row><cell>    trig.sty </cell><cell>   1999/03/16 v1.09 sin cos tan (DPC)</cell></row>
<row><cell>  ts1cmr.fd </cell><cell>   1999/05/25 v2.5h Standard LaTeX font definitions</cell></row>
<row><cell>  ts1enc.def </cell><cell>   1998/06/12 v3.0d (jk/car/fm) Standard LaTeX file</cell></row>
<row><cell>  ts1ptm.fd </cell><cell>   2000/01/12 PSNFSS-v8.1 font definitions for TS1/ptm.</cell></row>
<row><cell>    ulem.sty </cell><cell>   1997/04/21</cell></row>
<row><cell>    umsa.fd </cell><cell>   1995/01/05 v2.2e AMS font definitions</cell></row>
<row><cell>    umsb.fd </cell><cell>   1995/01/05 v2.2e AMS font definitions</cell></row>
<row><cell>    upsy.fd </cell><cell>   2000/01/12 PSNFSS-v8.1 font definitions for U/psy.</cell></row>
<row><cell>    upzd.fd </cell><cell>   2000/01/12 PSNFSS-v8.1 font definitions for U/pzd.</cell></row>
<row><cell>     url.sty </cell><cell>   1999/03/28  ver 1.5x  Verb mode for urls, etc.</cell></row>
<row><cell>  Ustmry.fd </cell><cell>  (version not available)</cell></row>
<row><cell>   uwasy.fd </cell><cell>   1999/05/13 v1.0iWasy-2 symbol font definitions</cell></row>
<row><cell> wasysym.sty </cell><cell>   1999/05/13 v1.0i Wasy-2 symbol support package</cell></row>
</table>
</p>
</div>
</div>


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


<div>
<head>Notes on conformance to the XSL draft specification of November 2000</head>
&properties;
</div>

<div>
<head>Sample files</head>
<p>
<list>
<item> The TEI Lite description (<xref
url="test/teiu5.xml">teiu5.xml</xref>) converted PDF as <xref
url="test/teiu5.pdf">teiu5.pdf</xref></item>
<item> A TEI test file  (<xref
url="test/exercise.xml">exercise.xml</xref>) 
converted to PDF as <xref
url="test/exercise.pdf">exercise.pdf</xref></item>
<item> A physics paper (<xref url="test/latextei.xml">latextei.xml</xref>) containing a fair
     amount of MathML markup, originally
     translated from LaTeX into XML.
     It is used extensively as an example in the
     <xref url="http://cseng.awl.com/bookpage.taf?ISBN=0-201-43311-7&amp;ptype=0&amp;catid=&amp;navmin=&amp;ctype=author&amp;catpage=&amp;seriesid=">LaTeX Web Companion</xref>.
Here we see it
      converted to <xref url="test/latextei.pdf">latextei.pdf</xref> using
      <xref url="test/latextei.xsl">test/latextei.xsl</xref></item>
<item> James Tauber prepared a simple XSL spec (<xref
url="test/darkness.xsl">darkness.xsl</xref>) for Joseph Conrad's 
<xref url="test/darkness.xml"><emph>Heart of
Darkness</emph></xref>, which I ran to PDF as <xref
url="test/darkness.pdf">darkness.pdf</xref></item>
</list>
</p>
</div>
  
<div>
<head>Concerns and problems</head>
<p>
Some points to bear in mind
<list type="ordered">
  <item> Obviously, the XSL FO spec is still a draft. 
  And this system is not conforming 
   precisely to the current draft. </item>
  <item> This is an experiment system to check whether the
       idea works. Expect something more polished eventually.</item>
  <item> You need a modern TeX setup (like
    <xref url="http://www.tug.org/teTeX/">teTeX</xref> or
   <xref url="http://www.tug.org/texlive/">TeX Live</xref>) 
to get to grips with it.</item>
  <item> Quite a few flow objects and characteristics are not dealt with yet.
       I will add support for more things as needed or requested.</item>
  <item> I do not have any objective check that what I think XSL FOs are
       supposed to do is actually right :-}</item>
  <item> I have only worked so far with the TEI Lite (XML version) and
    Docbook DTDs,  and probably misinterpreted half of what they say.</item>
</list>
</p>
</div>

<div>
<head>Things for LaTeX users to remember</head>
<p>
<list type="unordered">
<item> 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 <code>fotex:</code> namespace are supported 
(eg to get Acrobat bookmarks)
</item>
<item> XSL FO's underlying character set is Unicode; by default,
  entities are mapped to their Unicode position;
</item>
<item> All vertical and horizontal space is explicit in the
  specification
</item>
<item> Page and line breaking is left to TeX: the rest is up to you.
</item>
</list>
</p>
</div>

<div>
<head>Future directions</head>
<p>
<list type="unordered">
<item>Complete the MathML handling</item>
<item>Handle more variety in property values (eg colors, fonts) </item>
<item>Deal with more complex tables</item>
<item>Support SVG. How?
 <list type="unordered">
   <item>By direct intepretation and mapping to raw PDF</item>
   <item>By translation to MetaPost, and spawning a MetaPost process</item>
   <item>By pre-processing to existing TeX graphics languages</item>
 </list>
In any case, SVG fragments need to be recognized directly to perform in-line
graphical functions (setting text at an angle?)
</item>
<item>Use Unicode-based TeX variant (Omega) to handle non-Latin material
more naturally</item>
</list>
</p>
<p>
I will be very glad to discuss details with anyone. Contact me (Sebastian Rahtz) as
<xref url="mailto:sebastian.rahtz@oucs.ox.ac.uk">sebastian.rahtz@oucs.ox.ac.uk</xref>
</p>
</div>
</body>
</text>
</TEI.2>