summaryrefslogtreecommitdiff
path: root/graphics/pgf/base/tex/pgfsys-dvisvgm4ht.def
blob: 2853147a8d161d92f8fa37d98806b1ecf76027c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
% Copyright 2020 by Michal Hoftich
% Copyright 2006 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.

\ProvidesFileRCS{pgfsys-dvisvgm4ht.def}

% Driver commands for tex4ht

%
% Load common pdf commands:
%
  %\input pgfsys-dvisvgm.def
\input pgfsys-dvips.def



\AtBeginDocument{
  % configure the output picture format to svg
  \Configure{Picture}{.svg}
  % insert tex4ht hook to the code used at the start and end of each TikZ picture
  \def\pgfsys@beginpicture{%
    \bgroup%
    \ifdefined\inside@pict@cmd% handle nested uses
    \def\run@pict@cmd{}% insert the \Picture hooks only in the top nesting level
    \def\end@pict@cmd{}%
    \else
    % use different version of \Picture depending on the vertical mode
    \ifvmode\def\run@pict@cmd{\Picture*}\else\def\run@pict@cmd{\Picture+}\fi%
    \def\end@pict@cmd{\EndPicture}%
    \fi%
    % command used to detect nesting
    \def\inside@pict@cmd{}%
    \csname a:tikzpicture\endcsname%
    \orig@pgfsys@begin%
  }%
  \def\pgfsys@endpicture{%
    \orig@pgfsys@end%
      \csname b:tikzpicture\endcsname%
      \egroup%
      \par%
  }%
}


% Make the code inserted by tex4ht configurable

\NewConfigure{tikzpicture}{2}
\Configure{tikzpicture}{%
  % \ifvmode\IgnorePar\fi\EndP%\HtmlParOff
  \protect\csname nested:math\endcsname% support display math
  \run@pict@cmd{}%
}{\end@pict@cmd}

\let\orig@pgfsys@begin\pgfsys@beginpicture
\let\orig@pgfsys@end\pgfsys@endpicture
\def\pgf@sys@postscript@header#1{{\special{! #1}}}


\endinput


%%% Local Variables:
%%% mode: latex
%%% End: