Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to use TeX to typeset Søren Kierkegaard's complete works, which are available online here. It includes a collection of notes in a separate XML file which I would like to add to the document as side notes if possible. This question deals with how one can automatically convert an entire website into LaTeX, but as is also mentioned in the answer, these solutions are far from perfect. What I need is not really a program that automatically converts everything into TeX. Rather, I need a program where I can specify manually specify which LaTeX command each HTML tag must be converted into. For instance, the note reference

<span id="r132"><a class="k" name="r132" href="kom.xml#k132" onclick="return blank('kom',this.href,430)" style="display: inline;">*</a></span>

should be automatically converted into

\Anote{r132}

(cf. this question). Does there exist some software that can convert HTML tags into LaTeX commands in this way?

share|improve this question
4  
If your content is stored in XML and you want to use TeX as typesetting engine, you might want to look into ConTeXt. See tex.stackexchange.com/questions/4987/… –  Jubobs Jun 25 at 17:16
3  
XSLT is tailor made to do this. –  David Carlisle Jun 25 at 17:47

1 Answer 1

up vote 4 down vote accepted

I made an initial comment that XSLT is well suited to this, but particularly easy here as there is already XSLT matching all the elements and generating HTML, so you just need to make a version that writes TeX instead.

so for example

http://www.sks.dk/red/kn1dok.xml

looks like html as you view it but it is XML converted to XSLT (using the browser's built in XSLT 1 engine) but you could use a command line XSLT system to convert it to html files. View source shows you the XSLT is

http://www.sks.dk/red/specs.xsl

which is a series of templates matching the XML elements and generating HTML, you just need a similar set of templates that generates latex.

XSLT is off topic for this site but stack overflow has an active XSLT tag if you need more help.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.