summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/pgfplots/pgfplots-macros.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-10-26 21:36:14 +0000
committerKarl Berry <karl@freefriends.org>2012-10-26 21:36:14 +0000
commit4147899f17a6e0b0dde20f309845c4fc0032bce9 (patch)
tree3609a0dc99736d7a2081187b9e12e9bac63c6bb6 /Master/texmf-dist/doc/latex/pgfplots/pgfplots-macros.tex
parent3d12d871ae8a0e941fb2521bdc99ce436aeb17c6 (diff)
pgfplots (26oct12)
git-svn-id: svn://tug.org/texlive/trunk@28094 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/pgfplots/pgfplots-macros.tex')
-rw-r--r--Master/texmf-dist/doc/latex/pgfplots/pgfplots-macros.tex111
1 files changed, 101 insertions, 10 deletions
diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots-macros.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots-macros.tex
index c018e43613a..647b49724a8 100644
--- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots-macros.tex
+++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots-macros.tex
@@ -92,16 +92,21 @@
\def\pgfmanualbar{\char`\|}
\makeatletter
-\newif\ifpgfplotsmanualexternalexpensive
-\let\pgfplotsmanualexternalexpensivetrue@orig=\pgfplotsmanualexternalexpensivetrue
-
-% use \pgfplotsmanualexternalexpensivetrue to externalize expensive
-% examples.
-\def\pgfplotsmanualexternalexpensivetrue{%
- \usepgfplotslibrary{external}
- \pgfplotsmanualexternalexpensivetrue@orig
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\usepgfplotslibrary{external}
+
+% use \pgfplotsmanualenableexternalizationofexpensive in the preamble
+% to enable externalization of expensive examples.
+% This will ONLY externalize expensive examples, i.e. those for which
+% \pgfplotsexpensiveexample is written:
+%
+% \pgfplotsexpensiveexample
+% \begin{codeexample}
+\def\pgfplotsmanualenableexternalizationofexpensive{%
+ \pgfplotsmanual@enable@externalization@for@expensivetrue
\tikzexternalize[
- prefix=figures/expensiveexample,
+ prefix=figures/expensiveexampleX,% the 'X' suffix is to avoid confusion in git: previous versions contained the pdfs in git
figure name={},
export=false, % needs to be activated for single pictures (i.e. expensive ones)
mode=list and make,
@@ -115,6 +120,7 @@
}%
%\pgfkeys{/pgf/images/include external/.code={\href{file:#1}{\pgfimage{#1}}}} % FIXME : NOT FOR THE FINAL VERSION
+\newif\ifpgfplotsmanual@enable@externalization@for@expensive
\newif\ifpgfplots@example@is@expensive
\pgfkeys{
@@ -128,13 +134,98 @@
% Write this macro directly in front of \begin{codeexample} (without arguments):
\def\pgfplotsexpensiveexample{%
- \ifpgfplotsmanualexternalexpensive
+ \ifpgfplotsmanual@enable@externalization@for@expensive
\pgfplots@example@is@expensivetrue
\else
\message{[NOTE: I am now about to typeset an expensive example. You will need to ENLARGE YOUR TeX MEMORY CAPACITIES if this fails.]}%
\fi
}%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newif\ifpgfplotsmanualhtmlmode
+
+% MACROS FOR HTML OUTPUT:
+% HTML will be compiled in a separate folder. See the Makefile
+\tikzset{
+ external/html export mode/.style={
+ system call={%
+ pdflatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\\def\\pgfplotsmanualhtlatexmode{1}\texsource" && pdftoppm "\image.pdf" | pnmtopng > "\image.png"%
+ },
+ /pgf/images/external info,
+ /pgf/images/include external/.code={%
+ \includegraphics
+ [width=\pgfexternalwidth,height=\pgfexternalheight]
+ {##1.png}%
+ },
+ prefix=figures/generated/,
+ figure name={manual},
+ mode=list and make,
+ verbose=false,
+ },
+}
+
+\def\pgfplotsmanual@configure@for@htlatexmode{%
+ % disable this; we will externalize everything now:
+ \let\pgfplotsmanualenableexternalizationofexpensive=\relax
+ %
+ \message{^^Jpgfplots manual: initializing external lib for HTML output (png)^^J}%
+ \tikzexternalize[
+ html export mode,
+ ]
+ %
+ \@ifpackageloaded{tex4ht}{%
+ \usepackage[html,png,3]{tex4ht}
+ \tikzset{external/mode=only graphics}%
+ \patches@for@htlatex
+ }{%
+ }%
+ %
+ \pgfplotsmanualhtmlmodetrue
+ %
+ \gdef\pgfsys@imagesuffixlist{.png}
+ %
+ \tikzifexternalizing{%
+ %\nofiles
+ \pgfkeys{/pdflinks/codeexample links=false}%
+ }{}%
+}
+
+% explanation of how to customize tex4ht:
+% http://www.cvr.cc/tex4ht-low-level-commands/#more-482
+%
+% some reference:
+% http://www.cvr.cc/tex4ht-options/
+%
+% some tex4ht mailing list discussion:
+% http://tug.org/pipermail/tex4ht/2010q4/000246.html
+\def\patches@for@htlatex{%
+ \let\savecolor\color
+ \NewConfigure{color}[2]{\def\a at color{##1}\def\b at color{##2}}
+ \def\@@tmp##1{\a at color##1\b at color\savecolor{##1}\aftergroup\endspan}
+ \let\color\@@tmp
+ \def\endspan{\Tg</span>}
+ \Configure{color}{\HCode{<span style="color:}}{\HCode{;">}}
+}%
+
+\@ifpackageloaded{tex4ht}{
+ % always active here:
+ \def\pgfplotsmanualhtlatexmode{1}%
+}{
+}
+
+% the macro \pgfplotsmanualhtlatexmode should be set from command line
+% (to any value). If it is known, the manual will be translated to
+% HTML.
+\pgfutil@ifundefined{pgfplotsmanualhtlatexmode}{%
+}{%
+ \pgfplotsmanual@configure@for@htlatexmode
+}%
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
\newenvironment{addplotoperation}[3][]{
\begin{pgfmanualentry}