summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-08-14 23:23:14 +0000
committerKarl Berry <karl@freefriends.org>2012-08-14 23:23:14 +0000
commit9ef4d43a194168faca909a9261e94c3ba72e85af (patch)
treeb630a799b52b1b94463cf1bbbd6bf68cc6133eda /Master/texmf-dist
parent921dfb594af7744cf1a5c1887aa0e5a79aef7262 (diff)
tikz-cd (14aug12)
git-svn-id: svn://tug.org/texlive/trunk@27403 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/tikz-cd/README3
-rw-r--r--Master/texmf-dist/doc/latex/tikz-cd/tikz-cd-doc.pdfbin242031 -> 188002 bytes
-rw-r--r--Master/texmf-dist/doc/latex/tikz-cd/tikz-cd-doc.tex641
-rw-r--r--Master/texmf-dist/tex/latex/tikz-cd/tikz-cd.sty253
4 files changed, 524 insertions, 373 deletions
diff --git a/Master/texmf-dist/doc/latex/tikz-cd/README b/Master/texmf-dist/doc/latex/tikz-cd/README
index 8bb433208bf..20641c6f4ac 100644
--- a/Master/texmf-dist/doc/latex/tikz-cd/README
+++ b/Master/texmf-dist/doc/latex/tikz-cd/README
@@ -6,5 +6,4 @@ License: LaTeX Project Public License and/or GNU Public License.
Description: This package provides a set of macros to create
commutative diagrams and other kinds of mathematical pictures using
-tikz. It also provides a set of arrow tips that match closely those
-of Computer Modern's mathematical symbols.
+tikz.
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
index be9d16be63c..694afa3b606 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
Binary files differ
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 c90e94e132d..8df598bc957 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,4 +1,4 @@
-% Copyright 2011, 2012 by Florêncio Neves
+% Copyright 2011, 2012 by Florêncio Neves
%
% This file may be distributed and/or modified
%
@@ -102,7 +102,6 @@
\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
@@ -1317,24 +1316,31 @@ vv \fi%
inner ysep=0.5cm}
}
-\usepackage{tikz-cd}
-\usepackage{multicol,longtable}
+\usepackage{iftex,tikz-cd}
+\ifLuaTeX
+ \usepackage{fontspec}
+\else
+ \usepackage[utf8]{inputenc}
+\fi
-\hypersetup{pdftitle={The tikz-cd package},
- pdfauthor={Florêncio Neves},
+\hypersetup{unicode,
+ pdftitle={The tikz-cd package},
+ 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.2c, of July 17, 2012}
+\author{\normalsize Florêncio Neves\footnote{\emph{E-mail:} \href{mailto:florencioneves@gmail.com}{\texttt{florencioneves@gmail.com}}}}
+\date{\normalsize Version 0.3, of August 10, 2012}
\tikzset{commutative diagrams/background color=graphicbackground}
-\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=-\tikzcdaxisheight, line width=\tikzcdrulethickness] \draw[commutative diagrams/.cd, #2] (0,0) -- (0.6,0);}
+\newcommand{\displayarrow}[2][]{\texttt{#2} & yields \tikz[baseline=-2.5pt] \draw[#2-#2, line width=0.0929ex, #1] (0,0) -- (1,0);}
+\newcommand{\displayarrowstyle}[2][]{\texttt{#2} #1 & yields
+ \tikz[baseline=-tikzcdaxis, line width=tikzcdrule] \draw[commutative diagrams/.cd, #2] (0,0) -- (0.6,0);}
+
+\usepackage{microtype,ellipsis}
\begin{document}
\maketitle
@@ -1344,14 +1350,11 @@ commutative diagrams and other kinds of mathematical pictures,
generating high-quality results (see for example \cite{lenders} or
\cite{milne}). This package facilitates the creation of such diagrams
by providing a convenient set of macros and reasonable default
-settings. Familiarity with Ti\emph{k}Z is helpful, but not necessary,
-as the examples contained here cover the most often encountered
-situations.
-
-This package also includes an arrow tip library that match closely the
-arrows present in the Computer Modern typeface.
+settings. Familiarity with Ti\emph{k}Z is helpful but not necessary,
+since the examples contained here cover the most common situations.
-\textsc{pgf} version 2.10 is required.
+This package also includes an arrow tip library closely matching the
+Computer Modern arrow tips.
\tableofcontents
@@ -1359,11 +1362,11 @@ arrows present in the Computer Modern typeface.
\label{sec:basic-usage}
Commutative diagrams are created with the |tikzcd| environment. Its
-content describes a matrix, similarly to 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 |\[| \dots |\]|, so that the diagram is
-placed on a new line and centered.
+content describes a matrix, similarly to 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 |\[| \dots\ |\]| or an \texttt{equation} environment, so that
+the diagram is placed on a new line and centered.
\subsection{Inserting arrows}
\label{sec:inserting-arrows}
@@ -1405,10 +1408,19 @@ specified by juxtaposing |{|\meta{text}|}| or
\end{tikzcd}
\end{codeexample}
-To save some typing, the command |\ar| is provided as a shorthand to
+% If using \tikzname's \texttt{quotes} library, the above could be rewritten as follows:
+
+% \usetikzlibrary{quotes}
+% \begin{codeexample}[]
+% \begin{tikzcd}
+% A \arrow["\phi" near start, "\psi"', "\eta" near end]{r} & B
+% \end{tikzcd}
+% \end{codeexample}
+
+To save 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
+|\arrow{l}|, \dots, |\arrow{dl}|. 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}|}|.
@@ -1439,7 +1451,7 @@ user's guide.
\subsection{Changing arrow tips}
\label{sec:changing-arrow-tips}
-For each arrow-producing command present in \AmS-\LaTeX, there is a
+For some \LaTeX\ arrow-producing commands, there is a
corresponding option (without a ``|\|'') that can be passed to
|\arrow| to produce that kind of arrow. Notice the use of
|hookrightarrow| and |dashrightarrow| in the example below.
@@ -1452,26 +1464,21 @@ corresponding option (without a ``|\|'') that can be passed to
\end{tikzcd}
\end{codeexample}
-Of course, a similar effect could be achieved by directly using
-\tikzname{} options (e.g., using the option
-|right hook->|). However, the method above is more appropriate, as it
-abstracts the choice of an actual arrow tip design (see also the key
-\texttt{commutative diagrams/arrow style} below), and is probably also
-better from the mnemonic standpoint.
-
The following list shows all available arrows.
{\tikzset{commutative diagrams/.cd, background color=white}
\begin{quote}
\begin{tabular}{ll}
\displayarrowstyle{rightarrow}\\
- \displayarrowstyle{Rightarrow}\\
\displayarrowstyle{leftarrow}\\
- \displayarrowstyle{Leftarrow}\\
\displayarrowstyle{leftrightarrow}\\
+ \displayarrowstyle{dash}\\
+ \displayarrowstyle{Rightarrow}\\
+ \displayarrowstyle{Leftarrow}\\
\displayarrowstyle{Leftrightarrow}\\
- \displayarrowstyle{equals}\\
+ \displayarrowstyle{equal}\\
\displayarrowstyle[(or \texttt{maps to})]{mapsto}\\
+ \displayarrowstyle{mapsfrom}\\
\displayarrowstyle[(or \texttt{hook})]{hookrightarrow}\\
\displayarrowstyle{hookleftarrow}\\
\displayarrowstyle{rightharpoonup}\\
@@ -1491,9 +1498,9 @@ The following list shows all available arrows.
\end{quote}
}
-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.
+Some of the arrows above have an alternate name shown in parenthesis.
+These forms behave a little differently from the original ones, in
+that they can be superimposed with other arrows.
\begin{codeexample}[]
\begin{tikzcd}
@@ -1501,6 +1508,12 @@ superimposed with other arrow styles.
\end{tikzcd}
\end{codeexample}
+It is also possible to select arrow tips using the \tikzname{} |arrow|
+option directly (e.g., by saying |right hook->|). However, the method
+described here above is more appropriate, as it abstracts the choice
+of an actual arrow tip design (see also the key \texttt{commutative
+ diagrams/arrow style} below), and is arguably better from the
+mnemonic standpoint.
\section{Controlling the appearance of diagrams}
\label{sec:chang-appe-diagr}
@@ -1511,35 +1524,32 @@ Options can be made take effect in different scopes:
\item Globally, using the command |\tikzset|. This can be done in the
document preamble, or in the body, to affect all diagrams
appearing thereafter.
-\item For the current diagram, by placing options in the optional
+\item For a particular diagram, by placing options in the optional
argument to the |tikzcd| environment. Such options are applied to
- the |tikzpicture| environment generated by |tikzcd| (cf.\ \S\ref{sec:intern-arrow-comm}). Thus you can,
- for instance, use the |execute at end picuture| option 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|.
+ the |tikzpicture| environment generated by |tikzcd| (cf.\
+ \S\ref{sec:intern-arrow-comm}).
+\item For a particular 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 on
-diagrams, 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{quote}
- |\tikzset{commutative diagrams/row sep/normal=1cm}|,
-\end{quote}
-as detailed below.
+Of course, not all options make sense in all contexts.
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|. When
-using method 1, it is convenient to change the default search path by using
+|/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|. When using method 1, it is convenient to
+change the default search path by using
\begin{quote}
|\tikzset{commutative diagrams/.cd, |\meta{options}|}|.
\end{quote}
+Besides the keys described in this manual, numerous \tikzname\
+parameters can affect the appearance of a diagram. However, only a
+few of them (namely those appearing in \texttt{every diagram},
+\texttt{every arrow} and \texttt{every label} below) are reinitialized
+when |tikzcd| is called. This means that modifying a certain
+\tikzname\ parameter globally may or may not affect the output of
+|tikzcd|.
+
\subsection{General options}
\label{sec:general-options}
@@ -1549,9 +1559,9 @@ using method 1, it is convenient to change the default search path by using
\begin{quote}\ttfamily{}
/tikz/commutative diagrams/.cd,\\
|/tikz/cells={nodes={shape={asymmetrical rectangle}}}|,\\
+/tikz/baseline=0pt,\\
row sep=normal,\\
-column sep=normal,\\
-/tikz/baseline=0pt
+column sep=normal
\end{quote}
\end{stylekey}
@@ -1585,16 +1595,18 @@ stores a
\end{center}
\end{key}
- To change, say, the |normal| size (which is applied by default) to 1\,cm, you
- can use the code
+Notice that setting, say, |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| equal to 1\,cm,
+you can modify the meaning of |normal| by saying
\begin{quote}
|\tikzset{commutative diagrams/row sep/normal=1cm}|.
\end{quote}
- 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
+You can also create new sizes, but \pgfname\ requires new keys to be
+initialized explicitly. For example, to create a size |my size|,
+meaning 1\,ex, you should use
\begin{quote}
-|\tikzset{commutative diagrams/row sep/my size/.initial=1cm}|.
+|\tikzset{commutative diagrams/row sep/my size/.initial=1ex}|.
\end{quote}
\begin{key}{/tikz/commutative diagrams/column sep=\meta{size} (initially normal)}
@@ -1613,36 +1625,36 @@ too tall if the column or row separation were not set appropriately.
\begin{codeexample}[]
\begin{tikzcd}[column sep=small]
- & A \arrow{dl}\arrow{dr} & \\
- B \arrow{rr} & & C
+ & A \arrow{dl}\arrow{dr} & \\
+ B \arrow{rr} & & C
\end{tikzcd}
\end{codeexample}
\begin{codeexample}[]
\begin{tikzcd}[row sep=tiny]
- & B \arrow{dd} \\
- A \arrow{ur}\arrow{dr} & \\
+ & B \arrow{dd} \\
+ A \arrow{ur}\arrow{dr} & \\
& C
\end{tikzcd}
\end{codeexample}
The commands below are available only inside a |tikzcd| and are
intended to be used as arguments to |&| and |\\| when spacing
-adjustments are necessary.
+adjustments are necessary (see also \cite[\S17.3.2]{pgfman}).
\begin{command}{\colsep\marg{size}}
Returns the value
- stored in by the key |/tikz/commutative diagrams/column sep/|\meta{size}.
+ stored by the key |/tikz/commutative diagrams/column sep/|\meta{size}.
\end{command}
\begin{command}{\rowsep\marg{size}}
Returns the value
- stored in by the key |/tikz/commutative diagrams/row sep/|\meta{size}.
+ stored by the key |/tikz/commutative diagrams/row sep/|\meta{size}.
\end{command}
In the following example, $X$ would appear too far from the square
without any spacing adjustment.
\begin{codeexample}[]
\begin{tikzcd}
- X \ar[bend right]{rdd} \ar[bend left]{rrd} \ar[dashed]{dr}
+ X \ar[bend right]{rdd} \ar[bend left]{rrd} \ar[dashrightarrow]{dr}
&[\colsep{small}-\colsep{normal}] & \\[\rowsep{small}-\rowsep{normal}]
& A \ar{r}\ar{d} & B \ar{d} \\
& C \ar{r} & D
@@ -1651,9 +1663,9 @@ without any spacing adjustment.
\begin{key}{/tikz/commutative diagrams/math mode=\meta{boolean}
(initially true)}
- This keys determines whether the contents of a diagram is typeset in
+ This keys determines whether the contents of a diagram are 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
+ the diagram entries and arrow labels. If used with |\arrow|, it affects
only its labels.
\end{key}
@@ -1667,7 +1679,7 @@ without any spacing adjustment.
\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
+several keys 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~\cite{pgfman}.
@@ -1678,12 +1690,12 @@ as |dashed|, |dotted|, and its relatives, |line width=|\meta{dimension}, |color=
\begin{quote}\ttfamily{}
/tikz/commutative diagrams/.cd,\\
/tikz/draw,\\
-/tikz/commutative diagrams/default arrow
+default arrow
\end{quote}
\end{stylekey}
-The style |default arrow| is similar to |rightarrow|, but performs some
-additional initialization, such as setting the line width.
+The |default arrow| style is similar to |rightarrow|, but may perform
+some additional tasks, such as setting the line width.
\begin{key}{/tikz/commutative diagrams/arrows=\meta{options}}
This key appends \meta{options} to the style
@@ -1693,24 +1705,27 @@ additional initialization, such as setting the line width.
\begin{key}{/tikz/commutative diagrams/arrow style=\meta{style} (initially computer
modern)}
Setting this key causes the several arrow-tip-specifying styles
- listed in \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.
+ listed in \S\ref{sec:changing-arrow-tips} to be redefined. In
+ particular, it makes the style \texttt{/tikz/commutative
+ diagrams/default arrow}, which is automatically applied to every
+ arrow, to be redefined. Currently, \meta{style} can be one of
+ the following:
+ \begin{description}
+ \item[|computer modern|] This is the initial setting and is suitable
+ for documents using Computer Modern or Latin Modern fonts.
+ \item[|tikz|] This style uses the arrow tips defined in \tikzname's
+ |arrows| library (which has to be loaded before setting this
+ option). It honors the option |/tikz/>|, and it keeps the
+ parameter \texttt{/tikz/line width} untouched.
+ \end{description}
\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.
+better results by selecting the |tikz| arrow style, setting |/tikz/>|
+to the value that best matches your font (among those shown in
+\cite[\S23]{pgfman}), and adjusting |/tikz/line width| if necessary.
+The following example, if not particularly elegant, should be
+instructive.
\begin{codeexample}[]
\usetikzlibrary{arrows}
@@ -1718,7 +1733,7 @@ should be instructive.
\tikzset{
commutative diagrams/.cd,
arrow style=tikz,
- diagrams={>=open triangle 45, line width=\tikzcdrulethickness}}
+ diagrams={>=open triangle 45, line width=tikzcdrule}}
\begin{tikzcd}
A \arrow{r} \arrow{d} & B \arrow{d}\\
@@ -1726,30 +1741,52 @@ should be instructive.
\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 its target.
+\begin{key}{/tikz/commutative diagrams/start anchor=\meta{anchor}}
+ This key specifies at which anchor of the current node the arrow
+ should start.
\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.
+\begin{key}{/tikz/commutative diagrams/end anchor=\meta{anchor}}
+ This key specifies at which anchor of the target node the arrow
+ should arrive.
\end{key}
-See the picture on \S\ref{sec:asymm-rect-shape} for some of the
-possible values for \meta{anchor}. The picture below illustrates the
-use of \texttt{end anchor} and \texttt{start anchor}.
+% % | As it stands this is not immensely useful, so it will be left
+% % | undocumented while something better doesn't appear.
+% % V
-\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{key}{/tikz/commutative diagrams/start anchor=\ooarg{coordinate transformations}\meta{anchor}}
+% This key specifies at which anchor of the current node the arrow
+% should start. Optionally, additional coordinate transformations can
+% be supplied. An empty argument causes no anchor to be specified.
+% \end{key}
+
+% \begin{key}{/tikz/commutative diagrams/end anchor=\ooarg{coordinate transformations}\meta{anchor}}
+% This key works analogously, but refers to the target node of the arrow.
+% \end{key}
+
+% See the picture on \S\ref{sec:asymm-rect-shape} for some of the
+% possible values for \meta{anchor}. The picture below shows how
+% \texttt{end anchor} and \texttt{start anchor} can be used to fine-tune
+% the placement of arrows.
+
+% \begin{codeexample}[]
+% \begin{tikzcd}
+% X_0
+% \rar[to-, start anchor={[yshift=0.5ex]east}, end anchor={[yshift=0.5ex]west}]
+% \rar[to-, start anchor={[yshift=-0.5ex]east}, end anchor={[yshift=-0.5ex]west}] &
+% X_1
+% \rar[to-, start anchor={[yshift=1ex]east}, end anchor={[yshift=1ex]west}]
+% \rar[to-]
+% \rar[to-, start anchor={[yshift=-1ex]east}, end anchor={[yshift=-1ex]west}] &
+% X_2
+% \rar[to-, start anchor={[yshift=1.5ex]east}, end anchor={[yshift=1.5ex]west}]
+% \rar[draw=none][anchor=base,yshift=-1ex]{\vdots}
+% \rar[to-, start anchor={[yshift=-1.5ex]east}, end anchor={[yshift=-1.5ex]west}] &
+% \cdots
+% \end{tikzcd}
+% \end{codeexample}
\begin{stylekey}{/tikz/commutative diagrams/crossing over}
This style makes a thicker line, with color
@@ -1779,16 +1816,11 @@ The following picture, adapted from \cite{lenders}, illustrates this.
\end{codeexample}
\begin{key}{/tikz/commutative diagram/crossing over clearance=\meta{dimension}
- (initially 6pt)}
+ (initially 1.5ex)}
This key specifies the width of the background-colored line drawn
under a |crossing over| arrow.
\end{key}
-\begin{command}{\tikzcdrulethickness}
- This macro returns the value (in ex) of the math font default rule
- thickness.
-\end{command}
-
\subsection{Options for labels}
\label{sec:options-labels}
@@ -1802,20 +1834,22 @@ to the default), |sloped|, |pos=|\meta{fraction}, |near start|,
\begin{stylekey}{/tikz/commutative diagrams/every label}
This style is applied to every label produced with |\arrow|. It is initially set
- to the following:
+ to
\begin{quote}\ttfamily{}
/tikz/commutative diagrams/.cd,\\
/tikz/auto,\\
-/tikz/font=|\scriptsize|,\\
+/tikz/font=\meta{\rmfamily something},\\
/tikz/inner sep=0.5ex
\end{quote}
+where \meta{something} is something that makes |\scriptstyle| be
+applied to labels in math mode.
\end{stylekey}
-The style |auto| makes the label be placed to the left of the
+The key |/tikz/auto| makes the label be placed to the left of the
arrow, considering ``front'' as the direction the arrow points at.
-The dimension |inner sep| controls the distance between an
-arrow and its labels.
+The key |/tikz/inner sep| controls the distance between a label and
+the corresponding arrow.
\begin{key}{/tikz/commutative diagrams/labels=\meta{options}}
This key appends \meta{options} to the style
@@ -1823,8 +1857,9 @@ arrow and its labels.
\end{key}
\begin{stylekey}{/tikz/commutative diagrams/description}
- This style causes the label to be placed on the arrow, with the
- background filled.
+ This style causes the label to be placed over the arrow, with the
+ background filled. The clearance around the label is determined by
+ \texttt{/tikz/inner sep}.
\begin{codeexample}[]
\begin{tikzcd}
@@ -1833,19 +1868,12 @@ arrow and its labels.
\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{Further topics}
-\label{sec:further}
+\section{Advanced usage}
+\label{sec:advanced-usage}
-This sections provides further details on the functioning of
-this package, with the aim of showing how a more or less arbitrary use of
-\tikzname{} features can be made inside it.
+This section provides further details on the functioning of this
+package, with the aim of showing how a more or less arbitrary
+interaction with other \tikzname{} features is possible.
\subsection{Internals of \texttt{tikzcd} and the arrow commands}
\label{sec:intern-arrow-comm}
@@ -1867,14 +1895,15 @@ with roughly the following:
|\end{tikzpicture}|
\end{quote}
-Note that the next-row command |\\| for the last row is inserted by
-|tikzcd|, and therefore does not need to be present in
-\meta{contents}. The |\matrix| is supplied the option \texttt{matrix
- of nodes} or \texttt{matrix of math nodes} as specified by the
-option \texttt{commutative diagrams/math mode}. Also, not shown above
-are a number of initialization procedures, such as defining the
-commands |\arrow|, |\ar|, |\rar|, |\lar|, |\dar|, |\uar|, |\urar|,
-|\ular|, |\drar|, |\dlar|.
+Not shown above are a number of initialization procedures, such as
+defining |\arrow| and its relatives. Note that the next-row command
+|\\| for the last row is inserted by |tikzcd|, and therefore does not
+need to be present in \meta{contents}. The |\matrix| is supplied the
+option \texttt{matrix of nodes} or \texttt{matrix of math nodes} as
+specified by the option \texttt{commutative diagrams/math mode}.
+Notice also that you can use the key |execute at end picuture| in
+\meta{options} to have arbitrary \tikzname{} code executed after a
+diagram is drawn.
Initially, \meta{paths} is empty. The command
|\arrow[|\meta{path options}|]{|\meta{direction}|}| does nothing at the
@@ -1887,9 +1916,7 @@ point it is inserted, and causes the following code to be added to
Here, \meta{current node} is the node corresponding to the matrix cell
where the command |\arrow| is present, and \meta{target node} is determined by
-\meta{direction} as explained in \S\ref{sec:inserting-arrows}. The
-abbreviated commands |\rar|, |\dar|, etc., generate the same kind of
-code.
+\meta{direction} as explained in \S\ref{sec:inserting-arrows}.
Initially, \meta{labels} is the empty string. A label specifier of
the form |{|\meta{label text}|}| or |[|\meta{label
@@ -1903,15 +1930,8 @@ to be appended to \meta{labels}. Dollars signs surround \meta{label
text} depending on the setting \texttt{commutative diagrams/math
mode}.
-For the abbreviated form |\rar| (and similarly for |\dar|,
-|\lar|, etc.), the following are valid usages:
-\begin{quote}
- |\rar{|\meta{label text}|}|\meta{more labels},\\
- |\rar[|\meta{path options}|]{|\meta{label text}|}|\meta{more labels}, or\\
- |\rar[|\meta{path options}|][|\meta{label options}|]{|\meta{label
- text}|}|\meta{more labels}.
-\end{quote}
-Their effect is entirely analogous to the above.
+The abbreviated forms |\rar|, |\dar|, \dots, have entirely analogous
+effect.
\subsection{Tweaking \texttt{to} paths}
\label{sec:tweaking-to-paths}
@@ -1919,7 +1939,7 @@ Their effect is entirely analogous to the above.
Recall that the |to| path operation used in the paths created by
|\arrow| can take a number of options, as described in \S{}14.14
and \S{}51 of the \pgfname{} manual~\cite{pgfman}. In particular, the
-option |/tikz/to path| determines the path that is actually drawn, and
+key |/tikz/to path| determines the path that is actually drawn, and
can be used to do all sorts of fiddling.
\begin{codeexample}[]
@@ -1931,6 +1951,52 @@ can be used to do all sorts of fiddling.
\end{tikzcd}
\end{codeexample}
+A common use case is to produce parallel arrows.
+
+\begin{codeexample}[]
+\begin{tikzcd}
+ X_0
+ \rar[to-,
+ to path={
+ ([yshift=0.5ex]\tikztostart.east) --
+ ([yshift=0.5ex]\tikztotarget.west) \tikztonodes}]{d_0}
+ \rar[to-,
+ to path={
+ ([yshift=-0.5ex]\tikztostart.east) --
+ ([yshift=-0.5ex]\tikztotarget.west) \tikztonodes}][swap]{d_1}
+ & X_1
+\end{tikzcd}
+\end{codeexample}
+
+Whenever one starts using long options repeatedly, it might be a good
+idea to define a new style. In the example below, this is done with
+the statement |shift up/.style={| \dots\ |}| inside |\tikzset|.
+Styles can take one argument, which replaces all occurrences of |#1| in
+its definition.
+
+\begin{codeexample}[]
+\tikzset{
+ shift up/.style={
+ to path={([yshift=#1]\tikztostart.east) -- ([yshift=#1]\tikztotarget.west) \tikztonodes}
+ }
+}
+
+\begin{tikzcd}
+ X_0
+ \rar[to-, shift up=0.5ex]
+ \rar[to-, shift up=-0.5ex] &
+ X_1
+ \rar[to-, shift up=1ex]
+ \rar[to-]
+ \rar[to-, shift up=-1ex] &
+ X_2
+ \rar[to-, shift up=1.5ex]
+ \rar[draw=none][anchor=base,yshift=-1ex]{\vdots}
+ \rar[to-, shift up=-1.5ex] &
+ \cdots
+\end{tikzcd}
+\end{codeexample}
+
In the next example, empty labels are used to create nodes for later
reference, and in the third |\arrow| command the |to path| key is used
in a way that, in the terminology of the previous section,
@@ -1943,53 +2009,6 @@ in a way that, in the terminology of the previous section,
\end{tikzcd}
\end{codeexample}
-\subsection{The \texttt{asymmetrical rectangle} shape}
-\label{sec:asymm-rect-shape}
-
-The \texttt{asymmetrical rectangle} shape, defined by this package, is
-very similar to the \texttt{rectangle} shape, except that its
-\texttt{center} anchor is not located at the geometric center of the
-shape, but rather right above the \texttt{base} anchor, at a distance
-that can be specified by the following key, which is initially set to
-|\tikzcdaxisheight|.
-
-\begin{key}{/tikz/commutative diagrams/center shift=\meta{dimension}}
-\end{key}
-
-The picture below shows some of the available anchors. All anchors
-provided by \texttt{rectangle} are available and behave exactly the
-same, except for \texttt{center}, \texttt{west}, \texttt{east}, and
-the numerical anchors. The anchors \texttt{real center}, \texttt{real
- west} and \texttt{real east} agree with \texttt{rectangle}'s
-\texttt{center}, \texttt{west} and \texttt{east}.
-
-\begin{center}\Huge
- \begin{tikzpicture}
- \node[name=s,shape=asymmetrical rectangle,shape example]
- {Asymmetrical 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, real
- west/left, real center/above, real east/right, base west/left,
- base/below, base east/right, south west/below left, south/below,
- south east/below right, text/left, 10/right, 130/above,
- 230/below, -10/below} \draw[shift=(s.\anchor)] plot[mark=x]
- coordinates{(0,0)} node[\placement] {\scriptsize\texttt{\anchor}};
- \end{tikzpicture}
-\end{center}
-
-This shape is used in the matrix cells inside the \texttt{tikzcd}
-environment to ensure arrows between nodes in the same row are drawn
-horizontally. When \tikzname{} draws a path between
-two nodes, it chooses endpoints lying on their borders in such a way
-that the path points towards the \texttt{center} of these nodes. With
-the \texttt{rectangle} shape, the anchor \texttt{center} lies halfway
-between two nonadjacent vertices and therefore its position depends on
-the height and depth of the text.
-
-\begin{command}{\tikzcdaxisheight}
- This macro returns the value (in ex) of the math font axis height.
-\end{command}
-
\subsection{Drawing diagrams directly with Ti\emph{k}Z}
\label{sec:draw-diagr-directly}
@@ -2030,14 +2049,81 @@ how this can be done (the second one is adapted from \cite{milne}).
\end{tikzpicture}
\end{codeexample}
-\section{Computer Modern arrow tips}
+\section{Additional goodies}
+\label{sec:general-infra}
+
+This package provides some general \pgfname\ infrastructure to meet its ends,
+as described in this section.
+
+\subsection{The \texttt{asymmetrical rectangle} shape}
+\label{sec:asymm-rect-shape}
+
+The \texttt{asymmetrical rectangle} shape is similar to the
+\texttt{rectangle} shape, except that the \texttt{center} anchor is
+not located at its geometric center, but rather right above the
+\texttt{base} anchor, at a distance that can be specified by the
+following key.
+
+\begin{key}{/tikz/commutative diagrams/center yshift=\meta{dimension}
+ (initially tikzcdaxis)}
+\end{key}
+
+The picture below shows some of the available anchors. All anchors
+provided by \texttt{rectangle} are available and behave exactly the
+same, except for \texttt{center}, \texttt{west}, \texttt{east}, and
+the numerical anchors. The anchors \texttt{real center}, \texttt{real
+ west} and \texttt{real east} agree with \texttt{rectangle}'s
+\texttt{center}, \texttt{west} and \texttt{east}.
+
+\begin{center}\Huge
+ \begin{tikzpicture}
+ \node[name=s,shape=asymmetrical rectangle,shape example]
+ {Asymmetrical 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, real
+ west/left, real center/above, real east/right, base west/left,
+ base/below, base east/right, south west/below left, south/below,
+ south east/below right, text/left, 10/right, 130/above,
+ 230/below, -10/below} \draw[shift=(s.\anchor)] plot[mark=x]
+ coordinates{(0,0)} node[\placement] {\scriptsize\texttt{\anchor}};
+ \end{tikzpicture}
+\end{center}
+
+This shape is used in \texttt{tikzcd}'s matrix cells to ensure arrows
+between nodes in the same row are drawn horizontally. When
+\tikzname{} draws a path between two nodes, it chooses endpoints lying
+on their borders in such a way that the path points towards the
+\texttt{center} of the nodes. With the \texttt{rectangle} shape, the
+anchor \texttt{center} lies halfway between two nonadjacent vertices
+and therefore its position depends on the height and depth of the
+text, potentially causing slanted lines to be draw. The picture
+above, for instance, has a humongous ascender (namely, the rule after
+the word ``rectangle''), so its \texttt{real center} lies well above
+its \texttt{center}.
+
+\subsection{Reading font parameters}
+\label{sec:read-font-param}
+
+The following are |pgfmath| functions used to access relevant math
+font parameters. They take no arguments, but the result depends of
+the currently selected font size.
+
+\begin{math-function}{tikzcdaxis}
+Returns the ``axis height'' parameter of the document's math font.
+\end{math-function}
+
+\begin{math-function}{tikzcdrule}
+Returns the fraction rule thickness of the document's math font.
+\end{math-function}
+
+\subsection{Computer Modern arrow tips}
\label{sec:comp-modern-arrow}
The naming scheme of the Computer Modern-like arrow tips provided by
this package parallels that of \pgfname's |arrows| library, documented
in \S{}23 of the \pgfname{} manual~\cite{pgfman}. 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, or use the macro |\tikzcdrulethickness|.
+larger font sizes, scale this parameter accordingly, or use the value 0.0929\,ex.
Notice that by using the mechanism explained in
\S\ref{sec:changing-arrow-tips}, it is not necessary, and in fact not
@@ -2057,7 +2143,7 @@ to get matching arrows in formulas and diagrams.
\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.0929ex] (0,0) -- (1,0);\\
+ \texttt{cm \char`\|} & yields \tikz[baseline=-2.5pt] \draw[cm |-cm |, line width=0.0929ex] (0,0) -- (1,0);\\
\displayarrow{cm o}\\
\displayarrow{cm *}\\
\displayarrow{cm cap}\\
@@ -2090,47 +2176,112 @@ to get matching arrows in formulas and diagrams.
\end{tabular}
\end{description}
-\section{Font arrow tips}
+\subsection{Font arrow tips}
\label{sec:font-arrow-tips}
-{\it This is an experimental feature. It may be modified, moved
- elsewhere or even removed in the future, and it may conflict with
- future versions of \pgfname.}
+{\it This is
+ an experimental feature. It may be modified, moved elsewhere or
+ even removed in the future.}
As an attempt to provide a general solution to the problem of having
-matching arrow tips in text and in pictures, this feature produces
+matching arrow tips in text and pictures, this feature produces
arrow tips that consist of (pieces of) characters carefully placed at
-the endpoints of a path. To activate it in |tikzcd| diagrams, use
-\begin{center}
+the endpoints of the path. To activate it in |tikzcd| diagrams, say
+\begin{quote}
|\tikzset{commutative diagrams/arrow style=math font}|.
-\end{center}
+\end{quote}
It is also necessary to load |amssymb| or some other package defining
the symbols corresponding to the arrow tips you want to use.
+\ifLuaTeX
+Here are some samples:
-The above option also makes arrow tips named |math to|, \texttt{math
- to reversed}, \texttt{math cap}, \texttt{math \char`\|}, |math o|,
-\texttt{math implies}, |math implies cap|, |math left hook|, \texttt{math
-right hook}, \texttt{math double to}, |math left to|, and \texttt{math right
-to} available for use in \tikzname{} pictures in the usual way. These
-tips do not scale with the line width, but their size depends on the
-currently selected font size, so you will probably want to set
-\texttt{line width=}|\tikzcdrulethickness| when using them. It is
-possible to define more arrows or tweak the existing ones. Look into
-the source code of this package if you are interested. (And let me
-know what you think!)
+\begin{center}
+ \begin{tikzpicture}
+ \node[draw=gray,name=P]{
+ \begin{minipage}[t]{0.25\linewidth}\centering
+ \setmainfont{TG Pagella Math}
+ \tikzset{commutative diagrams/.cd,
+ arrow style=math font,
+ default arrow/.append style={line width=0.6pt},
+ font arrows/.cd,
+ declare head={math to}{→}{2.5pt}{1ex},
+ declare tail={math cap}{→}{2.5pt}{1ex},
+ declare tail={math right hook}{↪}{2.5pt}{1ex},
+ declare head={math double to}{↠}{2.5pt}{1.4ex},
+ }
+ \begin{tikzcd}[math mode=false]
+ \ar[bend right]{rr}\rar[hook]%
+ ð´\pgfmatrixnextcell ðµ\rar[two heads]%
+ \pgfmatrixnextcell ð¶
+ \end{tikzcd}\\
+ \TeX\ Gyre Pagella
+ \end{minipage}};
+ \node[draw=gray,name=Q,right=5mm of P]{
+ \begin{minipage}[t]{0.25\linewidth}\centering
+ \setmainfont{XITS Math}
+ \tikzset{commutative diagrams/.cd,
+ arrow style=math font,
+ default arrow/.append style={line width=0.66pt},
+ font arrows/.cd,
+ declare head={math to}{→}{2.5pt}{1ex},
+ declare tail={math cap}{→}{2.5pt}{1ex},
+ declare tail={math right hook}{↪}{2.5pt}{1ex},
+ declare head={math double to}{↠}{2.5pt}{1.4ex},
+ }
+ \begin{tikzcd}[math mode=false]
+ \ar[bend right]{rr}\rar[hook]%
+ ð´\pgfmatrixnextcell ðµ\rar[two heads]%
+ \pgfmatrixnextcell ð¶
+ \end{tikzcd}\\
+ XITS Math
+ \end{minipage}};
+ \node[draw=gray,name=R,right=5mm of Q]{
+ \begin{minipage}[t]{0.25\linewidth}\centering
+ \setmainfont{euler.otf}
+ \tikzset{commutative diagrams/.cd,
+ arrow style=math font,
+ default arrow/.append style={line width=0.4pt},
+ font arrows/.cd,
+ declare head={math to}{→}{2.5pt}{1ex},
+ declare tail={math cap}{→}{2.5pt}{1ex},
+ declare tail={math right hook}{↪}{2.5pt}{1ex},
+ declare head={math double to}{↠}{2.5pt}{1.4ex},
+ }
+ \begin{tikzcd}[math mode=false]
+ \ar[bend right]{rr}\rar[hook]%
+ A\pgfmatrixnextcell B\rar%
+ \pgfmatrixnextcell C
+ \end{tikzcd}\\
+ Neo Euler
+ \end{minipage}};
+\end{tikzpicture}
+\end{center}
+\fi
+
+Setting the key above also makes arrow tips named |math to|,
+\texttt{math to reversed}, \texttt{math cap}, \texttt{math \char`\|},
+|math o|, \texttt{math implies}, |math implies cap|, |math left hook|,
+\texttt{math right hook}, \texttt{math double to}, |math left to|, and
+\texttt{math right to} available for use in \tikzname{} pictures in
+the usual way. These tips do not scale with the line width, but their
+size depends on the current font size, so you will probably want to
+set \texttt{line width=tikzcdrule} when using them. It is possible to
+define more arrows or tweak the existing ones. Look into the source
+code of this package if you are interested. (And let me know what you
+think!)
The transition between a line and the arrow tip may be visible with some
document viewers and printers, as you may notice from the picture
below. When using \pdf\TeX{} (or Lua\TeX) with \pdf{} output, a
measure is taken to alleviate this.
\begin{center}\tikzset{commutative diagrams/enable font arrows}
- \pdf\TeX{} \tikz[baseline=-\tikzcdaxisheight]
- \draw[math cap-math to, line width=\tikzcdrulethickness] (0,0) -- (1,0);
+ \pdf\TeX{} \tikz[baseline=-tikzcdaxis]
+ \draw[math cap-math to, line width=tikzcdrule] (0,0) -- (1,0);
\hspace{1cm}
Other \TeX{} engines
\makeatletter\def\tikzcd@arrowset{\tikzcd@arrowset@generic}\makeatother
- \tikz[baseline=-\tikzcdaxisheight]
- \draw[math cap-math to,line width=\tikzcdrulethickness] (0,0) -- (1,0);
+ \tikz[baseline=-tikzcdaxis]
+ \draw[math cap-math to,line width=tikzcdrule] (0,0) -- (1,0);
\end{center}
I don't know of any automatic way of determining the distance between
@@ -2139,22 +2290,6 @@ so this parameter has to be entered manually via the key
\texttt{/tikz/commutative diagrams/font arrows/double distance} if you
want to use double lines.
-\section{Change history}
-\label{sec:change-history}
-
-\begin{description}
-\item[Version 0.2c] (July 2012) Added |\tikzcdrulethickness|,
- |\tikzcdaxisheight|, |\colsep|, |\rowsep|. Added experimental font arrows.
-\item[Version 0.2b] (March 2012) Added \texttt{asymetrical rectangle} shape.
-\item[Version 0.2a] (December 2011)
- Option |/tikz/commutative diagrams/path operation| removed
- in favor of direct use of |/tikz/to path|.
- Double lines with |tikz| arrow style now use \texttt{double
- equal sign distance}.
-\item[Version 0.2] (October 2011) Several changes.
-\item[Version 0.1] (September 2011) Preliminary release.
-\end{description}
-
\begin{thebibliography}{9}
\bibitem{knuth}
Donald Knuth,
@@ -2162,7 +2297,7 @@ want to use double lines.
Available at \url{http://www-cs-staff.stanford.edu/~uno/cm.html}
\bibitem{lenders}
Felix Lenders,
- \emph{Commutative diagrams using TikZ}.
+ \emph{Commutative diagrams using \tikzname}.
Available at \url{http://www.felixl.de/commu.pdf}.
\bibitem{milne}
James Milne,
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 ff9eeabdbd4..12af09e5efb 100644
--- a/Master/texmf-dist/tex/latex/tikz-cd/tikz-cd.sty
+++ b/Master/texmf-dist/tex/latex/tikz-cd/tikz-cd.sty
@@ -5,12 +5,8 @@
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
-\ProvidesPackage{tikz-cd}[2012/07/17 v0.2c Commutative diagrams with tikz.]
-\RequirePackage{tikz}
-\AtBeginDocument{% \fontdimen's can't be read reliably inside a tikzpicture
- \setbox\pgfutil@tempboxa\hbox{$ $}%
- \pgfmathparse{\the\fontdimen8\textfont3/1ex}\edef\tikzcdrulethickness{\pgfmathresult ex}%
- \pgfmathparse{\the\fontdimen22\textfont2/1ex}\edef\tikzcdaxisheight{\pgfmathresult ex}}
+\ProvidesPackage{tikz-cd}[2012/08/10 v0.3 Commutative diagrams with tikz.]
+\RequirePackage{tikz}[2010/10/13] %pgf version 2.10 required
\usetikzlibrary{matrix}
@@ -28,9 +24,7 @@
/tikz/commutative diagrams/every diagram/.append style={#1}},
description/.style={
/tikz/anchor=center,
- /tikz/fill=\pgfkeysvalueof{/tikz/commutative diagrams/background color},
- /tikz/inner sep=%
- \pgfkeysvalueof{/tikz/commutative diagrams/description clearance}},
+ /tikz/fill=\pgfkeysvalueof{/tikz/commutative diagrams/background color}},
crossing over/.style={
/tikz/preaction={
/tikz/draw=\pgfkeysvalueof{/tikz/commutative diagrams/background color},
@@ -46,17 +40,52 @@
execute at begin node=\iftikzcd@mathmode$\fi, %$
execute at end node=\iftikzcd@mathmode$\fi}}, %$
start anchor/.code={%
- \ifx#1\pgfkeysnovalue\let\tikzcd@sourceanchor\empty%
- \else\def\tikzcd@sourceanchor{.#1}\fi},
+ \tikzcd@threefold{\tikzcd@setanchor{start}}{}%
+ {\tikzcd@setanchor{start}[]}#1\relax},%
end anchor/.code={%
- \ifx#1\pgfkeysnovalue\let\tikzcd@targetanchor\empty%
- \else\def\tikzcd@targetanchor{.#1}\fi},
+ \tikzcd@threefold{\tikzcd@setanchor{end}}{}%
+ {\tikzcd@setanchor{end}[]}#1\relax},%
arrow style/.is choice}
% generic arrow tip selection styles
\pgfqkeys{/tikz/commutative diagrams}{
- dashrightarrow/.style={/tikz/commutative diagrams/.cd,rightarrow,dashed},
- dashleftarrow/.style={/tikz/commutative diagrams/.cd,leftarrow,dashed},
+ arrow style/generic/.style={
+ /tikz/commutative diagrams/.cd,
+ rightarrow/.style={/tikz/arrows=#1 cap-#1 to},
+ Rightarrow/.style={
+ /tikz/arrows=#1 implies cap-#1 implies,
+ /tikz/commutative diagrams/double line},
+ leftarrow/.style={/tikz/arrows=#1 to-#1 cap},
+ Leftarrow/.style={
+ /tikz/arrows=#1 implies-#1 implies cap,
+ /tikz/commutative diagrams/double line},
+ leftrightarrow/.style={/tikz/arrows=#1 to-#1 to},
+ Leftrightarrow/.style={
+ /tikz/arrows=#1 implies-#1 implies,
+ /tikz/commutative diagrams/double line},
+ mapsto/.style={/tikz/arrows=#1 |-#1 to},
+ mapsfrom/.style={/tikz/arrows=#1 to-#1 |},
+ hookrightarrow/.style={/tikz/arrows=#1 right hook-#1 to},
+ hookleftarrow/.style={/tikz/arrows=#1 to-#1 left hook},
+ rightharpoonup/.style={/tikz/arrows=#1 cap-#1 left to},
+ rightharpoondown/.style={/tikz/arrows=#1 cap-#1 right to},
+ leftharpoonup/.style={/tikz/arrows=#1 right to-#1 cap},
+ leftharpoondown/.style={/tikz/arrows=#1 left to-#1 cap},
+ dashrightarrow/.style={/tikz/arrows=-#1 to,/tikz/commutative diagrams/dashed},
+ dashleftarrow/.style={/tikz/arrows=#1 to-,/tikz/commutative diagrams/dashed},
+ rightarrowtail/.style={/tikz/arrows=#1 to reversed-#1 to},
+ leftarrowtail/.style={/tikz/arrows=#1 to-#1 to reversed},
+ twoheadrightarrow/.style={/tikz/arrows=#1 cap-#1 double to},
+ twoheadleftarrow/.style={/tikz/arrows=#1 double to-#1 cap},
+ dash/.style={/tikz/arrows=#1 cap-#1 cap},
+ equal/.style={
+ /tikz/arrows=#1 implies cap-#1 implies cap,
+ /tikz/commutative diagrams/double line},
+ maps to/.code={\pgfsetarrowsstart{#1 |}},
+ hook/.code={\pgfsetarrowsstart{#1 right hook}},
+ two heads/.code={\pgfsetarrowsend{#1 double to}},
+ tail/.code={\pgfsetarrowsstart{#1 to reversed}}},
+ equals/.style={/tikz/commutative diagrams/equal},
rightsquigarrow/.style={
/tikz/commutative diagrams/.cd,rightarrow,squiggly},
leftsquigarrow/.style={/tikz/commutative diagrams/.cd,leftarrow,squiggly},
@@ -64,66 +93,38 @@
/tikz/commutative diagrams/.cd,leftrightarrow,squiggly},
squiggly/.code={%
\expandafter\ifx\csname tikz@library@decorations.pathmorphing@loaded\endcsname\pgfutil@empty%
- \else\PackageError{tikz-cd}{To use squiggly arrows, include %
- \protect\usetikzlibrary{decorations.pathmorphing} in the document preamble}{}\fi},
+ \else\PackageError{tikz-cd}{You need to say %
+ \string\usetikzlibrary{decorations.pathmorphing} to use squiggly arrows}{}\fi},
squiggly/.append style={
decorate,
decoration={
zigzag,
- segment length=4,
- amplitude=.9,
- post=lineto, post length=2pt,
- pre=lineto, pre length=2pt}}}
+ segment length=9.25\pgflinewidth,
+ amplitude=1.9\pgflinewidth,
+ post=lineto, post length=6\pgflinewidth,
+ pre=lineto, pre length=6\pgflinewidth,
+ #1}}}
% The Computer Modern arrow style
\pgfqkeys{/tikz/commutative diagrams/arrow style}{
computer modern/.style={
/tikz/commutative diagrams/.cd,
+ arrow style/generic={cm},
default arrow/.style={
/tikz/line join=round,
- /tikz/arrows=cm cap-cm to,
- /tikz/line width=\tikzcdrulethickness},
- 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},
- 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},
- 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}},
+ /tikz/commutative diagrams/rightarrow,
+ /tikz/line width=0.0929ex},
double line/.style={
/tikz/double=\pgfkeysvalueof{/tikz/commutative diagrams/background color},
/tikz/double distance=3.643\pgflinewidth},
- dashed/.style={/tikz/densely dashed}}}
+ dashed/.style={/tikz/dash pattern={on 7\pgflinewidth off 4\pgflinewidth}}}}
% The tikz arrow style
\pgfqkeys{/tikz/commutative diagrams/arrow style}{
tikz/.code={%
\expandafter\ifx\csname tikz@library@arrows@loaded\endcsname\pgfutil@empty%
- \else\PackageError{tikz-cd}{To use the `tikz' arrow style, include %
- \protect\usetikzlibrary{arrows} in the document preamble}{}\fi},
+ \else\PackageError{tikz-cd}{You need to say \string\usetikzlibrary{arrows} %
+ to use the `tikz' arrow style}{}\fi},
tikz/.append style={
/tikz/commutative diagrams/.cd,
default arrow/.style={/tikz/arrows=->},
@@ -140,17 +141,21 @@
/tikz/arrows=implies-implies,
/tikz/commutative diagrams/double line},
mapsto/.style={/tikz/arrows=|->},
+ mapsfrom/.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/arrows=->,/tikz/commutative diagrams/dashed},
+ dashleftarrow/.style={/tikz/arrows=<-,/tikz/commutative diagrams/dashed},
rightarrowtail/.style={/tikz/arrows=>->},
leftarrowtail/.style={/tikz/arrows=<-<},
twoheadrightarrow/.style={/tikz/arrows=->>},
twoheadleftarrow/.style={/tikz/arrows=<<-}, %>>
- equals/.style={
+ dash/.style={/tikz/arrows=-},
+ equal/.style={
/tikz/arrows=-,
/tikz/commutative diagrams/double line},
maps to/.code={\pgfsetarrowsstart{|}},
@@ -167,13 +172,16 @@
% Default settings
\pgfqkeys{/tikz/commutative diagrams}{
every arrow/.style={
+ /handlers/first char syntax/the character "/.initial=\tikzcd@passquotes,
+ /tikz/edge quotes mean/.try={edge node={node [/tikz/commutative diagrams/every label,##2]{\tikzcd@mathmaybe{##1}}}},
/tikz/commutative diagrams/.cd,
/tikz/draw,
/tikz/commutative diagrams/default arrow},
every label/.style={
/tikz/commutative diagrams/.cd,
/tikz/auto,
- /tikz/font=\scriptsize,
+ /tikz/font=\everymath\expandafter{\the\everymath\scriptstyle},
+ % replace by \everymath{\scriptstyle} for plain TeX
/tikz/inner sep=0.5ex},
every diagram/.style={
/tikz/commutative diagrams/.cd,
@@ -182,7 +190,8 @@
column sep=normal,
/tikz/baseline=0pt},
math mode=true,
- center shift/.initial=\tikzcdaxisheight,
+ center yshift/.initial=tikzcdaxis,
+ center shift/.style={/tikz/commutative diagrams/center yshift=#1}, % this has been renamed
row sep/huge/.initial=10ex,
row sep/large/.initial=7.5ex,
row sep/normal/.initial=5ex,
@@ -196,12 +205,30 @@
column sep/small/.initial=3ex,
column sep/tiny/.initial=1.5ex,
arrow style=computer modern,
- start anchor,
- end anchor,
- description clearance/.initial=1.5pt,
- crossing over clearance/.initial=6pt,
+ description clearance/.code={%
+ \PackageWarning{tikz-cd}{The `description clearance' key has been deprecated}{}},
+ crossing over clearance/.initial=1.5ex,
background color/.initial=white}
+% pgfmath functions to obtain math fontdimens
+\pgfmathdeclarefunction{tikzcdaxis}{0}{%
+ \begingroup%
+ $\relax$% update fontdimens
+ \pgfutil@ifundefined{um_axis:N}% check if `unicode-math' is used
+ {\pgf@x=\the\fontdimen22\textfont2\relax}%
+ {\pgf@x=\expandafter\the\csname um_axis:N\endcsname\textstyle}%
+ \pgfmathreturn\pgf@x%
+ \endgroup}
+
+\pgfmathdeclarefunction{tikzcdrule}{0}{%
+ \begingroup%
+ $\relax$%
+ \pgfutil@ifundefined{um_fraction_rule:N}%
+ {\pgf@x=\the\fontdimen8\textfont3\relax}%
+ {\pgf@x=\expandafter\the\csname um_fraction_rule:N\endcsname\textstyle}%
+ \pgfmathreturn\pgf@x%
+ \endgroup}
+
% The shape used inside matrices
\pgfdeclareshape{asymmetrical rectangle} {
\inheritsavedanchors[from={rectangle}]
@@ -219,17 +246,17 @@
\inheritanchor[from={rectangle}]{mid east}
\inheritbackgroundpath[from={rectangle}]
\anchor{center}{\pgf@anchor@rectangle@center\pgfmathsetlength\pgf@y%
- {\pgfkeysvalueof{/tikz/commutative diagrams/center shift}}}
+ {\pgfkeysvalueof{/tikz/commutative diagrams/center yshift}}}
\anchor{west}{\pgf@anchor@rectangle@west\pgfmathsetlength\pgf@y%
- {\pgfkeysvalueof{/tikz/commutative diagrams/center shift}}}
+ {\pgfkeysvalueof{/tikz/commutative diagrams/center yshift}}}
\anchor{east}{\pgf@anchor@rectangle@east\pgfmathsetlength\pgf@y%
- {\pgfkeysvalueof{/tikz/commutative diagrams/center shift}}}
+ {\pgfkeysvalueof{/tikz/commutative diagrams/center yshift}}}
\anchor{real center}{\pgf@anchor@rectangle@center}
\anchor{real west}{\pgf@anchor@rectangle@west}
\anchor{real east}{\pgf@anchor@rectangle@east}
\anchorborder{%
\pgfmathsetlength\pgfutil@tempdima%
- {\pgfkeysvalueof{/tikz/commutative diagrams/center shift}}%
+ {\pgfkeysvalueof{/tikz/commutative diagrams/center yshift}}%
\pgf@xb=\pgf@x% xb/yb is target
\pgf@yb=\pgf@y%
\southwest%
@@ -284,20 +311,20 @@
\toks@\expandafter{\tikzcd@savedpaths\path[/tikz/commutative diagrams/every arrow,#1]}%
\global\edef\tikzcd@savedpaths{\the\toks@%
(\tikzmatrixname-\the\pgfmatrixcurrentrow-\the\pgfmatrixcurrentcolumn%
- \noexpand\tikzcd@sourceanchor) to }%
+ \noexpand\tikzcd@startanchor) to }%
\tikzcd@threefold{\tikzcd@ar@getlabel}{\tikzcd@ar@getlabel[]}{\tikzcd@ar@final}}
\def\tikzcd@ar@getlabel[#1]#2{%
- \expandafter\def\expandafter\tikzcd@savedpaths\expandafter{\tikzcd@savedpaths%
+ \expandafter\global\expandafter\def\expandafter\tikzcd@savedpaths\expandafter{\tikzcd@savedpaths%
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{%
- \toks@\expandafter{\tikzcd@savedpaths}
+ \toks@\expandafter{\tikzcd@savedpaths}%
\global\edef\tikzcd@savedpaths{%
\the\toks@%
(\tikzmatrixname-\the\tikzcd@targetrow-\the\tikzcd@targetcol%
- \noexpand\tikzcd@targetanchor); }}
+ \noexpand\tikzcd@endanchor); }}
\def\tikzcd@xar#1{\tikzcd@threefold{\tikzcd@@xar{#1}}{\tikzcd@arrow[]{#1}}{\tikzcd@arrow[]{#1}}}
@@ -314,7 +341,25 @@
only the characters l, r, u or d}{}\fi\fi\fi\fi\fi%
\tikzcd@tempa}
-%The tikzcd environment
+% `quotes' library support (see also `every arrow' style)
+\def\tikzcd@passquotes#1{\tikzset{every to/.append style={#1}}}
+
+% start anchor, end anchor keys
+\def\tikzcd@setanchor#1[#2]#3\relax{%
+ \pgfkeysdef{/tikz/tikzcd@#1transform}{\tikzset{#2}}%
+ \ifx\relax#2\relax\else%
+ \tikzset{to path={([tikzcd@starttransform]\tikztostart) %
+ -- ([tikzcd@endtransform]\tikztotarget) \tikztonodes}}%
+ \fi%
+ \ifx\relax#3\relax%
+ \expandafter\let\csname tikzcd@#1anchor\endcsname\empty%
+ \else%
+ \expandafter\def\csname tikzcd@#1anchor\endcsname{.#3}%
+ \fi}
+
+\pgfqkeys{/tikz/commutative diagrams}{start anchor=,end anchor=}
+
+% The tikzcd environment
\def\tikzcd{\tikzcd@threefold{\tikzcd@}{\tikzcd@[]}{\tikzcd@[]}}
\def\tikzcd@[#1]{%
@@ -344,7 +389,7 @@
\def\tikzcd@finalize{\tikzcd@savedpaths}
-\def\tikzcd@mathmaybe#1{\iftikzcd@mathmode$ #1$\else#1\fi}
+\def\tikzcd@mathmaybe#1{\iftikzcd@mathmode$\relax #1$\else#1\fi}
\def\tikzcd@sep#1#2{
\pgfkeysifdefined{/tikz/commutative diagrams/#1 sep/#2}%
@@ -674,60 +719,32 @@
% be big enough to contain the whole tip.
\tikzset{/tikz/commutative diagrams/font arrows/.cd,
double distance={3.8\pgflinewidth},
- declare head={math to}{$\to$}{\tikzcdaxisheight}{1ex},
- declare head={math to reversed}{$\leftarrowtail$}{\tikzcdaxisheight}{1ex},
- declare tail={math cap}{$\to$}{\tikzcdaxisheight}{1ex},
- declare tail={math |}{$\mapsto$}{\tikzcdaxisheight}{1ex},
- declare head={math o}{$\multimap$}{\tikzcdaxisheight}{1.4ex},
- declare head={math implies}{$\Rightarrow$}{\tikzcdaxisheight}{1.4ex},
- declare tail={math implies cap}{$\Rightarrow$}{\tikzcdaxisheight}{1ex},
- declare head={math left hook}{$\hookleftarrow$}{\tikzcdaxisheight}{1ex},
- declare tail={math right hook}{$\hookrightarrow$}{\tikzcdaxisheight}{1ex},
- declare head={math double to}{$\twoheadrightarrow$}{\tikzcdaxisheight}{1.4ex},
- declare head={math left to}{$\rightharpoonup$}{\tikzcdaxisheight}{1ex},
- declare head={math right to}{$\rightharpoondown$}{\tikzcdaxisheight}{1ex},
+ declare head={math to}{$\to$}{tikzcdaxis}{1ex},
+ declare head={math to reversed}{$\leftarrowtail$}{tikzcdaxis}{1ex},
+ declare tail={math cap}{$\to$}{tikzcdaxis}{1ex},
+ declare tail={math |}{$\mapsto$}{tikzcdaxis}{1ex},
+ declare head={math o}{$\multimap$}{tikzcdaxis}{1.4ex},
+ declare head={math implies}{$\Rightarrow$}{tikzcdaxis}{1.4ex},
+ declare tail={math implies cap}{$\Rightarrow$}{tikzcdaxis}{1ex},
+ declare head={math left hook}{$\hookleftarrow$}{tikzcdaxis}{1ex},
+ declare tail={math right hook}{$\hookrightarrow$}{tikzcdaxis}{1ex},
+ declare head={math double to}{$\twoheadrightarrow$}{tikzcdaxis}{1.4ex},
+ declare head={math left to}{$\rightharpoonup$}{tikzcdaxis}{1ex},
+ declare head={math right to}{$\rightharpoondown$}{tikzcdaxis}{1ex},
}
% The `math font' arrow style
\pgfkeys{/tikz/commutative diagrams/arrow style/math font/.style={
/tikz/commutative diagrams/.cd,
enable font arrows,
+ arrow style/generic={math},
default arrow/.style={
- /tikz/arrows=math cap-math to,
- /tikz/line width=\tikzcdrulethickness},
- rightarrow/.style={/tikz/arrows=math cap-math to},
- Rightarrow/.style={
- /tikz/arrows=math implies cap-math implies,
- /tikz/commutative diagrams/double line},
- leftarrow/.style={/tikz/arrows=math to-math cap},
- Leftarrow/.style={
- /tikz/arrows=math implies-math implies cap,
- /tikz/commutative diagrams/double line},
- leftrightarrow/.style={/tikz/arrows=math to-math to},
- Leftrightarrow/.style={
- /tikz/arrows=math implies-math implies,
- /tikz/commutative diagrams/double line},
- mapsto/.style={/tikz/arrows=math |-math to},
- hookrightarrow/.style={/tikz/arrows=math right hook-math to},
- hookleftarrow/.style={/tikz/arrows=math to-math left hook},
- rightharpoonup/.style={/tikz/arrows=math cap-math left to},
- rightharpoondown/.style={/tikz/arrows=math cap-math right to},
- leftharpoonup/.style={/tikz/arrows=math right to-math cap},
- leftharpoondown/.style={/tikz/arrows=math left to-math cap},
- rightarrowtail/.style={/tikz/arrows=math to reversed-math to},
- leftarrowtail/.style={/tikz/arrows=math to-math to reversed},
- twoheadrightarrow/.style={/tikz/arrows=math cap-math double to},
- twoheadleftarrow/.style={/tikz/arrows=math double to-math cap},
- equals/.style={
- /tikz/arrows=math implies cap-math implies cap,
- /tikz/commutative diagrams/double line},
- maps to/.code={\pgfsetarrowsstart{math |}},
- hook/.code={\pgfsetarrowsstart{math right hook}},
- two heads/.code={\pgfsetarrowsend{math double to}},
- tail/.code={\pgfsetarrowsstart{math to reversed}},
+ /tikz/commutative diagrams/rightarrow,
+ /tikz/line width=tikzcdrule},
double line/.style={
/tikz/double=\pgfkeysvalueof{/tikz/commutative diagrams/background color},
/tikz/double distance=\tikzcdfontarrowsdoubledistance},
- dashed/.style={/tikz/densely dashed}}}
+ dashed/.style={/tikz/dash pattern=on 0.8ex off 0.4ex},
+ squiggly/.default={pre length=1ex,post length=1ex}}}
\endinput