| 1 |
%% |
| 2 |
%% This is file `tikzinclude.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% tikzinclude.dtx (with options: `package') |
| 8 |
%% |
| 9 |
%% Copyright (C) 2012 by Ferdinand Schwenk ([email protected]). |
| 10 |
%% Copyright (C) 2012 by Benjamin Berg ([email protected]). |
| 11 |
%% |
| 12 |
%% This file may be distributed and/or modified under the |
| 13 |
%% conditions of the LaTeX Project Public License, either |
| 14 |
%% version 1.3c of this license or (at your option) any later |
| 15 |
%% version. The latest version of this license is available at |
| 16 |
%% http://www.latex-project.org/lppl/. |
| 17 |
%% |
| 18 |
\NeedsTeXFormat{LaTeX2e}[1999/12/01] |
| 19 |
\ProvidesPackage{tikzinclude} |
| 20 |
[2012/22/02 v1.0 package for including only a specified tikz pictures from a file] |
| 21 |
\RequirePackage{tikz} |
| 22 |
\RequirePackage{ifthen} |
| 23 |
\RequirePackage{etoolbox} |
| 24 |
\newif\if@tikzinclude@active\@tikzinclude@activefalse |
| 25 |
\let\@tikzinclude@typsetpicturebox\pgfsys@typesetpicturebox |
| 26 |
\newcommand{\@tikzinclude@picture@started}{% |
| 27 |
\if@tikzinclude@active% |
| 28 |
\let\par\@tikzinclude@par% |
| 29 |
\fi% |
| 30 |
} |
| 31 |
\newcommand{\@tikzinclude@picture@ended}{% |
| 32 |
\if@tikzinclude@active% |
| 33 |
\ifthenelse{% |
| 34 |
\equal{\pgfkeysvalueof{/tikzinclude/figure}}{\pgfkeysvalueof{/tikzinclude/select}}% |
| 35 |
}% |
| 36 |
{}% |
| 37 |
{% |
| 38 |
\global\def\pgfsys@typesetpicturebox##1{% |
| 39 |
\global\let\pgfsys@typesetpicturebox\@tikzinclude@typsetpicturebox% |
| 40 |
}% |
| 41 |
}% |
| 42 |
\fi% |
| 43 |
} |
| 44 |
\BeforeBeginEnvironment{tikzpicture}{\if@tikzinclude@active% |
| 45 |
\whileboolexpr{test{\ifdimgreater{\lastskip}{0pt}}}{\unskip}\fi}% |
| 46 |
\AtBeginEnvironment{tikzpicture}{\@tikzinclude@picture@started% |
| 47 |
} |
| 48 |
\AtEndEnvironment{tikzpicture}{\@tikzinclude@picture@ended} |
| 49 |
\AfterEndEnvironment{tikzpicture}{\ignorespaces} |
| 50 |
\pgfkeyssetvalue{/tikzinclude/figure}{} |
| 51 |
\pgfkeyssetvalue{/tikzinclude/select}{} |
| 52 |
\newcommand\includetikzgraphics[2][]{% |
| 53 |
\begingroup% |
| 54 |
\ifthenelse{\equal{#1}{}}% |
| 55 |
{% |
| 56 |
\input{#2}% |
| 57 |
}% |
| 58 |
{% |
| 59 |
\let\@tikzinclude@par\par% |
| 60 |
\def\par{}% |
| 61 |
\pgfkeyssetvalue{/tikzinclude/select}{#1}% |
| 62 |
\@tikzinclude@activetrue% |
| 63 |
\kern0pt\input{#2}% |
| 64 |
\whileboolexpr{test{\ifdimgreater{\lastskip}{0pt}}}{\unskip}% |
| 65 |
\@tikzinclude@activefalse% |
| 66 |
\let\par\@tikzinclude@par% |
| 67 |
}% |
| 68 |
\endgroup% |
| 69 |
} |
| 70 |
\endinput |
| 71 |
%% |
| 72 |
%% End of file `tikzinclude.sty'. |