summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-02-27 00:01:50 +0000
committerKarl Berry <karl@freefriends.org>2014-02-27 00:01:50 +0000
commit90ae413a94da014dbf7a6a8ab584f7c668483a5a (patch)
tree4e0528a2b2fb2004988e7fc804ea2f1354f1f5d5 /Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def
parent800cc56380d1edfe567a6a66bef13e8950eb2b0c (diff)
pgf 3.0.0
git-svn-id: svn://tug.org/texlive/trunk@33057 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def352
1 files changed, 193 insertions, 159 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def
index 71f819cc2bc..cc5dadb1173 100644
--- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def
+++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def
@@ -7,11 +7,9 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-tex4ht.def,v 1.23 2010/08/18 12:14:47 ludewich Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-tex4ht.def,v 1.25 2013/08/06 17:46:08 tantau Exp $
-\RequirePackage{xcolor}
-
% Driver commands for tex4ht
@@ -28,6 +26,11 @@
\newcount\pgf@sys@svg@picnum
+\def\pgfsys@pictureboxsynced#1{%
+ \pgfsys@beginscope\pgflowlevelsynccm\box#1\pgfsys@endscope%
+}
+
+
%%
%% initial support of Mathml and xhtml inside svg through the svg:foreignelement tag
%%
@@ -83,49 +86,60 @@
% class="}{\%s}{-\%s}{x-x-\%d}{}{">}{</span>}
%}
+\def\pgfsys@svg@newline{\Hnewline}
+
% we don't want tex4ht putting <p> and </p> tags automatically in our svg code and causing invalid xhtml in our svg pictures
\newif\ifpgfsys@CssIncluded@\pgfsys@CssIncluded@false
\def\pgfsys@beginpicture{%
- \EndP\HtmlParOff
- \pgfkeys{/tikz/tex4ht node/escape=false}% text only nodes are the default. Advantage : pure svg pictures are the default, nicer for text only nodes.
- % Disadvantages : this rendering methods produce more invalid or degraded svg pictures than with the foreignelement tag
+ \EndP\HtmlParOff
+ \pgfkeys{/pgf/tex4ht node/escape=false}%
+ % text only nodes are the default. Advantage : pure svg pictures are
+ % the default, nicer for text only nodes.
+ % Disadvantages : this rendering methods produce more invalid or degraded svg pictures than with the foreignelement tag
%% we use css to control the display of foreignelement rendered text nodes
- \ifpgfsys@CssIncluded@
- \else
- \Css{
- .foreignobject {%
- line-height:100\%;
- font-size:120\%; % this is the trick....a font of size 100% in a box scaled down to half size makes it a half size font.
-% you'll have to double the size of things that you want to have a regular size in this half-scaled box though
- font-family:STIXgeneral,Times,Symbol,cmr10,CMSY10,CMEX10;% can't wait for the stix font...the cmr10, etc font are available from the mozilla site, times and symbols should be okey
- padding:0;
- margin:0;
-% background-color:\#12ff55; usefull for debugging positioning
- text-align:center; % good for centered text nodes...will have to improve that later on...with more integration with tikz options for text nodes
- }
- }%
- \Css{%
- math {%, math[mode="inline"] {
- vertical-align:baseline;
- line-height:100\%;
- font-size:100\%;
- font-family:STIXGeneral,Times,Symbol, cmr10,cmsy10,cmex10,cmmi10;
- font-style: normal;
- margin:0;
-% background-color:\#99ff99;
- padding:0;
- }%
- }%
- \pgfsys@CssIncluded@true
- \fi
+ \ifpgfsys@CssIncluded@
+ \else
+ \Css{
+ .foreignobject {%
+ line-height:100\%;
+ font-size:120\%; % this is the trick....a font of size 100% in
+ % a box scaled down to half size makes it a
+ % half size font.
+ % you'll have to double the size of things
+ % that you want to have a regular size in
+ % this half-scaled box though
+ font-family:STIXgeneral,Times,Symbol,cmr10,CMSY10,CMEX10;%
+ % can't wait for the stix font...the cmr10, etc font are
+ % available from the mozilla site, times and symbols should be
+ % okey
+ padding:0;
+ margin:0;
+ % background-color:\#12ff55; usefull for debugging positioning
+ text-align:center; % good for centered text nodes...will have to improve that later on...with more integration with pgf options for text nodes
+ }
+ }%
+ \Css{%
+ math {%, math[mode="inline"] {
+ vertical-align:baseline;
+ line-height:100\%;
+ font-size:100\%;
+ font-family:STIXGeneral,Times,Symbol, cmr10,cmsy10,cmex10,cmmi10;
+ font-style: normal;
+ margin:0;
+ % background-color:\#99ff99;
+ padding:0;
+ }%
+ }%
+ \pgfsys@CssIncluded@true
+ \fi
}%
\def\pgfsys@endpicture{%
- \HtmlParOn
- \par% FIXME : was '\Par' but that seems to be undefined!?
+ \HtmlParOn
+ \par% FIXME : was '\Par' but that seems to be undefined!?
}%
-% this is okey for both rendering methods for text nodes (mtext or foreignelement)...
+% this is okay for both rendering methods for text nodes (mtext or foreignelement)...
\def\pgfsys@typesetpicturebox#1{%
\global\advance\pgf@sys@svg@picnum by 1\relax%
% Ok, compute width/height
@@ -143,8 +157,7 @@
\pgf@xc=\pgf@x%
\pgf@yc=\pgf@y%
\pgfsysprotocol@flushcurrentprotocol%
- \HCode{<object data="\jobname-\the\pgf@sys@svg@picnum.svg"
- width="}%
+ \HCode{<object data="\jobname-\the\pgf@sys@svg@picnum.svg" width="}%
% Calculate pixel coordinates (this does not really make sense, but
% we have to do it anyway). Assume 96dpi.
\pgf@x=1.3333333\pgf@x%
@@ -159,11 +172,11 @@
\pgfsysprotocol@flushcurrentprotocol%
\pgfsys@invoke{" type="image/svg+xml"><p>SVG-Viewer needed.</p></object>}%
\special{t4ht>\jobname-\the\pgf@sys@svg@picnum.svg}%
-%%%%%%%% This is necessary to control the svg through css
- \pgfkeys{%
- /tikz/tex4ht node/css/.get=\pgfsys@foreignobject@css
- }%
- \pgfsys@invoke{<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>\Hnewline% added that
+ %%%%%%%% This is necessary to control the svg through css
+ \pgfkeys{%
+ /pgf/tex4ht node/css/.get=\pgfsys@foreignobject@css
+ }%
+ \pgfsys@invoke{<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>\Hnewline% added that
<?xml-stylesheet href="\pgfsys@foreignobject@css.css" type="text/css"?>\Hnewline}% added that
%%%%%%%%%%%%%%% maybee I should add an option to change the css, for the whole picture
\pgfsys@invoke{<svg xmlns="http://www.w3.org/2000/svg"
@@ -199,23 +212,24 @@
%% we'll use this hbox for the mtext rendering method (the "text only=true" option)
\def\pgfsys@hbox#1{%
\pgf@x=.5\wd#1%
- \ifx\tikz@textcolor\relax%
- \else%
+ \ifx\tikz@textcolor\relax\else\ifx\tikz@textcolor\@undefined\else%
\ifx\tikz@textcolor\pgfutil@empty%
\pgfsetfillcolor{.}%
\else%
\pgfsetfillcolor{\tikz@textcolor}%
\fi%
- \fi% tweak for TikZ
+ \fi\fi% tweak for TikZ
\HCode{<text
style="stroke:none"
transform="scale(1,-1) translate(\pgf@sys@tonumber{\pgf@x},0)"
text-anchor="middle"
}%
- \ifx\f@size\pgfutil@empty%
- \else%
- \HCode{ font-size="\f@size"}%
- \fi%
+ \ifpgfutil@format@is@latex%
+ \ifx\f@size\pgfutil@empty%
+ \else%
+ \HCode{ font-size="\f@size"}%
+ \fi%
+ \fi%
\HCode{>\Hnewline }%
\wd#1=0pt%
\ht#1=0pt%
@@ -230,44 +244,55 @@
%% we have to use some "evil" ^^ tex4ht hackery
% tex4ht hackery
{% grouping necessary cause we change the catcode of ":"
- \catcode`:=11\relax
- %%% this is necessary to calculate the size of text nodes with inline maths
- % (it is an improvement of tex4ht, got to ask eitan gurary if he could put it in the tex4ht code)
- \gdef\DviMathAlt{%
- \a:DviMath\leavevmode \MathClass \ht:special{t4ht@(}\hbox\bgroup{\expandafter\ifx\csname ht:everypar\endcsname\relax\expandafter\everypar\else \expandafter\ht:everypar\fi{}\leavevmode\ht:special{t4ht@)}}\DviSend
- }%
-% these are configures for the foreignelement rendering method of text nodes : we let tex4ht write xhtml and mathml in the svg picture
-%
- \gdef\pgfsys@foreignobject@configure{%
- \Configure{$}{\Configure{@math}{%\a:mathml
- display="inline" }\DviMathAlt}{\EndDviMath}{}%%% we REALLY need to use \DviMathAlt here instead of \DviMath see above remark
- \Configure{$$}{\Configure{@math}{%\a:mathml
- display="block" }\IgnorePar
- \ifvmode\else \HCode{<!--tex4ht:inline-->}\fi\EndP
- \DviMath}{\EndDviMath\ShowPar\pgfsys@foreignobject@par{\csname HCondtrue\endcsname\noindent}
- }{\DisplayMathtrue}%
- \Configure{SUB}{\Send{BACK}{<\a:mathml msub><\a:mathml mrow\Hnewline>}%
- \Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\TG</\a:mathml msub\Hnewline>}%
- \Configure{SUP}{\Send{BACK}{<\a:mathml msup><\a:mathml mrow\Hnewline>}%
- \Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\TG</\a:mathml msup\Hnewline>}%
- \Configure{SUBSUP}{\Send{BACK}{<\a:mathml msubsup><\a:mathml mrow\Hnewline>}%
- \Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\TG</\a:mathml msubsup\Hnewline>}%
- \Configure{htf}{0}{+}{<span\Hnewline
- class="}{\%s}{-\%s}{x-x-\%d}{}{">}{</span>}%
- }%
- \global\let\pgfsys@foreignobject@par=\par % use this instead of \par -- \Configure is no \long macro (at least in one of the older versions).
-
-% these are the configures for the mtext rendering method of text nodes : we turn everything into regular character (don't want math modes or subsup)
-% and we hope it works (it doesn't if the text nodes aren't simple)
- \gdef\pgfsys@mtext@configure{%
- % no configures for \(\) and \[\] those might be needed for context or Latex. Let me know !
- \Configure{$$}{}{}{}% no block maths
- \Configure{$}{}{}{}%$ no inline maths
- \Configure{SUB}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}}%
- \Configure{SUP}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}}%
- \Configure{SUBSUP}{}{}{}% not both sub and sup
- \Configure{htf} {0}{+}{<tspan font-family="}{\%s}{" font-size="\%s}{}{}{">}{</tspan>}%
- }%
+ \catcode`:=11\relax
+ %%% this is necessary to calculate the size of text nodes with
+ %%% inline maths
+ % (it is an improvement of tex4ht, got to ask eitan gurary if he
+ % could put it in the tex4ht code)
+ \gdef\DviMathAlt{%
+ \a:DviMath\leavevmode \MathClass
+ \ht:special{t4ht@(}\hbox\bgroup{\expandafter\ifx\csname
+ ht:everypar\endcsname\relax\expandafter\everypar\else
+ \expandafter\ht:everypar\fi{}\leavevmode\ht:special{t4ht@)}}\DviSend
+ }%
+ % these are configures for the foreignelement rendering method of text nodes : we let tex4ht write xhtml and mathml in the svg picture
+ %
+ \gdef\pgfsys@foreignobject@configure{%
+ \Configure{$}{\Configure{@math}{%\a:mathml
+ display="inline" }\DviMathAlt}{\EndDviMath}{}%%% we REALLY need to use \DviMathAlt here instead of \DviMath see above remark
+ \Configure{$$}{\Configure{@math}{%\a:mathml
+ display="block" }\IgnorePar
+ \ifvmode\else \HCode{<!--tex4ht:inline-->}\fi\EndP
+ \DviMath}{\EndDviMath\ShowPar\pgfsys@foreignobject@par{\csname HCondtrue\endcsname\noindent}
+ }{\DisplayMathtrue}%
+ \Configure{SUB}{\Send{BACK}{<\a:mathml msub><\a:mathml mrow\Hnewline>}%
+ \Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\TG</\a:mathml msub\Hnewline>}%
+ \Configure{SUP}{\Send{BACK}{<\a:mathml msup><\a:mathml mrow\Hnewline>}%
+ \Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\TG</\a:mathml msup\Hnewline>}%
+ \Configure{SUBSUP}{\Send{BACK}{<\a:mathml msubsup><\a:mathml mrow\Hnewline>}%
+ \Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\TG</\a:mathml msubsup\Hnewline>}%
+ \Configure{htf}{0}{+}{<span\Hnewline
+ class="}{\%s}{-\%s}{x-x-\%d}{}{">}{</span>}%
+ }%
+ \global\let\pgfsys@foreignobject@par=\par % use this instead of \par
+ % -- \Configure is no \long macro (at
+ % least in one of the older
+ % versions).
+
+ % these are the configures for the mtext rendering method of text
+ % nodes : we turn everything into regular character (don't want math
+ % modes or subsup)
+ % and we hope it works (it doesn't if the text nodes aren't simple)
+ \gdef\pgfsys@mtext@configure{%
+ % no configures for \(\) and \[\] those might be needed for
+ % context or Latex. Let me know !
+ \Configure{$$}{}{}{}% no block maths
+ \Configure{$}{}{}{}%$ no inline maths
+ \Configure{SUB}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}}%
+ \Configure{SUP}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}}%
+ \Configure{SUBSUP}{}{}{}% not both sub and sup
+ \Configure{htf} {0}{+}{<tspan font-family="}{\%s}{" font-size="\%s}{}{}{">}{</tspan>}%
+ }%
}%
% a counter to produce unique ids for each text node rendered with foreign element
@@ -295,8 +320,8 @@
\def\pgfutil@endminipage{%
% same thing here
%
-% \ifpgfsys@textonly\else\EndP\HtmlParOff\fi
- \egroup\egroup
+% \ifpgfsys@textonly\else\EndP\HtmlParOff\fi
+ \egroup\egroup
}%
@@ -306,71 +331,73 @@
\newdimen\pgf@t
% this is the alternate hbox routine that renders text nodes through the foreignobject tag
\def\pgfsys@foreignobject@hbox#1{%
- % Compute box y translation (x translation is correct).
- \pgf@y=-\ht#1\relax
- \HCode{<g transform="scale(1,-1) translate(0,\pgf@sys@tonumber{\pgf@y}) % got to translate in y
- scale(0.5,0.5)">\Hnewline}% scaling work around (damn dumb browsers !)
- % Compute box size (scaled 2 times)
- % this is necessary to make the browser scale the font down 50% (the STUPID browsers won't make font-size:50% happen,
- % so we have to work around this by making svg scale the things down 50%, doubling the size of the text node frame (i.e. no changement there)
- \pgf@x=2\wd#1\relax
- \pgf@y=2\ht#1\relax
- \advance\pgf@y by 2\dp#1\relax
- % this is to adjust the y translation to compensate for the differences between the TeX and the Html models for lines
- \setbox\pgfsys@foreignobject@Box=\hbox{abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
- $abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZf_1^1\overline D)_1^1\vec i\vec j$}%
- \pgf@t=\ht#1\relax
- \advance\pgf@t by -\ht\pgfsys@foreignobject@Box\relax
- \pgf@s=\pgf@t\relax
- \advance\pgf@s by \dp#1\relax
- \advance\pgf@s by -\dp\pgfsys@foreignobject@Box\relax
- \ifnum\pgf@s>0\relax
- \pgf@s=0pt
- \pgf@t=0pt
- \else
- \advance \pgf@y by -2\pgf@s\relax
- \pgf@t=2\pgf@t\relax
- \fi
- %
- \HCode{<foreignObject x="0" y="\pgf@sys@tonumber{\pgf@t}"
- width="\pgf@sys@tonumber{\pgf@x}" height="\pgf@sys@tonumber{\pgf@y}">}%
- % this is to make use of the css, class and id options through which you can control the way things display
- \pgfkeys{%
- /tikz/tex4ht node/css/.get=\pgfsys@foreignobject@css,%
- /tikz/tex4ht node/class/.get=\pgfsys@foreignobject@class,%
- /tikz/tex4ht node/id/.get=\pgfsys@foreignobject@id
- }%
- \HCode{<head>\Hnewline
- <link rel="stylesheet" type="text/css" href="\pgfsys@foreignobject@css.css" />\Hnewline
- </head>\Hnewline
-% I'll have to look into this, perhaps there are better doctype....&nbsp; aren't recognised and produces invalid svg pictures
-% a workaround (not implemented yet) would be to make them into entities of the svg picture.
- <body id="\pgfsys@foreignobject@id" class="\pgfsys@foreignobject@class" xmlns="http://www.w3.org/1999/xhtml" >\Hnewline
- <div>\Hnewline
- }%
- \box#1%
- \HCode{%
- </div>\Hnewline
- </body>\Hnewline
- </foreignObject>\Hnewline
- }%
-% debug positioning not needed but it would be nice to let it there to control things later on
-% \HCode{<rect x="0" y="0" width="\pgf@sys@tonumber{\pgf@x}" height="\pgf@sys@tonumber{\pgf@y}"
-% style="fill:yellow;stroke:red; fill-opacity:0.5;stroke-opacity:0.5"/>}
- \HCode{</g>\Hnewline}%
- \global\advance\pgf@sys@svg@nodenum by 1\relax
+ % Compute box y translation (x translation is correct).
+ \pgf@y=-\ht#1\relax
+ \HCode{<g transform="scale(1,-1) translate(0,\pgf@sys@tonumber{\pgf@y}) % got to translate in y
+ scale(0.5,0.5)">\Hnewline}% scaling work around (damn dumb browsers !)
+ % Compute box size (scaled 2 times)
+ % this is necessary to make the browser scale the font down 50% (the STUPID browsers won't make font-size:50% happen,
+ % so we have to work around this by making svg scale the things down 50%, doubling the size of the text node frame (i.e. no changement there)
+ \pgf@x=2\wd#1\relax
+ \pgf@y=2\ht#1\relax
+ \advance\pgf@y by 2\dp#1\relax
+ % this is to adjust the y translation to compensate for the differences between the TeX and the Html models for lines
+ \setbox\pgfsys@foreignobject@Box=\hbox{abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
+ $abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZf_1^1\overline D)_1^1\vec i\vec j$}%
+ \pgf@t=\ht#1\relax
+ \advance\pgf@t by -\ht\pgfsys@foreignobject@Box\relax
+ \pgf@s=\pgf@t\relax
+ \advance\pgf@s by \dp#1\relax
+ \advance\pgf@s by -\dp\pgfsys@foreignobject@Box\relax
+ \ifnum\pgf@s>0\relax
+ \pgf@s=0pt
+ \pgf@t=0pt
+ \else
+ \advance \pgf@y by -2\pgf@s\relax
+ \pgf@t=2\pgf@t\relax
+ \fi
+ %
+ \HCode{<foreignObject x="0" y="\pgf@sys@tonumber{\pgf@t}"
+ width="\pgf@sys@tonumber{\pgf@x}" height="\pgf@sys@tonumber{\pgf@y}">}%
+ % this is to make use of the css, class and id options through which you can control the way things display
+ \pgfkeys{%
+ /pgf/tex4ht node/css/.get=\pgfsys@foreignobject@css,%
+ /pgf/tex4ht node/class/.get=\pgfsys@foreignobject@class,%
+ /pgf/tex4ht node/id/.get=\pgfsys@foreignobject@id
+ }%
+ \HCode{<head>\Hnewline
+ <link rel="stylesheet" type="text/css" href="\pgfsys@foreignobject@css.css" />\Hnewline
+ </head>\Hnewline
+ % I'll have to look into this, perhaps there are better
+ % doctype....&nbsp; aren't recognised and produces invalid svg
+ % pictures a workaround (not implemented yet) would be to make
+ % them into entities of the svg picture.
+ <body id="\pgfsys@foreignobject@id" class="\pgfsys@foreignobject@class" xmlns="http://www.w3.org/1999/xhtml" >\Hnewline
+ <div>\Hnewline
+ }%
+ \box#1%
+ \HCode{%
+ </div>\Hnewline
+ </body>\Hnewline
+ </foreignObject>\Hnewline
+ }%
+ % debug positioning not needed but it would be nice to let it there to control things later on
+ % \HCode{<rect x="0" y="0" width="\pgf@sys@tonumber{\pgf@x}" height="\pgf@sys@tonumber{\pgf@y}"
+ % style="fill:yellow;stroke:red; fill-opacity:0.5;stroke-opacity:0.5"/>}
+ \HCode{</g>\Hnewline}%
+ \global\advance\pgf@sys@svg@nodenum by 1\relax
}%
% the options and the code that controls it all (switches between \pgfsys@mtext@hbox and \pgfsys@foreignelement@hbox)
\pgfkeys{%
- /tikz/.cd,
- tex4ht node/escape/.is choice,
- tex4ht node/escape/false/.code={\let\pgfsys@hbox\pgfsys@mtext@hbox\pgfsys@mtext@configure\pgfsys@textonlytrue},
- tex4ht node/escape/true/.code={\let\pgfsys@hbox\pgfsys@foreignobject@hbox\pgfsys@foreignobject@configure\pgfsys@textonlyfalse},
- tex4ht node/css/.initial=\jobname,
- tex4ht node/class/.initial=foreignobject,
- tex4ht node/id/.initial=\jobname\the\pgf@sys@svg@picnum-\the\pgf@sys@svg@nodenum
+ /pgf/.cd,
+ tex4ht node/escape/.is choice,
+ tex4ht node/escape/false/.code={\let\pgfsys@hbox\pgfsys@mtext@hbox\pgfsys@mtext@configure\pgfsys@textonlytrue},
+ tex4ht node/escape/true/.code={\let\pgfsys@hbox\pgfsys@foreignobject@hbox\pgfsys@foreignobject@configure\pgfsys@textonlyfalse},
+ tex4ht node/css/.initial=\jobname,
+ tex4ht node/class/.initial=foreignobject,
+ tex4ht node/id/.initial=\jobname\the\pgf@sys@svg@picnum-\the\pgf@sys@svg@nodenum
}%
@@ -426,19 +453,26 @@
\pgfsysprotocol@literal{</g>\Hnewline}%
}
-% Protect against color.4ht evil meddling with xcolor:
-\let\pgf@xcolor@declaredcolor=\@declaredcolor
-\let\pgf@xcolor@undeclaredcolor=\@undeclaredcolor
+
+\ifpgfutil@format@is@latex
+ % Protect against color.4ht evil meddling with xcolor:
+ \RequirePackage{xcolor}
+ \let\pgf@xcolor@declaredcolor=\@declaredcolor
+ \let\pgf@xcolor@undeclaredcolor=\@undeclaredcolor
+\fi
\AtBeginDocument{
\let\pgfsys@invoke=\pgfsys@body@invoke
\let\pgfsys@shadingoutsidepgfpicture=\pgfsys@body@shadingoutsidepgfpicture
\let\pgfsys@shadinginsidepgfpicture=\pgfsys@body@shadinginsidepgfpicture
- \let\pgf@texht@declaredcolor=\@declaredcolor
- \let\pgf@texht@undeclaredcolor=\@undeclaredcolor
- \def\@declaredcolor{\ifpgfpicture\expandafter\pgf@xcolor@declaredcolor\else\expandafter\pgf@texht@declaredcolor\fi}
- \def\@undeclaredcolor{\ifpgfpicture\expandafter\pgf@xcolor@undeclaredcolor\else\expandafter\pgf@texht@undeclaredcolor\fi}
- %\ConfigureEnv{pgfpicture}{}{}{}{} there is no environment in plain TeX and this produces errors
+ \ifpgfutil@format@is@latex
+ \let\pgf@texht@declaredcolor=\@declaredcolor
+ \let\pgf@texht@undeclaredcolor=\@undeclaredcolor
+ \def\@declaredcolor{\ifpgfpicture\expandafter\pgf@xcolor@declaredcolor\else\expandafter\pgf@texht@declaredcolor\fi}
+ \def\@undeclaredcolor{\ifpgfpicture\expandafter\pgf@xcolor@undeclaredcolor\else\expandafter\pgf@texht@undeclaredcolor\fi}
+ \fi
+ \def\pgfutil@color{\pgfsetcolor}
+ % \ConfigureEnv{pgfpicture}{}{}{}{} there is no environment in plain TeX and this produces errors
% this might be needed for context or latex though....let me know !
}%