HTML with SWP Version 4.0
Philip A. Viton
February 11, 2002
1 SWP Version 4
With version 4.0, the SWP family of products — including Scientific
Notebook — allows you to create HTML directly from your on-screen
files. As with TeX4ht, graphic images are used for mathematics, but
because the internal Copy-As-Picture procedure is used to create them, the
process is not only transparent to you, it is much faster than TeX4ht’s
DVIPS+GhostScript+ImageMagick solution. For SN users who have previously
used Hevea to create HTML, the new facility gives you a the ability to create
HTML showing all your math without relying on glyphs being present in the
Symbol font; and this is a major improvement. However, for SW and SWP users,
who have access to LaTeX, there are a few limitations of the new facility that you
need to be aware of.
1.1 Some Version 4 issues
- The layout of the HTML is based on the screen appearance of
your document (with several modifications, such as not using red for
mathematics). If you’ve become used to not worrying much about the
screen appearance on the grounds that LaTeX will take care of all
the formatting for you, you may need to reconsider. TeX4ht, on the
other hand, is independent of the screen appearance. (Conversely, if
you want control over the appearance of your HTML, SWP 4’s .cst
files provide a particularly easy way to get it, without worrying about
LaTeX packages or TeX4ht configuration files).
- LaTeX is never used in the HTML Export feature. This has a number
of consequences, including:
- You cannot create a Table-of-Contents, linked or not.
(or a List of Tables, List of Figures, etc).
- BibTeX citations are handled by spelling out the contents of the
\cite field, and the .bbl file itself is never used. For example
if your screen says “as demonstrated in [cite: Viton:2001]” the
HTML will say exactly that, with no link to a reference list, which
in fact is not generated at all.
- Subdocuments and other documents incorporated by \include
are silently ignored.
- User-supplied TeX fields are “expanded” but have no effect,
beyond printing out their contents. For example, I generally
include the date via a \today fragment. The HTML export
feature just produces \today() (the contents of the fragment) in
the hypertext file.
- The HTML produced by Version 4’s Export feature appears to be
unusually sensitive to the browser. This applies particularly to inline math
viewed in Netscape 4.7 (or presumably any of the 4.x series), which has
severe alignment problems. However, alignment as viewed in Internet
Explorer 5.0+ or Netscape 6.2 (possibly also 6.0+) is excellent. See below
for a test.
- There can be a problem with a free-standing “f” in math mode (“free
standing” as opposed to, say an “f” followed by an open-parenthesis or
other math). The graphic created by the HTML-Export feature may be
missing both the ascender and descender and can look nothing like an italic
“f”. The reason is that the TrueType bounding box for this character does
not include parts of the character, as you can verify by highlighting it on
your SWP screen; and SWP uses that information in deciding on the size of
the graphic. One possible work-around is to surround the “f” with
a thinspace in math mode; this helps, but may have undesirable
implications for your typeset output, if you also need to produce
that.
- HTML Export in version 4.0 doesn’t treat the front-matter well: it is
translated as ordinary paragraph text. Fortunately, this is easily corrected:
open htmlout.cfg (in your top-level SWP directory) and add the following
lines to the end of the [STYLEHEADER] section, and before the closing
</SCRIPT>:
-
- P.Author {font-size: large ; text-align: center}
-
- P.Title {font-size: large ; text-align: center}
You can use these as a model of other elements in the front-matter; if you
want the text to be displayed in bold, you can add font-weight: bold to
the descriptors. Note that once you’ve done this, it will be used in all your
conversions, which is presumably what you want; however, there is no
provision for document-specific configuration.
- Cross-references are silently ignored. There is a partial fix for this, too (at
least as long as your cross-references refer to material in the same
document): open htmlout.dat (in your top-level SWP directory) and
replace the definitions of \QTSN{label}#2 and \QTSN#1#2 given there (at
about line 515) as follows:
-
- \QTSN{label}#2 modeless textarg "<A NAME=""#2""></A>"
-
- \QTSN#1#2 modeless "<A HREF=""##2"">#2</A>"
- Equation labels are also silently ignored, and the fix in the previous point
doesn’t work correctly here. It will generate a link where you have your
cross-reference, but because the label attached to the equation itself is
ignored, that link won’t work correctly: in Netscape 4 it takes you to the
top of the document. I know of no way to get equation labels to
work.
If these features are important to you, then you may wish to stick with a
converter like TeX4ht, which handles them all correctly, albeit with a time
cost.
1.2 A comparative test of HTML production
I have created a small test to show how the various HTML translation systems
compare on the same source document. You can view it starting from here , and
my advice is to do so in as many different browsers as you can, before you decide
on your HTML strategy.