The following software installation and configuration must have taken place.
A recent version of Emacs needs to be installed.
A recent version of the W3 subsystem for Emacs needs to be installed.
The Emacs Lisp file w3-convert-to-xml.el
needs to
be loaded into Emacs. If
path/w3-convert-to-xml.el
is a full path
to this file, then this can be accomplished with these Emacs
keystrokes:
M-x load-file RET path/w3-convert-to-xml.el
RET
The file xp.jar
from XP and the files
xt.jar
and sax.jar
from XT (both packages by
James Clark) must be findable via the environment variable
CLASSPATH
.
A Java implementation must be installed as a file named
java
which is findable via the environment variable
PATH
.
The following procedure will convert HTML to LaTeX:
If the HTML is in file.html
, type these Emacs
keystrokes to parse the HTML and display the formatted result in a
Emacs buffer:
M-x w3-find-file RET file.html
RET
The formatted result is not used in this procedure; it is merely a byproduct.
Then type these Emacs keystrokes to convert the internal parse
tree stored in the Emacs variable w3-last-parse-tree
into XML:
M-x w3-convert-to-xml RET
Switch to the W3 XML Conversion
buffer using these
Emacs keystrokes:
C-x b W3 SPC XML SPC Conversion RET
Save the XML into the file file.xml
using these Emacs keystrokes:
C-x w file.xml
RET
Let a full path to the file xhtml-to-latex.xsl
be
path/xhtml-to-latex.xsl
.
Run the following command to convert the XML into LaTeX:
java com.jclark.xsl.sax.Driver file.xml
path/xhtml-to-latex.xsl
> file.tex
The resulting LaTeX file file.tex
can
be used as usual for LaTeX.