From afb7d40814174e2a80e071eacfd55580945dca4d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 5 Aug 2019 21:06:42 +0000 Subject: matrix-skeleton (5aug19) git-svn-id: svn://tug.org/texlive/trunk@51823 c570f23f-e606-0410-a88d-b1316a301751 --- .../pgflibrarymatrix.skeleton.code.tex | 330 +++++++++++++++++++++ .../tikzlibrarymatrix.skeleton.code.tex | 278 +++++++++++++++++ 2 files changed, 608 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/matrix-skeleton/pgflibrarymatrix.skeleton.code.tex create mode 100644 Master/texmf-dist/tex/latex/matrix-skeleton/tikzlibrarymatrix.skeleton.code.tex (limited to 'Master/texmf-dist/tex/latex/matrix-skeleton') 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 +} -- cgit v1.2.3