diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-matrices.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-matrices.tex | 72 |
1 files changed, 40 insertions, 32 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-matrices.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-matrices.tex index 2ac22465b43..201fe734c2c 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-matrices.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-matrices.tex @@ -12,6 +12,10 @@ \label{section-base-matrices} +\begin{pgfmodule}{matrix} + The present section documents the commands of this module. +\end{pgfmodule} + \subsection{Overview} Matrices are a mechanism for aligning several so-called cell pictures @@ -29,11 +33,12 @@ and rows is discussed. A matrix consists of rows of \emph{cells}. Cells are separated using the special command |\pgfmatrixnextcell|, rows are ended using the -command |\\|. Each cell contains a \emph{cell picture}, although cell -pictures are not complete pictures as they lack layers. However, each -cell picture has its own bouding box like a normal picture does. These -bounding boxes are important for the alignment as explained -in the following. +command |\pgfmatrixendrow| (the command |\\| is setup to mean the same +as |\pgfmatrixendrow| by default). Each cell contains a \emph{cell + picture}, although cell pictures are not complete pictures as they +lack layers. However, each cell picture has its own bouding box like a +normal picture does. These bounding boxes are important for the +alignment as explained in the following. Each cell picture will have an origin somewhere in the picture (or even outside the picture). The position of these origins is important @@ -102,20 +107,25 @@ All matrices are typeset using the following command: However, you can make |&| an active character and have it expand to |\pgfmatrixnextcell|. This way, it will ``look'' as if |&| is used. + \item Rows are ended using the command |\pgfmatrixendrow|, but |\\| + is setup to mean the same by default. However, some environments + like |{minipage}| redefine |\\|, so it is good to have + |\pgfmatrixendrow| as a ``fallback.'' \item Every row \emph{including the last row} must be ended using - the command |\\|. + the command |\\| or |\pgfmatrixendrow|. \end{enumerate} - Both |\pgfmatrixnextcell| and |\\| take an optional argument as - explained in the Section~\ref{section-matrix-spacing} + Both |\pgfmatrixnextcell| and |\pgfmatrixendrow| (and, thus, also + |\\|) take an optional argument as explained in the + Section~\ref{section-matrix-spacing} \begin{codeexample}[] \begin{tikzpicture} \pgfmatrix{rectangle}{center}{mymatrix} {\pgfusepath{}}{\pgfpointorigin}{} { - \node {a}; \pgfmatrixnextcell \node {b}; \\ - \node {c}; \pgfmatrixnextcell \node {d}; \\ + \node {a}; \pgfmatrixnextcell \node {b}; \pgfmatrixendrow + \node {c}; \pgfmatrixnextcell \node {d}; \pgfmatrixendrow } \end{tikzpicture} \end{codeexample} @@ -186,9 +196,9 @@ All matrices are typeset using the following command: manner. Here are some effects you may wish to be aware of: \begin{itemize} \item It is not necessary to actually mention |\pgfmatrixnextcell| - or |\\| inside the \meta{matrix cells}. It suffices that the - macros inside \meta{matrix cells} expand to these macros sooner or - later. + or |\pgfmatrixendrow| inside the \meta{matrix cells}. It suffices + that the macros inside \meta{matrix cells} expand to these macros + sooner or later. \item In particular, you can define clever macros that insert columns and rows as needed for special effects. \end{itemize} @@ -284,8 +294,7 @@ commands for the column spacing. \end{itemize} \begin{codeexample}[] -\begin{tikzpicture} - \tikzstyle{every node}=[draw] +\begin{tikzpicture}[every node/.style=draw] \pgfsetmatrixcolumnsep{1mm} \pgfmatrix{rectangle}{center}{mymatrix} {\pgfusepath{}}{\pgfpointorigin}{\let\&=\pgfmatrixnextcell} @@ -297,8 +306,7 @@ commands for the column spacing. \end{tikzpicture} \end{codeexample} \begin{codeexample}[] -\begin{tikzpicture} - \tikzstyle{every node}=[draw] +\begin{tikzpicture}[every node/.style=draw] \pgfsetmatrixcolumnsep{1mm} \pgfmatrix{rectangle}{center}{mymatrix} {\pgfusepath{}}{\pgfpointorigin}{\let\&=\pgfmatrixnextcell} @@ -307,13 +315,12 @@ commands for the column spacing. \node {3}; \& \node {5}; \& \node {7}; \\ \node {4}; \& \node {9}; \& \node {2}; \\ } - \tikzstyle{every node}=[] - \draw [<->,red,thick] (a.center) -- (b.center) node [above,midway] {11mm}; + \draw [<->,red,thick,every node/.style=] (a.center) -- (b.center) + node [above,midway] {11mm}; \end{tikzpicture} \end{codeexample} \begin{codeexample}[] -\begin{tikzpicture} - \tikzstyle{every node}=[draw] +\begin{tikzpicture}[every node/.style=draw] \pgfsetmatrixcolumnsep{1cm,between origins} \pgfmatrix{rectangle}{center}{mymatrix} {\pgfusepath{}}{\pgfpointorigin}{\let\&=\pgfmatrixnextcell} @@ -322,9 +329,11 @@ commands for the column spacing. \node {3}; \& \node {5}; \& \node {7}; \\ \node {4}; \& \node {9}; \& \node {2}; \\ } - \tikzstyle{every node}=[] - \draw [<->,red,thick] (a.center) -- (b.center) node [above,midway] {10mm}; - \draw [<->,red,thick] (b.east) -- (c.west) node [above,midway] {10mm}; + \begin{scope}[every node/.style=] + \draw [<->,red,thick] (a.center) -- (b.center) node [above,midway] {10mm}; + \draw [<->,red,thick] (b.east) -- (c.west) node [above,midway] + {10mm}; + \end{scope} \end{tikzpicture} \end{codeexample} \end{command} @@ -339,18 +348,17 @@ commands are called differently. -\begin{pgfmanualentry} - \pgfmanualentryheadline{\declare{\doublebs}\opt{\oarg{additional sep list}}} - \index{*bs@\protect\doublebs} - \pgfmanualbody +\begin{command}{\pgfmatrixendrow\opt{\oarg{additional sep list}}} This command ends a line. The optional \meta{additional sep list} is used to determine the spacing between the row being ended and the next row. The modes and the computation of $d$ is done in the same way as for columns. For the last row the optional argument has no effect. - This command is defined in this special way only inside matrices. -\end{pgfmanualentry} + Inside matrices (and only there) the command |\\| is setup to mean + the same as this command. +\end{command} + \subsection{Callbacks} \label{section-matrix-callbacks} @@ -362,8 +370,8 @@ change the appearance of cells in a very general manner. \begin{command}{\pgfmatrixemptycode} This macro is executed for empty cells. This means that \pgfname\ uses some macro magic to determine whether a cell is empty (it - immediatly ends with |\pgfmatrixemptycode| or |\\|) and, if so, put - this macro inside the cell. + immediatly ends with |\pgfmatrixemptycode| or |\pgfmatrixendrow|) + and, if so, put this macro inside the cell. \begin{codeexample}[] \begin{tikzpicture} \def\pgfmatrixemptycode{\node{empty};} |