innoconv.ext.tikz2svg

Convert and insert TikZ figures.

SVG files are be rendered from TikZ code and saved in the folder _tikz in the static folder of the output directory.

TikZ code blocks are replaced by image elements.

Note

In order to use this extension you need to have the following installed on your system:

  • LaTeX distribution with PGF/TikZ

  • pdf2svg

Example

A TikZ image is written using a code block.

```tikz
\\begin{tikzpicture}
\\shade[left color=blue,right color=red,rounded corners=8pt] (-0.5,-0.5)
  rectangle (2.5,3.45);
\\draw[white,thick,dashed,rounded corners=8pt] (0,0) -- (0,2) -- (1,3.25)
  -- (2,2) -- (2,0) -- (0,2) -- (2,2) -- (0,0) -- (2,0);
\\node[white] at (1,-0.25) {\\footnotesize House of Santa Claus};
\\end{tikzpicture}
```

Upon conversion, this code block will be replaced in the output with an image tag, similar to the following.

![](/_tikz/tikz_abcdef0123456789.svg "Alt text")
class innoconv.ext.tikz2svg.Tikz2Svg(*args, **kwargs)[source]

Bases: innoconv.ext.abstract.AbstractExtension

Convert and insert TikZ images.

start(output_dir, source_dir)[source]

Initialize the list of images to be converted.

post_process_file(ast, _)[source]

Find TikZ images in AST and replace with image tags.

finish()[source]

Render images and copy SVG files to the static folder.