diff options
author | Karl Berry <karl@freefriends.org> | 2017-03-01 22:30:18 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-03-01 22:30:18 +0000 |
commit | a27782c0a2594f4f1c8f2c7b3c2b78d19fd760cd (patch) | |
tree | f831a4c440b8c38f292e573156a7627ba574581d /Master/texmf-dist/tex/latex | |
parent | 800462d19ac70da2bba3efcc39db662187751891 (diff) |
drawmatrix (1mar17)
git-svn-id: svn://tug.org/texlive/trunk@43372 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/drawmatrix/drawmatrix.sty | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/Master/texmf-dist/tex/latex/drawmatrix/drawmatrix.sty b/Master/texmf-dist/tex/latex/drawmatrix/drawmatrix.sty index a79f4c1a82e..bdadb90799f 100644 --- a/Master/texmf-dist/tex/latex/drawmatrix/drawmatrix.sty +++ b/Master/texmf-dist/tex/latex/drawmatrix/drawmatrix.sty @@ -13,7 +13,7 @@ %% This package is distributed under the MIT license. %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\ProvidesPackage{drawmatrix}[2016/08/25 v1.2.0 drawmatrix package] +\ProvidesPackage{drawmatrix}[2016/12/20 v1.4.0 drawmatrix package] \RequirePackage{tikz} \newif\ifdrawmatrix@externalize \pgfkeys{ @@ -46,13 +46,22 @@ lower/.style={upper bandwidth=0}, upper/.style={lower bandwidth=0}, diag/.style={lower, upper}, - externalize/.is if=drawmatrix@externalize, - externalize=true, + label text/.initial, label/.style={}, label pos/.style={label/.append style={at=(drawmatrix #1)}}, label pos=bbox.center, label anchor/.style={label/.append style={anchor=#1}}, label anchor=mid, + label base/.initial, + label outer/.style={}, + label base anchor/.style={label outer/.append style={ + anchor=#1, at=(drawmatrix label.#1) + }}, + label base anchor=base west, + exponent/.style={ + label base/.expanded=\pgfkeysvalueof{/drawmatrix/label text}, + label text/.append=^{#1} + }, drawmatrix/.style={}, .unknown/.code={% \let\dm@currname\pgfkeyscurrentname% @@ -68,28 +77,33 @@ every picture/.style={}, every bbox/.style={ name=drawmatrix bbox, - inner sep=0, + inner sep=0 }, every drawmatrix/.style={ fill=white, - draw=gray, + draw=gray }, every label/.style={ name=drawmatrix label, outer sep=0, - inner sep=0, + inner sep=0 }, every node/.style={ name=drawmatrix matrix, outer sep=0, inner sep=0, anchor=north west, - } + at=(drawmatrix north west) + }, + externalize/.is if=drawmatrix@externalize, + externalize=true } \newcommand\drawmatrixset[1]{\pgfqkeys{/drawmatrix}{#1}} \newcommand\drawmatrix[2][]{{% \drawmatrixset{ + label text={#2}, #1, + label text/.get=\dm@labeltext, height/.get=\dm@height, width/.get=\dm@width, lower bandwidth/.get=\dm@lowerbandwidth, @@ -98,8 +112,16 @@ offset width/.get=\dm@offsetwidth, bbox height/.get=\dm@bboxheight, bbox width/.get=\dm@bboxwidth, + label base/.get=\dm@labelbase }% - \ifmmode\def\dm@labeltext{$#2$}\else\def\dm@labeltext{#2}\fi% + \ifmmode\edef\dm@labeltext{$\dm@labeltext$}\fi% + \expandafter\ifx\dm@labelbase\pgfkeysnovalue\else% + \let\dm@labeltextouter\dm@labeltext% + \edef\dm@labelbase{% + \ifmmode$\dm@labelbase$\else\dm@labelbase\fi% + }% + \def\dm@labeltext{\phantom{\dm@labelbase}}% + \fi% \ifdrawmatrix@externalize\else% \ifx\tikz@library@external@loaded\undefined\else% \tikzset{external/export=false}% @@ -113,13 +135,13 @@ \pgfmathsetlengthmacro\dm@minsize{min(\dm@width, \dm@height)} \pgfmathsetlengthmacro\dm@zero{0.0} \expandafter\ifx\dm@lowerbandwidth\pgfkeysnovalue - \edef\dm@lowerbandwidth{\dm@minsize} + \def\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} + \def\dm@upperbandwidth{\dm@minsize} \else \path[/drawmatrix/path] (0, \dm@upperbandwidth); \pgfgetlastxy\dm@zero\dm@upperbandwidth @@ -168,8 +190,7 @@ coordinate (drawmatrix west); \node[/drawmatrix/every node, minimum height=\dm@height, - minimum width=\dm@width] - at (drawmatrix north west) {}; + minimum width=\dm@width] {}; \filldraw[/drawmatrix/every drawmatrix, /drawmatrix/drawmatrix] (drawmatrix north west) \ifx\dm@upperbandwidth\dm@zero @@ -194,6 +215,10 @@ -- cycle; \node[/drawmatrix/every label, /drawmatrix/label] {\dm@labeltext}; + \expandafter\ifx\dm@labelbase\pgfkeysnovalue\else + \node[/drawmatrix/every label, /drawmatrix/label, + /drawmatrix/label outer] {\dm@labeltextouter}; + \fi \end{tikzpicture}% }} \endinput |