diff options
author | Karl Berry <karl@freefriends.org> | 2014-10-21 22:44:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-10-21 22:44:36 +0000 |
commit | 76dea2df5620cf9e79246c926097da639829d9c3 (patch) | |
tree | 2e303f3dfd27c739822ee161d05c6c9cce07d205 /Master/texmf-dist/tex/generic/tikz-cd | |
parent | 1ed4b709f6e9f42a151624dcc40316b315bf6627 (diff) |
tikz-cd (21oct14)
git-svn-id: svn://tug.org/texlive/trunk@35413 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/tikz-cd')
-rw-r--r-- | Master/texmf-dist/tex/generic/tikz-cd/tikzlibrarycd.code.tex | 55 |
1 files changed, 35 insertions, 20 deletions
diff --git a/Master/texmf-dist/tex/generic/tikz-cd/tikzlibrarycd.code.tex b/Master/texmf-dist/tex/generic/tikz-cd/tikzlibrarycd.code.tex index 43b204c29e2..7f4d44896bd 100644 --- a/Master/texmf-dist/tex/generic/tikz-cd/tikzlibrarycd.code.tex +++ b/Master/texmf-dist/tex/generic/tikz-cd/tikzlibrarycd.code.tex @@ -1,4 +1,4 @@ -% tikzlibrarycd.code.tex [2014/03/08 v0.9b Commutative diagrams with tikz] +% tikzlibrarycd.code.tex [2014/10/20 v0.9c Commutative diagrams with tikz] % % Copyright 2011, 2012, 2014 by FlorĂȘncio Neves <florencioneves@gmail.com> % @@ -30,14 +30,8 @@ labels/.code={\tikzcdset{every label/.append style={#1}}}, cells/.code={\tikzcdset{every cell/.append style={#1}}}, diagrams/.code={\tikzcdset{every diagram/.append style={#1}}}, - to/.code={% - \pgfutil@ifundefined{pgf@sh@ns@\tikzcdmatrixname-#1} - {\def\tikzcd@ar@target{#1}} - {\def\tikzcd@ar@target{\tikzcdmatrixname-#1}}}, - from/.code={% - \pgfutil@ifundefined{pgf@sh@ns@\tikzcdmatrixname-#1} - {\def\tikzcd@ar@start{#1}} - {\def\tikzcd@ar@start{\tikzcdmatrixname-#1}}}, + to/.code={\tikzcd@setarrowend\tikzcd@ar@target{#1}}, + from/.code={\tikzcd@setarrowend\tikzcd@ar@start{#1}}, description/.style={ /tikz/anchor=center, /tikz/fill=\pgfkeysvalueof{/tikz/commutative diagrams/background color}}, @@ -62,6 +56,24 @@ \pgfkeysalso{/tikz/#1 sep/.expand once=\tikzcd@temp}}% {\pgfkeysalso{/tikz/#1 sep={#2}}}} +\def\tikzcd@setarrowend#1#2{% + \pgfutil@ifundefined{pgf@sh@ns@\tikzcdmatrixname-#2}% + {% + \c@pgf@counta=0% + \c@pgf@countb=0% + \let\tikzcd@temp=\tikzcd@parse% + \expandafter\tikzcd@temp#2\relax% + \ifx\tikzcd@temp\pgfutil@empty% true if it was a direction parameter + \advance\c@pgf@counta by\tikzcd@currentrow% + \advance\c@pgf@countb by\tikzcd@currentcolumn% + \edef#1{\tikzcdmatrixname-\the\c@pgf@counta-\the\c@pgf@countb}% + \else% + \def#1{#2}% + \fi% + }{% + \def#1{\tikzcdmatrixname-#2}% + }} + % The unknown key handler and direction argument parser \tikzcdset{ .unknown/.code={% @@ -115,9 +127,11 @@ \def\drar{\tikzcd@xar{dr}}% \def\dlar{\tikzcd@xar{dl}}% \global\let\tikzcd@savedpaths\pgfutil@empty% - \matrix[/tikz/matrix of \iftikzcd@mathmode math \fi nodes, - /tikz/every cell/.append code={\tikzcdset{every cell}}, - /tikz/commutative diagrams/.cd,every matrix]% + \matrix[ + /tikz/handle active characters in code=false, + /tikz/matrix of \iftikzcd@mathmode math \fi nodes, + /tikz/every cell/.append code={\tikzcdset{every cell}}, + /tikz/commutative diagrams/.cd,every matrix]% \bgroup} \def\endtikzcd{% @@ -134,11 +148,11 @@ % The arrow commands \def\tikzcd@arrow{% - \relax% + \relax% this was added to avoid errors when a cell starts with \arrow, but it seems unnecessary now \tikzcd@x@addto@macro\tikzcd@savedpaths{% - \noexpand\def\noexpand\tikzcd@currentcolumn{\the\pgfmatrixcurrentcolumn}% - \noexpand\def\noexpand\tikzcd@currentrow{\the\pgfmatrixcurrentrow}% - \noexpand\def\noexpand\tikzcd@lineno{\the\inputlineno}}% + \noexpand\def\noexpand\tikzcd@currentcolumn{\the\pgfmatrixcurrentcolumn}% + \noexpand\def\noexpand\tikzcd@currentrow{\the\pgfmatrixcurrentrow}% + \noexpand\def\noexpand\tikzcd@lineno{\the\inputlineno}}% \pgfutil@ifnextchar[{\tikzcd@@arrow}{\tikzcd@ar@old[]}} \def\tikzcd@@arrow[#1]{\pgfutil@ifnextchar\bgroup{\tikzcd@ar@old[#1]}{\tikzcd@ar@new[#1]}} @@ -150,12 +164,12 @@ \def\tikzcd@ar@old[#1]#2{% old syntax \pgfutil@g@addto@macro\tikzcd@savedpaths{% - \path[/tikz/commutative diagrams/.cd,every arrow,{#2},#1] (\tikzcd@ar@start\tikzcd@startanchor) to }% + \path[/tikz/commutative diagrams/.cd,every arrow,to={#2},#1] (\tikzcd@ar@start\tikzcd@startanchor) to }% \pgfutil@ifnextchar[{\tikzcd@ar@getlabel}{\pgfutil@ifnextchar\bgroup{\tikzcd@ar@getlabel[]}{\tikzcd@ar@final}}} \def\tikzcd@ar@getlabel[#1]#2{% \pgfutil@g@addto@macro\tikzcd@savedpaths{% - node[/tikz/commutative diagrams/.cd,every label,#1]{\tikzcd@mathmaybe{#2}}}% + node[/tikz/commutative diagrams/.cd,every label,#1]{\tikzcdmathmaybe{#2}}}% \pgfutil@ifnextchar[{\tikzcd@ar@getlabel}{\pgfutil@ifnextchar\bgroup{\tikzcd@ar@getlabel[]}{\tikzcd@ar@final}}} \def\tikzcd@ar@final{% @@ -165,7 +179,8 @@ \def\tikzcd@@xar#1[#2]{\tikzcd@arrow[#2]{#1}} -\def\tikzcd@mathmaybe#1{\iftikzcd@mathmode$\relax #1$\else#1\fi} +\def\tikzcdmathmaybe#1{% this must be a user-accessible command to avoid clash with babel library + \iftikzcd@mathmode$\relax #1$\else#1\fi} \def\tikzcd@ar@target{\tikzcdmatrixname-\tikzcd@currentrow-\tikzcd@currentcolumn} \def\tikzcd@ar@start{\tikzcdmatrixname-\tikzcd@currentrow-\tikzcd@currentcolumn} @@ -177,7 +192,7 @@ \pgfkeys{ /handlers/first char syntax/the character "/.initial=\tikzcd@passquotes, /tikz/edge quotes mean={% - edge node={node [/tikz/commutative diagrams/.cd,every label,##2]{\tikzcd@mathmaybe{##1}}}}}} + edge node={node [/tikz/commutative diagrams/.cd,every label,##2]{\tikzcdmathmaybe{##1}}}}}} % Improve error messages \def\tikzcd@patcherrmsg{% |