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 | |
parent | 1ed4b709f6e9f42a151624dcc40316b315bf6627 (diff) |
tikz-cd (21oct14)
git-svn-id: svn://tug.org/texlive/trunk@35413 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/tikz-cd/tikz-cd-doc.pdf | bin | 350206 -> 337327 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/tikz-cd/tikz-cd-doc.tex | 130 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/tikz-cd/tikzlibrarycd.code.tex | 55 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tikz-cd/tikz-cd.sty | 2 |
4 files changed, 107 insertions, 80 deletions
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 56fd4656dcd..14fa829099c 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 0e8e93f2921..c09863910ad 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 @@ -102,7 +102,6 @@ \usepackage{xxcolor} \usepackage{pifont} \usepackage{makeidx} -\usepackage{amsmath} \graphicspath{{../../images/}} % TODOsp: under windows this would go up 2 directories, but the file is only one directory up \input{pgfmanual-en-macros} % TODOsp: same here @@ -130,9 +129,8 @@ \usepackage[utf8]{inputenc} \hypersetup{unicode, - pdftitle={The tikz-cd package}, - pdfauthor={FlorĂȘncio Neves}, - pdfkeywords={commutative diagrams, latex, tikz, pgf}, + pdftitle={tikzcd: Commutative diagrams with TikZ}, + pdfkeywords={Commutative diagrams; TeX; LaTeX; ConTeXt; TikZ; pgf; tikz-cd; tikzcd}, } \externaldocument[pgfman-]{pgfmanual} @@ -147,10 +145,6 @@ /pdflinks/show labels=false, } -\title{The \texttt{tikz-cd} package} -\author{FlorĂȘncio Neves} -\date{Version 0.9b, of March 8, 2014} - \tikzset{/codeexample/every codeexample/.append style={/tikz/commutative diagrams/background color=graphicbackground}} \tikzset{gray x/.tip={Rays[color=gray]}} @@ -172,7 +166,13 @@ x-gray x,commutative diagrams/.cd, #1] (0,0) -- (0.6,0);} \begin{document} -\maketitle +\begin{center} +{\Huge |{tikzcd}|} +\\[4mm] +{\Large\bf Commutative diagrams with \tikzname} +\\[3mm] +{Version 0.9c $\quad$ October 20, 2014} +\end{center} The general-purpose drawing package Ti\emph{k}Z can be used to typeset commutative diagrams and other kinds of mathematical pictures, @@ -191,9 +191,9 @@ License, version 3 or later. \section{Disclaimer} \label{sec:disclaimer} -Before version 1.0 of this package is released, minor modifications and -bug fixes may be performed. All documents making an orthodox use of -this package will continue to compile and generate essentially the +Before version 1.0 of this package is released, minor modifications +and bug fixes may be performed. All documents making an orthodox use +of this package will continue to compile and generate essentially the same output. However, if you have strict stability requirements (for instance, if you want to assure no page break changes will happen in your documents), keep a copy of the current version of the file @@ -234,8 +234,9 @@ between matrix entries can be created with the |\arrow| command described below. Everything inside |{tikzcd}| is typeset in math mode, but you will -probably want use it inside an |{equation}| environment or |\[| \dots -|\]|, so that the diagram is placed on a new line and centered. +probably want to use it inside an |{equation}| environment or +|\[| \dots |\]|, +so that the diagram is placed on a new line and centered. It is important to note that \textsc{dvi} viewers will not display diagrams correctly. It is necessary to convert the \textsc{dvi} file @@ -258,12 +259,12 @@ Here, \meta{options} is a comma-separated list of options which can be used to specify the arrow target, add labels, change arrow tips, and perform additional modifications. -The arrow target is determined by a direction parameter, which +The arrow target can be specified by a direction parameter, which consists of a string of characters |r|, |l|, |d|, |u| (standing for right, left, down and up). Labels can be placed on an arrow by means of the quotes syntax, described in detail in the \pgfname{} manual -\cite[\S\ref*{pgfman-section-label-quotes}]{pgfman}. Notice the use of -|"\phi"| in the example below. +\cite[\S\ref*{pgfman-section-label-quotes}]{pgfman}. Notice the use +of |"\phi"| in the example below. \begin{codeexample}[] \begin{tikzcd} @@ -457,7 +458,10 @@ compatibility. \end{command} Here, \meta{direction} is a string containing the characters |r|, |l|, -|d|, |u| determining the arrow target, and \meta{labels} can be the +|d|, |u| and is used to determine the arrow target. Alternatively, +you can specify an explicit matrix cell by replacing \meta{direction} +with something of the form \meta{row number}\texttt{-}\meta{column + number}, or the name of a node. The trailing \meta{labels} can be the empty string or of the form \begin{quote} \opt{\oarg{label options}}\marg{label text}\meta{more labels}. @@ -561,9 +565,6 @@ the right side of the arrow, relative to its direction), |sloped|, manual~\cite[\S\ref*{pgfman-section-nodes}, esp.\ \S\ref*{pgfman-section-pos-option}]{pgfman}. - - - \subsection{General options} \label{sec:general-options} @@ -684,10 +685,10 @@ Section \ref*{pgfman-section-matrices}.3.2 of the \pgfname{} manual \begin{key}{/tikz/commutative diagrams/math mode=\meta{boolean} (default true)} - This keys determines whether or not the contents of a diagram are - typeset in math mode. If set globally or diagram-wise, it affects - both the diagram entries and arrow labels. If used with |\arrow|, - it affects only its labels. + This key determines whether or not the contents of a diagram are + typeset in math mode. If set globally or diagram-wise, it affects + both the diagram entries and arrow labels. If used with |\arrow|, + it affects only its labels. \end{key} \begin{key}{/tikz/commutative diagrams/background color=\meta{color} (initially white)} @@ -760,29 +761,33 @@ diagram entry where the command appears, and ending at an entry whose location is specified relative to that. The following keys override this behavior, allowing source and target to be selected explicitly. -\begin{key}{/tikz/commutative diagrams/from=\meta{node}} - Sets the arrow source to \meta{node}. When called with an argument - of the form \meta{row number}\texttt{-}\meta{column number}, sets - the arrow source to be the corresponding entry of the diagram's - matrix. +\begin{key}{/tikz/commutative diagrams/from=\meta{argument}} + If \meta{argument} is of the form \meta{row + number}\texttt{-}\meta{column number}, or if it is a string of + characters |r|, |l|, |d|, |u|, this key sets the arrow source to be + the corresponding cell in the diagram matrix. Otherwise, it assumes + the argument is the name of a node and sets the arrow source to + \meta{argument}. \end{key} -\begin{key}{/tikz/commutative diagrams/to=\meta{node}} +\begin{key}{/tikz/commutative diagrams/to=\meta{argument}} Similar to |from|, but refers to the arrow target. \end{key} Recall that it is possible to give a specific entry of a \tikzname{} matrix a name by using the \verb!|[!\meta{options}\verb!]|! syntax, as -done for entry $C$ in the example below. +done for entry $C$ in the example below. You must be careful not to +create nodes whose name contains only the characters |l|, |r|, |u|, +|d| if you want to refer to them using |from| or |to|. {\catcode`\|=12 \begin{codeexample}[] \begin{tikzcd} - A \arrow[to=c, red] \arrow[to=2-2, blue] + A \arrow[to=Z, red] \arrow[to=2-2, blue] & B \\ - |[alias=c]| C + |[alias=Z]| C & D - \arrow[from=1-1, to=1-2, purple] + \arrow[from=ul, to=1-2, purple] \end{tikzcd} \end{codeexample} } @@ -935,19 +940,17 @@ possible values for \meta{anchor}. \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 option \texttt{on background layer} -%\cite[\S\ref*{pgfman-section-tikz-backgrounds}]{pgfman} may also -%be useful in this context. -The following picture illustrates this. +Note that, since arrows are drawn in the order they are read, it may +be necessary to defer the drawing of certain arrows to achieve the +desired result. This can be done using the |from| key, as shown in the +following picture. \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[rr, crossing over] \arrow[dd] & & E \\ & U \arrow[dl] \arrow[rr] & & V \arrow[dl] \\ - M \arrow[rr] & & N \arrow[uu, crossing over, leftarrow]\\ + M \arrow[rr] & & N \arrow[from=uu, crossing over]\\ \end{tikzcd} \end{codeexample} @@ -1123,7 +1126,7 @@ adapted from \cite{milne}). \end{tikzpicture} \end{codeexample} -\subsection{Issues with active ampersand} +\subsection{Issues with active characters} \label{sec:issues-with-active-ampersand} By default, \tikzname{} makes the character |&| active inside @@ -1153,6 +1156,15 @@ line to your document after all packages have been loaded: However, this may interfere in unexpected ways with other packages. Use this trick at your own risk. +A different but related issue is that some packages, notably +\texttt{babel}, modify the catcodes of certain characters in a way +that may upset \tikzname's parser. To fix this, add +\begin{quote} + \ttfamily\char`\\usetikzlibrary\char`\{\declare{babel}\char`\} +\end{quote} +to your document preamble. Characters inside |{tikzcd}| cells will be +assigned their standard (non-\texttt{babel}) catcode. + \section{Additional goodies} \label{sec:general-infra} @@ -1231,8 +1243,8 @@ Returns the fraction rule thickness (a.k.a.\ $\xi_8$) of the document's math fon The following arrow tips mimic the Computer Modern designs. It is useful to know that at size 10\,pt, the Computer Modern arrow stems -are 0.4\,pt thick; for larger font sizes, this parameter should be -scaled accordingly, or replaced by the equivalent figure 0.0928\,ex. +are 0.4\,pt thick; for other font sizes, scale this parameter +accordingly, or set \texttt{line width=rule\_thickness}. Notice that by using the mechanism explained in \S\ref{sec:changing-arrow-tips}, it is not necessary, and in fact not @@ -1257,12 +1269,12 @@ inside a |{tikzcd}|. \end{tabular} \end{multicols} -Incidentally, \tikzname's original \texttt{to} arrow tip seems to be -based on the pre-1992 version of Computer Modern, which, in spite of -its author's wish \cite{knuth}, can still be found in many systems. -\TeX{}Live, for instance, distributed the old version up until 2007 or -2008. Therefore, an up-to-date \TeX{} distribution may be necessary -to get matching arrows in formulas and diagrams. +% Incidentally, \tikzname's original \texttt{to} arrow tip seems to be +% based on the pre-1992 version of Computer Modern, which, in spite of +% its author's wish \cite{knuth}, can still be found in many systems. +% \TeX{}Live, for instance, distributed the old version up until 2007 or +% 2008. Therefore, an up-to-date \TeX{} distribution may be necessary +% to get matching arrows in formulas and diagrams. \subsection{Glyph arrow tips} \label{sec:font-arrow-tips} @@ -1303,10 +1315,10 @@ parameters. Below are some usage examples. Notice that glyph arrow tips do not scale with \pgfname{} line width but their size depends on the current font size, so you will probably want to set \texttt{line - width=rule\_thickness} when using them. Also, contrarily to the arrow -parameters defined by the \texttt{arrows.meta} library, the parameters -described above are evaluated only at the time the arrow tip is drawn, -so they can (and should) be given in the units em or ex. + width=rule\_thickness} when using them. Also, contrarily to the +arrow parameters defined by the \texttt{arrows.meta} library, the +parameters described above are evaluated only at the time the arrow +tip is drawn, so they can (and should) be given in the units em or ex. \begin{codeexample}[] \tikzset{ @@ -1338,10 +1350,10 @@ stem makes certain assumptions about the font design and could fail in cases where unusual design choices are made. \begin{thebibliography}{9} -\bibitem{knuth} - Donald Knuth, - \emph{Important message to all users of \TeX}. - Available at \url{http://www-cs-staff.stanford.edu/~uno/cm.html} +% \bibitem{knuth} +% Donald Knuth, +% \emph{Important message to all users of \TeX}. +% Available at \url{http://www-cs-staff.stanford.edu/~uno/cm.html} \bibitem{lenders} Felix Lenders, \emph{Commutative diagrams using \tikzname}. 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{% 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 191924cbf19..9354939cb10 100644 --- a/Master/texmf-dist/tex/latex/tikz-cd/tikz-cd.sty +++ b/Master/texmf-dist/tex/latex/tikz-cd/tikz-cd.sty @@ -13,7 +13,7 @@ % You should have received a copy of the GNU General Public License % along with this program. If not, see <http://www.gnu.org/licenses/>. -\ProvidesPackage{tikz-cd}[2014/03/08 v0.9b Commutative diagrams with tikz] +\ProvidesPackage{tikz-cd}[2014/10/20 v0.9c Commutative diagrams with tikz] \RequirePackage{tikz}[2013/12/13] % pgf version 3.0.0 required \usetikzlibrary{cd} |