summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/drawmatrix
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-08-25 23:02:19 +0000
committerKarl Berry <karl@freefriends.org>2016-08-25 23:02:19 +0000
commitd685e6e33e852028b8bf79788ef8d7f47257849e (patch)
tree2833de4c70498c650a65ab36e7622a06d1a5f0b4 /Master/texmf-dist/tex/latex/drawmatrix
parentb4ca047b96a502350b025c4541bc5d479b2f86f3 (diff)
drawmatrix (25aug16)
git-svn-id: svn://tug.org/texlive/trunk@41928 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/drawmatrix')
-rw-r--r--Master/texmf-dist/tex/latex/drawmatrix/drawmatrix.sty155
1 files changed, 97 insertions, 58 deletions
diff --git a/Master/texmf-dist/tex/latex/drawmatrix/drawmatrix.sty b/Master/texmf-dist/tex/latex/drawmatrix/drawmatrix.sty
index 1fa5fc7afb3..a79f4c1a82e 100644
--- a/Master/texmf-dist/tex/latex/drawmatrix/drawmatrix.sty
+++ b/Master/texmf-dist/tex/latex/drawmatrix/drawmatrix.sty
@@ -8,19 +8,23 @@
%%
%% This is a generated file.
%%
-%% Copyright (C) 2015 by Elmar Peise
+%% Copyright (C) 2016 by Elmar Peise
%%
%% This package is distributed under the MIT license.
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-\ProvidesPackage{drawmatrix}[2015/11/26 v1.1.0 drawmatrix package]
+\ProvidesPackage{drawmatrix}[2016/08/25 v1.2.0 drawmatrix package]
\RequirePackage{tikz}
\newif\ifdrawmatrix@externalize
\pgfkeys{
drawmatrix/.is family,
drawmatrix/.cd,
picture/.style={},
+ path/.style={},
baseline/.style={picture/.append style={baseline=(drawmatrix #1)}},
+ scale/.style={path/.append style={scale=#1}},
+ x/.style={path/.append style={x=#1}},
+ y/.style={path/.append style={y=#1}},
baseline=label.base,
bbox/.style={},
bbox style/.style={bbox/.append style={#1}},
@@ -51,13 +55,13 @@
label anchor=mid,
drawmatrix/.style={},
.unknown/.code={%
- \let\@currname\pgfkeyscurrentname%
- \let\@currval\pgfkeyscurrentvalue%
+ \let\dm@currname\pgfkeyscurrentname%
+ \let\dm@currval\pgfkeyscurrentvalue%
\ifx#1\pgfkeysnovalue\pgfkeysalso{
- drawmatrix/.append style/.expand once={\@currname}
+ drawmatrix/.append style/.expand once={\dm@currname}
}\else\pgfkeysalso{
drawmatrix/.append style/.expand twice={%
- \expandafter\@currname\expandafter=\@currval%
+ \expandafter\dm@currname\expandafter=\dm@currval%
}
}\fi%
},
@@ -74,87 +78,122 @@
name=drawmatrix label,
outer sep=0,
inner sep=0,
+ },
+ every node/.style={
+ name=drawmatrix matrix,
+ outer sep=0,
+ inner sep=0,
+ anchor=north west,
}
}
\newcommand\drawmatrixset[1]{\pgfqkeys{/drawmatrix}{#1}}
\newcommand\drawmatrix[2][]{{%
- \ifmmode\def\@labeltext{$#2$}\else\def\@labeltext{#2}\fi%
- \drawmatrixset{#1}%
+ \drawmatrixset{
+ #1,
+ height/.get=\dm@height,
+ width/.get=\dm@width,
+ lower bandwidth/.get=\dm@lowerbandwidth,
+ upper bandwidth/.get=\dm@upperbandwidth,
+ offset height/.get=\dm@offsetheight,
+ offset width/.get=\dm@offsetwidth,
+ bbox height/.get=\dm@bboxheight,
+ bbox width/.get=\dm@bboxwidth,
+ }%
+ \ifmmode\def\dm@labeltext{$#2$}\else\def\dm@labeltext{#2}\fi%
\ifdrawmatrix@externalize\else%
\ifx\tikz@library@external@loaded\undefined\else%
\tikzset{external/export=false}%
\fi%
\fi%
- \pgfqkeys{/drawmatrix}{
- height/.get=\@height,
- width/.get=\@width,
- lower bandwidth/.get=\@lowerbandwidth,
- upper bandwidth/.get=\@upperbandwidth,
- offset height/.get=\@offsetheight,
- offset width/.get=\@offsetwidth,
- bbox height/.get=\@bboxheight,
- bbox width/.get=\@bboxwidth,
- }%
- \pgfmathsetmacro\@height{\@height + 0.0}%
- \pgfmathsetmacro\@width{\@width + 0.0}%
- \pgfmathsetmacro\@minsize{min(\@width, \@height)}%
- \pgfmathsetmacro\@zero{0.0}%
- \expandafter\ifx\@lowerbandwidth\pgfkeysnovalue%
- \edef\@lowerbandwidth{\@minsize}%
- \fi%
- \expandafter\ifx\@upperbandwidth\pgfkeysnovalue%
- \edef\@upperbandwidth{\@minsize}%
- \fi%
- \pgfmathsetmacro\@lowerbandwidth{min(\@minsize, \@lowerbandwidth)}%
- \pgfmathsetmacro\@upperbandwidth{min(\@minsize, \@upperbandwidth)}%
- \expandafter\ifx\@bboxheight\pgfkeysnovalue%
- \pgfmathsetmacro\@bboxheight{\@height + \@offsetheight}%
- \fi%
- \expandafter\ifx\@bboxwidth\pgfkeysnovalue%
- \pgfmathsetmacro\@bboxwidth{\@width + \@offsetwidth}%
- \fi%
\begin{tikzpicture}[/drawmatrix/every picture, /drawmatrix/picture]
+ \path[/drawmatrix/path] (\dm@width, \dm@height);
+ \pgfgetlastxy\dm@width\dm@height
+ \path[/drawmatrix/path] (\dm@offsetwidth, \dm@offsetheight);
+ \pgfgetlastxy\dm@offsetwidth\dm@offsetheight
+ \pgfmathsetlengthmacro\dm@minsize{min(\dm@width, \dm@height)}
+ \pgfmathsetlengthmacro\dm@zero{0.0}
+ \expandafter\ifx\dm@lowerbandwidth\pgfkeysnovalue
+ \edef\dm@lowerbandwidth{\dm@minsize}
+ \else
+ \path[/drawmatrix/path] (\dm@lowerbandwidth, 0);
+ \pgfgetlastxy\dm@lowerbandwidth\dm@zero
+ \fi
+ \expandafter\ifx\dm@upperbandwidth\pgfkeysnovalue
+ \edef\dm@upperbandwidth{\dm@minsize}
+ \else
+ \path[/drawmatrix/path] (0, \dm@upperbandwidth);
+ \pgfgetlastxy\dm@zero\dm@upperbandwidth
+ \fi
+ \pgfmathsetlengthmacro\dm@lowerbandwidth{
+ min(\dm@minsize, \dm@lowerbandwidth)
+ }
+ \pgfmathsetlengthmacro\dm@upperbandwidth{
+ min(\dm@minsize, \dm@upperbandwidth)
+ }
+ \expandafter\ifx\dm@bboxheight\pgfkeysnovalue
+ \pgfmathsetlengthmacro\dm@bboxheight{
+ \dm@height + \dm@offsetheight
+ }
+ \else
+ \path[/drawmatrix/path] (0, \dm@bboxheight);
+ \pgfgetlastxy\dm@zero\dm@bboxheight
+ \fi
+ \expandafter\ifx\dm@bboxwidth\pgfkeysnovalue
+ \pgfmathsetlengthmacro\dm@bboxwidth{
+ \dm@width + \dm@offsetwidth
+ }
+ \else
+ \path[/drawmatrix/path] (\dm@bboxwidth, 0);
+ \pgfgetlastxy\dm@bboxwidth\dm@zero
+ \fi
+ \pgfresetboundingbox
\node[/drawmatrix/every bbox, /drawmatrix/bbox,
- minimum height=\@bboxheight cm,
- minimum width=\@bboxwidth cm] {};
+ minimum height=\dm@bboxheight,
+ minimum width=\dm@bboxwidth] {};
\path (drawmatrix bbox.north west)
- ++(\@offsetwidth, -\@offsetheight)
+ ++(\dm@offsetwidth, -\dm@offsetheight)
++(.5\pgflinewidth, -.5\pgflinewidth)
coordinate (drawmatrix north west)
- ++(\@width, 0)
- +(-\@minsize + \@upperbandwidth, 0)
+ ++(\dm@width, 0)
+ +(-\dm@minsize + \dm@upperbandwidth, 0)
coordinate (drawmatrix north)
- +(0, -\@minsize + \@upperbandwidth)
+ +(0, -\dm@minsize + \dm@upperbandwidth)
coordinate (drawmatrix east)
- ++(0, -\@height)
+ ++(0, -\dm@height)
coordinate (drawmatrix south east)
- ++(-\@width, 0)
- +(\@minsize - \@lowerbandwidth, 0)
+ ++(-\dm@width, 0)
+ +(\dm@minsize - \dm@lowerbandwidth, 0)
coordinate (drawmatrix south)
- +(0, \@minsize - \@lowerbandwidth)
+ +(0, \dm@minsize - \dm@lowerbandwidth)
coordinate (drawmatrix west);
+ \node[/drawmatrix/every node,
+ minimum height=\dm@height,
+ minimum width=\dm@width]
+ at (drawmatrix north west) {};
\filldraw[/drawmatrix/every drawmatrix, /drawmatrix/drawmatrix]
(drawmatrix north west)
- \ifx\@upperbandwidth\@zero
- \ifx\@width\@minsize\else -- (drawmatrix north) \fi
- \ifx\@height\@minsize\else -- (drawmatrix east) \fi
+ \ifx\dm@upperbandwidth\dm@zero
+ \ifx\dm@width\dm@minsize\else -- (drawmatrix north) \fi
+ \ifx\dm@height\dm@minsize\else -- (drawmatrix east) \fi
\else
-- (drawmatrix north)
- \ifx\@upperbandwidth\@minsize\else -- (drawmatrix east) \fi
+ \ifx\dm@upperbandwidth\dm@minsize\else
+ -- (drawmatrix east)
+ \fi
\fi
-- (drawmatrix south east)
- \ifx\@lowerbandwidth\@zero
- \ifx\@width\@minsize\else -- (drawmatrix south) \fi
- \ifx\@height\@minsize\else -- (drawmatrix west) \fi
+ \ifx\dm@lowerbandwidth\dm@zero
+ \ifx\dm@width\dm@minsize\else -- (drawmatrix south) \fi
+ \ifx\dm@height\dm@minsize\else -- (drawmatrix west) \fi
\else
-- (drawmatrix south)
- \ifx\@lowerbandwidth\@minsize\else -- (drawmatrix west) \fi
+ \ifx\dm@lowerbandwidth\dm@minsize\else
+ -- (drawmatrix west)
+ \fi
\fi
-- cycle;
- \node[minimum height=\@height cm, minimum width=\@width cm,
- anchor=north west] at (drawmatrix north west)
- (drawmatrix matrix) {};
- \node[/drawmatrix/every label, /drawmatrix/label] {\@labeltext};
+ \node[/drawmatrix/every label, /drawmatrix/label]
+ {\dm@labeltext};
\end{tikzpicture}%
}}
\endinput