summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-SGML2TeX.html
blob: 6231da759594557c881e97f19eaf10efd9a29282 (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
<head>
<title>UK TeX FAQ -- question label SGML2TeX</title>
</head><body>
<h3>Conversion from SGML or HTML to TeX</h3>
<p/>SGML is a very important system for document storage and interchange,
but it has no formatting features; its companion ISO standard
DSSSL
(see <a href="http://www.jclark.com/dsssl/">http://www.jclark.com/dsssl/</a>) is designed for writing
transformations and formatting,
but this has not yet been widely implemented. Some SGML authoring
systems (e.g., SoftQuad <i>Author/Editor</i>) have formatting
abilities, and
there are high-end specialist SGML typesetting systems (e.g., Miles33&#8217;s
<i>Genera</i>).  However, the majority of SGML users probably transform
the source to an existing typesetting system when they want to print. 
TeX is a good candidate for this. There are three approaches to writing a
translator:
<ol>
<li> Write a free-standing translator in the traditional way, with
  tools like <i>yacc</i> and <i>lex</i>; this is hard, in
  practice, because of the complexity of SGML.
<li> Use a specialist language designed for SGML transformations; the
  best known are probably <i>Omnimark</i> and <i>Balise</i>.
  They are expensive, but powerful, incorporating SGML query and
  transformation abilities as well as simple translation.
<li> Build a translator on top of an existing SGML parser.  By far
  the best-known (and free!) parser is James Clark&#8217;s
  <i>nsgmls</i>, and this produces a much simpler output format,
  called ESIS, which can be parsed quite straightforwardly (one also
  has the benefit of an SGML parse against the DTD). Two
  good public domain packages use this method:
  <ul>
  <li>

      David Megginson&#8217;s
      <a href="http://www.perl.com/CPAN/modules/by-module/SGMLS"><i>sgmlspm</a></i>,
      written in <i>Perl</i> 5.
    <li>

      Joachim Schrod and Christine Detig&#8217;s
      <a href="ftp://ftp.tu-darmstadt.de/pub/text/sgml/stil"><i>STIL</a></i>,
       (&#8216;SGML Transformations in Lisp&#8217;).
  </ul>
  Both of these allow the user to write &#8216;handlers&#8217; for every SGML
  element, with plenty of access to attributes, entities, and
  information about the context within the document tree.
<p/>  If these packages don&#8217;t meet your needs for an average SGML
  typesetting job, you need the big commercial stuff.
</ol>
<p/>Since HTML is simply an example of SGML, we do not need a specific
system for HTML.  However, Nathan Torkington developed

<i>html2latex</i> from the HTML parser in NCSA&#8217;s
Xmosaic package.
The program takes an HTML file and generates a LaTeX file from it.
The conversion code is subject to NCSA restrictions, but the whole
source is available on CTAN.
<p/>Michel Goossens and Janne Saarela published a very useful summary of
SGML, and of public domain tools for writing and manipulating it, in
<i>TUGboat</i> 16(2).
<dl>
<dt><tt><i>html2latex source</i></tt><dd><a href="http://mirror.ctan.org/support/html2latex.zip">support/html2latex</a> (or <a href="http://mirror.ctan.org/support/html2latex/">browse the directory</a>)
</dl>
<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=SGML2TeX">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=SGML2TeX</a>
</body>