Skip to content

Latex package to include external tikz figures and similarly to \includegraphics command.

License

Notifications You must be signed in to change notification settings

gdolle/latex-includetikz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 

Repository files navigation

latex-includetikz

Latex package to include external tikz figures and similarly to \includegraphics command.

Install

Add includetikz in your current directory, or texmf install. Then add

\usepackage[<options>]{includetikz}

in your text source.

Package options:

Option Description
[external] Compute all include tikz as external pdf files with checksum (see tikz external library).
[origin] Compute all pdf picture in a subdirectory "autogen" under the original figure directory (Default will use the source directory ).
[force] Force all tikz figures to be recompiled (Slower build).
[disable] Disable all pictures and replace by a black picture (Faster build).
[optimize] Optimize generated pdf.

Usage

Create you tikz figures in a separate file then include them in your tex source using

\includetikz[<options>]{path/to/image.tikz}

Tikz PDFs are generated by default under a new directory called "autogen" in the source directory. You can change the default path using the option "origin" to create this directory relative to each figure directory.

NB: .tikz or .tex extension work.

Options

Option valuetype Description
[scale] float Scale the tikz image
[font keepratio] X Scale the image and inverse scale font size
[font scale] float Scale tikz image font
[font style] string Tikz image font style (beta)
[fill opacity] float Modify image opacity (beta)

Commands:

Command Description
\includetikzdisable Disable all pictures (to make compilation faster)
\includetikzorigin Change autogen path to figure origin directory
\includetikzforcerebuild Force tikz picture to be recompiled

Examples:

Minimal example:

% Preamble.
\usepackage{includetizk}

% Document.
\includetikz[scale=0.9]{figs/monimage.tikz}

Generate monimage.tikz during first compilation, then use auto-generated pdf:

% Preamble.
\usepackage[external]{includetizk}

% Document.
\includetikz[font scale=1.3]{figs/monimage.tikz}

FAQS

  1. I get an MD5 write error I can't write on file figs/.md5'
  2. I want to replace tikz picture by pdf

I get an MD5 write error I can't write on file figs/.md5'.

This often happens when you output files in another directory using the latex option -output-directory=<workdir>. The easier solution is to create a simlink inside the working directory. See the providen example.


I want to replace tikz picture by pdf

This is one of the goal of this package. Compile your latex file the first time to generate all tikz pictures. Then comment the includetikz lines and replace them by the \includegraphics function:

%\usepackage{includetikz}
\usepackage{graphicx}

%\includetikz[scale=0.5]{path/to/fig/figname-1}
\includegraphics{autogen/figname-1-n0} 

%\includetikz[scale=0.5]{path/to/fig/figname-1}
\includegraphics{autogen/figname-1-n1}

%\includetikz[scale=0.5]{path/to/fig/figname-2}
\includegraphics{autogen/figname-2-n0} 

Note that all generated picture are suffixed by -nX where X represent the nth call of the same figure. (This is necessary for the case where the same picture is generated with different options) If the origin option is passed then the path would be path/to/fig/autogen/ instead of autogen/.

About

Latex package to include external tikz figures and similarly to \includegraphics command.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages