-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpgfsys-dvisvgm4ht.def
More file actions
93 lines (77 loc) · 2.51 KB
/
pgfsys-dvisvgm4ht.def
File metadata and controls
93 lines (77 loc) · 2.51 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
% Copyright 2021 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:
%
% we load the dvips driver by default. it doesn't support patterns and some other stuff,
% but it handles better nested images and some formatting. if you use patterns or if you
% have other issues with the default method, pass the "tikz-dvisvgm" option to make4ht.
\ifdefined\ifOption
\ifOption{tikz+}{\input pgfsys-dvisvgm.def}{\input pgfsys-dvips.def}
\else
% load the dvips driver by default
\input pgfsys-dvips.def
\fi
\def\texfourht@tikz@begin{%
\bgroup%
\def\run@pict@cmd{}% insert the \Picture hooks only in the top nesting level
\def\end@pict@cmd{}%
\ifdefined\EndPicture\else% We are already inside command that uses \Picture
\ifdefined\inside@pict@cmd\else% handle nested uses
\ifdefined\tikzexternalize\else% Support externalize library
\def\run@pict@cmd{\Picture*[\csname a:Picture-alt\endcsname]}%
\def\end@pict@cmd{\EndPicture}%
\fi\fi\fi%
% command used to detect nesting
\def\inside@pict@cmd{}%
\csname a:tikzpicture\endcsname%
}
\def\texfourht@tikz@end{%
\csname b:tikzpicture\endcsname%
\egroup%
}
\AtBeginDocument{%
\NewConfigure{tikzpicture}{2}%
\catcode`\:=11%
\Configure{tikzpicture}{%
\protect\csname nested:math\endcsname% support display math
\run@pict@cmd{}%
}{\end@pict@cmd}
% configure the output picture format to svg, as it will require dvisvgm
% post processing.
\Configure{Picture}{.svg}%
\def\pgfsys@typesetpicturebox#1{%
\def\@tempa{#1}%
% I've found that inserting picture instructions here leads to
% errors when \pic feature of pgf is used.
\if\@tempa\pgfpic%
\orig@pgfsys@typesetpicturebox{#1}%
\else%
\texfourht@tikz@begin%
\orig@pgfsys@typesetpicturebox{#1}%
\texfourht@tikz@end%
\fi%
}
%
% insert tex4ht hooks around TikZ picture box
\ConfigureEnv{tikzpicture}{\texfourht@tikz@begin}{\texfourht@tikz@end}{}{}%
\ConfigureEnv{pgfpicture}{\texfourht@tikz@begin}{\texfourht@tikz@end}{}{}%
\catcode`\:=12%
}
% Make the code inserted by tex4ht configurable
%
\let\orig@pgfsys@typesetpicturebox\pgfsys@typesetpicturebox
%\def\pgf@sys@postscript@header#1{{\special{! #1}}}
\endinput
%%% Local Variables:
%%% mode: latex
%%% End: