summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pgf/macros/pgfmanual-en-macros.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/macros/pgfmanual-en-macros.tex')
-rw-r--r--Master/texmf-dist/doc/generic/pgf/macros/pgfmanual-en-macros.tex549
1 files changed, 500 insertions, 49 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/macros/pgfmanual-en-macros.tex b/Master/texmf-dist/doc/generic/pgf/macros/pgfmanual-en-macros.tex
index 9bfa33d0364..116cde6d9bf 100644
--- a/Master/texmf-dist/doc/generic/pgf/macros/pgfmanual-en-macros.tex
+++ b/Master/texmf-dist/doc/generic/pgf/macros/pgfmanual-en-macros.tex
@@ -7,10 +7,13 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-% $Header: /cvsroot/pgf/pgf/doc/generic/pgf/macros/pgfmanual-en-macros.tex,v 1.28 2008/02/20 11:00:42 tantau Exp $
+% $Header: /cvsroot/pgf/pgf/doc/generic/pgf/macros/pgfmanual-en-macros.tex,v 1.45 2009/11/15 13:13:24 ludewich Exp $
+
\providecommand\href[2]{\texttt{#1}}
+\providecommand\hypertarget[2]{\texttt{#1}}
+\providecommand\hyperlink[2]{\texttt{#1}}
\colorlet{examplefill}{yellow!80!black}
@@ -28,6 +31,7 @@
\pgfmanualentryheadline{\texttt{\string\pgfpagesuselayout\char`\{\declare{#1}\char`\}}\oarg{options}}
\index{#1@\protect\texttt{#1} layout}%
\index{Page layouts!#1@\protect\texttt{#1}}%
+ \pgfmanualpdflabel{#1}{}%
\pgfmanualbody
}
{
@@ -44,55 +48,152 @@
\end{pgfmanualentry}
}
+\newenvironment{commandlist}[1]{%
+ \begin{pgfmanualentry}
+ \foreach \xx in {#1} {%
+ \expandafter\extractcommand\xx\@@
+ }%
+ \pgfmanualbody
+}{%
+ \end{pgfmanualentry}
+}%
+
+% \begin{internallist}[register]{\pgf@xa}
+% \end{internallist}
+%
+% \begin{internallist}[register]{\pgf@xa,\pgf@xb}
+% \end{internallist}
+\newenvironment{internallist}[2][register]{%
+ \begin{pgfmanualentry}
+ \foreach \xx in {#2} {%
+ \expandafter\extractinternalcommand\expandafter{\xx}{#1}%
+ }%
+ \pgfmanualbody
+}{%
+ \end{pgfmanualentry}
+}%
+\def\extractinternalcommand#1#2{%
+ \pgfmanualentryheadline{Internal #2 \declare{\texttt{\string#1}}}%
+ \removeats{#1}%
+ \index{Internals!\strippedat @\protect\myprintocmmand{\strippedat}}%
+ \index{\strippedat @\protect\myprintocmmand{\strippedat}}%
+ \pgfmanualpdflabel{\textbackslash\strippedat}{}%
+}
+
%% MW: START MATH MACROS
-\def\mvar#1{{\rmfamily\textit{#1}}}
+\def\mvar#1{{\ifmmode\textrm{\textit{#1}}\else\rmfamily\textit{#1}\fi}}
\makeatletter
\def\extractmathfunctionname#1{\extractmathfunctionname@#1(,)\tmpa\tmpb}
\def\extractmathfunctionname@#1(#2)#3\tmpb{\def\mathname{#1}}
-\def\extractmathoperatorname{\begingroup\def\mvar##1{}\def\ {}\extractmathoperatorname@}
-\def\extractmathoperatorname@#1{\xdef\mathname{#1}\endgroup}
-
\makeatother
-\def\vskipspecial#1{\vskip#1\vskip0em}
-
\newenvironment{math-function}[1]{
+ \def\mathdefaultname{#1}
+ \extractmathfunctionname{#1}
+ \edef\mathurl{{math:\mathname}}\expandafter\hypertarget\expandafter{\mathurl}{}%
\begin{pgfmanualentry}
- \extractmathfunctionname{#1}
\pgfmanualentryheadline{\texttt{#1}}%
\index{\mathname @\protect\texttt{\mathname} math function}%
- \index{Math functions!\mathname @\protect\texttt{\mathname}}
+ \index{Math functions!\mathname @\protect\texttt{\mathname}}%
\pgfmanualbody
}
{
- \end{pgfmanualentry}\vskipspecial{-3em}
+ \end{pgfmanualentry}
}
-\newenvironment{math-operator}[1]{
+\def\pgfmanualemptytext{}
+\def\pgfmanualvbarvbar{\char`\|\char`\|}
+
+\newenvironment{math-operator}[4][]{%
\begin{pgfmanualentry}
- \extractmathoperatorname{#1}
- \pgfmanualentryheadline{\texttt{#1}}%
- \index{\mathname @\protect\texttt{\mathname} math operator}%
- \index{Math operators!\mathname @\protect\texttt{\mathname}}
- \pgfmanualbody
-}
-{%
- \end{pgfmanualentry}\vskipspecial{-3em}
+ \csname math#3operator\endcsname{#2}{#4}
+ \def\mathtest{#4}%
+ \ifx\mathtest\pgfmanualemptytext%
+ \def\mathtype{(#3 operator)}
+ \else%
+ \def\mathtype{(#3 operator; uses the \texttt{#4} function)}
+ \fi%
+ \pgfmanualentryheadline{\mathexample\hfill\mathtype}%
+ \def\mathtest{#1}%
+ \ifx\mathtest\pgfmanualemptytext%
+ \index{#2@\protect\texttt{#2} #3 math operator}%
+ \index{Math operators!#2@\protect\texttt{#2}}%
+ \fi%
+ \pgfmanualbody
}
+{\end{pgfmanualentry}}
-\newenvironment{math-constant}[1]{
+\newenvironment{math-operators}[5][]{%
\begin{pgfmanualentry}
- \pgfmanualentryheadline{\texttt{#1}}%
- \index{#1@\protect\texttt{#1} math constant}%
- \index{Math constants!#1@\protect\texttt{#1}}
- \pgfmanualbody
+ \csname math#4operator\endcsname{#2}{#3}
+ \def\mathtest{#5}%
+ \ifx\mathtest\pgfmanualemptytext%
+ \def\mathtype{(#4 operators)}
+ \else%
+ \def\mathtype{(#4 operators; use the \texttt{#5} function)}
+ \fi%
+ \pgfmanualentryheadline{\mathexample\hfill\mathtype}%
+ \def\mathtest{#1}%
+ \ifx\mathtest\pgfmanualemptytext%
+ \index{#2#3@\protect\texttt{#2\protect\ #3} #4 math operators}%
+ \index{Math operators!#2#3@\protect\texttt{#2\protect\ #3}}%
+ \fi%
+ \pgfmanualbody
}
-{
- \end{pgfmanualentry}\vskipspecial{-3em}
+{\end{pgfmanualentry}}
+
+\def\mathinfixoperator#1#2{%
+ \def\mathoperator{\texttt{#1}}%
+ \def\mathexample{\mvar{x}\space\texttt{#1}\space\mvar{y}}%
+}
+
+\def\mathprefixoperator#1#2{%
+ \def\mathoperator{\texttt{#1}}%
+ \def\mathexample{\texttt{#1}\mvar{x}}%
+}
+
+\def\mathpostfixoperator#1#2{%
+ \def\mathoperator{\texttt{#1}}
+ \def\mathexample{\mvar{x}\texttt{#1}}%
+}
+
+\def\mathgroupoperator#1#2{%
+ \def\mathoperator{\texttt{#1\ #2}}%
+ \def\mathexample{\texttt{#1}\mvar{x}\texttt{#2}}%
+}
+
+\expandafter\let\csname matharray accessoperator\endcsname=\mathgroupoperator
+\expandafter\let\csname matharrayoperator\endcsname=\mathgroupoperator
+
+\def\mathconditionaloperator#1#2{%
+ \def\mathoperator{#1\space#2}
+ \def\mathexample{\mvar{x}\ \texttt{#1}\ \mvar{y}\ {\texttt{#2}}\ \mvar{z}}
+}
+
+\newcommand\mathcommand[1][\mathdefaultname]{%
+ \expandafter\makemathcommand#1(\empty)\stop%
+ \expandafter\extractcommand\mathcommandname\@@%
+ \medskip
}
+\makeatletter
+
+\def\makemathcommand#1(#2)#3\stop{%
+ \expandafter\def\expandafter\mathcommandname\expandafter{\csname pgfmath#1\endcsname}%
+ \ifx#2\empty%
+ \else%
+ \@makemathcommand#2,\stop,
+ \fi}
+\def\@makemathcommand#1,{%
+ \ifx#1\stop%
+ \else%
+ \expandafter\def\expandafter\mathcommandname\expandafter{\mathcommandname{\ttfamily\char`\{#1\char`\}}}%
+ \expandafter\@makemathcommand%
+ \fi}
+\makeatother
+
\def\calcname{\textsc{calc}}
%% MW: END MATH MACROS
@@ -100,9 +201,12 @@
\def\extractcommand#1#2\@@{%
\pgfmanualentryheadline{\declare{\texttt{\string#1}}#2}%
\removeats{#1}%
- \index{\strippedat @\protect\myprintocmmand{\strippedat}}}
+ \index{\strippedat @\protect\myprintocmmand{\strippedat}}
+ \pgfmanualpdflabel{\textbackslash\strippedat}{}%
+}
+% \begin{environment}{{name}\marg{arguments}}
\renewenvironment{environment}[1]{
\begin{pgfmanualentry}
\extractenvironement#1\@@
@@ -117,7 +221,9 @@
\pgfmanualentryheadline{{\ttfamily\ \ }\meta{environment contents}}%
\pgfmanualentryheadline{{\ttfamily\char`\\end\char`\{\declare{#1}\char`\}}}%
\index{#1@\protect\texttt{#1} environment}%
- \index{Environments!#1@\protect\texttt{#1}}}
+ \index{Environments!#1@\protect\texttt{#1}}
+ \pgfmanualpdflabel{#1}{}%
+}
\newenvironment{plainenvironment}[1]{
@@ -134,7 +240,8 @@
\pgfmanualentryheadline{{\ttfamily\ \ }\meta{environment contents}}%
\pgfmanualentryheadline{{\ttfamily\declare{\char`\\end#1}}}%
\index{#1@\protect\texttt{#1} environment}%
- \index{Environments!#1@\protect\texttt{#1}}}
+ \index{Environments!#1@\protect\texttt{#1}}%
+}
\newenvironment{contextenvironment}[1]{
@@ -159,6 +266,19 @@
\pgfmanualentryheadline{Shape {\ttfamily\declare{#1}}}%
\index{#1@\protect\texttt{#1} shape}%
\index{Shapes!#1@\protect\texttt{#1}}
+ \pgfmanualpdflabel{#1}{}%
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+\newenvironment{shading}[1]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{Shading {\ttfamily\declare{#1}}}%
+ \index{#1@\protect\texttt{#1} shading}%
+ \index{Shadings!#1@\protect\texttt{#1}}
+ \pgfmanualpdflabel{#1}{}%
\pgfmanualbody
}
{
@@ -166,6 +286,18 @@
}
+\newenvironment{dataformat}[1]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{Format {\ttfamily\declare{#1}}}%
+ \index{#1@\protect\texttt{#1} format}%
+ \index{Formats!#1@\protect\texttt{#1}}
+ \pgfmanualpdflabel{#1}{}%
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
\newenvironment{handler}[1]{
\begin{pgfmanualentry}
\extracthandler#1\@nil%
@@ -180,6 +312,7 @@
\pgfmanualentryheadline{Key handler \meta{key}{\ttfamily/\declare{#1}}#2}%
\index{\gobble#1@\protect\texttt{#1} handler}%
\index{Key handlers!#1@\protect\texttt{#1}}
+ \pgfmanualpdflabel{/handlers/#1}%
}
@@ -196,7 +329,29 @@
\end{pgfmanualentry}
}
-
+\def\choicesep{$\vert$}%
+\def\choicearg#1{\texttt{#1}}
+
+\newif\iffirstchoice
+
+% \mchoice{choice1,choice2,choice3}
+\newcommand\mchoice[1]{%
+ \begingroup
+ \firstchoicetrue
+ \foreach \mchoice@ in {#1} {%
+ \iffirstchoice
+ \global\firstchoicefalse
+ \else
+ \choicesep
+ \fi
+ \choicearg{\mchoice@}%
+ }%
+ \endgroup
+}%
+
+% \begin{key}{/path/x=value}
+% \begin{key}{/path/x=value (initially XXX)}
+% \begin{key}{/path/x=value (default XXX)}
\newenvironment{key}[1]{
\begin{pgfmanualentry}
\def\extrakeytext{}
@@ -208,6 +363,49 @@
\end{pgfmanualentry}
}
+% \insertpathifneeded{a key}{/pgf} -> assign mykey={/pgf/a key}
+% \insertpathifneeded{/tikz/a key}{/pgf} -> assign mykey={/tikz/a key}
+%
+% #1: the key
+% #2: a default path (or empty)
+\def\insertpathifneeded#1#2{%
+ \def\insertpathifneeded@@{#2}%
+ \ifx\insertpathifneeded@@\empty
+ \def\mykey{#1}%
+ \else
+ \insertpathifneeded@#2\@nil
+ \ifpgfutil@in@
+ \def\mykey{#2/#1}%
+ \else
+ \def\mykey{#1}%
+ \fi
+ \fi
+}%
+\def\insertpathifneeded@#1#2\@nil{%
+ \def\insertpathifneeded@@{#1}%
+ \def\insertpathifneeded@@@{/}%
+ \ifx\insertpathifneeded@@\insertpathifneeded@@@
+ \pgfutil@in@true
+ \else
+ \pgfutil@in@false
+ \fi
+}%
+
+% \begin{keylist}[default path]
+% {/path/option 1=value,/path/option 2=value2}
+% \end{keylist}
+\newenvironment{keylist}[2][]{%
+ \begin{pgfmanualentry}
+ \def\extrakeytext{}%
+ \foreach \xx in {#2} {%
+ \expandafter\insertpathifneeded\expandafter{\xx}{#1}%
+ \expandafter\extractkey\mykey\@nil%
+ }%
+ \pgfmanualbody
+}{%
+ \end{pgfmanualentry}
+}%
+
\def\extractkey#1\@nil{%
\pgfutil@in@={#1}%
\ifpgfutil@in@%
@@ -263,7 +461,11 @@
\decompose#1/\nil%
}
-\def\keyalias#1{\vspace{-3pt}\item{\small alias {\ttfamily/#1/\myname}}\vspace{-2pt}\par}
+% Introduces a key alias '/#1/<name of current key>'
+% to be used inside of \begin{key} ... \end{key}
+\def\keyalias#1{\vspace{-3pt}\item{\small alias {\ttfamily/#1/\myname}}\vspace{-2pt}\par
+ \pgfmanualpdflabel{/#1/\myname}{}%
+}
\newif\iffirsttime
@@ -278,6 +480,13 @@
\def\myname{#1}%
\else%
\iffirsttime
+ \begingroup
+ % also make a pdf link anchor with full key path.
+ \def\hyperlabelwithoutslash##1/\nil{%
+ \pgfmanualpdflabel{##1}{}%
+ }%
+ \hyperlabelwithoutslash/#1/#2\nil
+ \endgroup
\def\mypath{#1@\protect\texttt{/#1/}!}%
\firsttimefalse
\else
@@ -288,12 +497,91 @@
\fi%
}
+\def\indexkey#1{%
+ \def\mypath{}%
+ \decompose#1/\nil%
+}
+
+\newenvironment{predefinedmethod}[1]{
+ \begin{pgfmanualentry}
+ \extractpredefinedmethod#1\@nil
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+\def\extractpredefinedmethod#1(#2)\@nil{%
+ \pgfmanualentryheadline{Method \declare{\ttfamily #1}\texttt(#2\texttt) \hfill(predefined for all classes)}
+ \index{#1@\protect\texttt{#1} method}%
+ \index{Methods!#1@\protect\texttt{#1}}
+ \pgfmanualpdflabel{#1}{}%
+}
+
+
+\newenvironment{ooclass}[1]{
+ \begin{pgfmanualentry}
+ \def\currentclass{#1}
+ \pgfmanualentryheadline{Class \declare{\texttt{#1}}}
+ \index{#1@\protect\texttt{#1} class}%
+ \index{Class #1@Class \protect\texttt{#1}}%
+ \index{Classes!#1@\protect\texttt{#1}}
+ \pgfmanualpdflabel{#1}{}%
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+\newenvironment{method}[1]{
+ \begin{pgfmanualentry}
+ \extractmethod#1\@nil
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+\def\extractmethod#1(#2)\@nil{%
+ \def\test{#1}
+ \ifx\test\currentclass
+ \pgfmanualentryheadline{Constructor \declare{\ttfamily #1}\texttt(#2\texttt)}
+ \else
+ \pgfmanualentryheadline{Method \declare{\ttfamily #1}\texttt(#2\texttt)}
+ \fi
+ \index{#1@\protect\texttt{#1} method}%
+ \index{Methods!#1@\protect\texttt{#1}}
+ \index{Class \currentclass!#1@\protect\texttt{#1}}%
+ \pgfmanualpdflabel{#1}{}%
+}
+
+\newenvironment{attribute}[1]{
+ \begin{pgfmanualentry}
+ \extractattribute#1\@nil
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+\def\extractattribute#1=#2;\@nil{%
+ \def\test{#2}%
+ \ifx\test\@empty
+ \pgfmanualentryheadline{Private attribute \declare{\ttfamily #1} \hfill (initially empty)}
+ \else
+ \pgfmanualentryheadline{Private attribute \declare{\ttfamily #1} \hfill (initially {\ttfamily #2})}
+ \fi
+ \index{#1@\protect\texttt{#1} attribute}%
+ \index{Attributes!#1@\protect\texttt{#1}}
+ \index{Class \currentclass!#1@\protect\texttt{#1}}%
+ \pgfmanualpdflabel{#1}{}%
+}
+
+
\newenvironment{predefinednode}[1]{
\begin{pgfmanualentry}
\pgfmanualentryheadline{Predefined node {\ttfamily\declare{#1}}}%
\index{#1@\protect\texttt{#1} node}%
\index{Predefined node!#1@\protect\texttt{#1}}
+ \pgfmanualpdflabel{#1}{}%
\pgfmanualbody
}
{
@@ -305,6 +593,7 @@
\pgfmanualentryheadline{Coordinate system {\ttfamily\declare{#1}}}%
\index{#1@\protect\texttt{#1} coordinate system}%
\index{Coordinate systems!#1@\protect\texttt{#1}}
+ \pgfmanualpdflabel{#1}{}%
\pgfmanualbody
}
{
@@ -345,6 +634,23 @@
\ifx\pgfmanualtest\@empty%
\index{#2@\protect\texttt{#2} path operation}%
\index{Path operations!#2@\protect\texttt{#2}}%
+ \pgfmanualpdflabel{#2}{}%
+ \fi%
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+\newenvironment{datavisualizationoperation}[3][]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{\textcolor{gray}{{\ttfamily\char`\\datavisualization}\
+ \ \dots}
+ \declare{\texttt{#2}}#3\ \textcolor{gray}{\dots\texttt{;}}}%
+ \def\pgfmanualtest{#1}%
+ \ifx\pgfmanualtest\@empty%
+ \index{#2@\protect\texttt{#2} (data visualization)}%
+ \index{Data visualization!#2@\protect\texttt{#2}}%
+ \pgfmanualpdflabel{#2}{}%
\fi%
\pgfmanualbody
}
@@ -356,7 +662,9 @@
\def\extractcommand#1#2\@@{%
\pgfmanualentryheadline{\declare{\texttt{\string#1}}#2}%
\removeats{#1}%
- \index{\strippedat @\protect\myprintocmmand{\strippedat}}}
+ \index{\strippedat @\protect\myprintocmmand{\strippedat}}
+ \pgfmanualpdflabel{\textbackslash\strippedat}{}%
+}
\def\doublebs{\texttt{\char`\\\char`\\}}
@@ -383,6 +691,7 @@
\index{Modules!#1@\protect\texttt{#1}}%
\pgfmanualentryheadline{{\ttfamily\char`\\usepgfmodule[\declare{#1}]\space\space \char`\%\space\space Con\TeX t\space and pure pgf}}
\pgfmanualbody
+ \pgfmanualpdflabel{#1}{}%
}
{
\end{pgfmanualentry}
@@ -400,6 +709,7 @@
\pgfmanualentryheadline{{\ttfamily\char`\\usetikzlibrary[\declare{#1}]\space
\char`\%\space\space Con\TeX t\space when using \tikzname}}
\pgfmanualbody
+ \pgfmanualpdflabel{#1}{}%
}
{
\end{pgfmanualentry}
@@ -412,6 +722,7 @@
\index{Libraries!#1@\protect\texttt{#1}}%
\pgfmanualentryheadline{{\ttfamily\char`\\usetikzlibrary[\declare{#1}]\space \char`\%\space\space Con\TeX t}}
\pgfmanualbody
+ \pgfmanualpdflabel{#1}{}%
}
{
\end{pgfmanualentry}
@@ -454,6 +765,7 @@
\def\beamer{\textsc{beamer}}
\def\pdf{\textsc{pdf}}
+\def\eps{\texttt{eps}}
\def\pgfname{\textsc{pgf}}
\def\tikzname{Ti\emph{k}Z}
\def\pstricks{\textsc{pstricks}}
@@ -560,6 +872,28 @@
\draw (0pt,.5ex) -- (1cm,.5ex);
\end{tikzpicture}
}
+\newcommand\symarrowdouble[1]{
+ \index{#1@\protect\texttt{#1} arrow tip}%
+ \index{Arrow tips!#1@\protect\texttt{#1}}
+ \texttt{#1}& yields thick
+ \begin{tikzpicture}[arrows={#1-#1},thick,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture}
+ and thin
+ \begin{tikzpicture}[arrows={#1-#1},thin,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture}, double
+ \begin{tikzpicture}[arrows={#1-#1},thick,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture} and
+ \begin{tikzpicture}[arrows={#1-#1},thin,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture}
+}
\newcommand\sarrow[2]{
\index{#1@\protect\texttt{#1} arrow tip}%
@@ -577,6 +911,30 @@
\end{tikzpicture}
}
+\newcommand\sarrowdouble[2]{
+ \index{#1@\protect\texttt{#1} arrow tip}%
+ \index{Arrow tips!#1@\protect\texttt{#1}}
+ \index{#2@\protect\texttt{#2} arrow tip}%
+ \index{Arrow tips!#2@\protect\texttt{#2}}
+ \texttt{#1-#2}& yields thick
+ \begin{tikzpicture}[arrows={#1-#2},thick,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture} and thin
+ \begin{tikzpicture}[arrows={#1-#2},thin,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture}, double
+ \begin{tikzpicture}[arrows={#1-#2},thick,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture} and
+ \begin{tikzpicture}[arrows={#1-#2},thin,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture}
+}
+
\newcommand\carrow[1]{
\index{#1@\protect\texttt{#1} arrow tip}%
\index{Arrow tips!#1@\protect\texttt{#1}}
@@ -617,11 +975,16 @@
\catcode`\\=12 |gdef|find@example#1\end{codeexample}[|endofcodeexample[#1]]
|endgroup
+% define \returntospace.
+%
+% It should define NEWLINE as {}, spaces and tabs as \space.
\begingroup
\catcode`\^=7
\catcode`\^^M=13
+\catcode`\^^I=13
\catcode`\ =13%
-\gdef\returntospace{\catcode`\ =13\def {\space}\catcode`\^^M=13\def^^M{}}%
+\gdef\returntospace{\catcode`\ =13\def {\space}\catcode`\^^I=13\def^^I{\space}}
+\gdef\showreturn{\show^^M}
\endgroup
\begingroup
@@ -634,19 +997,86 @@
\gdef\@typeset@till@return#1^^M{{\def%{\char`\%}\textsl{\char`\%#1}}\par}
\endgroup
-\define@key{codeexample}{width}{\setlength\codeexamplewidth{#1}}
-\define@key{codeexample}{graphic}{\colorlet{graphicbackground}{#1}}
-\define@key{codeexample}{code}{\colorlet{codebackground}{#1}}
-\define@key{codeexample}{execute code}{\csname code@execute#1\endcsname}
-\define@key{codeexample}{code only}[]{\code@executefalse}
-\define@key{codeexample}{pre}{\def\code@pre{#1}}
-\define@key{codeexample}{post}{\def\code@post{#1}}
-\define@key{codeexample}{vbox}[]{\def\code@pre{\vbox\bgroup\setlength{\hsize}{\linewidth-6pt}}\def\code@post{\egroup}}
-\define@key{codeexample}{ignorespaces}[]{\let\@gobble@till@return=\@gobble@till@return@ignore}
-\define@key{codeexample}{leave comments}[]{\def\code@catcode@hook{\catcode`\%=12}\let\commenthandler=\relax\let\typesetcomment=\relax}
-
-\def\code@pre{}
-\def\code@post{}
+% Define tab-implementation functions
+% \codeexample@tabinit@replacementchars@
+% and
+% \codeexample@tabinit@catcode@
+%
+% They should ONLY be used in case that tab replacement is active.
+%
+% This here is merely a preparation step.
+%
+% Idea:
+% \codeexample@tabinit@catcode@ will make TAB active
+% and
+% \codeexample@tabinit@replacementchars@ will insert as many spaces as
+% /codeexample/tabsize contains.
+{
+\catcode`\^^I=13
+% ATTENTION: do NOT use tabs in these definitions!!
+\gdef\codeexample@tabinit@replacementchars@{%
+ \begingroup
+ \count0=\pgfkeysvalueof{/codeexample/tabsize}\relax
+ \toks0={}%
+ \loop
+ \ifnum\count0>0
+ \advance\count0 by-1
+ \toks0=\expandafter{\the\toks0\ }%
+ \repeat
+ \xdef\codeexample@tabinit@replacementchars@@{\the\toks0}%
+ \endgroup
+ \let^^I=\codeexample@tabinit@replacementchars@@
+}%
+\gdef\codeexample@tabinit@catcode@{\catcode`\^^I=13}%
+}%
+
+% Called after any options have been set. It assigns
+% \codeexample@tabinit@catcode
+% and
+% \codeexample@tabinit@replacementchars
+% which are used inside of
+%\begin{codeexample}
+% ...
+%\end{codeexample}
+%
+% \codeexample@tabinit@catcode is either \relax or it makes tab
+% active.
+%
+% \codeexample@tabinit@replacementchars is either \relax or it inserts
+% a proper replacement sequence for tabs (as many spaces as
+% configured)
+\def\codeexample@tabinit{%
+ \ifnum\pgfkeysvalueof{/codeexample/tabsize}=0\relax
+ \let\codeexample@tabinit@replacementchars=\relax
+ \let\codeexample@tabinit@catcode=\relax
+ \else
+ \let\codeexample@tabinit@catcode=\codeexample@tabinit@catcode@
+ \let\codeexample@tabinit@replacementchars=\codeexample@tabinit@replacementchars@
+ \fi
+}
+
+\pgfqkeys{/codeexample}{%
+ width/.code= {\setlength\codeexamplewidth{#1}},
+ graphic/.code= {\colorlet{graphicbackground}{#1}},
+ code/.code= {\colorlet{codebackground}{#1}},
+ execute code/.is if=code@execute,
+ code only/.code= {\code@executefalse},
+ pre/.store in=\code@pre,
+ post/.store in=\code@post,
+ % #1 is the *complete* environment contents as it shall be
+ % typeset. In particular, the catcodes are NOT the normal ones.
+ typeset listing/.code= {#1},
+ render instead/.store in=\code@render,
+ vbox/.code= {\def\code@pre{\vbox\bgroup\setlength{\hsize}{\linewidth-6pt}}\def\code@post{\egroup}},
+ ignorespaces/.code= {\let\@gobble@till@return=\@gobble@till@return@ignore},
+ leave comments/.code= {\def\code@catcode@hook{\catcode`\%=12}\let\commenthandler=\relax\let\typesetcomment=\relax},
+ tabsize/.initial=0,% FIXME : this here is merely used for indentation. It is just a TAB REPLACEMENT.
+ every codeexample/.style={width=4cm+7pt},
+}
+
+\let\code@pre\pgfutil@empty
+\let\code@post\pgfutil@empty
+\let\code@render\pgfutil@empty
\def\code@catcode@hook{}
\newdimen\codeexamplewidth
@@ -655,8 +1085,8 @@
\def\codeexample[#1]{%
\begingroup%
\code@executetrue
- \setlength\codeexamplewidth{4cm+7pt}
- \setkeys{codeexample}{#1}%
+ \pgfqkeys{/codeexample}{every codeexample,#1}%
+ \codeexample@tabinit% assigns \codeexample@tabinit@[catcode,replacementchars]
\parindent0pt
\begingroup%
\par%
@@ -668,21 +1098,28 @@
\catcode`\%=13%
\catcode`\^^M=13%
\code@catcode@hook%
+ \codeexample@tabinit@catcode
\relax%
\find@example}
\def\endofcodeexample#1{%
\endgroup%
\ifcode@execute%
\setbox\codeexamplebox=\hbox{%
+ \ifx\code@render\pgfutil@empty%
{%
{%
\returntospace%
\commenthandler%
\xdef\code@temp{#1}% removes returns and comments
}%
+ \catcode`\^^M=9%
\colorbox{graphicbackground}{\color{black}\ignorespaces%
\code@pre\expandafter\scantokens\expandafter{\code@temp\ignorespaces}\code@post\ignorespaces}%
}%
+ \else%
+ \colorbox{graphicbackground}{\color{black}\ignorespaces%
+ \code@render}%
+ \fi%
}%
\ifdim\wd\codeexamplebox>\codeexamplewidth%
\def\code@start{\par}%
@@ -725,6 +1162,7 @@
\frenchspacing\@vobeyspaces
\normalfont\ttfamily\footnotesize
\typesetcomment%
+ \codeexample@tabinit@replacementchars
\@tempswafalse
\def\par{%
\if@tempswa
@@ -735,7 +1173,8 @@
\fi}%
\obeylines
\everypar \expandafter{\the\everypar \unpenalty}%
- #1}
+ \pgfkeysvalueof{/codeexample/typeset listing/.@cmd}{#1}\pgfeov
+ }
\end{minipage}}%
\code@end%
\par%
@@ -748,6 +1187,18 @@
\makeatother
+\usepackage{pgfmanual}
+
+\makeatletter
+% \pgfautoxrefs will be defined by 'make dist'
+\pgfutil@ifundefined{pgfautoxrefs}{%
+ \def\pgfmanualpdflabel#1#2{#2}% NO-OP
+ \def\pgfmanualpdfref#1#2{#2}%
+ \pgfkeys{
+ /pdflinks/codeexample links=false,% DISABLED.
+ }%
+}{}
+\makeatother
%%% Local Variables:
%%% mode: latex