diff options
author | Karl Berry <karl@freefriends.org> | 2014-01-25 22:42:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-01-25 22:42:24 +0000 |
commit | 40d79de6e8268eb6f3dcd9b24b656fe6643b5792 (patch) | |
tree | 43b6737e0ff6d7b6d8f26459c471471729a720a7 /Master/texmf-dist/doc/latex/sa-tikz/pgfmanual-en-macros.tex | |
parent | 1db7092b704f1203699f36e7065b822324747a3a (diff) |
sa-tikz (25jan14)
git-svn-id: svn://tug.org/texlive/trunk@32788 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/sa-tikz/pgfmanual-en-macros.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/sa-tikz/pgfmanual-en-macros.tex | 1058 |
1 files changed, 796 insertions, 262 deletions
diff --git a/Master/texmf-dist/doc/latex/sa-tikz/pgfmanual-en-macros.tex b/Master/texmf-dist/doc/latex/sa-tikz/pgfmanual-en-macros.tex index 116cde6d9bf..e687ae3c426 100644 --- a/Master/texmf-dist/doc/latex/sa-tikz/pgfmanual-en-macros.tex +++ b/Master/texmf-dist/doc/latex/sa-tikz/pgfmanual-en-macros.tex @@ -7,8 +7,7 @@ % % 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.45 2009/11/15 13:13:24 ludewich Exp $ - +% $Header: /cvsroot/pgf/pgf/doc/generic/pgf/macros/pgfmanual-en-macros.tex,v 1.79 2013/12/20 15:22:35 tantau Exp $ \providecommand\href[2]{\texttt{#1}} @@ -18,20 +17,34 @@ \colorlet{examplefill}{yellow!80!black} \definecolor{graphicbackground}{rgb}{0.96,0.96,0.8} -\definecolor{codebackground}{rgb}{0.8,0.8,1} +\definecolor{codebackground}{rgb}{0.9,0.9,1} \newenvironment{pgfmanualentry}{\list{}{\leftmargin=2em\itemindent-\leftmargin\def\makelabel##1{\hss##1}}}{\endlist} -\newcommand\pgfmanualentryheadline[1]{\itemsep=0pt\parskip=0pt\item\strut{#1}\par\topsep=0pt} +\newcommand\pgfmanualentryheadline[1]{\itemsep=0pt\parskip=0pt{\raggedright\item\strut{#1}\par}\topsep=0pt} \newcommand\pgfmanualbody{\parskip3pt} +\let\origtexttt=\texttt +\def\texttt#1{{\def\textunderscore{\char`\_}\def\textbraceleft{\char`\{}\def\textbraceright{\char`\}}\origtexttt{#1}}} +\def\exclamationmarktext{!} +\def\atmarktext{@} + +{ + \catcode`\|=12 + \gdef\pgfmanualnormalbar{|} + \catcode`\|=13 + \AtBeginDocument{\gdef|{\ifmmode\pgfmanualnormalbar\else\expandafter\verb\expandafter|\fi}} +} + \newenvironment{pgflayout}[1]{ \begin{pgfmanualentry} - \pgfmanualentryheadline{\texttt{\string\pgfpagesuselayout\char`\{\declare{#1}\char`\}}\oarg{options}} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \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 } { @@ -48,12 +61,149 @@ \end{pgfmanualentry} } +\makeatletter + +\def\includeluadocumentationof#1{ + \directlua{require 'pgf.manual.DocumentParser'} + \directlua{pgf.manual.DocumentParser.include '#1'} +} + +\newenvironment{luageneric}[4]{ + \pgfmanualentry + \pgfmanualentryheadline{#4 \texttt{#1\declare{#2}}#3} + \index{#2@\protect\texttt{#2} (Lua)}% + \def\temp{#1} + \ifx\temp\pgfutil@empty\else + \index{#1@\protect\texttt{#1}!#2@\protect\texttt{#2} (Lua)}% + \fi + \pgfmanualbody +}{\endpgfmanualentry} + +\newenvironment{luatable}[3]{ + \medskip + \luageneric{#1}{#2}{ (declared in \texttt{#3})}{\textbf{Lua table}} +}{\endluageneric} + +\newenvironment{luafield}[1]{ + \pgfmanualentry + \pgfmanualentryheadline{Field \texttt{\declare{#1}}} + \pgfmanualbody +}{\endpgfmanualentry} + + +\newenvironment{lualibrary}[1]{ + \pgfmanualentry + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Graph Drawing Library} \texttt{\declare{#1}}% + } + \index{#1@\protect\texttt{#1} graph drawing library}% + \index{Libraries!#1@\protect\texttt{#1}}% + \index{Graph drawing libraries!#1@\protect\texttt{#1}}% + \vskip.25em + {\ttfamily\char`\\usegdlibrary\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX\space and plain \TeX}\\ + {\ttfamily\char`\\usegdlibrary[\declare{#1}]\space \char`\%\space\space Con\TeX t}\smallskip\par + \pgfmanualbody +}{\endpgfmanualentry} + +\newenvironment{luadeclare}[4]{ + \pgfmanualentry + \def\manual@temp@default{#3}% + \def\manual@temp@initial{#4}% + \def\manual@temp@{#3#4}% + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + {\ttfamily/graph + drawing/\declare{#1}\opt{=}}\opt{#2}\hfill% + \ifx\manual@temp@\pgfutil@empty\else% + (\ifx\manual@temp@default\pgfutil@empty\else% + default {\ttfamily #3}\ifx\manual@temp@initial\pgfutil@empty\else, \fi% + \fi% + \ifx\manual@temp@initial\pgfutil@empty\else% + initially {\ttfamily #4}% + \fi% + )\fi% + }% + \index{#1@\protect\texttt{#1} key}% + \pgfmanualbody + \gdef\myname{#1}% +% \keyalias{tikz} +% \keyalias{tikz/graphs} +}{\endpgfmanualentry} + +\newenvironment{luadeclarestyle}[4]{ + \pgfmanualentry + \def\manual@temp@para{#2}% + \def\manual@temp@default{#3}% + \def\manual@temp@initial{#4}% + \def\manual@temp@{#3#4}% + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + {\ttfamily/graph drawing/\declare{#1}}\ifx\manual@temp@para\pgfutil@empty\else\opt{\texttt=}\opt{#2}\fi\hfill% + (style\ifx\manual@temp@\pgfutil@empty\else, % + \ifx\manual@temp@default\pgfutil@empty\else% + default {\ttfamily #3}\ifx\manual@temp@initial\pgfutil@empty\else, \fi% + \fi% + \ifx\manual@temp@initial\pgfutil@empty\else% + initially {\ttfamily #4}% + \fi% + \fi)% + }% + \index{#1@\protect\texttt{#1} key}% + \pgfmanualbody% + \gdef\myname{#1}% +% \keyalias{tikz} +% \keyalias{tikz/graphs} +}{\endpgfmanualentry} + +\newenvironment{luanamespace}[2]{ + \luageneric{#1}{#2}{}{\textbf{Lua namespace}} +}{\endluageneric} + +\newenvironment{luafiledescription}[1]{}{} + +\newenvironment{luacommand}[4]{ + \hypertarget{pgf/lua/#1}{\luageneric{#2}{#3}{\texttt{(#4)}}{\texttt{function}}} +}{\endluageneric} + +\newenvironment{luaparameters}{\par\emph{Parameters:}% + \parametercount=0\relax% + \let\item=\parameteritem% + \let\list=\restorelist% +} +{\par +} + +\newenvironment{luareturns}{\par\emph{Returns:}% + \parametercount=0\relax% + \let\item=\parameteritem% + \let\list=\restorelist% +} +{\par +} + +\newcount\parametercount + +\newenvironment{parameterdescription}{\unskip% + \parametercount=0\relax% + \let\item=\parameteritem% + \let\list=\restorelist% +} +{\par +} +\let\saveditemcommand=\item +\let\savedlistcommand=\list +\def\denselist#1#2{\savedlistcommand{#1}{#2}\parskip0pt\itemsep0pt} +\def\restorelist{\let\item=\saveditemcommand\denselist} +\def\parameteritem{\pgfutil@ifnextchar[\parameteritem@{}}%} +\def\parameteritem@[#1]{\advance\parametercount by1\relax\hskip0.15em plus 1em\emph{\the\parametercount.}\kern1ex\def\test{#1}\ifx\test\pgfutil@empty\else#1\kern.5em\fi} + \newenvironment{commandlist}[1]{% - \begin{pgfmanualentry} - \foreach \xx in {#1} {% - \expandafter\extractcommand\xx\@@ - }% - \pgfmanualbody + \begin{pgfmanualentry} + \foreach \xx in {#1} {% + \expandafter\extractcommand\xx\@@ + }% + \pgfmanualbody }{% \end{pgfmanualentry} }% @@ -64,20 +214,21 @@ % \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 + \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}% + \pgfmanualentryheadline{% + \pgfmanualpdflabel{\textbackslash\strippedat}{}% + Internal #2 \declare{\texttt{\string#1}}}% \index{Internals!\strippedat @\protect\myprintocmmand{\strippedat}}% \index{\strippedat @\protect\myprintocmmand{\strippedat}}% - \pgfmanualpdflabel{\textbackslash\strippedat}{}% } %% MW: START MATH MACROS @@ -89,120 +240,147 @@ \def\extractmathfunctionname@#1(#2)#3\tmpb{\def\mathname{#1}} \makeatother - + \newenvironment{math-function}[1]{ - \def\mathdefaultname{#1} - \extractmathfunctionname{#1} - \edef\mathurl{{math:\mathname}}\expandafter\hypertarget\expandafter{\mathurl}{}% - \begin{pgfmanualentry} - \pgfmanualentryheadline{\texttt{#1}}% - \index{\mathname @\protect\texttt{\mathname} math function}% - \index{Math functions!\mathname @\protect\texttt{\mathname}}% - \pgfmanualbody + \def\mathdefaultname{#1} + \extractmathfunctionname{#1} + \edef\mathurl{{math:\mathname}}\expandafter\hypertarget\expandafter{\mathurl}{}% + \begin{pgfmanualentry} + \pgfmanualentryheadline{\texttt{#1}}% + \index{\mathname @\protect\texttt{\mathname} math function}% + \index{Math functions!\mathname @\protect\texttt{\mathname}}% + \pgfmanualbody } { - \end{pgfmanualentry} + \end{pgfmanualentry} } \def\pgfmanualemptytext{} \def\pgfmanualvbarvbar{\char`\|\char`\|} \newenvironment{math-operator}[4][]{% - \begin{pgfmanualentry} - \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 + \begin{pgfmanualentry} + \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-operators}[5][]{% - \begin{pgfmanualentry} - \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 + \begin{pgfmanualentry} + \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}} \def\mathinfixoperator#1#2{% - \def\mathoperator{\texttt{#1}}% - \def\mathexample{\mvar{x}\space\texttt{#1}\space\mvar{y}}% + \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\mathoperator{\texttt{#1}}% + \def\mathexample{\texttt{#1}\mvar{x}}% } \def\mathpostfixoperator#1#2{% - \def\mathoperator{\texttt{#1}} - \def\mathexample{\mvar{x}\texttt{#1}}% + \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}}% + \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}} + \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 + \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} + \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} + \ifx#1\stop% + \else% + \expandafter\def\expandafter\mathcommandname\expandafter{\mathcommandname{\ttfamily\char`\{#1\char`\}}}% + \expandafter\@makemathcommand% + \fi} \makeatother \def\calcname{\textsc{calc}} + +\newenvironment{math-keyword}[1]{ + \extracttikzmathkeyword#1@ + \begin{pgfmanualentry} + \pgfmanualentryheadline{\texttt{\color{red}\mathname}\mathrest}% + \index{\mathname @\protect\texttt{\mathname} tikz math function}% + \index{TikZ math functions!\mathname @\protect\texttt{\mathname}}% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\def\extracttikzmathkeyword#1#2@{% + \def\mathname{#1}% + \def\mathrest{#2}% +} + %% MW: END MATH MACROS \def\extractcommand#1#2\@@{% - \pgfmanualentryheadline{\declare{\texttt{\string#1}}#2}% \removeats{#1}% + \pgfmanualentryheadline{% + \pgfmanualpdflabel{\textbackslash\strippedat}{}% + \declare{\texttt{\string#1}}#2% + }% \index{\strippedat @\protect\myprintocmmand{\strippedat}} - \pgfmanualpdflabel{\textbackslash\strippedat}{}% +} + +\def\luaextractcommand#1#2\relax{% + \declare{\texttt{\string#1}}#2\par% +% \removeats{#1}% + % \index{\strippedat @\protect\myprintocmmand{\strippedat}} + % \pgfmanualpdflabel{\textbackslash\strippedat}{}% } @@ -217,12 +395,14 @@ } \def\extractenvironement#1#2\@@{% - \pgfmanualentryheadline{{\ttfamily\char`\\begin\char`\{\declare{#1}\char`\}}#2}% + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + {\ttfamily\char`\\begin\char`\{\declare{#1}\char`\}}#2% + }% \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}} - \pgfmanualpdflabel{#1}{}% } @@ -263,10 +443,26 @@ \newenvironment{shape}[1]{ \begin{pgfmanualentry} - \pgfmanualentryheadline{Shape {\ttfamily\declare{#1}}}% + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Shape} {\ttfamily\declare{#1}}% + }% \index{#1@\protect\texttt{#1} shape}% \index{Shapes!#1@\protect\texttt{#1}} - \pgfmanualpdflabel{#1}{}% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\newenvironment{pictype}[2]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Pic type} {\ttfamily\declare{#1}#2}% + }% + \index{#1@\protect\texttt{#1} pic type}% + \index{Pic Types!#1@\protect\texttt{#1}} \pgfmanualbody } { @@ -275,10 +471,11 @@ \newenvironment{shading}[1]{ \begin{pgfmanualentry} - \pgfmanualentryheadline{Shading {\ttfamily\declare{#1}}}% + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Shading} {\ttfamily\declare{#1}}}% \index{#1@\protect\texttt{#1} shading}% \index{Shadings!#1@\protect\texttt{#1}} - \pgfmanualpdflabel{#1}{}% \pgfmanualbody } { @@ -286,12 +483,58 @@ } +\newenvironment{graph}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Graph} {\ttfamily\declare{#1}}}% + \index{#1@\protect\texttt{#1} graph}% + \index{Graphs!#1@\protect\texttt{#1}} + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\newenvironment{gdalgorithm}[2]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Layout} {\ttfamily/graph drawing/\declare{#1}\opt{=}}\opt{\meta{options}}}% + \index{#1@\protect\texttt{#1} layout}% + \index{Layouts!#1@\protect\texttt{#1}}% + \foreach \algo in {#2} + {\edef\marshal{\noexpand\index{#2@\noexpand\protect\noexpand\texttt{#2} algorithm}}\marshal}% + \index{Graph drawing layouts!#1@\protect\texttt{#1}} + \item{\small alias {\ttfamily/tikz/#1}}\par + \item{\small alias {\ttfamily/tikz/graphs/#1}}\par + \item{\small Employs {\ttfamily algorithm=#2}}\par + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + \newenvironment{dataformat}[1]{ \begin{pgfmanualentry} - \pgfmanualentryheadline{Format {\ttfamily\declare{#1}}}% + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Format} {\ttfamily\declare{#1}}}% \index{#1@\protect\texttt{#1} format}% \index{Formats!#1@\protect\texttt{#1}} - \pgfmanualpdflabel{#1}{}% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\newenvironment{stylesheet}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Style sheet} {\ttfamily\declare{#1}}}% + \index{#1@\protect\texttt{#1} style sheet}% + \index{Style sheets!#1@\protect\texttt{#1}} \pgfmanualbody } { @@ -309,10 +552,11 @@ \def\gobble#1{} \def\extracthandler#1#2\@nil{% - \pgfmanualentryheadline{Key handler \meta{key}{\ttfamily/\declare{#1}}#2}% + \pgfmanualentryheadline{% + \pgfmanualpdflabel{/handlers/#1}{}% + \textbf{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}% } @@ -336,17 +580,17 @@ % \mchoice{choice1,choice2,choice3} \newcommand\mchoice[1]{% - \begingroup - \firstchoicetrue - \foreach \mchoice@ in {#1} {% - \iffirstchoice - \global\firstchoicefalse - \else - \choicesep - \fi - \choicearg{\mchoice@}% - }% - \endgroup + \begingroup + \firstchoicetrue + \foreach \mchoice@ in {#1} {% + \iffirstchoice + \global\firstchoicefalse + \else + \choicesep + \fi + \choicearg{\mchoice@}% + }% + \endgroup }% % \begin{key}{/path/x=value} @@ -369,39 +613,39 @@ % #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@@{#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 + \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} +% {/path/option 1=value,/path/option 2=value2} % \end{keylist} \newenvironment{keylist}[2][]{% - \begin{pgfmanualentry} + \begin{pgfmanualentry} \def\extrakeytext{}% - \foreach \xx in {#2} {% - \expandafter\insertpathifneeded\expandafter{\xx}{#1}% - \expandafter\extractkey\mykey\@nil% - }% - \pgfmanualbody + \foreach \xx in {#2} {% + \expandafter\insertpathifneeded\expandafter{\xx}{#1}% + \expandafter\extractkey\mykey\@nil% + }% + \pgfmanualbody }{% \end{pgfmanualentry} }% @@ -415,12 +659,14 @@ \ifpgfutil@in@% \extractequalinitial#1\@nil% \else - \pgfmanualentryheadline{{\ttfamily\declare{#1}}\hfill(\extrakeytext no value)}% + \pgfmanualentryheadline{% \def\mykey{#1}% \def\mypath{}% - \def\myname{}% + \gdef\myname{}% \firsttimetrue% + \pgfmanualdecomposecount=0\relax% \decompose#1/\nil% + {\ttfamily\declare{#1}}\hfill(\extrakeytext no value)}% \fi \fi% } @@ -434,31 +680,49 @@ \ifpgfutil@in@% \extractinitial{#1}#2\@nil% \else - \pgfmanualentryheadline{{\ttfamily\declare{#1}=}#2\hfill(\extrakeytext no default)}% + \pgfmanualentryheadline{% + \def\mykey{#1}% + \def\mypath{}% + \gdef\myname{}% + \firsttimetrue% + \pgfmanualdecomposecount=0\relax% + \decompose#1/\nil% + {\ttfamily\declare{#1}=}#2\hfill(\extrakeytext no default)}% \fi% \fi% - \def\mykey{#1}% - \def\mypath{}% - \def\myname{}% - \firsttimetrue% - \decompose#1/\nil% } \def\extractdefault#1#2(default #3)\@nil{% - \pgfmanualentryheadline{{\ttfamily\declare{#1}\opt{=}}\opt{#2}\hfill (\extrakeytext default {\ttfamily#3})}% + \pgfmanualentryheadline{% + \def\mykey{#1}% + \def\mypath{}% + \gdef\myname{}% + \firsttimetrue% + \pgfmanualdecomposecount=0\relax% + \decompose#1/\nil% + {\ttfamily\declare{#1}\opt{=}}\opt{#2}\hfill (\extrakeytext default {\ttfamily#3})}% } \def\extractinitial#1#2(initially #3)\@nil{% - \pgfmanualentryheadline{{\ttfamily\declare{#1}=}#2\hfill (\extrakeytext no default, initially {\ttfamily#3})}% + \pgfmanualentryheadline{% + \def\mykey{#1}% + \def\mypath{}% + \gdef\myname{}% + \firsttimetrue% + \pgfmanualdecomposecount=0\relax% + \decompose#1/\nil% + {\ttfamily\declare{#1}=}#2\hfill (\extrakeytext no default, initially {\ttfamily#3})}% } \def\extractequalinitial#1 (initially #2)\@nil{% - \pgfmanualentryheadline{{\ttfamily\declare{#1}}\hfill (\extrakeytext initially {\ttfamily#2})}% - \def\mykey{#1}% - \def\mypath{}% - \def\myname{}% - \firsttimetrue% - \decompose#1/\nil% + \pgfmanualentryheadline{% + \def\mykey{#1}% + \def\mypath{}% + \gdef\myname{}% + \firsttimetrue% + \pgfmanualdecomposecount=0\relax% + \decompose#1/\nil% + {\ttfamily\declare{#1}}\hfill (\extrakeytext initially {\ttfamily#2})}% } % Introduces a key alias '/#1/<name of current key>' @@ -468,6 +732,7 @@ } \newif\iffirsttime +\newcount\pgfmanualdecomposecount \makeatother @@ -477,26 +742,48 @@ % aha. \index{#1@\protect\texttt{#1} key}% \index{\mypath#1@\protect\texttt{#1}}% - \def\myname{#1}% + \gdef\myname{#1}% + \pgfmanualpdflabel{#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 - \expandafter\def\expandafter\mypath\expandafter{\mypath#1@\protect\texttt{#1/}!}% - \fi - \def\firsttime{} - \decompose/#2\nil% + \advance\pgfmanualdecomposecount by1\relax% + \ifnum\pgfmanualdecomposecount>2\relax% + \decomposetoodeep#1/#2\nil% + \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% + \expandafter\def\expandafter\mypath\expandafter{\mypath#1@\protect\texttt{#1/}!}% + \fi% + \def\firsttime{}% + \decompose/#2\nil% + \fi% \fi% } +\def\decomposetoodeep#1/#2/\nil{% + % avoid too-deep nesting in index + \index{#1/#2@\protect\texttt{#1/#2} key}% + \index{\mypath#1/#2@\protect\texttt{#1/#2}}% + \decomposefindlast/#1/#2/\nil% +} +\makeatletter +\def\decomposefindlast/#1/#2\nil{% + \def\test{#2}% + \ifx\test\pgfutil@empty% + \gdef\myname{#1}% + \else% + \decomposefindlast/#2\nil% + \fi% +} +\makeatother \def\indexkey#1{% \def\mypath{}% \decompose#1/\nil% @@ -511,21 +798,23 @@ \end{pgfmanualentry} } \def\extractpredefinedmethod#1(#2)\@nil{% - \pgfmanualentryheadline{Method \declare{\ttfamily #1}\texttt(#2\texttt) \hfill(predefined for all classes)} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + 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}}} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{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 } { @@ -543,14 +832,17 @@ \def\extractmethod#1(#2)\@nil{% \def\test{#1} \ifx\test\currentclass - \pgfmanualentryheadline{Constructor \declare{\ttfamily #1}\texttt(#2\texttt)} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + Constructor \declare{\ttfamily #1}\texttt(#2\texttt)} \else - \pgfmanualentryheadline{Method \declare{\ttfamily #1}\texttt(#2\texttt)} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + 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]{ @@ -564,24 +856,28 @@ \def\extractattribute#1=#2;\@nil{% \def\test{#2}% \ifx\test\@empty - \pgfmanualentryheadline{Private attribute \declare{\ttfamily #1} \hfill (initially empty)} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + Private attribute \declare{\ttfamily #1} \hfill (initially empty)} \else - \pgfmanualentryheadline{Private attribute \declare{\ttfamily #1} \hfill (initially {\ttfamily #2})} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + 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}}}% + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Predefined node} {\ttfamily\declare{#1}}}% \index{#1@\protect\texttt{#1} node}% \index{Predefined node!#1@\protect\texttt{#1}} - \pgfmanualpdflabel{#1}{}% \pgfmanualbody } { @@ -590,10 +886,11 @@ \newenvironment{coordinatesystem}[1]{ \begin{pgfmanualentry} - \pgfmanualentryheadline{Coordinate system {\ttfamily\declare{#1}}}% + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Coordinate system} {\ttfamily\declare{#1}}}% \index{#1@\protect\texttt{#1} coordinate system}% \index{Coordinate systems!#1@\protect\texttt{#1}} - \pgfmanualpdflabel{#1}{}% \pgfmanualbody } { @@ -602,7 +899,7 @@ \newenvironment{snake}[1]{ \begin{pgfmanualentry} - \pgfmanualentryheadline{Snake {\ttfamily\declare{#1}}}% + \pgfmanualentryheadline{\textbf{Snake} {\ttfamily\declare{#1}}}% \index{#1@\protect\texttt{#1} snake}% \index{Snakes!#1@\protect\texttt{#1}} \pgfmanualbody @@ -613,7 +910,7 @@ \newenvironment{decoration}[1]{ \begin{pgfmanualentry} - \pgfmanualentryheadline{Decoration {\ttfamily\declare{#1}}}% + \pgfmanualentryheadline{\textbf{Decoration} {\ttfamily\declare{#1}}}% \index{#1@\protect\texttt{#1} decoration}% \index{Decorations!#1@\protect\texttt{#1}} \pgfmanualbody @@ -627,14 +924,17 @@ \makeatletter \newenvironment{pathoperation}[3][]{ \begin{pgfmanualentry} - \pgfmanualentryheadline{\textcolor{gray}{{\ttfamily\char`\\path}\ + \def\pgfmanualtest{#1}% + \pgfmanualentryheadline{% + \ifx\pgfmanualtest\@empty% + \pgfmanualpdflabel{#2}{}% + \fi% + \textcolor{gray}{{\ttfamily\char`\\path}\ \ \dots} \declare{\texttt{#2}}#3\ \textcolor{gray}{\dots\texttt{;}}}% - \def\pgfmanualtest{#1}% \ifx\pgfmanualtest\@empty% \index{#2@\protect\texttt{#2} path operation}% \index{Path operations!#2@\protect\texttt{#2}}% - \pgfmanualpdflabel{#2}{}% \fi% \pgfmanualbody } @@ -643,14 +943,17 @@ } \newenvironment{datavisualizationoperation}[3][]{ \begin{pgfmanualentry} - \pgfmanualentryheadline{\textcolor{gray}{{\ttfamily\char`\\datavisualization}\ + \def\pgfmanualtest{#1}% + \pgfmanualentryheadline{% + \ifx\pgfmanualtest\@empty% + \pgfmanualpdflabel{#2}{}% + \fi% + \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 } @@ -659,19 +962,14 @@ } \makeatother -\def\extractcommand#1#2\@@{% - \pgfmanualentryheadline{\declare{\texttt{\string#1}}#2}% - \removeats{#1}% - \index{\strippedat @\protect\myprintocmmand{\strippedat}} - \pgfmanualpdflabel{\textbackslash\strippedat}{}% -} - \def\doublebs{\texttt{\char`\\\char`\\}} \newenvironment{package}[1]{ \begin{pgfmanualentry} - \pgfmanualentryheadline{{\ttfamily\char`\\usepackage\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX}} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + {\ttfamily\char`\\usepackage\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX}} \index{#1@\protect\texttt{#1} package}% \index{Packages and files!#1@\protect\texttt{#1}}% \pgfmanualentryheadline{{\ttfamily\char`\\input \declare{#1}.tex\space\space\space \char`\%\space\space plain \TeX}} @@ -685,13 +983,14 @@ \newenvironment{pgfmodule}[1]{ \begin{pgfmanualentry} - \pgfmanualentryheadline{{\ttfamily\char`\\usepgfmodule\char`\{\declare{#1}\char`\}\space\space\space + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + {\ttfamily\char`\\usepgfmodule\char`\{\declare{#1}\char`\}\space\space\space \char`\%\space\space \LaTeX\space and plain \TeX\space and pure pgf}} \index{#1@\protect\texttt{#1} module}% \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} @@ -699,17 +998,37 @@ \newenvironment{pgflibrary}[1]{ \begin{pgfmanualentry} - \pgfmanualentryheadline{{\ttfamily\char`\\usepgflibrary\char`\{\declare{#1}\char`\}\space\space\space - \char`\%\space\space \LaTeX\space and plain \TeX\space and pure pgf}} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{\tikzname\ Library} \texttt{\declare{#1}}} \index{#1@\protect\texttt{#1} library}% \index{Libraries!#1@\protect\texttt{#1}}% - \pgfmanualentryheadline{{\ttfamily\char`\\usepgflibrary[\declare{#1}]\space\space \char`\%\space\space Con\TeX t\space and pure pgf}} - \pgfmanualentryheadline{{\ttfamily\char`\\usetikzlibrary\char`\{\declare{#1}\char`\}\space\space - \char`\%\space\space \LaTeX\space and plain \TeX\space when using \tikzname}} - \pgfmanualentryheadline{{\ttfamily\char`\\usetikzlibrary[\declare{#1}]\space - \char`\%\space\space Con\TeX t\space when using \tikzname}} + \vskip.25em% + {{\ttfamily\char`\\usepgflibrary\char`\{\declare{#1}\char`\}\space\space\space + \char`\%\space\space \LaTeX\space and plain \TeX\space and pure pgf}}\\ + {{\ttfamily\char`\\usepgflibrary[\declare{#1}]\space\space \char`\%\space\space Con\TeX t\space and pure pgf}}\\ + {{\ttfamily\char`\\usetikzlibrary\char`\{\declare{#1}\char`\}\space\space + \char`\%\space\space \LaTeX\space and plain \TeX\space when using \tikzname}}\\ + {{\ttfamily\char`\\usetikzlibrary[\declare{#1}]\space + \char`\%\space\space Con\TeX t\space when using \tikzname}}\\[.5em] + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\newenvironment{purepgflibrary}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{{\small PGF} Library} \texttt{\declare{#1}}} + \index{#1@\protect\texttt{#1} library}% + \index{Libraries!#1@\protect\texttt{#1}}% + \vskip.25em% + {{\ttfamily\char`\\usepgflibrary\char`\{\declare{#1}\char`\}\space\space\space + \char`\%\space\space \LaTeX\space and plain \TeX}}\\ + {{\ttfamily\char`\\usepgflibrary[\declare{#1}]\space\space \char`\%\space\space Con\TeX t}}\\[.5em] \pgfmanualbody - \pgfmanualpdflabel{#1}{}% } { \end{pgfmanualentry} @@ -717,12 +1036,15 @@ \newenvironment{tikzlibrary}[1]{ \begin{pgfmanualentry} - \pgfmanualentryheadline{{\ttfamily\char`\\usetikzlibrary\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX\space and plain \TeX}} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{\tikzname\ Library} \texttt{\declare{#1}}} \index{#1@\protect\texttt{#1} library}% \index{Libraries!#1@\protect\texttt{#1}}% - \pgfmanualentryheadline{{\ttfamily\char`\\usetikzlibrary[\declare{#1}]\space \char`\%\space\space Con\TeX t}} + \vskip.25em% + {{\ttfamily\char`\\usetikzlibrary\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX\space and plain \TeX}}\\ + {{\ttfamily\char`\\usetikzlibrary[\declare{#1}]\space \char`\%\space\space Con\TeX t}}\\[.5em] \pgfmanualbody - \pgfmanualpdflabel{#1}{}% } { \end{pgfmanualentry} @@ -858,89 +1180,225 @@ \def\noindexing{\let\index=\@gobble} +\newenvironment{arrowtipsimple}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{\textbf{Arrow Tip Kind} {\ttfamily#1}} + \index{#1@\protect\texttt{#1} arrow tip}% + \index{Arrow tips!#1@\protect\texttt{#1}}% + \def\currentarrowtype{#1} + \pgfmanualbody} +{ + \end{pgfmanualentry} +} -\newcommand\symarrow[1]{ +\newenvironment{arrowtip}[4]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{\textbf{Arrow Tip Kind} {\ttfamily#1}} + \index{#1@\protect\texttt{#1} arrow tip}% + \index{Arrow tips!#1@\protect\texttt{#1}}% + \pgfmanualbody + \def\currentarrowtype{#1} + \begin{minipage}[t]{10.25cm} + #2 + \end{minipage}\hskip5mm\begin{minipage}[t]{4.75cm} + \leavevmode\vskip-2em + \tikz{ + \draw [black!50,line width=5mm,-{#1[#3,color=black]}] (-4,0) -- (0,0); + \foreach \action in {#4} + { \expandafter\processaction\action\relax } + } + \end{minipage}\par\smallskip + } +{ + \end{pgfmanualentry} +} + +\newenvironment{arrowcap}[5]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{\textbf{Arrow Tip Kind} {\ttfamily#1}} + \index{#1@\protect\texttt{#1} arrow tip}% + \index{Arrow tips!#1@\protect\texttt{#1}}% + \pgfmanualbody + \def\currentarrowtype{#1} + \begin{minipage}[t]{10.25cm} + #2 + \end{minipage}\hskip5mm\begin{minipage}[t]{4.75cm} + \leavevmode\vskip-2em + \tikz{ + \path [tips, line width=10mm,-{#1[#3,color=black]}] (-4,0) -- (0,0); + \draw [line width=10mm,black!50] (-3,0) -- (#5,0); + \foreach \action in {#4} + { \expandafter\processaction\action\relax } + } + \end{minipage}\par\smallskip + } +{ + \end{pgfmanualentry} +} + +\def\processaction#1=#2\relax{ + \expandafter\let\expandafter\pgf@temp\csname manual@action@#1\endcsname + \ifx\pgf@temp\relax\else + \pgf@temp#2/0/\relax + \fi +} +\def\manual@action@length#1/#2/#3\relax{% + \draw [red,|<->|,semithick,xshift=#2] ([yshift=4pt]current bounding + box.north -| -#1,0) coordinate (last length) -- node + [above=-2pt] {|length|} ++(#1,0); +} +\def\manual@action@width#1/#2/#3\relax{% + \draw [overlay, red,|<->|,semithick] (.5,-#1/2) -- node [below,sloped] {|width|} (.5,#1/2); +} +\def\manual@action@inset#1/#2/#3\relax{% + \draw [red,|<->|,semithick,xshift=#2] ([yshift=-4pt]current bounding + box.south -| last length) -- node [below] {|inset|} ++(#1,0); +} + +\newenvironment{arrowexamples} +{\begin{tabbing} + \hbox to \dimexpr\linewidth-5.5cm\relax{\emph{Appearance of the below at line width} \hfil} \= + \hbox to 1.9cm{\emph{0.4pt}\hfil} \= \hbox to 2cm{\emph{0.8pt}\hfil} \= \emph{1.6pt} \\ + } +{\end{tabbing}\vskip-1em} + +\newenvironment{arrowcapexamples} +{\begin{tabbing} + \hbox to \dimexpr\linewidth-5.5cm\relax{\emph{Appearance of the below at line width} \hfil} \= + \hbox to 1.9cm{\emph{1ex}\hfil} \= \hbox to 2cm{\emph{1em}\hfil} \\ + } +{\end{tabbing}\vskip-1em} + +\def\arrowcapexample#1[#2]{\def\temp{#1}\ifx\temp\pgfutil@empty\arrowcapexample@\currentarrowtype[{#2}]\else\arrowcapexample@#1[{#2}]\fi} +\def\arrowcapexample@#1[#2]{% + {\sfcode`\.1000\small\texttt{#1[#2]}} \> + \kern-.5ex\tikz [baseline,>={#1[#2]}] \draw [line + width=1ex,->] (0,.5ex) -- (2em,.5ex); \> + \kern-.5em\tikz [baseline,>={#1[#2]}] \draw [line + width=1em,->] (0,.5ex) -- (2em,.5ex); \\ +} + +\def\arrowexample#1[#2]{\def\temp{#1}\ifx\temp\pgfutil@empty\arrowexample@\currentarrowtype[{#2}]\else\arrowexample@#1[{#2}]\fi} +\def\arrowexample@#1[#2]{% + {\sfcode`\.1000\small\texttt{#1[#2]}} \> + \tikz [baseline,>={#1[#2]}] \draw [line + width=0.4pt,->] (0,.5ex) -- (2em,.5ex); thin \> + \tikz [baseline,>={#1[#2]}] \draw [line + width=0.8pt,->] (0,.5ex) -- (2em,.5ex); \textbf{thick} \> + \tikz [baseline,>={#1[#2]}] \draw [line + width=1.6pt,->] (0,.5ex) -- (3em,.5ex); \\ +} +\def\arrowexampledup[#1]{\arrowexample[{#1] \currentarrowtype[}]} +\def\arrowexampledupdot[#1]{\arrowexample[{#1] . \currentarrowtype[}]} + +\def\arrowexampledouble#1[#2]{\def\temp{#1}\ifx\temp\pgfutil@empty\arrowexampledouble@\currentarrowtype[{#2}]\else\arrowexampledouble@#1[{#2}]\fi} +\def\arrowexampledouble@#1[#2]{% + {\sfcode`\.1000\small\texttt{#1[#2]} on double line} \> + \tikz [baseline,>={#1[#2]}] + \draw [double equal sign distance,line width=0.4pt,->] (0,.5ex) -- (2em,.5ex); thin \> + \tikz [baseline,>={#1[#2]}] + \draw [double equal sign distance,line width=0.8pt,->] (0,.5ex) -- (2em,.5ex); \textbf{thick} \> + \tikz [baseline,>={#1[#2]}] + \draw [double equal sign distance, line width=1.6pt,->] (0,.5ex) -- (3em,.5ex); \\ +} + + + +\newcommand\symarrow[1]{% \index{#1@\protect\texttt{#1} arrow tip}% - \index{Arrow tips!#1@\protect\texttt{#1}} + \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); + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; \draw (0pt,.5ex) -- (1cm,.5ex); \end{tikzpicture} and thin \begin{tikzpicture}[arrows={#1-#1},thin,baseline] - \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex); + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; \draw (0pt,.5ex) -- (1cm,.5ex); \end{tikzpicture} } -\newcommand\symarrowdouble[1]{ +\newcommand\symarrowdouble[1]{% \index{#1@\protect\texttt{#1} arrow tip}% - \index{Arrow tips!#1@\protect\texttt{#1}} + \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); + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; \draw (0pt,.5ex) -- (1cm,.5ex); \end{tikzpicture} and thin \begin{tikzpicture}[arrows={#1-#1},thin,baseline] - \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex); + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; \draw (0pt,.5ex) -- (1cm,.5ex); \end{tikzpicture}, double \begin{tikzpicture}[arrows={#1-#1},thick,baseline] - \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex); + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; \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); + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex); \end{tikzpicture} } -\newcommand\sarrow[2]{ +\newcommand\sarrow[2]{% \index{#1@\protect\texttt{#1} arrow tip}% - \index{Arrow tips!#1@\protect\texttt{#1}} + \index{Arrow tips!#1@\protect\texttt{#1}}% \index{#2@\protect\texttt{#2} arrow tip}% - \index{Arrow tips!#2@\protect\texttt{#2}} + \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); + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; \draw (0pt,.5ex) -- (1cm,.5ex); \end{tikzpicture} and thin \begin{tikzpicture}[arrows={#1-#2},thin,baseline] - \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex); + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; \draw (0pt,.5ex) -- (1cm,.5ex); \end{tikzpicture} } -\newcommand\sarrowdouble[2]{ +\newcommand\sarrowdouble[2]{% \index{#1@\protect\texttt{#1} arrow tip}% - \index{Arrow tips!#1@\protect\texttt{#1}} + \index{Arrow tips!#1@\protect\texttt{#1}}% \index{#2@\protect\texttt{#2} arrow tip}% - \index{Arrow tips!#2@\protect\texttt{#2}} + \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); + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; \draw (0pt,.5ex) -- (1cm,.5ex); \end{tikzpicture} and thin \begin{tikzpicture}[arrows={#1-#2},thin,baseline] - \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex); + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; \draw (0pt,.5ex) -- (1cm,.5ex); \end{tikzpicture}, double \begin{tikzpicture}[arrows={#1-#2},thick,baseline] - \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex); + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; \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); + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex); \end{tikzpicture} } -\newcommand\carrow[1]{ +\newcommand\carrow[1]{% \index{#1@\protect\texttt{#1} arrow tip}% - \index{Arrow tips!#1@\protect\texttt{#1}} + \index{Arrow tips!#1@\protect\texttt{#1}}% \texttt{#1}& yields for line width 1ex \begin{tikzpicture}[arrows={#1-#1},line width=1ex,baseline] - \useasboundingbox (0pt,-0.5ex) rectangle (1.5cm,2ex); + \useasboundingbox (-1mm,-0.5ex) rectangle (1.6cm,2ex); + \fill [black!15] (1.5cm,-.5ex) rectangle (1.6cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; \draw (0pt,.5ex) -- (1.5cm,.5ex); \end{tikzpicture} } @@ -1046,32 +1504,62 @@ % 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 + \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 } +\newif\ifpgfmanualtikzsyntaxhilighting + \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, + 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}, + 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, tikz syntax=true}, + from file/.code={\codeexamplefromfiletrue\def\codeexamplesource{#1}}, + tikz syntax/.is if=pgfmanualtikzsyntaxhilighting, +} + + +\newread\examplesource + + +% Opening, reading and closing the results file + +\def\opensource#1{ + \immediate\openin\examplesource=#1 +} +\def\do@codeexamplefromfile{% + \immediate\openin\examplesource\expandafter{\codeexamplesource}% + \def\examplelines{}% + \readexamplelines + \closein\examplesource + \expandafter\endofcodeexample\expandafter{\examplelines}% +} + +\def\readexamplelines{ + \ifeof\examplesource% + \else + \immediate\read\examplesource to \exampleline + \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\examplelines\expandafter\expandafter\expandafter{\expandafter\examplelines\exampleline} + \expandafter\readexamplelines% + \fi } \let\code@pre\pgfutil@empty @@ -1079,6 +1567,7 @@ \let\code@render\pgfutil@empty \def\code@catcode@hook{} +\newif\ifcodeexamplefromfile \newdimen\codeexamplewidth \newif\ifcode@execute \newbox\codeexamplebox @@ -1086,6 +1575,10 @@ \begingroup% \code@executetrue \pgfqkeys{/codeexample}{every codeexample,#1}% + \ifpgfmanualtikzsyntaxhilighting% + \pgfkeys{/codeexample/syntax hilighting}% + \fi% + \ifcodeexamplefromfile\begingroup\fi \codeexample@tabinit% assigns \codeexample@tabinit@[catcode,replacementchars] \parindent0pt \begingroup% @@ -1100,7 +1593,11 @@ \code@catcode@hook% \codeexample@tabinit@catcode \relax% - \find@example} + \ifcodeexamplefromfile% + \expandafter\do@codeexamplefromfile% + \else% + \expandafter\find@example% + \fi} \def\endofcodeexample#1{% \endgroup% \ifcode@execute% @@ -1155,6 +1652,7 @@ \fi% \code@mid% \colorbox{codebackground}{% + \pgfkeysvalueof{/codeexample/prettyprint/base color}% \begin{minipage}[t]{\code@width}% {% \let\do\@makeother @@ -1179,7 +1677,7 @@ \code@end% \par% \medskip - \end{codeexample} + \endcodeexample\endgroup } \def\endcodeexample{\endgroup} @@ -1189,16 +1687,52 @@ \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 + +% autoxref is now always on + +% \makeatletter +% % \pgfautoxrefs will be defined by 'make dist' +% \pgfutil@ifundefined{pgfautoxrefs}{% +% \renewcommand\pgfmanualpdflabel[3][]{#3}% NO-OP +% \def\pgfmanualpdfref#1#2{#2}% +% \pgfkeys{ +% /pdflinks/codeexample links=false,% DISABLED. +% }% +% }{} +% \makeatother + +\newdimen\pgfmanualcslinkpreskip + +% Styling of the pretty printer +\pgfkeys{ + /codeexample/syntax hilighting/.style={ + /codeexample/prettyprint/key name/.code={\textcolor{green!50!black}{\pgfmanualpdfref{##1}{##1}}}, + /codeexample/prettyprint/key name with handler/.code 2 args={\textcolor{green!50!black}{\pgfmanualpdfref{##1}{##1}}/\textcolor{blue!70!black}{\pgfmanualpdfref{/handlers/##2}{##2}}}, + /codeexample/prettyprint/key value display only/.code={\textcolor{green!50!black}{{\itshape{\let\pgfmanualwordstartup\relax\pgfmanualprettyprintcode{##1}}}}}, + /codeexample/prettyprint/cs/.code={\textcolor{blue!70!black}{\pgfmanualcslinkpreskip4.25pt\pgfmanualpdfref{##1}{##1}}}, + /codeexample/prettyprint/cs with args/.code 2 args={\textcolor{black}{\pgfmanualcslinkpreskip4.25pt\pgfmanualpdfref{##1}{##1}}\{\textcolor{black}{\pgfmanualprettyprintcode{##2}}\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/pgfkeys/.initial=1, + /codeexample/prettyprint/cs/pgfkeys/.code 2 args={\textcolor{black}{\pgfmanualcslinkpreskip4.25pt\pgfmanualpdfref{##1}{##1}}\{\textcolor{black}{\pgfmanualprettyprintpgfkeys{##2}}\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/begin/.initial=1, + /codeexample/prettyprint/cs/begin/.code 2 args={\textcolor{black}{##1}\{\textcolor{blue!70!black}{\pgfmanualpdfref{##2}{##2}}\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/end/.initial=1, + /codeexample/prettyprint/cs/end/.code 2 args={\textcolor{black}{##1}\{\textcolor{blue!70!black}{\pgfmanualpdfref{##2}{##2}}\pgfmanualclosebrace}, + /codeexample/prettyprint/word/.code={\pgfmanualwordstartup{\begingroup\pgfkeyssetvalue{/pdflinks/search key prefixes in}{}\pgfmanualpdfref{##1}{##1}\endgroup}}, + /codeexample/prettyprint/point/.code={\textcolor{violet}{##1}},% + /codeexample/prettyprint/point with cs/.code 2 args={\textcolor{violet}{(\pgfmanualpdfref{##1}{##1}:##2}},% + /codeexample/prettyprint/comment font=\itshape, + /codeexample/prettyprint/base color/.initial=\color{black!55}, + /pdflinks/render hyperlink/.code={% + {\setbox0=\hbox{##1}% + \rlap{{\color{white}\dimen0\wd0\advance\dimen0by-\pgfmanualcslinkpreskip\hskip\pgfmanualcslinkpreskip\vrule width\dimen0 height-1pt depth1.6pt}}% + \box0% + }% + } + } +} + +\def\pgfmanualwordstartup{\textcolor{black}} + %%% Local Variables: %%% mode: latex |