LaTeX is a high-quality typesetting system that includes features designed for the production
of technical and scientific documentation. LaTeX can also be used to express mathematical
formulas in a textual format. By default, web browsers and PDF readers do not have support to
show mathematical equations written in LaTeX, but there are open-source projects that can read
LaTeX and convert it to other image types.
Adding support for writing LaTeX equations in a DITA topic implies three stages:
- Find a way to write the equation in the DITA XML content. You can either create a DITA
DTD specialization and add a new element (for example, called
<latex> and it extends the DITA <foreign>
element). Alternatively, you can directly use the DITA <foreign>
element with a specific @outputclass attribute value:
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="testEquation">
<title>Test equation</title>
<body>
<p><foreign outputclass="embed-latex">L' = {L}{\sqrt{1-\frac{v^2}{c^2}}}</foreign></p>
</body>
</topic>
- If you want Oxygen XML Author Eclipse plugin to properly present the LaTeX equation when editing
in the Author visual mode, you need a plugin that converts the equation content to
an image. There is a sample plugin that does that here: https://github.com/oxygenxml/wsaccess-javascript-sample-plugins/tree/master/latex-images-support. You can download and copy the plugin folder
latex-images-support to the Oxygen XML Author Eclipse plugin
plugins folder, then restart Oxygen XML Author Eclipse plugin.
- The final stage would be to publish the content to HTML-based or PDF output. The
following DITA Open Toolkit plugin automatically converts LaTeX images to SVG when
publishing: https://github.com/oxygenxml/dita-latex.