Skip to content

dialoa/imagify

Repository files navigation

Imagify - Pandoc/Quarto filter to convert selected LaTeX into images

GitHub build status

Lua filter to convert some or all LaTeX code in a document into images and to use .tex/.tikz files as image sources.

Copyright 2021-2023 Philosophie.ch under MIT License, see LICENSE file for details.

Maintained by Julien Dutant.

Overview

Imagify turns selected LaTeX elements into images in non-LaTeX/PDF output. This is useful for web output if you use MathJAX but it doesn't handle all of your LaTeX code.

It also allows you to use .tex or .tikz elements as image source files, which is useful to create cross-referenceable figures with Pandoc-crossref or Quarto without having to convert your LaTeX/TikZ code into images first.

Imagify tries to match your document's LaTeX output settings (fonts, LaTeX packages, etc.). Its rendering options are otherwise extensively configurable, and different rendering options can be used for different elements. It can embed its images within HTML output or provide them as separate image files.

Requirements: Pandoc or Quarto, a LaTeX installation (with dvisvgm and, recommended, latexmk, which are included in common LaTeX distributions).

Limitations

  • So far designed with HTML output in mind, LaTeX to SVG conversion, and LaTeX/PDF outputs with separate .tikz or .tex files as image sources. In other output formats, the images will be inserted or linked as PDFs and may display in wrong sizes or not at all.
  • Embedding within HTML output isn't compatible with Pandoc's extract-media option.

Use cases

The filter is used to produce the academic journal Dialectica. See for instance this article.

Demonstration

See the manual's example HTML output.

For a quick try-out, clone the repository and try:

Pandoc : make generate && open example-pandoc/expected.html

Or:

Quarto : make quarto && open example-quarto/example.html

You'll need either Pandoc or Quarto and a standard LaTeX distribution (that includes dvisvgm).

Installation and usage

See the manual.

Issues and contributing

Issues and PRs welcome.

Acknowledgements

Development funded by Philosophie.ch.