summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvisvgm4ht.def
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvisvgm4ht.def')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvisvgm4ht.def70
1 files changed, 70 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvisvgm4ht.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvisvgm4ht.def
new file mode 100644
index 00000000000..2853147a8d1
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvisvgm4ht.def
@@ -0,0 +1,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: