LaTeX Exporter

Last modified by Vincent Massol on 2024/10/21 00:14

cogInserts buttons to export to LaTeX in the Export UI (internally using the Output Filter to trigger the export)
Recommended
TypeJAR
CategoryUI Extension
Developed by

Vincent Massol, Thomas Mortagne

Active Installs41
Rating
0 Votes
LicenseGNU Lesser General Public License 2.1
Compatibility

Since v1.5 requires XWiki 10.2RC1

Installable with the Extension Manager

Description

Provide an entry point to export a wiki page into:

  • LaTeX content (you get a zip file containing the LaTeX files)
  • Latex 1.10+ PDF directly (the LaTeX files are converted to PDF)

See Output Filter for more details about the generated package.

Usage

Export

You will get 2 entries in the export menu for LaTeX as follows:

export.png

Exporting to PDF requires one of the following:

Alternatively you can export a page by changing the /view/ action in the browser address bar into /latexexport/. For example to export the wiki home page you can use http://myhost/xwiki/bin/latexexport/Main/. If you pass the pdf=true query string parameter, the export will generate a PDF.

Options

Then you'll get various export options that you can select/configure:

export-options.png

Progress

Latex 1.12+

Since the export can take some time (especially on the first run if you're exporting to PDF and the Docker image used to convert from LaTeX to PDF hasn't been downloaded yet - this is needed only once), the export progress is shown with a progress bar.

Convert to PDF

If you export to LaTeX and wish to manually generate a PDF from it, you can achieve this, using, for example, this LaTeX Docker image. Put yourself at the root of the unzipped ZIP and do the following (after having installed Docker if you don't have it already):

wget https://raw.githubusercontent.com/blang/latex-docker/master/latexdockercmd.sh
chmod +x latexdockercmd.sh
./latexdockercmd.sh pdflatex -shell-escape index.tex

This will generate an index.pdf file.

You'll need to call pdflatex twice to get the Table of Content generated since it requires two passes.

Example

Here's an example of the SandBox home page as a PDF.

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.


By default, the export to PDF will use Docker and thus it requires Docker to be installed, see the LaTeX to PDF documentation.

latex 1.18+

However, it's possible to configure an alternate method that doesn't mandate Docker but that requires some local executable to be present to perform the conversion. See the LaTeX PDF Process extension for details. To configure the export to use the process-based method, configure the following in your xwiki.properties file:

latex.pdf.export.hint=process

To explicitly configure it to use the Docker-based method, either comment the property or set it to docker, as in:

latex.pdf.export.hint=docker

Dependencies

Dependencies for this extension (org.xwiki.contrib.latex:latex-export 1.26):

Get Connected