From d685e6e33e852028b8bf79788ef8d7f47257849e Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 25 Aug 2016 23:02:19 +0000 Subject: drawmatrix (25aug16) git-svn-id: svn://tug.org/texlive/trunk@41928 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/drawmatrix/drawmatrix.sty | 155 +++++++++++++-------- 1 file changed, 97 insertions(+), 58 deletions(-) (limited to 'Master/texmf-dist/tex/latex/drawmatrix') 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 -- cgit v1.2.3