summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-03-18 23:22:20 +0000
committerKarl Berry <karl@freefriends.org>2012-03-18 23:22:20 +0000
commit4259209d35460c4a5011aa52ffb619c557591c03 (patch)
tree65dfce8d44ac48c4982be94e085ce4f2b55bfb92 /Master
parent61065674de81d0dccba11b46076f426e424ad58a (diff)
tikz-cd (18mar12)
git-svn-id: svn://tug.org/texlive/trunk@25687 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/tikz-cd/tikz-cd-doc.pdfbin231785 -> 235681 bytes
-rw-r--r--Master/texmf-dist/doc/latex/tikz-cd/tikz-cd-doc.tex161
-rw-r--r--Master/texmf-dist/tex/latex/tikz-cd/tikz-cd.sty74
3 files changed, 157 insertions, 78 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
index 0278864d424..c63039466ee 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 33c9caf5e33..3acee948f03 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 by Florêncio Neves
+% Copyright 2011, 2012 by Florêncio Neves
%
% This file may be distributed and/or modified
%
@@ -1328,7 +1328,7 @@
\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.2a, of December 9, 2011}
+\date{\normalsize Version 0.2b, of March 18, 2012}
\tikzset{commutative diagrams/background color=graphicbackground}
@@ -1379,7 +1379,7 @@ placed on an arrow by providing a second argument.
\end{tikzcd}
\end{codeexample}
-You can control the behavior of the arrow by placing an argument
+You can control the appearance of the arrow by placing an argument
inside square braces before the direction parameter. It may contain
any option that can be passed to \tikzname{}'s
|\path| command. Similarly, a label can be modified by an argument in
@@ -1509,7 +1509,7 @@ 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.
+ appearing thereafter.
\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| (cf.\ \S\ref{sec:intern-arrow-comm}). Thus you can,
@@ -1531,10 +1531,10 @@ can use
as detailed below.
All keys provided by this package are located in the path
-|/tikz/commutative diagrams|. Methods 2.\ and 3.\ above will search
+|/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. When
-using method 1., it is convenient to change the default search path by using
+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}
@@ -1545,22 +1545,19 @@ using method 1., it is convenient to change the default search path by using
\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.
-
+\begin{quote}\ttfamily{}
+/tikz/commutative diagrams/.cd,\\
+|/tikz/cells={nodes={shape={asymmetrical rectangle}}}|,\\
+row sep=normal,\\
+column sep=normal,\\
+/tikz/baseline=0pt
+\end{quote}
\end{stylekey}
+The |baseline=0pt| setting is used to make equation numbers be placed
+correctly. The \texttt{asymmetrical rectangle} shape, used in the
+matrix nodes, is described in \S\ref{sec:asymm-rect-shape}.
+
\begin{key}{/tikz/commutative diagrams/diagrams=\meta{options}}
This key appends \meta{options} to the style
|/tikz/commutative diagrams/every diagram|.
@@ -1640,7 +1637,7 @@ too tall if the column or row separation were not set appropriately.
\begin{key}{/tikz/commutative diagrams/background color=\meta{color} (initially white)}
This key 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.
+ It does not cause the background of diagrams to be filled.
\end{key}
\subsection{Options for arrows}
@@ -1650,20 +1647,21 @@ 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 \pgfname{} manual~\cite{pgfman}.
+|loop|, etc. See the \pgfname{} manual~\cite{pgfman}.
\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,
+\begin{quote}\ttfamily{}
+/tikz/commutative diagrams/.cd,\\
+/tikz/draw,\\
/tikz/commutative diagrams/default arrow
-\end{codeexample}
-
-Initially, the style |default arrow| is a synonym to |rightarrow|.
+\end{quote}
\end{stylekey}
+The style |default arrow| is similar to |rightarrow|, but performs some
+additional initialization, such as setting the line width.
+
\begin{key}{/tikz/commutative diagrams/arrows=\meta{options}}
This key appends \meta{options} to the style
|/tikz/commutative diagrams/every arrow|.
@@ -1672,7 +1670,7 @@ Initially, the style |default arrow| is a synonym to |rightarrow|.
\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
+ 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.
@@ -1717,29 +1715,14 @@ should be instructive.
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|.
+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}.
\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}
+ \rar[start anchor=south east, end anchor=south west, swap]{\phi}
& B
\end{tikzcd}
\end{codeexample}
@@ -1794,26 +1777,22 @@ to the default), |sloped|, |pos=|\meta{fraction}, |near start|,
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}
+\begin{quote}\ttfamily{}
+/tikz/commutative diagrams/.cd,\\
+/tikz/auto,\\
+/tikz/font=|\scriptsize|,\\
+/tikz/inner sep=0.5ex
+\end{quote}
+\end{stylekey}
-The style |/tikz/auto| makes the label be placed to the left of the
+The style |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. The options |text height| and |text depth| are
-reset here because they are set picture-wise by the |every diagram|
-style.
-\end{stylekey}
+The dimension |inner sep| controls the distance between the
+arrow and the label.
\begin{key}{/tikz/commutative diagrams/labels=\meta{options}}
This key appends \meta{options} to the style
- |/tikz/commutative diagrams/every label|.
+ \texttt{/tikz/commutative diagrams/every label}.
\end{key}
\begin{stylekey}{/tikz/commutative diagrams/description}
@@ -1834,7 +1813,7 @@ style.
key |/tikz/inner sep|.
\end{key}
-\section{Further possibilities}
+\section{Further topics}
\label{sec:further}
This sections provides further details on the functioning of
@@ -1870,16 +1849,17 @@ are a number of initialization procedures, such as defining the
commands |\arrow|, |\ar|, |\rar|, |\lar|, |\dar|, |\uar|, |\urar|,
|\ular|, |\drar|, |\dlar|.
-The command |\arrow[|\meta{options}|]{|\meta{direction}|}| does
-nothing at the point it is inserted, and causes the following code to
-be added to \meta{paths}:
+Initially, \meta{paths} is empty. The command
+|\arrow[|\meta{options}|]{|\meta{direction}|}| does nothing at the
+point it is inserted, and causes the following code to be added to
+\meta{paths}:
\begin{quote}
|\path[commutative diagrams/every arrow, |\meta{options}|] (|%
\meta{current node}|) to |\meta{labels}| (|\meta{target~node}|);|
\end{quote}
Here, \meta{current node} is the node corresponding to the matrix cell
-where the command |\arrow| is, and \meta{target node} is determined by
+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.
@@ -1934,6 +1914,48 @@ 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 shape \texttt{asymmetrical rectangle}, 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:
+
+\begin{key}{/tikz/commutative diagrams/center shift=\meta{dimension} (initially 0.575ex)}
+\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}
+ \begin{tikzpicture}\Huge
+ \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. Roughly speaking, 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 those 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.
+
\subsection{Drawing diagrams directly with Ti\emph{k}Z}
\label{sec:draw-diagr-directly}
@@ -2051,6 +2073,7 @@ to get matching arrows in formulas and diagrams.
\label{sec:change-history}
\begin{description}
+\item[Version 0.2b] (March 2012) Added \texttt{asymetrical rectangle} shape.
\item[Version 0.2a] (December 2011)
\begin{itemize}
\item Option |/tikz/commutative diagrams/path operation| removed
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 d7d13d98166..bd5202c82d4 100644
--- a/Master/texmf-dist/tex/latex/tikz-cd/tikz-cd.sty
+++ b/Master/texmf-dist/tex/latex/tikz-cd/tikz-cd.sty
@@ -1,11 +1,11 @@
-% Copyright 2011 by Florêncio Neves
+% Copyright 2011, 2012 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.
%
-\ProvidesPackage{tikz-cd}[2011/12/09 v0.2a Commutative diagrams with tikz.]
+\ProvidesPackage{tikz-cd}[2012/03/18 v0.2b Commutative diagrams with tikz.]
\RequirePackage{tikz}
\usetikzlibrary{matrix}
@@ -33,8 +33,6 @@
/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}},
@@ -193,17 +191,15 @@
/tikz/commutative diagrams/.cd,
/tikz/auto,
/tikz/font=\scriptsize,
- /tikz/inner sep=0.5ex,
- /tikz/text height=,
- /tikz/text depth=},
+ /tikz/inner sep=0.5ex},
every diagram/.style={
/tikz/commutative diagrams/.cd,
+ /tikz/cells={/tikz/nodes={/tikz/shape={asymmetrical rectangle}}},
row sep=normal,
column sep=normal,
- /tikz/text height=1.5ex,
- /tikz/text depth=0.25ex,
/tikz/baseline=0pt},
math mode=true,
+ center shift/.initial=0.575ex,
row sep/huge/.initial=10ex,
row sep/large/.initial=7.5ex,
row sep/normal/.initial=5ex,
@@ -223,6 +219,66 @@
crossing over clearance/.initial=6pt,
background color/.initial=white}
+% The shape used inside matrices
+\pgfdeclareshape{asymmetrical rectangle} {
+ \inheritsavedanchors[from={rectangle}]
+ \inheritanchor[from={rectangle}]{base}
+ \inheritanchor[from={rectangle}]{north}
+ \inheritanchor[from={rectangle}]{south}
+ \inheritanchor[from={rectangle}]{base west}
+ \inheritanchor[from={rectangle}]{north west}
+ \inheritanchor[from={rectangle}]{south west}
+ \inheritanchor[from={rectangle}]{base east}
+ \inheritanchor[from={rectangle}]{north east}
+ \inheritanchor[from={rectangle}]{south east}
+ \inheritanchor[from={rectangle}]{mid}
+ \inheritanchor[from={rectangle}]{mid west}
+ \inheritanchor[from={rectangle}]{mid east}
+ \inheritbackgroundpath[from={rectangle}]
+ \anchor{center}{\pgf@anchor@rectangle@center\pgfmathsetlength\pgf@y%
+ {\pgfkeysvalueof{/tikz/commutative diagrams/center shift}}}
+ \anchor{west}{\pgf@anchor@rectangle@west\pgfmathsetlength\pgf@y%
+ {\pgfkeysvalueof{/tikz/commutative diagrams/center shift}}}
+ \anchor{east}{\pgf@anchor@rectangle@east\pgfmathsetlength\pgf@y%
+ {\pgfkeysvalueof{/tikz/commutative diagrams/center shift}}}
+ \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}}%
+ \pgf@xb=\pgf@x% xb/yb is target
+ \pgf@yb=\pgf@y%
+ \southwest%
+ \pgf@xa=\pgf@x% xa/ya is se
+ \pgf@ya=\pgf@y%
+ \northeast%
+ \advance\pgf@x by-\pgf@xa%
+ \advance\pgf@y by-\pgf@ya%
+ \pgf@xc=.5\pgf@x% x/y is half width/height
+ \pgf@yc=.5\pgf@y%
+ \advance\pgf@xa by\pgf@xc% xa/ya becomes center
+ \advance\pgf@ya by\pgf@yc%
+ \ifdim\pgf@yb>0pt%
+ \northeast%
+ \pgf@yc=\pgf@y%
+ \advance\pgf@yc by-\pgfutil@tempdima%
+ \else%
+ \southwest%
+ \pgf@yc=-\pgf@y%
+ \advance\pgf@yc by\pgfutil@tempdima%
+ \fi
+ \edef\pgf@marshal{%
+ \noexpand\pgfpointborderrectangle
+ {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}
+ {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}%
+ }%
+ \pgf@process{\pgf@marshal}%
+ \advance\pgf@x by\pgf@xa%
+ \advance\pgf@y by\pgfutil@tempdima%
+ }
+}
+
% Branch depending on whether the next character is [, { or none of those.
\def\tikzcd@threefold#1#2#3{%
\def\tikzcd@tempa{#1}%