diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/systemlayer')
3 files changed, 75 insertions, 35 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def index 678fdd4d0bf..8a791ff5ad1 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def @@ -567,7 +567,7 @@ \wd#1=0pt \ht#1=0pt \dp#1=0pt - \hskip\pgf@picminx\box#1% + \hskip\pgf@picminx\box#1\hskip-\pgf@picminx \pgfsys@outerinvoke{% /pgffoa pgf@sys@foa def /pgfsoa pgf@sys@soa def grestore diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvisvgm4ht.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvisvgm4ht.def index 2853147a8d1..4235c75d64f 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvisvgm4ht.def +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvisvgm4ht.def @@ -15,51 +15,68 @@ % % Load common pdf commands: % - %\input pgfsys-dvisvgm.def + +% 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% handle nested uses + \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\fi% + % command used to detect nesting + \def\inside@pict@cmd{}% + \csname a:tikzpicture\endcsname% +} +\def\texfourht@tikz@end{% + \csname b:tikzpicture\endcsname% + \egroup% +} \AtBeginDocument{ - % configure the output picture format to svg + \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} - % 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% - }% + % insert tex4ht hooks around TikZ picture box + \def\pgfsys@typesetpicturebox#1{% + \texfourht@tikz@begin% + \orig@pgfsys@typesetpicturebox{#1}% + \texfourht@tikz@end% + } + % + \ConfigureEnv{tikzpicture}{\ifvmode\Picture*{}\else\Picture+{}\fi\def\inside@pict@cmd{}}{\EndPicture}{}{} + \ConfigureEnv{pgfpicture}{\ifvmode\Picture*{}\else\Picture+{}\fi\def\inside@pict@cmd{}}{\EndPicture}{}{} + \catcode`\:=12 } % 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}}} +\let\orig@pgfsys@typesetpicturebox\pgfsys@typesetpicturebox +%\def\pgf@sys@postscript@header#1{{\special{! #1}}} \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex index 000eef098c2..fd87b091816 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex @@ -1715,7 +1715,30 @@ % inserted into the resulting .pdf/.ps/.xxx file. - +% String comparison +\ifdefined\pdfstrcmp + \let\pgfsys@strcmp\pdfstrcmp +\else\ifdefined\strcmp + \let\pgfsys@strcmp\strcmp +\else\ifdefined\directlua + \directlua{ + local lft = lua.get_functions_table() + lft[\string#lft+1] = function() + local lhs = token.scan_string() + local rhs = token.scan_string() + if lhs < rhs then + tex.sprint(-2, "-1") + elseif lhs == rhs then + tex.sprint(-2, "0") + else + tex.sprint(-2, "1") + end + end + token.set_lua("pgfsys@strcmp", \string#lft, "global") + } +\else + \def\pgfsys@strcmp#1#2{\pgf@sys@fail{string comparison}}% +\fi\fi\fi % Discern the driver: |