Debian Codegraph @

texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvisvgm4ht.def

raw
1 % Copyright 2021-2024 by Michal Hoftich
2 % Copyright 2006 by Till Tantau
3 %
4 % This file may be distributed and/or modified
5 %
6 % 1. under the LaTeX Project Public License and/or
7 % 2. under the GNU Public License.
8 %
9 % See the file doc/generic/pgf/licenses/LICENSE for more details.
10
11 \ProvidesFileRCS{pgfsys-dvisvgm4ht.def}
12
13 % Driver commands for tex4ht
14
15 %
16 % Load common pdf commands:
17 %
18
19 % we switched to dvisvgm driver by default. it supports patterns and other features
20 % dvips driver is available through the tikz+ option. It doesn't support everything,
21 % but it worked better with nested pictures in the past.
22 \ifdefined\ifOption
23 \ifOption{tikz+}{\input pgfsys-dvips.def}{\input pgfsys-dvisvgm.def}
24 \else
25 % load the dvips driver by default
26 \input pgfsys-dvisvgm.def
27 \fi
28
29
30 \catcode`\:=11%
31
32 % we must call most of these redefinitions in \AtBeginDocument, because \HLet is available
33 % only at that moment
34 \AtBeginDocument{%
35 % configure the output picture format to svg, as it will require dvisvgm
36 % post processing.
37 \Configure{Picture}{.svg}%
38
39 % insert picture hooks to pgfsys commands
40 % these redefinitions are usually called only with the \tikz command,
41 % they are ignored in tikzpicture environment
42 \def\:tempa#1{%
43 \texfourht@tikz@begin%
44 \csname o:pgfsys@typesetpicturebox:\endcsname{#1}
45 \texfourht@tikz@end%
46 }
47 \HLet\pgfsys@typesetpicturebox\:tempa
48
49 % we must remove Picture-alt in \pgfsys@beginpicture, because it can result in alt text included in the image
50 \def\:tempa{\Configure{Picture-alt}{}\texfourht@tikz@begin\o:pgfsys@beginpicture:}
51 \HLet\pgfsys@beginpicture\:tempa
52 \let\o:pgfsys@endpicture:\pgfsys@endpicture
53 \def\:tempa{\o:pgfsys@endpicture:}
54 \HLet\pgfsys@endpicture\:tempa
55
56 % start picture around TikZ and PGF environments
57 \ConfigureEnv{tikzpicture}{\begingroup\texfourht@tikz@begin}{\texfourht@tikz@end\endgroup}{}{}%
58 \ConfigureEnv{pgfpicture}{\begingroup\texfourht@tikz@begin}{\texfourht@tikz@end\endgroup}{}{}%
59 }
60
61 \def\texfourht@tikz@begin{
62 \protect\csname nested:math\endcsname% support display math
63 \Picture+[\csname a:Picture-alt\endcsname]{}%
64 }
65 \def\texfourht@tikz@end{\EndPicture}
66
67 \catcode`\:=12%
68
69
70 \endinput
71
72
73 %%% Local Variables:
74 %%% mode: latex
75 %%% End: