## 5.5.1 Specific packages

There a some packages that are currently supported only by the HTML5 renderer because they use the package resources mechanism described in the next section or need the output format to handle svg files.

### TikZ and TikZ-CD

TikZ is a general purpose drawing package for LaTeX relying on a low level language called PGF. The HTML5 renderer tries to handle `tikzpicture` environments by calling regular pdflatex to get a pdf file, then converting to svg using pdf2svg and including in the final html file. This should work without any tweak in the simplest cases where the TeX source contains only `\usepackage{tikz}` with no option, tikz library etc…and the tikzpicture environment itself uses no user defined macro.

For more complicated cases, there are three configuration options that can be set either on the command line or in a configuration file. Option --tikz-compiler indicates which LaTeXcompiler to use, default is pdflatex. Option --tikz-converter indicates which pdf to svg converter to use, default is pdf2svg. Option --tikz-template can be used to indicate which file should be used as a template receiving the `tikzpicture` code. By default this option is set to an empty string, in which case the template becomes

    \documentclass{standalone}
    \usepackage{tikz}
    \begin{document}
      {{ tikzpicture }}
    \end{document}

In a more realistic setup one can use --tikz-template ‘mytemplate.tex’ and put inside ‘mytemplate.tex’ something like:

    \documentclass{standalone}
    \usepackage{tikz}
    \usetikzlibrary{arrows,decorations.pathmorphing}

    \newcommand{\mymacro}{I love TikZ}
    \begin{document}
      {{ tikzpicture }}
    \end{document}

In the resulting html file, the `tikzpicture` will appear as something like

    <div class="tikzpicture">
      <object class="tikzpicture" data="images/a0000000001.svg" type="image/svg+xml">
        TikZ picture
        Source code
      </object>
    </div>

where “Tikz picture” can be replaced by something else if it appears in a custom lang file (see Section 2.1.2) and “Source code” will be replaced by the actual source of the picture. This text will appear only in browsers that cannot display the resulting svg picture or when using assistive technology such as screen readers.

The package tikz-cd is a specialized set of TikZ macros for easy commutative diagrams creation (if you do not know what is a commutative diagram then you do not need tikz-cd). This package is supported in a similar way except that the template configuration option is --tikz-cd-template and the default template is:

    \documentclass{standalone}
    \usepackage{tikz-cd}
    \begin{document}
      {{ tikzpicture }}
    \end{document}

and the source code is introduced by “Commutative diagram”.