diff options
author | Karl Berry <karl@freefriends.org> | 2019-08-05 21:06:42 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-08-05 21:06:42 +0000 |
commit | afb7d40814174e2a80e071eacfd55580945dca4d (patch) | |
tree | 49cd74d99ff4f43c9a7a9b3bf58faf6ad5ad11d8 /Master | |
parent | f6fa706801c1c4d41cc2cf0638b64c8ab70ee413 (diff) |
matrix-skeleton (5aug19)
git-svn-id: svn://tug.org/texlive/trunk@51823 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/matrix-skeleton/LICENSE | 5 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/matrix-skeleton/README.md | 34 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/matrix-skeleton/example.pdf | bin | 0 -> 33635 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/matrix-skeleton/example.tex | 17 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/matrix-skeleton/manual.pdf | bin | 0 -> 114680 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/matrix-skeleton/manual.tex | 397 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/matrix-skeleton/pgflibrarymatrix.skeleton.code.tex | 330 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/matrix-skeleton/tikzlibrarymatrix.skeleton.code.tex | 278 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/matrix-skeleton.tlpsrc | 0 |
11 files changed, 1063 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/matrix-skeleton/LICENSE b/Master/texmf-dist/doc/latex/matrix-skeleton/LICENSE new file mode 100644 index 00000000000..cf5d56f156e --- /dev/null +++ b/Master/texmf-dist/doc/latex/matrix-skeleton/LICENSE @@ -0,0 +1,5 @@ +Copyright (c) 2013-2019, Nicolas Dudebout <nicolas.dudebout@gatech.edu> + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/Master/texmf-dist/doc/latex/matrix-skeleton/README.md b/Master/texmf-dist/doc/latex/matrix-skeleton/README.md new file mode 100644 index 00000000000..a084f16689d --- /dev/null +++ b/Master/texmf-dist/doc/latex/matrix-skeleton/README.md @@ -0,0 +1,34 @@ +`matrix.skeleton` is a `PGF/TikZ` library that simplifies working with multiple matrix nodes. +To do so, `matrix.skeleton` correctly aligns groups of nodes with the content of the whole matrix. +Furthermore, `matrix.skeleton` provides rows and columns for easy styling. + +For example, the following picture is easily typeset: + +![Example](example.pdf) + +with this simple code: + +```TeX +\documentclass[tikz]{standalone} + +\usetikzlibrary{matrix.skeleton} + +\begin{document} + \begin{tikzpicture} + \matrix (m) [matrix of math nodes, + style odd rows on layer={background}{fill=black!25}] { + 1 & \frac{\frac{16}{2}}{4} & 3 \\ + 4.0000001 & 5 & 6 \\ + 7 & 8 & 9 \\ + 10 & 11 & 12 \\ + 13 & 14 & 15 \\ + }; + \fitandstyle{(m-cell-1-1) (m-cell-2-2)}{draw=red, fill=red!25, opacity=0.5} + \end{tikzpicture} +\end{document} +``` + +More information and examples are available in [the manual](manual.pdf). + +Author: Nicolas Dudebout +License: ISC diff --git a/Master/texmf-dist/doc/latex/matrix-skeleton/example.pdf b/Master/texmf-dist/doc/latex/matrix-skeleton/example.pdf Binary files differnew file mode 100644 index 00000000000..1bf57b0b62b --- /dev/null +++ b/Master/texmf-dist/doc/latex/matrix-skeleton/example.pdf diff --git a/Master/texmf-dist/doc/latex/matrix-skeleton/example.tex b/Master/texmf-dist/doc/latex/matrix-skeleton/example.tex new file mode 100644 index 00000000000..eff0bd0d14b --- /dev/null +++ b/Master/texmf-dist/doc/latex/matrix-skeleton/example.tex @@ -0,0 +1,17 @@ +\documentclass[tikz]{standalone} + +\usetikzlibrary{matrix.skeleton} + +\begin{document} + \begin{tikzpicture} + \matrix (m) [matrix of math nodes, + style odd rows on layer={background}{fill=black!25}] { + 1 & \frac{\frac{16}{2}}{4} & 3 \\ + 4.0000001 & 5 & 6 \\ + 7 & 8 & 9 \\ + 10 & 11 & 12 \\ + 13 & 14 & 15 \\ + }; + \fitandstyle{(m-cell-1-1) (m-cell-2-2)}{draw=red, fill=red!25, opacity=0.5} + \end{tikzpicture} +\end{document} diff --git a/Master/texmf-dist/doc/latex/matrix-skeleton/manual.pdf b/Master/texmf-dist/doc/latex/matrix-skeleton/manual.pdf Binary files differnew file mode 100644 index 00000000000..878e7af24a3 --- /dev/null +++ b/Master/texmf-dist/doc/latex/matrix-skeleton/manual.pdf diff --git a/Master/texmf-dist/doc/latex/matrix-skeleton/manual.tex b/Master/texmf-dist/doc/latex/matrix-skeleton/manual.tex new file mode 100644 index 00000000000..14ee41c69a6 --- /dev/null +++ b/Master/texmf-dist/doc/latex/matrix-skeleton/manual.tex @@ -0,0 +1,397 @@ +\documentclass{scrartcl} + +\usepackage{tikz} +\usetikzlibrary{matrix.skeleton} + +\usepackage[justification=centering,labelfont={sf,bf,up},labelsep=period,font=small]{caption} +\captionsetup[figure]{position=bottom,singlelinecheck=false} +\usepackage[font=small,justification=centering]{subcaption} +\usepackage{float} +\floatstyle{komabelow} +\restylefloat{figure} + +\usepackage{xspace} + +\usepackage{hyperref} +\hypersetup{ colorlinks=true + , linkcolor=blue!75 + , citecolor=black + , urlcolor=blue!75 + } + +\usepackage[noabbrev, capitalize]{cleveref} + +\tikzset{highlight/.style={draw=#1!75, fill=#1!25, rounded corners=1pt}} +\newcommand\code\texttt +\newcommand{\TikZ}{Ti\textit{k}Z\xspace} + +\title{\texttt{matrix.skeleton}'s Manual} +\author{Nicolas Dudebout} +\date{} + +\begin{document} + +\maketitle + +\section{Introduction} + +The \TikZ \code{matrix} library places nodes on a grid. +However, this grid is discarded after the nodes have been placed. +As a result, certain constructions involving multiple nodes become cumbersome. +The following two examples highlight some of the difficulties. + +\subsection{Alignment Issues with \code{fit}} + +The \code{fit} library is used to highlight a subset of nodes in a matrix. +If all the nodes in the matrix have the same dimension, as in~\cref{fig:highlighting_identical_dimensions}, \code{fit} produces the desired output. + +\begin{figure}[h] +\centering + +\begin{subfigure}{0.45\textwidth} +\centering +\begin{tikzpicture} +\matrix (m) [matrix of math nodes, column sep = 3pt, row sep = 3pt] { +1 & 2 \\ +3 & 4 \\ +5 & 6 \\ +}; +\end{tikzpicture} +\caption{Input matrix} +\end{subfigure} +% +\begin{subfigure}{0.45\textwidth} +\centering +\begin{tikzpicture} +\matrix (m) [matrix of math nodes, column sep = 3pt, row sep = 3pt] { +1 & 2 \\ +3 & 4 \\ +5 & 6 \\ +}; + +\fitandstyle[background]{(m-1-1) (m-2-1)}{highlight = yellow} +\fitandstyle[background]{(m-1-2) (m-2-2)}{highlight = red} +\fitandstyle[background]{(m-3-1) (m-3-2)}{highlight = green} +\end{tikzpicture} +\caption{Desired output and result with \code{fit}} +\end{subfigure} + +\caption{Highlighting in a matrix with nodes of identical dimensions} +\label{fig:highlighting_identical_dimensions} +\end{figure} + +However, if the nodes have different heights and widths, as illustrated in~\cref{fig:highlighting_different_dimensions}, some alignment issues arise. + +\begin{figure}[h] +\centering +\begin{subfigure}{0.3\textwidth} +\centering + +\begin{tikzpicture} +\matrix (m) [matrix of math nodes, column sep = 3pt, row sep = 3pt] { +1 & \frac{\frac{16}{4}}{1 + \frac{2}{2}} \\ +2.999999 & 4 \\ +5 & 6.000001 \\ +}; +\end{tikzpicture} +\caption{Input matrix} +\end{subfigure} +% +\begin{subfigure}{0.3\textwidth} +\centering + +\begin{tikzpicture} +\matrix (m) [matrix of math nodes, column sep = 3pt, row sep = 3pt, label skeleton] { +1 & \frac{\frac{16}{4}}{1 + \frac{2}{2}} \\ +2.999999 & 4 \\ +5 & 6.000001 \\ +}; + +\fitandstyle[background]{(m-cell-1-1) (m-cell-2-1)}{highlight = yellow} +\fitandstyle[background]{(m-cell-1-2) (m-cell-2-2)}{highlight = red} +\fitandstyle[background]{(m-cell-3-1) (m-cell-3-2)}{highlight = green} +\end{tikzpicture} +\caption{Desired output} +\end{subfigure} +% +\begin{subfigure}{0.3\textwidth} +\centering + +\begin{tikzpicture} +\matrix (m) [matrix of math nodes, column sep = 3pt, row sep = 3pt] { +1 & \frac{\frac{16}{4}}{1 + \frac{2}{2}} \\ +2.999999 & 4 \\ +5 & 6.000001 \\ +}; + +\fitandstyle[background]{(m-1-1) (m-2-1)}{highlight = yellow} +\fitandstyle[background]{(m-1-2) (m-2-2)}{highlight = red} +\fitandstyle[background]{(m-3-1) (m-3-2)}{highlight = green} +\end{tikzpicture} +\caption{Result with \code{fit}} +\end{subfigure} + +\caption{Highlighting in a matrix with nodes of different dimensions} +\label{fig:highlighting_different_dimensions} +\end{figure} + +These problems can be addressed using \code{minimum width} and \code{minimum height}. +However, adjusting manually these parameters in every matrix is a waste of time. + +The \code{matrix.skeleton} library provides a clean solution through the use of nodes called~\code{cells}. +These \code{cells} and other skeleton nodes are described in~\cref{sec:skeleton}. + +\subsection{Working with Rows and Columns} + +The readability of a matrix can sometimes be improved by adding a background on every other row. +This simple task is not easily achievable with \code{matrix} alone. +The style \code{every odd column} only affects the nodes of the said columns. +There is no real column object to work with. + +The \code{matrix.skeleton} library provides \TikZ styles to achieve this goal easily. +These styles are described in~\cref{sec:styling} + +\section{Skeleton} +\label{sec:skeleton} + +\subsection{Nodes} + +\code{matrix.skeleton} works by positioning a set of nodes to recreate the \code{matrix} grid. +The eight types of such nodes are illustrated in~\cref{fig:skeleton_nodes}. + +\begin{figure}[h] +\centering +\begin{subfigure}{0.3\textwidth} +\centering +\begin{tikzpicture} +\matrix (m) [draw, matrix of nodes, column sep=10pt, row sep=10pt, label skeleton] { +1 & 2 & 3 \\ +4 & 5 & 6 \\ +7 & 8 & 9 \\ +}; + +\fitandstyle[background]{(m-cell-1-1)}{fill=yellow!30} +\fitandstyle[background]{(m-row-2)}{fill=red!25} +\fitandstyle[background]{(m-column-3)}{fill=green!25, opacity=.75} +\end{tikzpicture} +\caption{\textcolor{yellow!80!orange}{Cell}, \textcolor{red!50}{row}, and \textcolor{green!60}{column}} +\end{subfigure} +% +\begin{subfigure}{0.3\textwidth} +\centering +\begin{tikzpicture} +\matrix (m) [draw, matrix of nodes, column sep=10pt, row sep=10pt, label skeleton] { +1 & 2 & 3 \\ +4 & 5 & 6 \\ +7 & 8 & 9 \\ +}; + +\fitandstyle[background]{(m-inter-row-1)}{fill=red!25} +\fitandstyle[background]{(m-inter-column-2)}{fill=green!25, opacity=.75} +\end{tikzpicture} +\caption{\textcolor{red!50}{Inter-row} and \textcolor{green!60}{inter-column}} +\end{subfigure} +% +\begin{subfigure}{0.3\textwidth} +\centering +\begin{tikzpicture} +\matrix (m) [draw, matrix of nodes, column sep=10pt, row sep=10pt, label skeleton] { +1 & 2 & 3 \\ +4 & 5 & 6 \\ +7 & 8 & 9 \\ +}; +\fitandstyle[background]{(m-tiling-cell-1-1)}{fill=yellow!30} +\fitandstyle[background]{(m-tiling-row-2)}{fill=red!25} +\fitandstyle[background]{(m-tiling-column-3)}{fill=green!25, opacity=.75} +\end{tikzpicture} +\caption{\textcolor{yellow!80!orange}{Tiling cell}, \textcolor{red!50}{tiling row}, and \textcolor{green!60}{tiling column}} +\end{subfigure} +\caption{Skeleton nodes} +\label{fig:skeleton_nodes} +\end{figure} + +\subsection{Using \code{matrix.skeleton}} + +The recommended way of using \code{matrix.skeleton} is through \TikZ. +First, load the library with: +\begin{verbatim} + \usetikzlibrary{matrix.skeleton} +\end{verbatim} +Then add an option to your matrix: +\begin{verbatim} + \matrix (m) [label skeleton] {...}; +\end{verbatim} +This creates a set of nodes that can be used for styling. +For example, the nodes illustrated in~\cref{fig:skeleton_nodes} are named: \code{m-cell-1-1}, \code{m-row-2}, \code{m-column-3}, \code{m-inter-row-1}, \code{m-inter-column-2}, \code{m-tiling-cell-1}, \code{m-tiling-row-2}, and \code{m-tiling-column-3}. + +\section{Styling} +\label{sec:styling} + +The skeleton nodes are PGF nodes not meant to be styled. +Styles should be applied to nodes whose shapes depend on the skeleton ones. + +\subsection{Macros} + +Styling in \code{matrix.skeleton} is done with the~\code{fit} library. +The following macro creates a \code{fit} node with the specified style: +\begin{verbatim} + \fitandstyle{(m-cell-1-1) (m-cell-2-2)}{draw=red}; +\end{verbatim} + +It takes an optional argument to place the node in a \code{pgfonlayer} environment: +\begin{verbatim} + \fitandstyle[background]{(m-cell-1-1) (m-cell-2-2)}{fill=red}; +\end{verbatim} + +\subsection{\TikZ \code{matrix} Options} + +Common styling options are also provided as \TikZ options. +These options call~\code{label skeleton} before styling the appropriate nodes. +They take the following form: +\begin{verbatim} + \matrix (m) [style odd rows = {draw=red}] {...}; +\end{verbatim} + +\begin{verbatim} + \matrix (m) [style odd tiling rows = {draw=red}] {...}; +\end{verbatim} + +\begin{verbatim} + \matrix (m) [style grid = {draw}] {...}; +\end{verbatim} + +\begin{verbatim} + \matrix (m) [style tiling grid = {draw}] {...}; +\end{verbatim} + +All of these options have an \code{on layer} variant taking the following form: +\begin{verbatim} + \matrix (m) [style odd rows on layer = {background}{fill=red}] {...}; +\end{verbatim} + +\section{Examples} + +The following examples illustrate the styling capabilities offered by \code{matrix.skeleton}. + +\subsection{Grid} + +\begin{figure}[h] +\centering +\begin{tikzpicture} +\matrix (m) [matrix of math nodes, style contour = {draw, very thick}, style grid = {draw, thin}] { +1 & \frac{\frac{16}{4}}{1 + \frac{2}{2}} & 3 \\ +3.999999 & 5 & 6 \\ +7 & 8.000001 & 3 + 3 + 3 \\ +}; +\end{tikzpicture} +\end{figure} + +\begin{verbatim} +\begin{tikzpicture} +\matrix (m) [matrix of math nodes, style contour = {draw, very thick}, + style grid = {draw, thin}] { +1 & \frac{\frac{16}{4}}{1 + \frac{2}{2}} & 3 \\ +3.999999 & 5 & 6 \\ +7 & 8.000001 & 3 + 3 + 3 \\ +}; +\end{tikzpicture} +\end{verbatim} + +\subsection{Rows} + +\begin{figure}[h] +\centering +\begin{tikzpicture} +\matrix (m) [matrix of math nodes, row sep = 10pt, style odd rows on layer={background}{fill=green!25}, style even rows on layer={background}{fill=yellow!30}] { +1 & \frac{\frac{16}{4}}{1 + \frac{2}{2}} & 3 \\ +3.999999 & 5 & 6 \\ +7 & 8.000001 & 3 + 3 + 3 \\ +}; + +\fitandstyle{(m-inter-row-1)}{fill=red!25} +\fitandstyle{(m-inter-row-2)}{fill=red!25} +\end{tikzpicture} +\end{figure} + +\begin{verbatim} +\begin{tikzpicture} +\matrix (m) [matrix of math nodes, row sep = 10pt, + style odd rows on layer={background}{fill=green!25}, + style even rows on layer={background}{fill=yellow!30}] { +1 & \frac{\frac{16}{4}}{1 + \frac{2}{2}} & 3 \\ +3.999999 & 5 & 6 \\ +7 & 8.000001 & 3 + 3 + 3 \\ +}; + +\fitandstyle{(m-inter-row-1)}{fill=red!25} +\fitandstyle{(m-inter-row-2)}{fill=red!25} +\end{tikzpicture} +\end{verbatim} + +\subsection{Checker Board} + +This example is inspired by the following \href{http://tex.stackexchange.com}{\TeX{} - \LaTeX{} Stack Exchange} question: \href{http://tex.stackexchange.com/questions/14061/how-can-i-set-the-background-color-of-the-rows-and-columns-of-a-matrix-node-in-t}{How can I set the background color of the rows and columns of a matrix node in Tikz?} + +\begin{figure}[h] +\centering +\begin{tikzpicture} +\matrix (m) [draw, matrix of nodes, row sep=2mm, column sep=1mm, nodes={draw, thick, circle, inner sep=1pt}, label skeleton] { + & 1 & &[2mm]|[gray]|1\\ + & & 2 &|[gray]|2\\ + |[gray]|2 & & &|[gray]|2\\[4mm] + 3 & & & 3\\ +}; +\foreach \row in {1, ..., 4} { + \foreach \col in {1, ..., 4} { + \pgfmathparse{Mod(\row + \col, 2) ? "red!25" : "yellow!30"} + \colorlet{squarebg}{\pgfmathresult} + \fitandstyle[background]{(m-tiling-cell-\row-\col)}{fill = squarebg} + } +} +\end{tikzpicture} +\end{figure} + +\newpage + +\begin{verbatim} +\begin{tikzpicture} +\matrix (m) [draw, matrix of nodes, row sep=2mm, column sep=1mm, + nodes={draw, thick, circle, inner sep=1pt}, label skeleton] { + & 1 & &[2mm]|[gray]|1\\ + & & 2 &|[gray]|2\\ + |[gray]|2 & & &|[gray]|2\\[4mm] + 3 & & & 3\\ +}; +\foreach \row in {1, ..., 4} { + \foreach \col in {1, ..., 4} { + \pgfmathparse{Mod(\row + \col, 2) ? "red!25" : "yellow!30"} + \colorlet{squarebg}{\pgfmathresult} + \fitandstyle[background]{(m-tiling-cell-\row-\col)}{fill = squarebg} + } +} +\end{tikzpicture} +\end{verbatim} + +\section{Internals} + +\code{matrix.skeleton} was heavily inspired by \href{http://tex.stackexchange.com/users/86/andrew-stacey}{Andrew Stacey}'s \code{matrixcells} \LaTeX{} package. +It has three distinctive features. +First, it works with any \code{anchor}. +Second, it provides finer control with respect to \code{row sep}, \code{column sep}, and \code{inner sep}. +Third, the skeleton node positioning relies only on \TeX{} and PGF, not on \LaTeX{} or \TikZ. + +\code{matrixcells} properly aligns its \code{cells} when the node \code{anchor} is \code{base}. +However, when the alignment is different it runs into problems, as exposed in the following \href{http://tex.stackexchange.com}{\TeX{} - \LaTeX{} Stack Exchange} question: \href{http://tex.stackexchange.com/questions/128045/matrixcells-problem-with-the-y-axis-only}{Matrixcells problem with the y-axis only}. +This shortcoming is the result of some loss of information in \code{pgfmodulematrix.code.tex}. +A dimension used during the placement of nodes is overwritten. +Therefore, this information is not available to build the grid. +In \code{matrixcells}, this lost dimension is reconstructed as the average of two other dimensions. +This method only gives the right dimension when the nodes are anchored at \code{base}. +To always get proper alignment, the~\code{pgfmodulematrix.code.tex} macro erasing the dimension was rewritten. +Following \href{http://tex.stackexchange.com/users/3235/percusse}{\code{@percusse}}'s recommendation this change is transparent to the user and does not require updating PGF/\TikZ. + +\code{matrixcells} only provides \code{cells} corresponding the \code{tiling-cells} in \code{matrix.skeleton}. +This tiling behavior is sometimes desired. +However, it can result in unexpected behaviors when: using a non-base \code{anchor}, using \code{row sep} or \code{column sep}, or when working on boundary nodes. + +\end{document} diff --git a/Master/texmf-dist/tex/latex/matrix-skeleton/pgflibrarymatrix.skeleton.code.tex b/Master/texmf-dist/tex/latex/matrix-skeleton/pgflibrarymatrix.skeleton.code.tex new file mode 100644 index 00000000000..b031338eb37 --- /dev/null +++ b/Master/texmf-dist/tex/latex/matrix-skeleton/pgflibrarymatrix.skeleton.code.tex @@ -0,0 +1,330 @@ +\usepgfmodule{matrix} + +\def\pgfmatrixlabelskeleton{ + \let\pgf@matrix@compute@origin\pgf@matrix@skeleton@compute@origin + \let\pgf@matrix@shift@nodes@initial\pgf@matrix@skeleton@shift@nodes@initial + \let\pgf@end@matrix\pgf@end@matrix@skeleton +} + +\expandafter\def\expandafter\pgf@end@matrix@skeleton\expandafter{\pgf@end@matrix \pgf@matrix@create@skeleton}% + +% Creates the skeleton + +% orig contains the upper left corner of the different boxes + +\def\pgf@matrix@create@skeleton{% + \xdef\pgf@matrix@skel@innerxsep{\pgfkeysvalueof{/pgf/inner xsep}}% + \xdef\pgf@matrix@skel@innerysep{\pgfkeysvalueof{/pgf/inner ysep}}% + \pgfscope% + \pgfgetlastxy\ck@shift@x\ck@shift@y + \pgftransformshift{\pgfpoint{\ck@shift@x}{\ck@shift@y}}% + \pgfset{inner sep=0pt}% + \pgf@matrix@skeleton@create@cells% + \pgf@matrix@skeleton@create@tiling@cells% + \pgf@matrix@skeleton@create@rows% + \pgf@matrix@skeleton@create@tiling@rows% + \pgf@matrix@skeleton@create@columns% + \pgf@matrix@skeleton@create@tiling@columns% + \endpgfscope% +} + +\def\pgf@matrix@skeleton@create@cells{% + \newcount\pgf@matrix@skel@next@row + \foreach \pgf@matrix@skel@row in {1, ..., \pgfmatrixcurrentrow} {% + \pgf@matrix@skel@next@row=\pgf@matrix@skel@row + \advance\pgf@matrix@skel@next@row by 1 + \pgfmathsetmacro{\pgf@matrix@skel@origy}{\csname pgf@matrix@origy\pgf@matrix@skel@row\endcsname + \csname pgf@matrix@maxy\pgf@matrix@skel@row\endcsname}% + \pgfmathsetmacro{\pgf@matrix@skel@height}{\csname pgf@matrix@maxy\pgf@matrix@skel@row\endcsname - \csname pgf@matrix@miny\pgf@matrix@skel@row\endcsname - \pgflinewidth}% + \pgfmathsetmacro{\pgf@matrix@skel@height}{\pgf@matrix@skel@height - \csname pgf@matrix@row@sep@\the\pgf@matrix@skel@next@row\endcsname} + \foreach \pgf@matrix@skel@col in {1, ..., \pgf@matrix@numberofcolumns} {% + \pgfmathsetmacro{\pgf@matrix@skel@origx}{\csname pgf@matrix@origx\pgf@matrix@skel@col\endcsname + \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname}% + \pgfmathsetmacro{\pgf@matrix@skel@width}{\csname pgf@matrix@maxx\pgf@matrix@skel@col\endcsname - \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname - \pgflinewidth}% + \ifnum\pgf@matrix@skel@col>1\relax% + \pgfmathsetmacro{\pgf@matrix@skel@origx}{\pgf@matrix@skel@origx + \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname}% + \pgfmathsetmacro{\pgf@matrix@skel@width}{\pgf@matrix@skel@width - \pgflinewidth - \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname}% + \fi% + {% + \pgfset{minimum width=\pgf@matrix@skel@width, minimum height=\pgf@matrix@skel@height}% + \pgftransformshift{\pgfpoint{\pgf@matrix@skel@origx pt}{\pgf@matrix@skel@origy pt}}% + \pgfnode{rectangle}{north west}{}{\pgf@matrix@par@name-cell-\pgf@matrix@skel@row-\pgf@matrix@skel@col}{}% + } + } + } +} + +\def\pgf@matrix@skeleton@create@tiling@cells{% + \newcount\pgf@matrix@skel@next@col + \newcount\pgf@matrix@skel@next@row + \foreach \pgf@matrix@skel@row in {1, ..., \pgfmatrixcurrentrow} {% + \pgf@matrix@skel@next@row=\pgf@matrix@skel@row + \advance\pgf@matrix@skel@next@row by 1 + \pgfmathsetmacro{\pgf@matrix@skel@origy}{\csname pgf@matrix@origy\pgf@matrix@skel@row\endcsname + \csname pgf@matrix@maxy\pgf@matrix@skel@row\endcsname}% + \pgfmathsetmacro{\pgf@matrix@skel@height}{\csname pgf@matrix@maxy\pgf@matrix@skel@row\endcsname - \csname pgf@matrix@miny\pgf@matrix@skel@row\endcsname - \pgflinewidth}% + \ifnum\pgf@matrix@skel@row=1\relax% + \pgfmathsetmacro{\pgf@matrix@skel@origy}{\pgf@matrix@skel@origy + \pgf@matrix@skel@innerysep}% + \pgfmathsetmacro{\pgf@matrix@skel@height}{\pgf@matrix@skel@height + \pgf@matrix@skel@innerysep}% + \fi + \ifnum\pgf@matrix@skel@row=\pgfmatrixcurrentrow\relax% + \pgfmathsetmacro{\pgf@matrix@skel@height}{\pgf@matrix@skel@height + \pgf@matrix@skel@innerysep - \pgfmatrixrowsep}% + \fi + \ifnum\pgf@matrix@skel@row>1\relax% + \pgfmathsetmacro{\pgf@matrix@skel@origy}{\pgf@matrix@skel@origy + 0.5 * \csname pgf@matrix@row@sep@\pgf@matrix@skel@row\endcsname} + \pgfmathsetmacro{\pgf@matrix@skel@height}{\pgf@matrix@skel@height + 0.5 * \csname pgf@matrix@row@sep@\pgf@matrix@skel@row\endcsname} + \fi + \ifnum\pgf@matrix@skel@row<\pgfmatrixcurrentrow\relax% + \pgfmathsetmacro{\pgf@matrix@skel@height}{\pgf@matrix@skel@height - 0.5 * \csname pgf@matrix@row@sep@\the\pgf@matrix@skel@next@row\endcsname} + \fi + \foreach \pgf@matrix@skel@col in {1, ..., \pgf@matrix@numberofcolumns} {% + \pgf@matrix@skel@next@col=\pgf@matrix@skel@col + \advance\pgf@matrix@skel@next@col by 1 + \pgfmathsetmacro{\pgf@matrix@skel@origx}{\csname pgf@matrix@origx\pgf@matrix@skel@col\endcsname + \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname}% + \pgfmathsetmacro{\pgf@matrix@skel@width}{\csname pgf@matrix@maxx\pgf@matrix@skel@col\endcsname - \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname- \pgflinewidth}% + \ifnum\pgf@matrix@skel@col=1\relax% + \pgfmathsetmacro{\pgf@matrix@skel@origx}{\pgf@matrix@skel@origx - \pgf@matrix@skel@innerxsep}% + \pgfmathsetmacro{\pgf@matrix@skel@width}{\pgf@matrix@skel@width + \pgf@matrix@skel@innerxsep}% + \fi% + \ifnum\pgf@matrix@skel@col=\pgf@matrix@numberofcolumns\relax% + \pgfmathsetmacro{\pgf@matrix@skel@width}{\pgf@matrix@skel@width + \pgf@matrix@skel@innerxsep}% + \fi% + \ifnum\pgf@matrix@skel@col<\pgf@matrix@numberofcolumns% + \pgfmathsetmacro{\pgf@matrix@skel@width}{\pgf@matrix@skel@width + 0.5 * \csname pgf@matrix@column@sep@\the\pgf@matrix@skel@next@col\endcsname}% + \fi% + \ifnum\pgf@matrix@skel@col>1% + \pgfmathsetmacro{\pgf@matrix@skel@origx}{\pgf@matrix@skel@origx + 0.5 * \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname}% + \pgfmathsetmacro{\pgf@matrix@skel@width}{\pgf@matrix@skel@width - 0.5 * \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname}% + \fi% + {% + \pgfset{minimum width=\pgf@matrix@skel@width, minimum height=\pgf@matrix@skel@height}% + \pgftransformshift{\pgfpoint{\pgf@matrix@skel@origx pt}{\pgf@matrix@skel@origy pt}}% + \pgfnode{rectangle}{north west}{}{\pgf@matrix@par@name-tiling-cell-\pgf@matrix@skel@row-\pgf@matrix@skel@col}{}% + } + } + } +} + +\def\pgf@matrix@skeleton@create@rows{% + \newcount\pgf@matrix@skel@next@row% + \pgfmathsetmacro{\pgf@matrix@skel@width}{\csname pgf@matrix@origx\the\pgf@matrix@numberofcolumns\endcsname + \csname pgf@matrix@maxx\the\pgf@matrix@numberofcolumns\endcsname - \pgflinewidth}% + \pgfmathsetmacro{\pgf@matrix@skel@origx}{\csname pgf@matrix@origx1\endcsname + \csname pgf@matrix@minx1\endcsname}% + \foreach \pgf@matrix@skel@row in {1, ..., \pgfmatrixcurrentrow} {% + \pgf@matrix@skel@next@row=\pgf@matrix@skel@row\relax% + \advance\pgf@matrix@skel@next@row by1\relax% + \pgfmathsetmacro{\pgf@matrix@skel@origy}{\csname pgf@matrix@origy\pgf@matrix@skel@row\endcsname + \csname pgf@matrix@maxy\pgf@matrix@skel@row\endcsname}% + \pgfmathsetmacro{\pgf@matrix@skel@height}{\csname pgf@matrix@maxy\pgf@matrix@skel@row\endcsname - \csname pgf@matrix@miny\pgf@matrix@skel@row\endcsname - \csname pgf@matrix@row@sep@\the\pgf@matrix@skel@next@row\endcsname - \pgflinewidth}% + {% + \pgfset{minimum width=\pgf@matrix@skel@width, minimum height=\pgf@matrix@skel@height}% + \pgftransformshift{\pgfpoint{\pgf@matrix@skel@origx pt}{\pgf@matrix@skel@origy pt}}% + \pgfnode{rectangle}{north west}{}{\pgf@matrix@par@name-row-\pgf@matrix@skel@row}{}% + } + \ifnum\pgf@matrix@skel@row<\pgfmatrixcurrentrow\relax% + \pgfmathsetmacro{\pgf@matrix@skel@origy}{\csname pgf@matrix@origy\the\pgf@matrix@skel@next@row\endcsname + \csname pgf@matrix@maxy\the\pgf@matrix@skel@next@row\endcsname + \csname pgf@matrix@row@sep@\the\pgf@matrix@skel@next@row\endcsname + 0.5 * \pgflinewidth}% + \pgfmathsetmacro{\pgf@matrix@skel@height}{\csname pgf@matrix@row@sep@\the\pgf@matrix@skel@next@row\endcsname}% + {% + \pgfset{minimum width=\pgf@matrix@skel@width, minimum height=\pgf@matrix@skel@height}% + \pgftransformshift{\pgfpoint{\pgf@matrix@skel@origx pt}{\pgf@matrix@skel@origy pt}}% + \pgfnode{rectangle}{north west}{}{\pgf@matrix@par@name-inter-row-\pgf@matrix@skel@row}{}% + } + \fi% + } +} + +\def\pgf@matrix@skeleton@create@tiling@rows{% + \newcount\pgf@matrix@skel@next@row% + \pgfmathsetmacro{\pgf@matrix@skel@width}{\csname pgf@matrix@origx\the\pgf@matrix@numberofcolumns\endcsname + \csname pgf@matrix@maxx\the\pgf@matrix@numberofcolumns\endcsname - \pgflinewidth + 2 * \pgf@matrix@skel@innerxsep}% + \pgfmathsetmacro{\pgf@matrix@skel@origx}{\csname pgf@matrix@origx1\endcsname + \csname pgf@matrix@minx1\endcsname - \pgf@matrix@skel@innerxsep}% + \foreach \pgf@matrix@skel@row in {1, ..., \pgfmatrixcurrentrow} {% + \pgf@matrix@skel@next@row=\pgf@matrix@skel@row\relax% + \advance\pgf@matrix@skel@next@row by1\relax% + \pgfmathsetmacro{\pgf@matrix@skel@origy}{\csname pgf@matrix@origy\pgf@matrix@skel@row\endcsname + \csname pgf@matrix@maxy\pgf@matrix@skel@row\endcsname}% + \pgfmathsetmacro{\pgf@matrix@skel@height}{\csname pgf@matrix@maxy\pgf@matrix@skel@row\endcsname - \csname pgf@matrix@miny\pgf@matrix@skel@row\endcsname - \csname pgf@matrix@row@sep@\the\pgf@matrix@skel@next@row\endcsname - \pgflinewidth}% + \ifnum\pgf@matrix@skel@row=1\relax% + \pgfmathsetmacro{\pgf@matrix@skel@origy}{\pgf@matrix@skel@origy + \pgf@matrix@skel@innerysep}% + \pgfmathsetmacro{\pgf@matrix@skel@height}{\pgf@matrix@skel@height + \pgf@matrix@skel@innerysep}% + \fi + \ifnum\pgf@matrix@skel@row=\pgfmatrixcurrentrow\relax% + \pgfmathsetmacro{\pgf@matrix@skel@height}{\pgf@matrix@skel@height + \pgf@matrix@skel@innerysep}% + \fi + \ifnum\pgf@matrix@skel@row>1\relax% + \pgfmathsetmacro{\pgf@matrix@skel@origy}{\pgf@matrix@skel@origy + 0.5 * \csname pgf@matrix@row@sep@\pgf@matrix@skel@row\endcsname}% + \pgfmathsetmacro{\pgf@matrix@skel@height}{\pgf@matrix@skel@height + 0.5 * \csname pgf@matrix@row@sep@\pgf@matrix@skel@row\endcsname}% + \fi% + \ifnum\pgf@matrix@skel@row<\pgfmatrixcurrentrow\relax% + \pgfmathsetmacro{\pgf@matrix@skel@height}{\pgf@matrix@skel@height + 0.5 * \csname pgf@matrix@row@sep@\the\pgf@matrix@skel@next@row\endcsname}% + \fi% + {% + \pgfset{minimum width=\pgf@matrix@skel@width, minimum height=\pgf@matrix@skel@height}% + \pgftransformshift{\pgfpoint{\pgf@matrix@skel@origx pt}{\pgf@matrix@skel@origy pt}}% + \pgfnode{rectangle}{north west}{}{\pgf@matrix@par@name-tiling-row-\pgf@matrix@skel@row}{}% + } + } +} + +\def\pgf@matrix@skeleton@create@columns{% + \newcount\pgf@matrix@skel@prev@col% + \pgfmathsetmacro{\pgf@matrix@skel@height}{\csname pgf@matrix@origy1\endcsname + \csname pgf@matrix@maxy1\endcsname - \csname pgf@matrix@miny\the\pgfmatrixcurrentrow\endcsname - \pgfmatrixrowsep - \pgflinewidth}% + \pgfmathsetmacro{\pgf@matrix@skel@origy}{\csname pgf@matrix@origy1\endcsname + \csname pgf@matrix@maxy1\endcsname}% + \foreach \pgf@matrix@skel@col in {1, ..., \pgf@matrix@numberofcolumns} {% + \ifnum\pgf@matrix@skel@col>1\relax% + \pgfmathsetmacro{\pgf@matrix@skel@origx}{\csname pgf@matrix@origx\pgf@matrix@skel@col\endcsname + \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname + \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname}% + \pgfmathsetmacro{\pgf@matrix@skel@width}{\csname pgf@matrix@maxx\pgf@matrix@skel@col\endcsname - \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname - \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname - \pgflinewidth}% + \else% + \pgfmathsetmacro{\pgf@matrix@skel@origx}{\csname pgf@matrix@origx\pgf@matrix@skel@col\endcsname + \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname}% + \pgfmathsetmacro{\pgf@matrix@skel@width}{\csname pgf@matrix@maxx\pgf@matrix@skel@col\endcsname - \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname - \pgflinewidth}% + \fi% + {% + \pgfset{minimum width=\pgf@matrix@skel@width, minimum height=\pgf@matrix@skel@height}% + \pgftransformshift{\pgfpoint{\pgf@matrix@skel@origx pt}{\pgf@matrix@skel@origy pt}}% + \pgfnode{rectangle}{north west}{}{\pgf@matrix@par@name-column-\pgf@matrix@skel@col}{}% + } + \ifnum\pgf@matrix@skel@col>1\relax% + \pgf@matrix@skel@prev@col=\pgf@matrix@skel@col\relax% + \advance\pgf@matrix@skel@prev@col by-1\relax% + \pgfmathsetmacro{\pgf@matrix@skel@origx}{\csname pgf@matrix@origx\the\pgf@matrix@skel@prev@col\endcsname + \csname pgf@matrix@maxx\the\pgf@matrix@skel@prev@col\endcsname - 0.5 * \pgflinewidth}% + \pgfmathsetmacro{\pgf@matrix@skel@width}{\csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname}% + {% + \pgfset{minimum width=\pgf@matrix@skel@width, minimum height=\pgf@matrix@skel@height}% + \pgftransformshift{\pgfpoint{\pgf@matrix@skel@origx pt}{\pgf@matrix@skel@origy pt}}% + \pgfnode{rectangle}{north west}{}{\pgf@matrix@par@name-inter-column-\the\pgf@matrix@skel@prev@col}{}% + } + \fi% + } +} + +\def\pgf@matrix@skeleton@create@tiling@columns{% + \newcount\pgf@matrix@skel@next@col% + \pgfmathsetmacro{\pgf@matrix@skel@height}{\csname pgf@matrix@origy1\endcsname + \csname pgf@matrix@maxy1\endcsname - \csname pgf@matrix@miny\the\pgfmatrixcurrentrow\endcsname - \pgfmatrixrowsep - \pgflinewidth + 2 * \pgf@matrix@skel@innerysep}% + \pgfmathsetmacro{\pgf@matrix@skel@origy}{\csname pgf@matrix@origy1\endcsname + \csname pgf@matrix@maxy1\endcsname + \pgf@matrix@skel@innerysep}% + \foreach \pgf@matrix@skel@col in {1, ..., \pgf@matrix@numberofcolumns} {% + \pgf@matrix@skel@next@col=\pgf@matrix@skel@col\relax% + \advance\pgf@matrix@skel@next@col by1\relax% + \ifnum\pgf@matrix@skel@col>1\relax% + \pgfmathsetmacro{\pgf@matrix@skel@origx}{\csname pgf@matrix@origx\pgf@matrix@skel@col\endcsname + \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname + \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname}% + \pgfmathsetmacro{\pgf@matrix@skel@width}{\csname pgf@matrix@maxx\pgf@matrix@skel@col\endcsname - \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname - \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname - \pgflinewidth}% + \else% + \pgfmathsetmacro{\pgf@matrix@skel@origx}{\csname pgf@matrix@origx\pgf@matrix@skel@col\endcsname + \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname}% + \pgfmathsetmacro{\pgf@matrix@skel@width}{\csname pgf@matrix@maxx\pgf@matrix@skel@col\endcsname - \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname - \pgflinewidth}% + \fi% + \ifnum\pgf@matrix@skel@col=1\relax% + \pgfmathsetmacro{\pgf@matrix@skel@origx}{\pgf@matrix@skel@origx - \pgf@matrix@skel@innerxsep}% + \pgfmathsetmacro{\pgf@matrix@skel@width}{\pgf@matrix@skel@width + \pgf@matrix@skel@innerxsep}% + \fi + \ifnum\pgf@matrix@skel@col=\pgf@matrix@numberofcolumns\relax% + \pgfmathsetmacro{\pgf@matrix@skel@width}{\pgf@matrix@skel@width + \pgf@matrix@skel@innerxsep}% + \fi + \ifnum\pgf@matrix@skel@col>1\relax% + \pgfmathsetmacro{\pgf@matrix@skel@origx}{\pgf@matrix@skel@origx - 0.5 * \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname}% + \pgfmathsetmacro{\pgf@matrix@skel@width}{\pgf@matrix@skel@width + 0.5 * \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname}% + \fi + \ifnum\pgf@matrix@skel@col<\pgf@matrix@numberofcolumns\relax% + \pgfmathsetmacro{\pgf@matrix@skel@width}{\pgf@matrix@skel@width + 0.5 * \csname pgf@matrix@column@sep@\the\pgf@matrix@skel@next@col\endcsname}% + \fi + {% + \pgfset{minimum width=\pgf@matrix@skel@width, minimum height=\pgf@matrix@skel@height}% + \pgftransformshift{\pgfpoint{\pgf@matrix@skel@origx pt}{\pgf@matrix@skel@origy pt}}% + \pgfnode{rectangle}{north west}{}{\pgf@matrix@par@name-tiling-column-\pgf@matrix@skel@col}{}% + } + } +} + +% Compute the real positions of the origins + +% We must now compute the real positions of the origins of all the +% small pictures. To this end, we need to compute prefix sums. After +% the procedure is done, the origx and the origy will contain the origin +% positions. + +\def\pgf@matrix@skeleton@compute@origin{% + % + % Inverse prefix sum on the vertical positions + % + {% + \ifnum\pgfmatrixcurrentrow>0\relax% + \expandafter\gdef\csname pgf@matrix@origy\the\pgfmatrixcurrentrow\endcsname{0pt}% + \fi% + \c@pgf@counta=\pgfmatrixcurrentrow\relax% + \loop% + \ifnum\c@pgf@counta>1\relax% + \pgf@y=\csname pgf@matrix@origy\the\c@pgf@counta\endcsname\relax% + \advance\pgf@y by\csname pgf@matrix@maxy\the\c@pgf@counta\endcsname\relax + \advance\c@pgf@counta by-1\relax% + \pgf@ya=\csname pgf@matrix@miny\the\c@pgf@counta\endcsname\relax% + \advance\pgf@y by-\pgf@ya\relax% + \expandafter\xdef\csname pgf@matrix@origy\the\c@pgf@counta\endcsname{\the\pgf@y}% + \repeat% + }% + % + % Prefix sum on the horizontal positions + % + {% + \ifnum\pgf@matrix@numberofcolumns>0\relax% + \pgf@x=\csname pgf@matrix@minx1\endcsname\relax% + \pgf@x=-\pgf@x% + \expandafter\xdef\csname pgf@matrix@origx1\endcsname{\the\pgf@x}% + \fi% + \c@pgf@counta=1\relax% + \loop% + \ifnum\c@pgf@counta<\pgf@matrix@numberofcolumns\relax% + \pgf@x=\csname pgf@matrix@origx\the\c@pgf@counta\endcsname\relax% + \advance\pgf@x by\csname pgf@matrix@maxx\the\c@pgf@counta\endcsname\relax% + \advance\c@pgf@counta by1\relax% + \pgf@xa=\csname pgf@matrix@minx\the\c@pgf@counta\endcsname\relax% + \advance\pgf@x by-\pgf@xa\relax% + \expandafter\xdef\csname pgf@matrix@origx\the\c@pgf@counta\endcsname{\the\pgf@x}% + \repeat% + }% +} + + +% Shift the nodes to their origins + +% The following procedure shifts all nodes in +% \pgf@matrix@node@list to their location inside a temporary +% picture. This picture will later be shifted again to its final +% position in the real picture. + +\def\pgf@matrix@skeleton@shift@nodes@initial{% + {% + \pgfutil@for\pgf@matrix@node@name:=\pgf@matrix@node@list\do{% + \ifx\pgf@matrix@node@name\pgfutil@empty% + \else% + \expandafter\ifx\csname pgf@matrix@node@visited@\pgf@matrix@node@name\endcsname\relax% + \pgf@shift@node{\pgf@matrix@node@name}{% + \pgf@x=\csname pgf@matrix@origx% + \expandafter\expandafter\expandafter\pgfutil@secondoftwo\csname pgf@matrix@node@location@\pgf@matrix@node@name\endcsname\endcsname% + \pgf@y=\csname pgf@matrix@origy% + \expandafter\expandafter\expandafter\pgfutil@firstoftwo\csname pgf@matrix@node@location@\pgf@matrix@node@name\endcsname\endcsname% + }% + \expandafter\let\csname pgf@matrix@node@visited@\pgf@matrix@node@name\endcsname=\pgfutil@empty% + \fi% + \fi% + }% + }% +} + + +% End of line +\def\pgfmatrixendrow{% + % if the cell contains nothing, the following \let will be at the + % beginning (macro expansion has stopped here since neither \omit + % nor \span was found) + \let\pgf@matrix@signal@cell@end=\pgf@matrix@signal@cell@end% + &\pgf@matrix@correct@calltrue% + \global\pgf@matrix@fixedfalse% + \pgf@y=0pt% + \pgf@matrix@addtolength\pgf@y{\pgfmatrixrowsep}% + \pgfutil@ifnextchar[{\pgfmatrixendrow@skip}{ + { + \advance\pgfmatrixcurrentrow by1\relax % only temporary for the following: + \expandafter\xdef\csname pgf@matrix@row@sep@\the\pgfmatrixcurrentrow\endcsname{\the\pgf@y}% + } + \pgf@matrix@finish@line}% +} + +\def\pgfmatrixendrow@skip[#1]{% + \pgf@matrix@addtolength\pgf@y{#1}% + { + \advance\pgfmatrixcurrentrow by1\relax % only temporary for the following: + \expandafter\xdef\csname pgf@matrix@row@sep@\the\pgfmatrixcurrentrow\endcsname{\the\pgf@y}% + } + \pgf@matrix@finish@line% +} diff --git a/Master/texmf-dist/tex/latex/matrix-skeleton/tikzlibrarymatrix.skeleton.code.tex b/Master/texmf-dist/tex/latex/matrix-skeleton/tikzlibrarymatrix.skeleton.code.tex new file mode 100644 index 00000000000..8f342e8ae7a --- /dev/null +++ b/Master/texmf-dist/tex/latex/matrix-skeleton/tikzlibrarymatrix.skeleton.code.tex @@ -0,0 +1,278 @@ +\usepgflibrary{matrix.skeleton} + +\usetikzlibrary{matrix} +\usetikzlibrary{fit} +\usetikzlibrary{backgrounds} + +\tikzset{ + label skeleton/.code = { + \pgfmatrixlabelskeleton + }, + add styling node/.style = { + append after command = { + \pgfextra + \pgfinterruptpath + % This next line is not useful in CVS. This is protection that was needed in the past for nodes. + \setbox\tikz@figbox=\box\pgfutil@voidb@x + #1 + \endpgfinterruptpath + \endpgfextra + } + }, + style odd rows/.style = { + label skeleton, + add styling node = { + \foreach \row in {1, ..., \the\pgfmatrixcurrentrow}{ + \ifodd\row + \fitandstyle{(\tikzlastnode-row-\row)}{#1} + \fi + } + } + }, + style even rows/.style = { + label skeleton, + add styling node={ + \foreach \row in {1, ..., \the\pgfmatrixcurrentrow}{ + \ifodd\row + \else + \fitandstyle{(\tikzlastnode-row-\row)}{#1} + \fi + } + } + }, + style odd rows on layer/.style 2 args= { + label skeleton, + add styling node = { + \foreach \row in {1, ..., \the\pgfmatrixcurrentrow}{ + \ifodd\row + \fitandstyle[#1]{(\tikzlastnode-row-\row)}{#2} + \fi + } + } + }, + style even rows on layer/.style 2 args = { + label skeleton, + add styling node={ + \foreach \row in {1, ..., \the\pgfmatrixcurrentrow}{ + \ifodd\row + \else + \fitandstyle[#1]{(\tikzlastnode-row-\row)}{#2} + \fi + } + } + }, + style odd tiling rows/.style = { + label skeleton, + add styling node = { + \foreach \row in {1, ..., \the\pgfmatrixcurrentrow}{ + \ifodd\row + \fitandstyle{(\tikzlastnode-tiling-row-\row)}{#1} + \fi + } + } + }, + style even tiling rows/.style = { + label skeleton, + add styling node={ + \foreach \row in {1, ..., \the\pgfmatrixcurrentrow}{ + \ifodd\row + \else + \fitandstyle{(\tikzlastnode-tiling-row-\row)}{#1} + \fi + } + } + }, + style odd tiling rows on layer/.style 2 args= { + label skeleton, + add styling node = { + \foreach \row in {1, ..., \the\pgfmatrixcurrentrow}{ + \ifodd\row + \fitandstyle[#1]{(\tikzlastnode-tiling-row-\row)}{#2} + \fi + } + } + }, + style even tiling rows on layer/.style 2 args = { + label skeleton, + add styling node={ + \foreach \row in {1, ..., \the\pgfmatrixcurrentrow}{ + \ifodd\row + \else + \fitandstyle[#1]{(\tikzlastnode-tiling-row-\row)}{#2} + \fi + } + } + }, + style odd columns/.style = { + label skeleton, + add styling node = { + \foreach \col in {1, ..., \the\pgf@matrix@numberofcolumns}{ + \ifodd\col + \fitandstyle{(\tikzlastnode-column-\col)}{#1} + \fi + } + } + }, + style even columns/.style = { + label skeleton, + add styling node={ + \foreach \col in {1, ..., \the\pgf@matrix@numberofcolumns}{ + \ifodd\col + \else + \fitandstyle{(\tikzlastnode-column-\col)}{#1} + \fi + } + } + }, + style odd columns on layer/.style 2 args= { + label skeleton, + add styling node = { + \foreach \col in {1, ..., \the\pgf@matrix@numberofcolumns}{ + \ifodd\col + \fitandstyle[#1]{(\tikzlastnode-column-\col)}{#2} + \fi + } + } + }, + style even columns on layer/.style 2 args = { + label skeleton, + add styling node={ + \foreach \col in {1, ..., \the\pgf@matrix@numberofcolumns}{ + \ifodd\col + \else + \fitandstyle[#1]{(\tikzlastnode-column-\col)}{#2} + \fi + } + } + }, + style odd tiling columns/.style = { + label skeleton, + add styling node = { + \foreach \col in {1, ..., \the\pgf@matrix@numberofcolumns}{ + \ifodd\col + \fitandstyle{(\tikzlastnode-tiling-column-\col)}{#1} + \fi + } + } + }, + style even tiling columns/.style = { + label skeleton, + add styling node={ + \foreach \col in {1, ..., \the\pgf@matrix@numberofcolumns}{ + \ifodd\col + \else + \fitandstyle{(\tikzlastnode-tiling-column-\col)}{#1} + \fi + } + } + }, + style odd tiling columns on layer/.style 2 args= { + label skeleton, + add styling node = { + \foreach \col in {1, ..., \the\pgf@matrix@numberofcolumns}{ + \ifodd\col + \fitandstyle[#1]{(\tikzlastnode-tiling-column-\col)}{#2} + \fi + } + } + }, + style even tiling columns on layer/.style 2 args = { + label skeleton, + add styling node={ + \foreach \col in {1, ..., \the\pgf@matrix@numberofcolumns}{ + \ifodd\col + \else + \fitandstyle[#1]{(\tikzlastnode-tiling-column-\col)}{#2} + \fi + } + } + }, + style contour/.style = {% + label skeleton, + add styling node = { + \stylecontour{#1} + } + }, + style contour on layer/.style 2 args= {% + label skeleton, + add styling node = { + \pgfonlayer{#1} + \stylecontour{#2} + \endpgfonlayer + } + }, + style grid/.style = {% + label skeleton, + add styling node = { + \stylegrid{#1} + } + }, + style grid on layer/.style 2 args= {% + label skeleton, + add styling node = { + \pgfonlayer{#1} + \stylegrid{#2} + \endpgfonlayer + } + }, + style tiling grid/.style = {% + label skeleton, + add styling node = { + \styletilinggrid{#1} + } + }, + style tiling grid on layer/.style 2 args= {% + label skeleton, + add styling node = { + \pgfonlayer{#1} + \styletilinggrid{#2} + \endpgfonlayer + } + }, +} + +\def\fitandstyle{\@ifnextchar[{\fitandstyle@layer}{\fitandstyle@main}} +\def\fitandstyle@layer[#1]#2#3{ + \pgfonlayer{#1} + \fitandstyle@main{#2}{#3} + \endpgfonlayer +} +\def\fitandstyle@main#1#2{\node [fit = #1, inner sep = 0pt, #2] {};} + +\def\stylecontour#1{ + \path [#1] (\tikzlastnode-row-1.north west) -- (\tikzlastnode-row-1.north east) -- (\tikzlastnode-row-\the\pgfmatrixcurrentrow.south east) -- (\tikzlastnode-row-\the\pgfmatrixcurrentrow.south west) -- cycle; +} + +\def\stylegrid#1{ + \ifnum\the\pgfmatrixcurrentrow>1\relax% + \foreach \row in {1, ..., \the\pgfmatrixcurrentrow}{ + \ifnum\row<\the\pgfmatrixcurrentrow\relax% + \path [#1] (\tikzlastnode-inter-row-\row.west) -- (\tikzlastnode-inter-row-\row.east); + \fi + } + \fi + \ifnum\the\pgf@matrix@numberofcolumns>1\relax% + \foreach \column in {1, ..., \the\pgf@matrix@numberofcolumns}{ + \ifnum\column<\the\pgf@matrix@numberofcolumns\relax% + \path [#1] (\tikzlastnode-inter-column-\column.north) -- (\tikzlastnode-inter-column-\column.south); + \fi + } + \fi +} + +\def\styletilinggrid#1{ + \ifnum\the\pgfmatrixcurrentrow>1\relax% + \foreach \row in {1, ..., \the\pgfmatrixcurrentrow}{ + \ifnum\row<\the\pgfmatrixcurrentrow\relax% + \path [#1] (\tikzlastnode-tiling-row-\row.south west) -- (\tikzlastnode-tiling-row-\row.south east); + \fi + } + \fi + \ifnum\the\pgf@matrix@numberofcolumns>1\relax% + \foreach \column in {1, ..., \the\pgf@matrix@numberofcolumns}{ + \ifnum\column<\the\pgf@matrix@numberofcolumns\relax% + \path [#1] (\tikzlastnode-tiling-column-\column.north east) -- (\tikzlastnode-tiling-column-\column.south east); + \fi + } + \fi +} diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index cc02e02b977..e85c10632c2 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -447,7 +447,7 @@ my @TLP_working = qw( mathcommand mathcomp mathdesign mathdots mathexam mathfam256 mathfixs mathfont mathpartir mathpazo mathpunctspace mathspec mathtools matlab-prettifier mathspic maths-symbols - mattens maybemath + matrix-skeleton mattens maybemath mcaption mceinleger mcexam mcf2graph mcite mciteplus mcmthesis mdframed mdputu mdsymbol mdwtools media9 medstarbeamer meetingmins memdesign memexsupp diff --git a/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc b/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc index c0fee66c2b9..6a705965fc5 100644 --- a/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc @@ -115,6 +115,7 @@ depend mathcomp depend mathfixs depend mathpartir depend mathpunctspace +depend matrix-skeleton depend matlab-prettifier depend mattens depend memorygraphs diff --git a/Master/tlpkg/tlpsrc/matrix-skeleton.tlpsrc b/Master/tlpkg/tlpsrc/matrix-skeleton.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/matrix-skeleton.tlpsrc |