diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/tikz-cd/pgfmanualstyle.sty | 238 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/tikz-cd/tikz-cd-doc.pdf | bin | 199688 -> 240892 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/tikz-cd/tikz-cd-doc.tex | 1909 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tikz-cd/tikz-cd.sty | 490 |
4 files changed, 2174 insertions, 463 deletions
diff --git a/Master/texmf-dist/doc/latex/tikz-cd/pgfmanualstyle.sty b/Master/texmf-dist/doc/latex/tikz-cd/pgfmanualstyle.sty deleted file mode 100644 index ff73284411d..00000000000 --- a/Master/texmf-dist/doc/latex/tikz-cd/pgfmanualstyle.sty +++ /dev/null @@ -1,238 +0,0 @@ -%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––> -% -% Copyright 2010 by Jakob Voss -% -% This file is based on works by Till Tantau. It contains additions and/or -% modifications by Jakob Voss and Rouben Rostamian. It may be distributed -% and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% -% See the file LICENSE for more details. - -%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––> -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{pgfmanualstyle}[2010/01/24 v0.1 pgfmanualstyle] -\RequirePackage{tikz}[2009/09/04] - -%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––> -% code from pgfmanual-en-macros.tex -%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––> -\definecolor{graphicbackground}{rgb}{0.96,0.96,0.8} -\definecolor{codebackground}{rgb}{0.8,0.8,1} - -\makeatletter - -\begingroup -\catcode`|=0 -\catcode`[= 1 -\catcode`]=2 -\catcode`\{=12 -\catcode `\}=12 -\catcode`\\=12 |gdef|find@example#1\end{codeexample}[|endofcodeexample[#1]] -|endgroup -% -\begingroup -\catcode`\^=7 -\catcode`\^^M=13 -\catcode`\ =13% -\gdef\returntospace{\catcode`\ =13\def {\space}\catcode`\^^M=13\def^^M{}}% -\endgroup -% -\begingroup -\catcode`\%=13 -\catcode`\^^M=13 -\gdef\commenthandler{\catcode`\%=13\def%{\@gobble@till@return}} -\gdef\@gobble@till@return#1^^M{} -\gdef\typesetcomment{\catcode`\%=13\def%{\@typeset@till@return}} -\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}} -% -\def\code@pre{} -\def\code@post{} -% -\newdimen\finalcodeexamplewidth % XXX -\newdimen\codeexamplewidth -\newif\ifcode@execute -\newbox\codeexamplebox -\def\codeexample[#1]{% - \code@executetrue - \setlength\codeexamplewidth{4cm}% - \addtolength\codeexamplewidth{7pt}% - \setkeys{codeexample}{#1}% - \parindent0pt - \begingroup% - \par% - \medskip% - \let\do\@makeother% - \dospecials% - \obeylines% - \@vobeyspaces% - \catcode`\%=13% - \catcode`\^^M=13% - \find@example} -\def\endofcodeexample#1{% - \endgroup% - \ifcode@execute% - \setbox\codeexamplebox=\hbox{% - {% - {% - \returntospace% - \commenthandler% - \xdef\code@temp{#1}% removes returns and comments - }% - \colorbox{graphicbackground}{\color{black}\ignorespaces% - \code@pre\expandafter\scantokens\expandafter{\code@temp\ignorespaces}\code@post\ignorespaces}% - }% - }% - \ifdim\wd\codeexamplebox>\codeexamplewidth% - \def\code@start{\par}% - \def\code@flushstart{}\def\code@flushend{}% - \def\code@mid{\parskip2pt\par\noindent}% - %\def\code@width{\linewidth-6pt}% XXX - \setlength\finalcodeexamplewidth{\linewidth} % XXX - \addtolength\finalcodeexamplewidth{-6pt} % XXX - \def\code@end{}% - \else% - \def\code@start{% - \linewidth=\textwidth% - \parshape \@ne 0pt \linewidth - \leavevmode% - \hbox\bgroup}% - \def\code@flushstart{\hfill}% - \def\code@flushend{\hbox{}}% - \def\code@mid{\hskip6pt}% - %\def\code@width{\linewidth-12pt-\codeexamplewidth}% XXX - \setlength\finalcodeexamplewidth{\linewidth} % XXX - \addtolength\finalcodeexamplewidth{-12pt} % XXX - \addtolength\finalcodeexamplewidth{-\codeexamplewidth} % XXX - \def\code@end{\egroup}% - \fi% - \code@start% - \noindent% - \begin{minipage}[t]{\codeexamplewidth}\raggedright - \hrule width0pt% - \footnotesize\vskip-1em% - \code@flushstart\box\codeexamplebox\code@flushend% - \vskip-1ex - \leavevmode% - \end{minipage}% - \else% - \def\code@mid{\par} - %\def\code@width{\linewidth-6pt}% XXX - \setlength\finalcodeexamplewidth{\linewidth} % XXX - \addtolength\finalcodeexamplewidth{-6pt} % XXX - \def\code@end{} - \fi% - \code@mid% - \colorbox{codebackground}{% -% \begin{minipage}[t]{\code@width}% XXX - \begin{minipage}[t]{\the\finalcodeexamplewidth}% - {% - \let\do\@makeother - \dospecials - \frenchspacing\@vobeyspaces - \normalfont\ttfamily\footnotesize - \typesetcomment% - \@tempswafalse - \def\par{% - \if@tempswa - \leavevmode \null \@@par\penalty\interlinepenalty - \else - \@tempswatrue - \ifhmode\@@par\penalty\interlinepenalty\fi - \fi}% - \obeylines - \everypar \expandafter{\the\everypar \unpenalty}% - #1} - \end{minipage}}% - \code@end% - \par% - \medskip - \end{codeexample} -} - -\def\endcodeexample{} - - -%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––> -% code from various pgf/tikz source files and own modifications or additions -%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––> - -\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\pgfmanualbody{\parskip3pt} - -\definecolor{darkred}{rgb}{0.75,0,0} -\definecolor{green}{rgb}{0,.75,0} - -\def\bschar{{\char`\\}} - -\newcommand{\stylekeyheadline}[2][\pgfutil@empty]{% - \pgfmanualentryheadline{\texttt{\color{darkred}/tikz/#2}% - \def\pgf@test{#1}% - \ifx\pgf@test\pgfutil@empty% - \else% - \texttt{=}#1% - \fi% - \index{#2@\texttt{#2} key}}% -} - -\newenvironment{stylekey}[2][]{ - \begin{pgfmanualentry} - \stylekeyheadline[#1]{#2} - \pgfmanualbody -}{ - \end{pgfmanualentry} -} -\newcommand{\commandentry}[2][]{% - \texttt{\color{darkred}\textbackslash #2}#1% - \index{#2@\texttt{\textbackslash #2}} -} -\newenvironment{command}[2][]{ - \begin{pgfmanualentry} - \pgfmanualentryheadline{\commandentry{#2}{#1}} - \pgfmanualbody -}{ - \end{pgfmanualentry} -} -\newcommand\arrowtip[1]{ - \texttt{#1}\index{Arrow tips!mandatory@\protect\texttt{mandatory}}% -} - -\newcommand{\opt}[1]{\color{green}#1} -\newcommand{\meta}[1]{$\langle$\textit{#1}$\rangle$} -\newcommand{\marg}[1]{\texttt{\textbraceleft}\meta{#1}\texttt{\textbraceright}} -\newcommand{\oarg}[1]{\texttt{\textbraceleft} \texttt{\textbraceright}} - -% Global styles: -\tikzset{ - shape example/.style={ - color=black!30, - draw, - fill=yellow!30, - line width=.25cm, % .5 - inner xsep=1.25cm, % 2.5 - inner ysep=0.25cm} % 0.5 -} - -\def\tikzname{Ti\emph{k}Z} - -\makeatother - -%%% Enable '|' to type verbatim - -\usepackage{fancyvrb} -\DefineShortVerb{\|} - -%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––> -\endinput diff --git a/Master/texmf-dist/doc/latex/tikz-cd/tikz-cd-doc.pdf b/Master/texmf-dist/doc/latex/tikz-cd/tikz-cd-doc.pdf Binary files differindex f61f2bd0bcd..3d011c33f2a 100644 --- a/Master/texmf-dist/doc/latex/tikz-cd/tikz-cd-doc.pdf +++ b/Master/texmf-dist/doc/latex/tikz-cd/tikz-cd-doc.pdf diff --git a/Master/texmf-dist/doc/latex/tikz-cd/tikz-cd-doc.tex b/Master/texmf-dist/doc/latex/tikz-cd/tikz-cd-doc.tex index 3d929a2c55c..46e2ece30b8 100644 --- a/Master/texmf-dist/doc/latex/tikz-cd/tikz-cd-doc.tex +++ b/Master/texmf-dist/doc/latex/tikz-cd/tikz-cd-doc.tex @@ -1,31 +1,1344 @@ -\documentclass{article} -\usepackage[utf8]{inputenc} -\usepackage{amsmath,tikz-cd} -\usepackage{pgfmanualstyle} -\usepackage{hyperref} +% Copyright 2011 by Florêncio Neves +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% The preamble of this file contains parts of the files +% pgfmanual-en-main.tex and pgfmanual-en-macros.tex of the pgf package, +% copyright 2006 by Till Tantau and distributed under LPPL and/or GNU +% GPL. + +\documentclass{ltxdoc} + + \def\xcolorversion{2.00} + + \usepackage[version=latest]{pgf} + + \usepackage{xkeyval,calc,listings,tikz,fp} + + \usepackage{hyperref} + \hypersetup{% + colorlinks=true, % use true to enable colors below: + linkcolor=blue,%red, + filecolor=blue,%magenta, + pagecolor=blue,%red, + urlcolor=blue,%cyan, + citecolor=blue, + pdfborder=0 0 0, + } + + % We need lots of libraries... + \usetikzlibrary{ + arrows, + calc, + fit, + patterns, + plotmarks, + shapes.geometric, + shapes.misc, + shapes.symbols, + shapes.arrows, + shapes.callouts, + shapes.multipart, + shapes.gates.logic.US, + shapes.gates.logic.IEC, + circuits.logic.US, + circuits.logic.IEC, + circuits.logic.CDH, + circuits.ee.IEC, + datavisualization, + datavisualization.formats.functions, + er, + automata, + backgrounds, + chains, + topaths, + trees, + petri, + mindmap, + matrix, + calendar, + folding, + fadings, + shadings, + spy, + through, + turtle, + positioning, + scopes, + decorations.fractals, + decorations.shapes, + decorations.text, + decorations.pathmorphing, + decorations.pathreplacing, + decorations.footprints, + decorations.markings, + shadows, + lindenmayersystems, + intersections, + fixedpointarithmetic, + fpu, + svg.path, + external, + } + + \iffalse + % \iftrue + \tikzexternalize[ + mode=list only,export=true,% simply skips EVERY picture -> good for debugging the text. + ] + {pgfmanual} + + \tikzifexternalizing{% + \pgfkeys{/pdflinks/codeexample links=false}% + }{}% + \fi + + + \usepackage[a4paper,left=2.25cm,right=2.25cm,top=2.5cm,bottom=2.5cm,nohead]{geometry} + \usepackage{amsmath,amssymb} + \usepackage{xxcolor} + \usepackage{pifont} + \usepackage{makeidx} + \usepackage[latin1]{inputenc} + \usepackage{amsmath} + + \graphicspath{{../../images/}} % TODOsp: under windows this would go up 2 directories, but the file is only one directory up + % \makeindex + + \providecommand\href[2]{\texttt{#1}} + \providecommand\hypertarget[2]{\texttt{#1}} + \providecommand\hyperlink[2]{\texttt{#1}} + + + \colorlet{examplefill}{yellow!80!black} + \definecolor{graphicbackground}{rgb}{0.96,0.96,0.8} + \definecolor{codebackground}{rgb}{0.8,0.8,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\pgfmanualbody{\parskip3pt} + + + + \newenvironment{pgflayout}[1]{ + \begin{pgfmanualentry} + \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 + } + { + \end{pgfmanualentry} + } + + + \newenvironment{command}[1]{ + \begin{pgfmanualentry} + \extractcommand#1\@@ + \pgfmanualbody + } + { + \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{{\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}} + + \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 + } + { + \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 + } + {\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 + } + {\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 + + + \def\extractcommand#1#2\@@{% + \pgfmanualentryheadline{\declare{\texttt{\string#1}}#2}% + \removeats{#1}% + \index{\strippedat @\protect\myprintocmmand{\strippedat}} + \pgfmanualpdflabel{\textbackslash\strippedat}{}% + } + + + % \begin{environment}{{name}\marg{arguments}} + \renewenvironment{environment}[1]{ + \begin{pgfmanualentry} + \extractenvironement#1\@@ + \pgfmanualbody + } + { + \end{pgfmanualentry} + } + + \def\extractenvironement#1#2\@@{% + \pgfmanualentryheadline{{\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}{}% + } + + + \newenvironment{plainenvironment}[1]{ + \begin{pgfmanualentry} + \extractplainenvironement#1\@@ + \pgfmanualbody + } + { + \end{pgfmanualentry} + } + + \def\extractplainenvironement#1#2\@@{% + \pgfmanualentryheadline{{\ttfamily\declare{\char`\\#1}}#2}% + \pgfmanualentryheadline{{\ttfamily\ \ }\meta{environment contents}}% + \pgfmanualentryheadline{{\ttfamily\declare{\char`\\end#1}}}% + \index{#1@\protect\texttt{#1} environment}% + \index{Environments!#1@\protect\texttt{#1}}% + } + + + \newenvironment{contextenvironment}[1]{ + \begin{pgfmanualentry} + \extractcontextenvironement#1\@@ + \pgfmanualbody + } + { + \end{pgfmanualentry} + } + + \def\extractcontextenvironement#1#2\@@{% + \pgfmanualentryheadline{{\ttfamily\declare{\char`\\start#1}}#2}% + \pgfmanualentryheadline{{\ttfamily\ \ }\meta{environment contents}}% + \pgfmanualentryheadline{{\ttfamily\declare{\char`\\stop#1}}}% + \index{#1@\protect\texttt{#1} environment}% + \index{Environments!#1@\protect\texttt{#1}}} + + + \newenvironment{shape}[1]{ + \begin{pgfmanualentry} + \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 + } + { + \end{pgfmanualentry} + } + + + \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% + \pgfmanualbody + } + { + \end{pgfmanualentry} + } + + \def\gobble#1{} + \def\extracthandler#1#2\@nil{% + \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}% + } + + + \makeatletter + + + \newenvironment{stylekey}[1]{ + \begin{pgfmanualentry} + \def\extrakeytext{style, } + \extractkey#1\@nil% + \pgfmanualbody + } + { + \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{} + % \def\altpath{\emph{\color{gray}or}}% + \extractkey#1\@nil% + \pgfmanualbody + } + { + \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@% + \extractkeyequal#1\@nil + \else% + \pgfutil@in@{(initial}{#1}% + \ifpgfutil@in@% + \extractequalinitial#1\@nil% + \else + \pgfmanualentryheadline{{\ttfamily\declare{#1}}\hfill(\extrakeytext no value)}% + \def\mykey{#1}% + \def\mypath{}% + \def\myname{}% + \firsttimetrue% + \decompose#1/\nil% + \fi + \fi% + } + + \def\extractkeyequal#1=#2\@nil{% + \pgfutil@in@{(default}{#2}% + \ifpgfutil@in@% + \extractdefault{#1}#2\@nil% + \else% + \pgfutil@in@{(initial}{#2}% + \ifpgfutil@in@% + \extractinitial{#1}#2\@nil% + \else + \pgfmanualentryheadline{{\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})}% + } + + \def\extractinitial#1#2(initially #3)\@nil{% + \pgfmanualentryheadline{{\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% + } + + % 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 + + \makeatother + + \def\decompose/#1/#2\nil{% + \def\test{#2}% + \ifx\test\empty% + % aha. + \index{#1@\protect\texttt{#1} key}% + \index{\mypath#1@\protect\texttt{#1}}% + \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 + \expandafter\def\expandafter\mypath\expandafter{\mypath#1@\protect\texttt{#1/}!}% + \fi + \def\firsttime{} + \decompose/#2\nil% + \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 + } + { + \end{pgfmanualentry} + } + + \newenvironment{coordinatesystem}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{Coordinate system {\ttfamily\declare{#1}}}% + \index{#1@\protect\texttt{#1} coordinate system}% + \index{Coordinate systems!#1@\protect\texttt{#1}} + \pgfmanualpdflabel{#1}{}% + \pgfmanualbody + } + { + \end{pgfmanualentry} + } + + \newenvironment{snake}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{Snake {\ttfamily\declare{#1}}}% + \index{#1@\protect\texttt{#1} snake}% + \index{Snakes!#1@\protect\texttt{#1}} + \pgfmanualbody + } + { + \end{pgfmanualentry} + } + + \newenvironment{decoration}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{Decoration {\ttfamily\declare{#1}}}% + \index{#1@\protect\texttt{#1} decoration}% + \index{Decorations!#1@\protect\texttt{#1}} + \pgfmanualbody + } + { + \end{pgfmanualentry} + } + + + \def\pgfmanualbar{\char`\|} + \makeatletter + \newenvironment{pathoperation}[3][]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{\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 + } + { + \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 + } + { + \end{pgfmanualentry} + } + \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}} + \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}} + \pgfmanualentryheadline{{\ttfamily\char`\\usemodule[\declare{#1}]\space\space \char`\%\space\space Con\TeX t}} + \pgfmanualbody + } + { + \end{pgfmanualentry} + } + + + \newenvironment{pgfmodule}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{{\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} + } + + \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}} + \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}} + \pgfmanualbody + \pgfmanualpdflabel{#1}{}% + } + { + \end{pgfmanualentry} + } + + \newenvironment{tikzlibrary}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{{\ttfamily\char`\\usetikzlibrary\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX\space and plain \TeX}} + \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}} + \pgfmanualbody + \pgfmanualpdflabel{#1}{}% + } + { + \end{pgfmanualentry} + } + + + + \newenvironment{filedescription}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{File {\ttfamily\declare{#1}}}% + \index{#1@\protect\texttt{#1} file}% + \index{Packages and files!#1@\protect\texttt{#1}}% + \pgfmanualbody + } + { + \end{pgfmanualentry} + } + + + \newenvironment{packageoption}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{{\ttfamily\char`\\usepackage[\declare{#1}]\char`\{pgf\char`\}}} + \index{#1@\protect\texttt{#1} package option}% + \index{Package options for \textsc{pgf}!#1@\protect\texttt{#1}}% + \pgfmanualbody + } + { + \end{pgfmanualentry} + } + + + + \newcommand\opt[1]{{\color{black!50!green}#1}} + \newcommand\ooarg[1]{{\ttfamily[}\meta{#1}{\ttfamily]}} + + \def\opt{\afterassignment\pgfmanualopt\let\next=} + \def\pgfmanualopt{\ifx\next\bgroup\bgroup\color{black!50!green}\else{\color{black!50!green}\next}\fi} + + + + \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}} + \def\prosper{\textsc{prosper}} + \def\seminar{\textsc{seminar}} + \def\texpower{\textsc{texpower}} + \def\foils{\textsc{foils}} + + { + \makeatletter + \global\let\myempty=\@empty + \global\let\mygobble=\@gobble + \catcode`\@=12 + \gdef\getridofats#1@#2\relax{% + \def\getridtest{#2}% + \ifx\getridtest\myempty% + \expandafter\def\expandafter\strippedat\expandafter{\strippedat#1} + \else% + \expandafter\def\expandafter\strippedat\expandafter{\strippedat#1\protect\printanat} + \getridofats#2\relax% + \fi% + } + + \gdef\removeats#1{% + \let\strippedat\myempty% + \edef\strippedtext{\stripcommand#1}% + \expandafter\getridofats\strippedtext @\relax% + } + + \gdef\stripcommand#1{\expandafter\mygobble\string#1} + } + + \def\printanat{\char`\@} + + \def\declare{\afterassignment\pgfmanualdeclare\let\next=} + \def\pgfmanualdeclare{\ifx\next\bgroup\bgroup\color{red!75!black}\else{\color{red!75!black}\next}\fi} + + + \let\textoken=\command + \let\endtextoken=\endcommand + + \def\myprintocmmand#1{\texttt{\char`\\#1}} + + \def\example{\par\smallskip\noindent\textit{Example: }} + \def\themeauthor{\par\smallskip\noindent\textit{Theme author: }} + + + \def\indexoption#1{% + \index{#1@\protect\texttt{#1} option}% + \index{Graphic options and styles!#1@\protect\texttt{#1}}% + } + + \def\itemcalendaroption#1{\item \declare{\texttt{#1}}% + \index{#1@\protect\texttt{#1} date test}% + \index{Date tests!#1@\protect\texttt{#1}}% + } + + + + \def\class#1{\list{}{\leftmargin=2em\itemindent-\leftmargin\def\makelabel##1{\hss##1}}% + \extractclass#1@\par\topsep=0pt} + \def\endclass{\endlist} + \def\extractclass#1#2@{% + \item{{{\ttfamily\char`\\documentclass}#2{\ttfamily\char`\{\declare{#1}\char`\}}}}% + \index{#1@\protect\texttt{#1} class}% + \index{Classes!#1@\protect\texttt{#1}}} + + \def\partname{Part} + + \makeatletter + \def\index@prologue{\section*{Index}\addcontentsline{toc}{section}{Index} + This index only contains automatically generated entries. A good + index should also contain carefully selected keywords. This index is + not a good index. + \bigskip + } + \c@IndexColumns=2 + \def\theindex{\@restonecoltrue + \columnseprule \z@ \columnsep 29\p@ + \twocolumn[\index@prologue]% + \parindent -30pt + \columnsep 15pt + \parskip 0pt plus 1pt + \leftskip 30pt + \rightskip 0pt plus 2cm + \small + \def\@idxitem{\par}% + \let\item\@idxitem \ignorespaces} + \def\endtheindex{\onecolumn} + \def\noindexing{\let\index=\@gobble} + + + + \newcommand\symarrow[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} + } + \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}% + \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} + } + + \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}} + \texttt{#1}& yields for line width 1ex + \begin{tikzpicture}[arrows={#1-#1},line width=1ex,baseline] + \useasboundingbox (0pt,-0.5ex) rectangle (1.5cm,2ex); + \draw (0pt,.5ex) -- (1.5cm,.5ex); + \end{tikzpicture} + } + \def\myvbar{\char`\|} + \newcommand\plotmarkentry[1]{% + \index{#1@\protect\texttt{#1} plot mark}% + \index{Plot marks!#1@\protect\texttt{#1}} + \texttt{\char`\\pgfuseplotmark\char`\{\declare{#1}\char`\}} & + \tikz\draw[color=black!25] plot[mark=#1,mark options={fill=examplefill,draw=black}] coordinates{(0,0) (.5,0.2) (1,0) (1.5,0.2)};\\ + } + \newcommand\plotmarkentrytikz[1]{% + \index{#1@\protect\texttt{#1} plot mark}% + \index{Plot marks!#1@\protect\texttt{#1}} + \texttt{mark=\declare{#1}} & \tikz\draw[color=black!25] + plot[mark=#1,mark options={fill=examplefill,draw=black}] + coordinates {(0,0) (.5,0.2) (1,0) (1.5,0.2)};\\ + } + + + + \ifx\scantokens\@undefined + \PackageError{pgfmanual-macros}{You need to use extended latex + (elatex) or (pdfelatex) to process this document}{} + \fi + + \begingroup + \catcode`|=0 + \catcode`[= 1 + \catcode`]=2 + \catcode`\{=12 + \catcode `\}=12 + \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`\^^I=13\def^^I{\space}} + \gdef\showreturn{\show^^M} + \endgroup + + \begingroup + \catcode`\%=13 + \catcode`\^^M=13 + \gdef\commenthandler{\catcode`\%=13\def%{\@gobble@till@return}} + \gdef\@gobble@till@return#1^^M{} + \gdef\@gobble@till@return@ignore#1^^M{\ignorespaces} + \gdef\typesetcomment{\catcode`\%=13\def%{\@typeset@till@return}} + \gdef\@typeset@till@return#1^^M{{\def%{\char`\%}\textsl{\char`\%#1}}\par} + \endgroup + + % 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 + \newif\ifcode@execute + \newbox\codeexamplebox + \def\codeexample[#1]{% + \begingroup% + \code@executetrue + \pgfqkeys{/codeexample}{every codeexample,#1}% + \codeexample@tabinit% assigns \codeexample@tabinit@[catcode,replacementchars] + \parindent0pt + \begingroup% + \par% + \medskip% + \let\do\@makeother% + \dospecials% + \obeylines% + \@vobeyspaces% + \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}% + \def\code@flushstart{}\def\code@flushend{}% + \def\code@mid{\parskip2pt\par\noindent}% + \def\code@width{\linewidth-6pt}% + \def\code@end{}% + \else% + \def\code@start{% + \linewidth=\textwidth% + \parshape \@ne 0pt \linewidth + \leavevmode% + \hbox\bgroup}% + \def\code@flushstart{\hfill}% + \def\code@flushend{\hbox{}}% + \def\code@mid{\hskip6pt}% + \def\code@width{\linewidth-12pt-\codeexamplewidth}% + \def\code@end{\egroup}% + \fi% + \code@start% + \noindent% + \begin{minipage}[t]{\codeexamplewidth}\raggedright + \hrule width0pt% + \footnotesize\vskip-1em% + \code@flushstart\box\codeexamplebox\code@flushend% + \vskip-1ex + \leavevmode% + \end{minipage}% + \else% + \def\code@mid{\par} + \def\code@width{\linewidth-6pt} + \def\code@end{} + \fi% + \code@mid% + \colorbox{codebackground}{% + \begin{minipage}[t]{\code@width}% + {% + \let\do\@makeother + \dospecials + \frenchspacing\@vobeyspaces + \normalfont\ttfamily\footnotesize + \typesetcomment% + \codeexample@tabinit@replacementchars + \@tempswafalse + \def\par{% + \if@tempswa + \leavevmode \null \@@par\penalty\interlinepenalty + \else + \@tempswatrue + \ifhmode\@@par\penalty\interlinepenalty\fi + \fi}% + \obeylines + \everypar \expandafter{\the\everypar \unpenalty}% + \pgfkeysvalueof{/codeexample/typeset listing/.@cmd}{#1}\pgfeov + } + \end{minipage}}% + \code@end% + \par% + \medskip + \end{codeexample} + } + + \def\endcodeexample{\endgroup} + + + \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 + + + \makeatletter + \renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.8em}} + \renewcommand*\l@subsubsection{\@dottedtocline{3}{4.3em}{3.2em}} + \makeatother + + % \includeonly{pgfmanual-en-library-profiler} + + % Global styles: + \tikzset{ + every plot/.style={prefix=plots/pgf-}, + shape example/.style={ + color=black!30, + draw, + fill=yellow!30, + line width=.5cm, + inner xsep=2.5cm, + inner ysep=0.5cm} + } + +\usepackage{tikz-cd} +\usepackage{multicol,longtable} \hypersetup{pdftitle={The tikz-cd package}, - pdfauthor={Florêncio Neves}, + pdfauthor={Florêncio Neves}, pdfkeywords={commutative diagrams, latex, tikz, pgf}, colorlinks } \title{The \texttt{tikz-cd} package} -\author{\normalsize Florêncio Neves\footnote{\emph{E-mail:} \href{mailto:florencioneves@gmail.com}{\texttt{florencioneves@gmail.com}}}} -\date{\normalsize Version 0.1\footnote{\color{red}This is a preliminary version. Future versions may not be backwards-compatible. Comments are welcome.}} +\author{\normalsize Florêncio Neves\footnote{\emph{E-mail:} \href{mailto:florencioneves@gmail.com}{\texttt{florencioneves@gmail.com}}}} +\date{\normalsize Version 0.2, of October, 2011} -\makeatletter -\definecolor{graphicbackground}{rgb}{0.96,0.96,0.8} -\def\tikzcd@bgcolor{graphicbackground} -\makeatother +\tikzset{commutative diagrams/background color=graphicbackground} -\newcommand{\displayarrow}[2][]{\texttt{#2} & yelds \tikz[baseline=-2.5pt] \draw[#2-#2, line width=0.44pt, #1] (0,0) -- (1,0);} -\newcommand{\displayarrowstyle}[2][]{\texttt{#2} & yelds \tikz[baseline=-2.5pt] \draw[/commutative diagrams/current arrows, #2, #1] (0,0) -- (0.4,0);} +\newcommand{\displayarrow}[2][]{\texttt{#2} & yelds \tikz[baseline=-2.5pt] \draw[#2-#2, line width=0.0929ex, #1] (0,0) -- (1,0);} +\newcommand{\displayarrowstyle}[2][]{\texttt{#2} #1 & yelds \tikz[baseline=-2.5pt] \draw[commutative diagrams/.cd, #2] (0,0) -- (0.6,0);} \begin{document} \maketitle -The general-purpose drawing package \tikzname{} can be used to typeset +The general-purpose drawing package Ti\emph{k}Z can be used to typeset commutative diagrams and other kinds of mathematical pictures, generating high-quality results (see for example \cite{lenders} or \cite{milne}). The purpose of this package is to make the process of @@ -34,7 +1347,7 @@ macros and reasonable default settings. This package also includes an arrow tip library that match closely the arrows present in the Computer Modern typeface. -PGF version 2.10 is required. +\textsc{pgf} version 2.10 is required. \tableofcontents @@ -45,117 +1358,536 @@ Commutative diagrams are created with the |tikzcd| environment. Its content describes a matrix, like the |\matrix| command in \tikzname{} or the |align| environment in \LaTeX. Everything is typeset in math mode, but you will probably want use \texttt{tikzcd} inside an -|equation| environment or inside |\[ \]|, so that the diagram will be +|equation| environment or inside |\[| \dots |\]|, so that the diagram is placed on a new line and centered. \subsection{Inserting arrows} \label{sec:inserting-arrows} Inside the |tikzcd| environment, the command |\arrow| is provided to -allow insertion of arrows. In its simplest form, it takes one -argument, a string containing the characters |l|, |r|, |u| or |d|, -standing for left, right, up and down, that determine the arrow -target. A label can be placed on this arrow by providing a second -argument. +produce arrows. In its simplest form, it takes one argument, a string +containing the characters |r|, |l|, |u| or |d|, standing for right, left, +up and down, that determine the arrow target. A label can be +placed on an arrow by providing a second argument. \begin{codeexample}[] \begin{tikzcd} - A \arrow{ld} \arrow{l}{\phi} & B \\ + A \arrow{rd} \arrow{r}{\phi} & B \\ & C \end{tikzcd} \end{codeexample} You can control the behavior of the arrow by placing an argument inside square braces before the direction parameter. It may contain -anything that can be passed as an argument to a \tikzname{}'s |edge| -operator. Similarly, the label can be modified by an argument in -square braces right before it. It may contain anything that can be -passed to a |node| operator. +any option that can be passed to \tikzname{}'s +|\path| command. Similarly, a label can be modified by an argument in square braces right before it. It may contain anything that can be passed to a |node| +operator. \begin{codeexample}[] \begin{tikzcd} - A \arrow{l}{\psi} \arrow[color=red]{d} + A \arrow{r}{\psi} \arrow[color=red]{d} & B \arrow{d}[color=red]{\psi} \\ - C \arrow[color=red]{l}[color=blue]{\eta} + C \arrow[color=red]{r}[color=blue]{\eta} & D \end{tikzcd} \end{codeexample} -If you want to save typing, the command |\ar| is provided as a -shortcut to |\arrow|. There are also commands |\lar|, |\rar|, |\uar| -and |\dar|, that act like |\arrow{l}|, |\arrow{r}| and so forth. They -can take up to three optional argument:\ one in square braces to -control the arrow, one in square braces to control the label, and one -in curly braces to specify a label. Thus, the previous diagram can be -rewritten as follows. +An arrow can in fact have an arbitrary number of labels, each one +being specified by appending |{|\meta{text}|}| or |[|\meta{options}|]{|\meta{text}|}| to the |\arrow| +command. + \begin{codeexample}[] \begin{tikzcd} - A \lar{\psi} \dar[color=red] + A \arrow{r}[near start]{\phi}[swap]{\psi}[near end]{\eta} & B +\end{tikzcd} +\end{codeexample} + +To save some typing, the command |\ar| is provided as a shorthand to +|\arrow|. There are also commands |\rar|, |\lar|, |\uar|, |\dar|, +|\urar|, |\ular|, |\drar| and |\dlar| that act like |\arrow{r}|, +|\arrow{l}|, \dots, |\arrow{ur}|, and so forth. They can take an optional +argument in square braces to modify the arrow, followed by label +specifiers of the form |{|\meta{text}|}| or +|[|\meta{options}|]{|\meta{text}|}|. +Thus, the diagram above can be rewritten as follows. +\begin{codeexample}[] +\begin{tikzcd} + A \rar{\psi} \dar[color=red] & B \dar[color=red]{\psi} \\ - C \lar[color=red][color=blue]{\eta} + C \rar[color=red][color=blue]{\eta} & D \end{tikzcd} \end{codeexample} +We provide one more example, reproduced from X\raisebox{-0.3ex}{Y}-pic +user's guide. + +\begin{codeexample}[] +\begin{tikzcd} + T + \arrow[bend left]{drr}{x} + \arrow[bend right]{ddr}{y} + \arrow[dotted]{dr}[description]{(x,y)} & & \\ + & X \times_Z Y \arrow{r}{p} \arrow{d}{q} & X \arrow{d}{f} \\ + & Y \arrow{r}{g} & Z +\end{tikzcd} +\end{codeexample} + \subsection{Changing arrow tips} \label{sec:changing-arrow-tips} -If you are familiar with \tikzname, you certainly noticed that you can -produce different kids of arrows by passing arguments like |right hook->| -to the |\arrow| command. This package provides an alternative -way of doing this. Namely, there are styles named after \LaTeX{} -arrow producing commands for this purpose. Thus, instead of -|\arrow[right hook->]{l}|, you can use |\arrow[hookrightarrow]{l}|, as +If you are familiar with \tikzname, you certainly noticed that +different kids of arrows can be produced by passing arguments like +|right hook->| to the |\arrow| command. This package provides an +alternative method:\ it defines styles named after \LaTeX{} +arrow-producing commands. Thus, instead of +|\arrow[right hook->]{r}|, you can use |\arrow[hookrightarrow]{r}|, as in the example below. \begin{codeexample}[] \begin{tikzcd} - X \arrow[hookrightarrow]{l} \arrow[dashed]{ld} + X \arrow[hookrightarrow]{r} \arrow[dashed]{rd} & \bar{X} \arrow{d}\\ & Y \end{tikzcd} \end{codeexample} -The complete list of arrow types available so far is given below. It -will be made comprehensive in the future. +The list below show all arrow styles available. -\begin{tabular}{ll} +{\tikzset{commutative diagrams/background color=white} +\begin{longtable}{ll} \displayarrowstyle{rightarrow}\\ + \displayarrowstyle{Rightarrow}\\ \displayarrowstyle{leftarrow}\\ - \displayarrowstyle{hookrightarrow}\\ + \displayarrowstyle{Leftarrow}\\ + \displayarrowstyle{leftrightarrow}\\ + \displayarrowstyle{Leftrightarrow}\\ + \displayarrowstyle{equals}\\ + \displayarrowstyle[or \texttt{maps to}]{mapsto}\\ + \displayarrowstyle[or \texttt{hook}]{hookrightarrow}\\ \displayarrowstyle{hookleftarrow}\\ - \displayarrowstyle{hookrightarrow}\\ \displayarrowstyle{rightharpoonup}\\ \displayarrowstyle{rightharpoondown}\\ \displayarrowstyle{leftharpoonup}\\ \displayarrowstyle{leftharpoondown}\\ -\end{tabular} + \displayarrowstyle[or \texttt{dashed}]{dashrightarrow}\\ + \displayarrowstyle{dashleftarrow}\\ + \displayarrowstyle[or \texttt{tail}]{rightarrowtail}\\ + \displayarrowstyle{leftarrowtail}\\ + \displayarrowstyle[or \texttt{two heads}]{twoheadrightarrow}\\ + \displayarrowstyle{twoheadleftarrow}\\ + \displayarrowstyle[or \texttt{squiggly}]{rightsquigarrow}\\ + \displayarrowstyle{leftsquigarrow}\\ + \displayarrowstyle{leftrightsquigarrow} +\end{longtable} +} + +Some of the styles above have two names. In these cases, the second +one behaves a little differently from the first, in that it can be +superimposed with other arrow styles. + +\begin{codeexample}[] +\begin{tikzcd} + A \arrow[tail, two heads, dashed]{r} & B +\end{tikzcd} +\end{codeexample} -\section{Changing the appearance of diagrams} + +\section{Controlling the appearance of diagrams} \label{sec:chang-appe-diagr} -In the future, a customization scheme using |pgfkeys| will be implemented. For now, you can change the appearance of diagrams by understanding some of |tikz-cd|'s internals. The |tikzcd| environment generates codes with the following basic structure: +This section lists all customization keys defined by this package. +Options can be made take effect in different scopes: +\begin{enumerate} +\item Globally, using the command |\tikzset|. This can be done in the + document preamble, or in the body, to affect all diagrams + appearing next. +\item For the current diagram, by placing options in the optional + argument to the |tikzcd| environment. Such options are applied to + the |tikzpicture| environment generated by |tikzcd|. Thus you can, + for instance, use the |execute at end picuture| key in this + situation to have arbitrary \tikzname{} code executed after a + diagram is drawn. +\item For the current arrow or label, by placing options in one of the + optional arguments of |\arrow|. +\end{enumerate} + +Of course, not all options make sense in all contexts. For example, +setting |row sep=1cm| globally with |\tikzset| will have no effect, +since the |row sep| option is re-set at the beginning of each diagram. +To make all diagrams have |row sep| set to 1\,cm, you can use +\begin{center} + |\tikzset{commutative diagrams/row sep/normal=1cm}|, +\end{center} +as detailed below. + +All keys provided by this package are located in the path +|/tikz/commutative diagrams|. Methods 2.\ and 3.\ above will search +in this path by default. If a key is not found there, an attempt is +made to find it in |/tikz|, which is what you would expect. With +method 1., it is convenient to change the default search path by using + \begin{center} + |\tikzset{commutative diagrams/.cd, |\meta{options}|}|. + \end{center} + +\subsection{General options} +\label{sec:general-options} + +\begin{stylekey}{/tikz/commutative diagrams/every diagram} + This style is applied to every |tikzcd| environment. Initially, it + contains the following: +\begin{codeexample}[code only] +/tikz/commutative diagrams/.cd, +/tikz/text height=1.5ex, +/tikz/text depth=0.25ex, +/tikz/baseline=0pt, +row sep=normal, +column sep=normal +\end{codeexample} + +The options |text height| and |text depth| are set to ensure arrows +between nodes in the same row are drawn horizontally, as discussed in +\cite{lenders}. The |baseline=0pt| setting is used to make equation +numbers be placed correctly. + +\end{stylekey} + +\begin{key}{/tikz/commutative diagrams/diagrams=\meta{options}} + This key appends \meta{options} to the style + |/tikz/commutative diagrams/every diagram|. +\end{key} + +\begin{key}{/tikz/commutative diagrams/row sep=\meta{size} (initially normal)} + This key acts as a ``frontend'' to \tikzname's |/tikz/row sep| key. If + the key + \begin{center} + |/tikz/commutative diagrams/row sep/|\meta{size} + \end{center} +stores a + \meta{value}, then it is read and |/tikz/row sep|=\meta{value} is + set. If the key above is not initialized, then \meta{size} is + presumably a dimension, and |/tikz/row sep|=\meta{size} is set. + + The values of \meta{size} initially available, and their values, are + the following: + \begin{center} + \begin{tabular}{cccccc} + |tiny| & |small| & |scriptsize| & |normal| & |large| & |huge| \\ + 1.25\,ex & 2.5\,ex & 3.75\,ex & 5\,ex & 7.5\,ex & 10\,ex + \end{tabular} + \end{center} +\end{key} + + To change, say, the |normal| size (which is applied by default) to 1\,cm, you + can use \begin{codeexample}[code only] - \begin{tikzpicture}[ ... ] - \matrix (m) [ ... ] { - & ... & \\ - & ... & \\}; - \path[ ... ] ...; - \end{tikzpicture} -\end{codeexample} -There are styles -\begin{quote} -|/commutative diagrams/picture style|,\\ -|/commutative diagrams/matrix style|, and\\ -|/commutative diagrams/path style|\\ -\end{quote} -that are applied at the relevant places. By appending things to these styles, you can control the behavior of diagrams quite arbitrarily. The arrow tip styles are stored in |/commutative diagrams/current arrows|. +\tikzset{commutative diagrams/row sep/normal=1cm} +\end{codeexample} + You can also create new sizes, but |pgfkeys| requires new keys to be + explicitly initialized. For example, to create a size |my size|, meaning + 1\,cm, you should use +\begin{codeexample}[code only] +\tikzset{commutative diagrams/row sep/my size/.initial=1cm} +\end{codeexample} +\begin{key}{/tikz/commutative diagrams/column sep=\meta{size} (initially normal)} + This works analogously to the |row sep| key above. The sizes available + initially are the following: + \begin{center} + \begin{tabular}{cccccc} + |tiny| & |small| & |scriptsize| & |normal| & |large| & |huge| \\ + 1.5\,ex & 3\,ex & 4.5\,ex & 6\,ex & 9\,ex & 12\,ex + \end{tabular} + \end{center} +\end{key} + +In the examples below, the triangular diagrams would look too wide or +too tall if the column or row separation were not changed. + +\begin{codeexample}[] + \begin{tikzcd}[column sep=tiny] + & A \arrow{dl}\arrow{dr} & \\ + B \arrow{rr} & & C + \end{tikzcd} + + \begin{tikzcd}[row sep=small] + & B \arrow{dd} \\ + A \arrow{ur}\arrow{dr} & \\ + & C + \end{tikzcd} +\end{codeexample} + +\begin{key}{/tikz/commutative diagrams/math mode=\meta{boolean} + (initially true)} + This keys determines whether the contents of a diagram is typeset in + math mode or not. If set globally or diagram-wise, it affects both + the diagram entries and arrow labels. If used with |\arrow|, it affect + only its labels. +\end{key} + +\begin{key}{/tikz/commutative diagrams/background color=\meta{color} (initially white)} + This key simply stores the name of a color, and is read by + styles that fill the background, such as |description| and |crossing over|. + It does not cause the background to painted. +\end{key} + +\subsection{Options for arrows} +\label{sec:options-arrows} + +Besides the options and styles provided by this package, there are +several options defined by \tikzname{} that are useful for arrows, such +as |dashed|, |dotted| and its relatives, |line width=|\meta{dimension}, |color=|\meta{color}, +|bend right|, |bend left|, |in=|\meta{angle}, |out=|\meta{angle}, +|loop|, etc. See the \pgfname{} manual. + +\begin{stylekey}{/tikz/commutative diagrams/every arrow} + This style is applied to every |\arrow|. Initially, it contains the + following: +\begin{codeexample}[code only] +/tikz/commutative diagrams/.cd, +/tikz/draw, +/tikz/commutative diagrams/default arrow +\end{codeexample} + +Initially, the style |default arrow| is a synonym to |rightarrow|. +\end{stylekey} + +\begin{key}{/tikz/commutative diagrams/arrows=\meta{options}} + This key appends \meta{options} to the style + |/tikz/commutative diagrams/every arrow|. +\end{key} + +\begin{key}{/tikz/commutative diagrams/arrow style=\meta{style} (initially computer + modern)} + Setting this key causes the several arrow-tip-specifying styles + listed on \S\ref{sec:changing-arrow-tips} to be (re)defined. In + particular, it makes the style + |/tikz/commutative diagrams/default arrow|, + which is automatically applied to every arrow, to be defined. + Currently, \meta{style} can be one of |computer modern| or |tikz|. The |tikz| style uses the arrow tips defined in \tikzname's |arrows| + library, and it honors the option |/tikz/>|. + + The |computer modern| style sets the parameter |/tikz/line width| in + accordance to the current font size. The |tikz| arrow style, + however, does not change it, allowing you to directly control the + thickness of arrows. +\end{key} + +If you are using a font different from Computer Modern, you may find +better results by selecting the |tikz| arrow style, setting |/tikz/>| to +the value that best matches your font, and adjusting |/tikz/line width| +if necessary. The following example, if not particularly elegant, +should be instructive. + +\begin{codeexample}[] +\tikzset{ + commutative diagrams/.cd, + arrow style=tikz, + diagrams={>=open triangle 45, line width=1pt}} + +\begin{tikzcd} + A \arrow{r} \arrow{d} & B \arrow{d}\\ + C \arrow{r} & D +\end{tikzcd} +\end{codeexample} + +\begin{key}{/tikz/commutative diagrams/start anchor=\meta{anchor} + (default \normalfont empty)} + This style specifies at which anchor of the current node an arrow + should start. The default behavior is not to specify an anchor, + causing the arrow to start at the point in the boundary of the + current node closest to the destination, as explained in the + \pgfname{} manual. +\end{key} + +\begin{key}{/tikz/commutative diagrams/end anchor=\meta{anchor} + (default \normalfont empty)} + This style works analogously, but refers to the target node of the arrow. +\end{key} + +Some of the possible values for \meta{anchor} are shown below. + + \begin{center} + \begin{tikzpicture} + \node[name=s,shape=rectangle,shape example] {\Huge Rectangle\vrule + width 1pt height 2cm}; \foreach \anchor/\placement in {north + west/above left, north/above, north east/above right, + west/left, center/above, east/right, mid west/right, + mid/above, mid east/left, base west/left, base/below, base + east/right, south west/below left, south/below, south + east/below right, text/left, 10/right, 130/above} + \draw[shift=(s.\anchor)] plot[mark=x] coordinates{(0,0)} + node[\placement] {\scriptsize\texttt{\anchor}}; + \end{tikzpicture} + \end{center} + +The picture below illustrates the use of |end anchor| and +|start anchor|. + +\begin{codeexample}[] +\begin{tikzcd} + A \rar[start anchor=north east, end anchor=north west]{\psi} + \rar[start anchor=south east, end anchor=south west,swap]{\phi} + & B +\end{tikzcd} +\end{codeexample} + +\begin{stylekey}{/tikz/commutative diagrams/crossing over} + This style makes a thicker line, with color + |/tikz/commutative diagrams/background color|, to be drawn under the + current arrow, simulating the effect of its passing over other + arrows. + +\begin{codeexample}[] +\begin{tikzcd} + A \arrow{dr} & B \arrow[crossing over]{dl} \\ + C & D +\end{tikzcd} +\end{codeexample} +\end{stylekey} + +Note that, since arrows are drawn in the order they are read, some +arrows may need to run ``backwards'' to achieve the desired result. +The following picture, from \cite{lenders}, illustrates this. + +\begin{codeexample}[] +\begin{tikzcd}[row sep=scriptsize, column sep=scriptsize] + & f^* E_V \arrow{dl}\arrow{rr}\arrow{dd} & & E_V \arrow{dl}\arrow{dd} \\ + f^* E \arrow[crossing over]{rr}\arrow{dd} & & E \\ + & U \arrow{dl}\arrow{rr} & & V \arrow{dl} \\ + M \arrow{rr} & & N\arrow[crossing over, leftarrow]{uu} \\ +\end{tikzcd} +\end{codeexample} + +\begin{key}{/tikz/commutative diagram/crossing over clearance=\meta{dimension} + (initially 6pt)} + This key specifies the width of the line drawn under a |crossing over| arrow. +\end{key} + +\begin{key}{/tikz/commutative diagrams/path operation=\meta{operation} (initially to)} + Normally, the command |\arrow[|\meta{options}|]{|\meta{direction}|}| + causes the following code to be executed: + \begin{center} + |\path[commutative diagrams/every arrow, |\meta{options}|] (|% + \meta{current node}|) to (|\meta{target node}|);| + \end{center} + However, the path operation ``|to|'' appearing above is not + hard-coded, but rather determined by this key. The main purpose of this + key is to allow some tweaking. + +\begin{codeexample}[] +\begin{tikzcd} + A \arrow[path operation=|-, dashed]{dr} + \arrow[path operation={.. controls +(1.5,0.5) and +(-1,0.8) ..}]{dr}& \\ + & B +\end{tikzcd} +\end{codeexample} + +\end{key} +\subsection{Options for labels} +\label{sec:options-labels} + +Besides the options provided by this package and listed below, there +are many options provided by \tikzname{} that are useful for +labels, such as |above|, |below|, |left|, +|right|, |swap| (which makes the label be placed in the opposite side +to the default), |sloped|, |pos=|\meta{fraction}, |near start|, +|near end|, |inner sep=|\meta{dimension}, |font=|\meta{font + command}, |text width=|\meta{dimension}, etc. See the \pgfname{} manual. + +\begin{stylekey}{/tikz/commutative diagrams/every label} + This style works as if it were applied to the optional argument + corresponding to each label attached to an arrow. Initially is set + to the following: + +\begin{codeexample}[code only] +/tikz/commutative diagrams/.cd, +/tikz/auto, +/tikz/font=\scriptsize, +/tikz/inner sep=0.5ex, +/tikz/text height=, +/tikz/text depth= +\end{codeexample} + +The style |/tikz/auto| makes the label be placed to the left of the +arrow, understanding ``front'' as the direction the arrow points at. +The dimension |/tikz/inner sep| controls the distance between the +arrow and the label. +\end{stylekey} + +\begin{key}{/tikz/commutative diagrams/labels=\meta{options}} + This key appends \meta{options} to the style + |/tikz/commutative diagrams/every label|. +\end{key} + +\begin{stylekey}{/tikz/commutative diagrams/description} + This style causes the label to be placed on the arrow, with the + background filled. + +\begin{codeexample}[] +\begin{tikzcd} + A \arrow{r}[description]{\phi} & B +\end{tikzcd} +\end{codeexample} +\end{stylekey} + +\begin{key}{/tikz/commutative diagrams/description + clearance=\meta{dimension} (initially 1.5pt)} + This key determines the size of the border around a label when the + |description| style above is applied. Its value is used to set the + key |/tikz/inner sep|. +\end{key} + +\section{Drawing diagrams directly with Ti\emph{k}Z} +\label{sec:draw-diagr-directly} + +If the tools provided by this package prove not flexible enough +for some application, you can use the methods described in +\cite{lenders} and \cite{milne} to draw diagrams directly with +\tikzname. In this case, you can still use the styles provided by +this package, to achieve uniformity with diagrams drawn with +|tikzcd|. The pictures below show how this can be done (the second +one is adapted from \cite{milne}). + +\begin{codeexample}[] +\begin{tikzpicture}[commutative diagrams/every diagram] + \matrix[matrix of math nodes, name=m] { + X & \bar X \\ + & Y \\}; + \path[commutative diagrams/.cd, every arrow, every label] + (m-1-1) edge[commutative diagrams/hook] (m-1-2) + edge[commutative diagrams/dashed] (m-2-2) + (m-1-2) edge (m-2-2); +\end{tikzpicture} +\end{codeexample} + + +\begin{codeexample}[] +\begin{tikzpicture}[commutative diagrams/every diagram] + \node (P0) at (90:2.8cm) {$X\otimes (Y\otimes (Z\otimes T))$}; + \node (P1) at (90+72:2.5cm) {$X\otimes ((Y\otimes Z)\otimes T))$} ; + \node (P2) at (90+2*72:2.5cm) {\makebox[5ex][r]{$(X\otimes (Y\otimes Z))\otimes T$}}; + \node (P3) at (90+3*72:2.5cm) {\makebox[5ex][l]{$((X\otimes Y)\otimes Z)\otimes T$}}; + \node (P4) at (90+4*72:2.5cm) {$(X\otimes Y)\otimes (Z\otimes T)$}; + + \path[commutative diagrams/.cd, every arrow, every label] + (P0) edge node[swap] {$1\otimes\phi$} (P1) + (P1) edge node[swap] {$\phi$} (P2) + (P2) edge node {$\phi\otimes 1$} (P3) + (P4) edge node {$\phi$} (P3) + (P0) edge node {$\phi$} (P4); +\end{tikzpicture} +\end{codeexample} \section{Computer Modern arrow tips} \label{sec:comp-modern-arrow} -By using the mechanism explained in \S\ref{sec:changing-arrow-tips}, it is not necessary to know the technical details in this section. - -The naming scheme of the Computer Modern-like arrow tips provided by this package follows that of |pgf|'s |arrows| library, as described in Section 23 of the |pgf| manual. You can of course use these arrow tips outside the |tikzcd| environment; in this case, you will probably want to know that in order to match the Computer Modern font at size $10\,\mathrm{pt}$, it is necessary to set \texttt{line width} to $0.4\,\mathrm{pt}$; for larger font sizes, scale this parameter accordingly. +By using the mechanism explained in \S\ref{sec:changing-arrow-tips}, +it is not necessary, and in fact not advisable, to directly use the +arrow tips library documented in this section when creating diagrams. +The naming scheme of the Computer Modern-like arrow tips provided by +this package follows that of \pgfname's |arrows| library, as described +in \S{}23 of the \pgfname{} manual. To match the Computer Modern +typeface at size 10\,pt, line width should be set to 0.4\,pt; for +larger font sizes, scale this parameter accordingly. \begin{description} \item[Basic arrow tips]\ \\ @@ -163,12 +1895,18 @@ The naming scheme of the Computer Modern-like arrow tips provided by this packag \displayarrow{cm to}\\ \displayarrow{cm to reversed}\\ \displayarrow[line width=0.66pt]{cm bold to} (with a line 50\% thicker)\\ - \texttt{cm \char`\|} & yelds \tikz[baseline=-2.5pt] \draw[cm |-cm |, line width=0.44pt] (0,0) -- (1,0);\\ + \texttt{cm \char`\|} & yelds \tikz[baseline=-2.5pt] \draw[cm |-cm |, line width=0.0929ex] (0,0) -- (1,0);\\ \displayarrow{cm o}\\ \displayarrow{cm *}\\ \displayarrow{cm cap}\\ \end{tabular} +\item[Arrow tips for double lines]\ \\ +\begin{tabular}{ll} + \displayarrow[/tikz/double distance=3.643\pgflinewidth]{cm implies}\\ + \displayarrow[/tikz/double distance=3.643\pgflinewidth]{cm implies cap} +\end{tabular} + \item[Hooks]\ \\ \begin{tabular}{ll} \displayarrow{cm left hook}\\ @@ -191,20 +1929,17 @@ The naming scheme of the Computer Modern-like arrow tips provided by this packag \end{tabular} \end{description} -\section{Some examples} -\label{sec:some-examples} +% \section{Some examples} +% \label{sec:some-examples} + + +% \begin{codeexample}[] +% \begin{tikzcd}[row sep=small] +% H^i(A) \rar & H^i(B) \rar & H^i(C) \arrow[out=0, in=180]{dll}\\ +% H^{i+1}(A) \rar & H^{i+1}(B) \rar & H^{i+1}(C) +% \end{tikzcd} +% \end{codeexample} -The following example is taken from \cite{milne}. -\begin{codeexample}[] -\begin{tikzcd} - T - \arrow[bend left]{dll}{x} - \arrow[bend right]{ddl}{y} - \arrow[dotted]{dl}[description]{(x,y)} & & \\ - & X \times_Z Y \arrow{l}{p} \arrow{d}{q} & X \arrow{d}{f} \\ - & Y \arrow{l}{g} & Z -\end{tikzcd} -\end{codeexample} \begin{thebibliography}{9} \bibitem{lenders} @@ -216,4 +1951,10 @@ The following example is taken from \cite{milne}. \emph{Guide to commutative diagrams}. Available at \url{http://www.jmilne.org/not/CDGuide.html}. \end{thebibliography} + \end{document} + +%%% Local Variables: +%%% mode: tex +%%% mode: auto-fill +%%% End:
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/tikz-cd/tikz-cd.sty b/Master/texmf-dist/tex/latex/tikz-cd/tikz-cd.sty index e0d8d1546de..336eaa246a0 100644 --- a/Master/texmf-dist/tex/latex/tikz-cd/tikz-cd.sty +++ b/Master/texmf-dist/tex/latex/tikz-cd/tikz-cd.sty @@ -5,159 +5,323 @@ % 1. under the LaTeX Project Public License and/or % 2. under the GNU Public License. % -\ProvidesPackage{tikz-cd}[2011/09/12 v0.1 Macros for creation of commutative diagrams with tikz.] +\ProvidesPackage{tikz-cd}[2011/10/21 v0.2 Commutative diagrams with tikz.] \RequirePackage{tikz} -\usepgfmodule{parser} \usetikzlibrary{matrix} \usepgflibrary{arrows} +\usetikzlibrary{decorations.pathmorphing} -\pgfkeys{% - /commutative diagrams/picture style/.style={ - baseline=(current bounding box.base)}, - /commutative diagrams/matrix style/.style={ - matrix of math nodes, - row sep=6ex, - column sep=6ex, - text height=1.5ex, - text depth=0.25ex}, - /commutative diagrams/path style/.style={ - font=\scriptsize, - auto, - description/.style={ - anchor=center,fill=\tikzcd@bgcolor,inner sep=2pt}}, - /commutative diagrams/current arrows/.style={ - rightarrow/.style={cm cap-cm to}, - leftarrow/.style={cm to-cm cap}, - mapsto/.style={cm |-cm to}, - hookrightarrow/.style={cm right hook-cm to}, - hookleftarrow/.style={cm to-cm left hook}, - rightharpoonup/.style={cm cap-cm left to}, - rightharpoondown/.style={cm cap-cm right to}, - leftharpoonup/.style={cm right to-cm cap}, - leftharpoondown/.style={cm left to-cm cap}, - line width=0.09285ex, - rightarrow}} - -\def\tikzcd@bgcolor{white} - -\makeatletter +\newtoks\tikzcd@temptoksa +\newtoks\tikzcd@temptoksb +\newtoks\tikzcd@temptoksc + +\newif\iftikzcd@mathmode \newcount\tikzcd@currcol \newcount\tikzcd@currrow -\newcount\tikzcd@destrow -\newcount\tikzcd@destcol +\newcount\tikzcd@targetrow +\newcount\tikzcd@targetcol + +\pgfqkeys{/tikz/commutative diagrams}{ + /tikz/commutative diagrams/.search also={/tikz}, + arrows/.style={ + /tikz/commutative diagrams/every arrow/.append style={#1}}, + labels/.style={ + /tikz/commutative diagrams/every label/.append style={#1}}, + diagrams/.style={ + /tikz/commutative diagrams/every diagram/.append style={#1}}, + description/.style={ + /tikz/anchor=center, + text height=, + text depth=, + /tikz/fill=\pgfkeysvalueof{/tikz/commutative diagrams/background color}, + /tikz/inner sep=\pgfkeysvalueof{/tikz/commutative diagrams/description clearance}}, + crossing over/.style={ + /tikz/preaction={ + /tikz/draw=\pgfkeysvalueof{/tikz/commutative diagrams/background color}, + /tikz/arrows=-, + /tikz/line width=\pgfkeysvalueof{/tikz/commutative diagrams/crossing over clearance}}}, + row sep/.code={\tikzcd@sep{row}{#1}}, + column sep/.code={\tikzcd@sep{column}{#1}}, + math mode/.is if=tikzcd@mathmode, + matrix of math nodes maybe/.style={% + /tikz/matrix of nodes, + /tikz/nodes={ + execute at begin node=\iftikzcd@mathmode$\fi, %$ + execute at end node=\iftikzcd@mathmode$\fi}}, %$ + path operation/.store in=\tikzcd@pathoperator, + start anchor/.code={% + \ifx#1\pgfkeysnovalue\let\tikzcd@sourceanchor\empty% + \else\def\tikzcd@sourceanchor{.#1}\fi}, + end anchor/.code={% + \ifx#1\pgfkeysnovalue\let\tikzcd@targetanchor\empty% + \else\def\tikzcd@targetanchor{.#1}\fi}, + arrow style/.is choice} + +% The Computer Modern arrow style +\pgfkeys{/tikz/commutative diagrams/arrow style/computer modern/.style={ + /tikz/commutative diagrams/.cd, + default arrow/.style={ + /tikz/line join=round, + /tikz/arrows=cm cap-cm to, + /tikz/line width=0.0929ex}, + rightarrow/.style={/tikz/arrows=cm cap-cm to}, + Rightarrow/.style={ + /tikz/arrows=cm implies cap-cm implies, + /tikz/commutative diagrams/double line}, + leftarrow/.style={/tikz/arrows=cm to-cm cap}, + Leftarrow/.style={ + /tikz/arrows=cm implies-cm implies cap, + /tikz/commutative diagrams/double line}, + leftrightarrow/.style={/tikz/arrows=cm to-cm to}, + Leftrightarrow/.style={ + /tikz/arrows=cm implies-cm implies, + /tikz/commutative diagrams/double line}, + mapsto/.style={/tikz/arrows=cm |-cm to}, + hookrightarrow/.style={/tikz/arrows=cm right hook-cm to}, + hookleftarrow/.style={/tikz/arrows=cm to-cm left hook}, + rightharpoonup/.style={/tikz/arrows=cm cap-cm left to}, + rightharpoondown/.style={/tikz/arrows=cm cap-cm right to}, + leftharpoonup/.style={/tikz/arrows=cm right to-cm cap}, + leftharpoondown/.style={/tikz/arrows=cm left to-cm cap}, + dashrightarrow/.style={/tikz/commutative diagrams/.cd,rightarrow,dashed}, + dashleftarrow/.style={/tikz/commutative diagrams/.cd,leftarrow,dashed}, + rightarrowtail/.style={/tikz/arrows=cm to reversed-cm to}, + leftarrowtail/.style={/tikz/arrows=cm to-cm to reversed}, + twoheadrightarrow/.style={/tikz/arrows=cm cap-cm double to}, + twoheadleftarrow/.style={/tikz/arrows=cm double to-cm cap}, + rightsquigarrow/.style={/tikz/commutative diagrams/.cd,rightarrow,squiggly}, + leftsquigarrow/.style={/tikz/commutative diagrams/.cd,leftarrow,squiggly}, + leftrightsquigarrow/.style={ + /tikz/commutative diagrams/.cd,leftrightarrow,squiggly}, + equals/.style={ + /tikz/arrows=cm implies cap-cm implies cap, + /tikz/commutative diagrams/double line}, + maps to/.code={\pgfsetarrowsstart{cm |}}, + hook/.code={\pgfsetarrowsstart{cm right hook}}, + two heads/.code={\pgfsetarrowsend{cm double to}}, + tail/.code={\pgfsetarrowsstart{cm to reversed}}, + squiggly/.style={ + %http://tex.stackexchange.com/questions/12678/ + decorate, + decoration={ + zigzag, + segment length=4, + amplitude=.9, + post=lineto, post length=2pt, + pre=lineto, pre length=2pt}}, + double line/.style={ + /tikz/double=\pgfkeysvalueof{/tikz/commutative diagrams/background color}, + /tikz/double distance=3.643\pgflinewidth}, + dashed/.style={/tikz/densely dashed}}} + +% The tikz arrow style +\pgfkeys{/tikz/commutative diagrams/arrow style/tikz/.style={ + /tikz/commutative diagrams/.cd, + default arrow/.style={/tikz/arrows=->}, + rightarrow/.style={/tikz/arrows=->}, + Rightarrow/.style={ + /tikz/arrows=-implies, + /tikz/commutative diagrams/double line}, + leftarrow/.style={/tikz/arrows=<-}, + Leftarrow/.style={ + /tikz/arrows=implies-, + /tikz/commutative diagrams/double line}, + leftrightarrow/.style={/tikz/arrows=<->}, + Leftrightarrow/.style={ + /tikz/arrows=implies-implies, + /tikz/commutative diagrams/double line}, + mapsto/.style={/tikz/arrows=|->}, + hookrightarrow/.style={/tikz/arrows=right hook->}, + hookleftarrow/.style={/tikz/arrows=<-left hook}, + rightharpoonup/.style={/tikz/arrows=-left to}, + rightharpoondown/.style={/tikz/arrows=-right to}, + leftharpoonup/.style={/tikz/arrows=right to-}, + leftharpoondown/.style={/tikz/arrows=left to-}, + dashrightarrow/.style={/tikz/commutative diagrams/.cd,rightarrow,dashed}, + dashleftarrow/.style={/tikz/commutative diagrams/.cd,leftarrow,dashed}, + rightarrowtail/.style={/tikz/arrows=>->}, + leftarrowtail/.style={/tikz/arrows=<-<}, + twoheadrightarrow/.style={/tikz/arrows=->>}, + twoheadleftarrow/.style={/tikz/arrows=<<-}, + rightsquigarrow/.style={ + /tikz/commutative diagrams/.cd, + rightarrow, + squiggly}, + leftsquigarrow/.style={ + /tikz/commutative diagrams/.cd, + leftarrow, + squiggly}, + leftrightsquigarrow/.style={ + /tikz/commutative diagrams/.cd, + leftrightarrow, + squiggly}, + equals/.style={ + /tikz/arrows=-, + /tikz/commutative diagrams/double line}, + maps to/.code={\pgfsetarrowsstart{|}}, + hook/.code={\pgfsetarrowsstart{right hook}}, + two heads/.code={ + \pgfsetarrowsend{\csname tikz@special@arrow@end>>\endcsname}}, + tail/.code={ + \pgfsetarrowsstart{\csname tikz@special@arrow@start>\endcsname}}, + squiggly/.style={ + %http://tex.stackexchange.com/questions/12678/ + decorate, + decoration={ + zigzag, + segment length=4, + amplitude=.9, + post=lineto, post length=2pt, + pre=lineto, pre length=2pt}}, + double line/.style={ + /tikz/double=\pgfkeysvalueof{/tikz/commutative diagrams/background color}}}} + +% Default settings +\pgfqkeys{/tikz/commutative diagrams}{ + every arrow/.style={ + /tikz/commutative diagrams/.cd, + /tikz/draw, + /tikz/commutative diagrams/default arrow}, + every label/.style={ + /tikz/commutative diagrams/.cd, + /tikz/auto, + /tikz/font=\scriptsize, + /tikz/inner sep=0.5ex, + /tikz/text height=, + /tikz/text depth=}, + every diagram/.style={ + /tikz/commutative diagrams/.cd, + row sep=normal, + column sep=normal, + /tikz/text height=1.5ex, + /tikz/text depth=0.25ex, + /tikz/baseline=0pt}, + math mode=true, + row sep/huge/.initial=10ex, + row sep/large/.initial=7.5ex, + row sep/normal/.initial=5ex, + row sep/scriptsize/.initial=3.75ex, + row sep/small/.initial=2.5ex, + row sep/tiny/.initial=1.25ex, + column sep/huge/.initial=12ex, + column sep/large/.initial=9ex, + column sep/normal/.initial=6ex, + column sep/scriptsize/.initial=4.5ex, + column sep/small/.initial=3ex, + column sep/tiny/.initial=1.5ex, + arrow style=computer modern, + path operation=to, + start anchor, + end anchor, + description clearance/.initial=1.5pt, + crossing over clearance/.initial=6pt, + background color/.initial=white} -%The arrow commands and its parser +% Branch depending on whether the next character is [, { or none of those. +\def\tikzcd@threefold#1#2#3{% + \def\tikzcd@tempa{#1}% + \def\tikzcd@tempb{#2}% + \def\tikzcd@tempc{#3}% + \futurelet\next\tikzcd@@threefold} +\def\tikzcd@@threefold{% + \ifx[\next\let\tikzcd@tempd\tikzcd@tempa% + \else\ifx\bgroup\next\let\tikzcd@tempd\tikzcd@tempb% + \else\let\tikzcd@tempd\tikzcd@tempc\fi\fi% + \tikzcd@tempd} + +%The arrow commands \def\tikzcd@arrow{% - \let\tikzcd@ar@edgeopt\empty% - \let\tikzcd@ar@node\empty% - \let\tikzcd@ar@nodeopt\empty% - \tikzcd@destcol\tikzcd@currcol% - \tikzcd@destrow\tikzcd@currrow% - \global\edef\tikzcd@patharg{\tikzcd@patharg % - (m-\the\tikzcd@currrow-\the\tikzcd@currcol) }% - \futurelet\next\tikzcd@arrowb} -\def\tikzcd@arrowb{% - \ifx[\next\expandafter\tikzcd@arrowi\else% - \expandafter\tikzcd@arrowii\fi} -\def\tikzcd@arrowi[#1]{% - \def\tikzcd@ar@edgeopt{[#1]}% - \tikzcd@arrowii} -\def\tikzcd@arrowii#1{% - \pgfparserparse{tikzmd@parser}#1*% - \futurelet\next\tikzcd@arrowiii} -\def\tikzcd@arrowiii{% - \ifx[\next\expandafter\tikzcd@arrowiv% - \else\expandafter\tikzcd@arrowv\fi} -\def\tikzcd@arrowiv[#1]{% - \def\tikzcd@ar@nodeopt{[#1]}% - \futurelet\next\tikzcd@arrowv} -\def\tikzcd@arrowv{% - \ifx\next\bgroup\expandafter\tikzcd@arrowvi% - \else\tikzcd@arrowvii\fi} -\def\tikzcd@arrowvi#1{% - \def\tikzcd@ar@node{ node\tikzcd@ar@nodeopt{$#1$}}% - \tikzcd@arrowvii} -\def\tikzcd@arrowvii{ - \global\edef\tikzcd@patharg{\tikzcd@patharg % - edge\tikzcd@ar@edgeopt \tikzcd@ar@node % - (m-\the\tikzcd@destrow-\the\tikzcd@destcol)}% -} + \tikzcd@targetrow\tikzcd@currrow% + \tikzcd@targetcol\tikzcd@currcol% + \tikzcd@threefold{\tikzcd@ar@getdir}{\tikzcd@ar@getdir[]}{}} -\def\tikzcd@lar{% - \tikzcd@destcol\tikzcd@currcol% - \tikzcd@destrow\tikzcd@currrow% - \advance\tikzcd@destcol by1\relax% - \futurelet\next\tikzcd@xar} -\def\tikzcd@rar{% - \tikzcd@destcol\tikzcd@currcol% - \tikzcd@destrow\tikzcd@currrow% - \advance\tikzcd@destcol by-1\relax% - \futurelet\next\tikzcd@xar} -\def\tikzcd@dar{% - \tikzcd@destcol\tikzcd@currcol% - \tikzcd@destrow\tikzcd@currrow% - \advance\tikzcd@destrow by1\relax% - \futurelet\next\tikzcd@xar} -\def\tikzcd@uar{% - \tikzcd@destcol\tikzcd@currcol% - \tikzcd@destrow\tikzcd@currrow% - \advance\tikzcd@destrow by-1\relax% - \futurelet\next\tikzcd@xar} -\def\tikzcd@xar{% - \let\tikzcd@ar@edgeopt\empty% - \let\tikzcd@ar@node\empty% - \let\tikzcd@ar@nodeopt\empty% - \global\edef\tikzcd@patharg{\tikzcd@patharg % - (m-\the\tikzcd@currrow-\the\tikzcd@currcol) }% - \ifx[\next\expandafter\tikzcd@xari% - \else\expandafter\tikzcd@xarii\fi} -\def\tikzcd@xari[#1]{% - \def\tikzcd@ar@edgeopt{[#1]}% - \futurelet\next\tikzcd@xarii} -\def\tikzcd@xarii{% - \ifx\next\bgroup\expandafter\tikzcd@arrowvi% - \else\expandafter\tikzcd@xariii\fi} -\def\tikzcd@xariii{% - \ifx[\next\expandafter\tikzcd@arrowiv% - \else\tikzcd@arrowvii\fi} - -\pgfparserdef{tikzmd@parser}{initial}{the letter l} -{\advance\tikzcd@destcol by1\relax} -\pgfparserdef{tikzmd@parser}{initial}{the letter r} -{\advance\tikzcd@destcol by-1\relax} -\pgfparserdef{tikzmd@parser}{initial}{the letter d} -{\advance\tikzcd@destrow by1\relax} -\pgfparserdef{tikzmd@parser}{initial}{the letter u} -{\advance\tikzcd@destrow by-1\relax} -\pgfparserdef{tikzmd@parser}{initial}{the character *} -{\pgfparserswitch{final}} - -%Diagram environment -\def\tikzcd{% - \tikzpicture[/commutative diagrams/picture style]% - \let\tikzcd@patharg\empty% - \let\arrow\tikzcd@arrow% - \let\ar\tikzcd@arrow% - \let\lar\tikzcd@lar% - \let\rar\tikzcd@rar% - \let\dar\tikzcd@dar% - \let\uar\tikzcd@uar% - \matrix (m) [/commutative diagrams/matrix style,% - execute at begin cell=% - \tikzcd@currcol\pgfmatrixcurrentcolumn% - \tikzcd@currrow\pgfmatrixcurrentrow]\bgroup% -} +\def\tikzcd@ar@getdir[#1]#2{% + \tikzcd@temptoksa{\path[/tikz/commutative diagrams/every arrow,#1]}% + \tikzcd@parse#2\relax% + \tikzcd@temptoksb{}% this will store the labels + \tikzcd@threefold{\tikzcd@ar@getlabel}{\tikzcd@ar@getlabel[]}{\tikzcd@ar@final}} + +\def\tikzcd@ar@getlabel[#1]#2{% + \tikzcd@temptoksb\expandafter{\the\tikzcd@temptoksb % + node[/tikz/commutative diagrams/every label,#1]{\tikzcd@mathmaybe{#2}}}% + \tikzcd@threefold{\tikzcd@ar@getlabel}{\tikzcd@ar@getlabel[]}{\tikzcd@ar@final}} + +\def\tikzcd@ar@final{% + \tikzcd@temptoksc\expandafter{\tikzcd@savedpaths}% + \global\edef\tikzcd@savedpaths{% + \the\tikzcd@temptoksc% the previously saved stuff + \the\tikzcd@temptoksa% the current arrow + (\tikzmatrixname-\the\tikzcd@currrow-\the\tikzcd@currcol% + \noexpand\tikzcd@sourceanchor)% + \noexpand\tikzcd@pathoperator% + \the\tikzcd@temptoksb% the current labels + (\tikzmatrixname-\the\tikzcd@targetrow-\the\tikzcd@targetcol% + \noexpand\tikzcd@targetanchor);}} + +\def\tikzcd@xar#1#2{% + \tikzcd@targetrow\tikzcd@currrow% + \advance\tikzcd@targetrow by#1% + \tikzcd@targetcol\tikzcd@currcol% + \advance\tikzcd@targetcol by#2% + \tikzcd@threefold{\tikzcd@@xar}{\tikzcd@@xar[]}{\tikzcd@@xar[]}} + +\def\tikzcd@@xar[#1]{% + \tikzcd@temptoksa{\path[/tikz/commutative diagrams/every arrow,#1]}% + \tikzcd@temptoksb{}% this will store the labels + \tikzcd@threefold{\tikzcd@ar@getlabel}{\tikzcd@ar@getlabel[]}{\tikzcd@ar@final}} + +% Parser for arrow direction argument +\def\tikzcd@parse#1{% + \def\tikzcd@tempa{\tikzcd@parse}% + \ifx#1r\advance\tikzcd@targetcol by1\else% + \ifx#1d\advance\tikzcd@targetrow by1\else% + \ifx#1l\advance\tikzcd@targetcol by-1\else% + \ifx#1u\advance\tikzcd@targetrow by-1\else% + \ifx#1\relax\let\tikzcd@tempa\empty% + \else\errmessage{Arrow direction argument must contain % + only the characters l, r, u or d}\fi\fi\fi\fi\fi% + \tikzcd@tempa} + +%The tikzcd environment +\def\tikzcd{\tikzcd@threefold{\tikzcd@}{\tikzcd@[]}{\tikzcd@[]}} + +\def\tikzcd@[#1]{% + \tikzpicture[/tikz/commutative diagrams/every diagram,#1]% + \tikzcd@initialize% + \matrix[/tikz/commutative diagrams/matrix of math nodes maybe,% + /tikz/execute at begin cell=% + \tikzcd@currcol\pgfmatrixcurrentcolumn% + \tikzcd@currrow\pgfmatrixcurrentrow]% + \bgroup} \def\endtikzcd{% - \\\egroup;% - \path[/commutative diagrams/path style,% - /commutative diagrams/current arrows]% - \tikzcd@patharg ;% - %\typeout{\tikzcd@patharg} - \endtikzpicture% -} + \pgfmatrixendrow\egroup;% + \tikzcd@finalize% + \endtikzpicture} + +\def\tikzcd@initialize{% + \def\arrow{\tikzcd@arrow}% + \def\ar{\tikzcd@arrow}% + \def\rar{\tikzcd@xar{0}{1}}% + \def\lar{\tikzcd@xar{0}{-1}}% + \def\dar{\tikzcd@xar{1}{0}}% + \def\uar{\tikzcd@xar{-1}{0}}% + \def\urar{\tikzcd@xar{-1}{1}}% + \def\ular{\tikzcd@xar{-1}{-1}}% + \def\drar{\tikzcd@xar{1}{1}}% + \def\dlar{\tikzcd@xar{1}{-1}}% + \global\let\tikzcd@savedpaths\empty} + +\def\tikzcd@finalize{\tikzcd@savedpaths} + +\def\tikzcd@mathmaybe#1{\iftikzcd@mathmode$#1$\else#1\fi} + +\def\tikzcd@sep#1#2{ + \pgfkeysifdefined{/tikz/commutative diagrams/#1 sep/#2}% + {\tikzset{#1 sep=\pgfkeysvalueof{/tikz/commutative diagrams/#1 sep/#2}}}% + {\tikzset{#1 sep=#2}}} %Computer modern arrow tips \pgfarrowsdeclare{cm to}{cm to} @@ -182,6 +346,32 @@ \pgfusepathqstroke } +\pgfarrowsdeclare{cm implies}{cm implies} +{ + \pgfmathsetlength{\pgfutil@tempdima}{-0.729\pgflinewidth+.25*\pgfinnerlinewidth} + \pgfarrowsleftextend{\pgfutil@tempdima} + \pgfmathsetlength{\pgfutil@tempdima}{1.094\pgflinewidth-.25*\pgfinnerlinewidth} + \pgfarrowsrightextend{\pgfutil@tempdima} +} +{ + \pgfmathsetlength{\pgfutil@tempdimb}{.5\pgflinewidth-.5*\pgfinnerlinewidth} + \pgfutil@tempdima\pgflinewidth + \pgfsetlinewidth{\pgfutil@tempdimb} + \pgfsetdash{}{+0pt} + \pgfsetroundcap + \pgfsetroundjoin + \pgfpathmoveto{\pgfqpoint{-0.542\pgfutil@tempdima}{1.142\pgfutil@tempdima}} + \pgfpathcurveto + {\pgfqpoint{-0.247\pgfutil@tempdima}{0.476\pgfutil@tempdima}} + {\pgfqpoint{0.29\pgfutil@tempdima}{0.114\pgfutil@tempdima}} + {\pgfqpoint{0.844\pgfutil@tempdima}{0pt}} + \pgfpathcurveto + {\pgfqpoint{0.29\pgfutil@tempdima}{-0.114\pgfutil@tempdima}} + {\pgfqpoint{-0.247\pgfutil@tempdima}{-0.476\pgfutil@tempdima}} + {\pgfqpoint{-0.542\pgfutil@tempdima}{-1.142\pgfutil@tempdima}} + \pgfusepathqstroke +} + \pgfarrowsdeclare{cm bold to}{cm bold to} { \pgfarrowsleftextend{-4.055\pgflinewidth} @@ -318,6 +508,25 @@ \pgfusepathqstroke } +\pgfarrowsdeclare{cm implies cap}{cm implies cap} +{ + \pgfmathsetlength{\pgfutil@tempdima}{.5\pgflinewidth-.5*\pgfinnerlinewidth} + \pgfarrowsleftextend{+0pt} + \pgfarrowsrightextend{+\pgfutil@tempdima} +} +{ + \pgfmathsetlength{\pgfutil@tempdima}{.5\pgflinewidth-.5*\pgfinnerlinewidth} + \pgfmathsetlength{\pgfutil@tempdimb}{.5\pgflinewidth-.5*\pgfutil@tempdima} + \pgfsetlinewidth{\pgfutil@tempdima} + \pgfsetdash{}{+0pt} + \pgfsetroundcap + \pgfpathmoveto{\pgfqpoint{0pt}{+1\pgfutil@tempdimb}} + \pgfpathlineto{\pgfqpoint{0.5\pgfutil@tempdima}{+1\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfqpoint{0pt}{-1\pgfutil@tempdimb}} + \pgfpathlineto{\pgfqpoint{0.5\pgfutil@tempdima}{-1\pgfutil@tempdimb}} + \pgfusepathqstroke +} + \pgfarrowsdeclarereversed{cm to reversed}{cm to reversed}{cm to}{cm to} \pgfarrowsdeclarereversed{cm left to reversed}{cm left to reversed}{cm left to}{cm left to} \pgfarrowsdeclarereversed{cm right to reversed}{cm right to reversed}{cm right to}{cm right to} @@ -325,5 +534,4 @@ \pgfarrowsdeclaredouble{cm double to}{cm double to}{cm to}{cm to} \pgfarrowsdeclaredouble{cm double to reversed}{cm double to reversed}{cm to reversed}{cm to reversed} -\makeatother \endinput
\ No newline at end of file |