summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pgf/frontendlayer/libraries/tikzlibraryexternal.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/pgf/frontendlayer/libraries/tikzlibraryexternal.code.tex')
-rw-r--r--Master/texmf-dist/tex/latex/pgf/frontendlayer/libraries/tikzlibraryexternal.code.tex33
1 files changed, 33 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/pgf/frontendlayer/libraries/tikzlibraryexternal.code.tex b/Master/texmf-dist/tex/latex/pgf/frontendlayer/libraries/tikzlibraryexternal.code.tex
index 9fe775dc8a8..c3000401b0b 100644
--- a/Master/texmf-dist/tex/latex/pgf/frontendlayer/libraries/tikzlibraryexternal.code.tex
+++ b/Master/texmf-dist/tex/latex/pgf/frontendlayer/libraries/tikzlibraryexternal.code.tex
@@ -22,9 +22,19 @@
% It replaces \tikzpicture/ \endtikzpicture and \tikz and invokes \beginpgfgraphicnamed ... \endpgfgraphicnamed
% commands if necessary.
+% load this package in order to get \pdf@mdfivesum .
+% \pdf@mdfivesum is available for pdftex and lualatex and computes the
+% md5 sum. Note that pdftex has \pdfmdfivesum, but lualatex does not
+% have it.
+\usepackage{pdftexcmds}
+
% source generic implementation:
\input tikzexternalshared.code.tex
+\pgfutil@IfUndefined{pdf@mdfivesum}{}{%
+ \let\tikzexternal@mdfivesum=\pdf@mdfivesum
+}%
+
\def\tikzexternal@TEXDIALECT@begpicture{\begin{tikzpicture}}
\def\tikzexternal@TEXDIALECT@endpicture{\end{tikzpicture}}%
@@ -52,6 +62,7 @@
\noexpand\endgroup
\noexpand#1{\the\t@tikzexternal@tmpa}%
}%
+ \t@tikzexternal@tmpa={}% release memory.
\else
\t@tikzexternal@tmpa=\expandafter{\the\t@tikzexternal@tmpa #2\end{#3}}%
\def\tikzexternal@TEXDIALECT@collectpicture@next{%
@@ -61,8 +72,30 @@
}%
\def\tikzexternal@laTeX@collect@until@end@tikzpicturetikzpicturestring{tikzpicture}%
+\def\tikzexternal@handle@landscape{%
+ \ltx@ifpackageloaded{pdflscape}{%
+ % Work around a bug in conjunction with pdflscape and
+ % external: without this optimize-away-instruction, the
+ % externalized image would be rotated - and it will be rotated
+ % once more again when it is included.
+ %
+ % if we "optimize it away", the landscape stuff will be
+ % omitted. I hope this is enough... might not be entirely
+ % fool-proof; perhaps we need to set it to \relax. For now, it
+ % will probably do the job
+ \tikzset{
+ external/.cd,
+ optimize command away=\landscape,
+ optimize command away=\endlandscape
+ }%
+ }{%
+ }%
+}%
+
\AtBeginDocument{%
\pgfutil@ifundefined{tikzexternalrealjob}{%
\global\let\tikzexternalrealjob=\jobname
}{}%
+ \tikzexternal@handle@landscape
}%
+