From fa3720c40955f139e3846475ff94698d483128b4 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 7 Jan 2019 22:12:07 +0000 Subject: memorygraphs (7jan19) git-svn-id: svn://tug.org/texlive/trunk@49631 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/memorygraphs/memorygraphs.sty | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'Master/texmf-dist/tex/latex/memorygraphs') diff --git a/Master/texmf-dist/tex/latex/memorygraphs/memorygraphs.sty b/Master/texmf-dist/tex/latex/memorygraphs/memorygraphs.sty index bcd5286b718..15a13207ec0 100644 --- a/Master/texmf-dist/tex/latex/memorygraphs/memorygraphs.sty +++ b/Master/texmf-dist/tex/latex/memorygraphs/memorygraphs.sty @@ -1,5 +1,5 @@ %% memorygraphs.tex -%% Copyright 2018 C. Staps +%% Copyright 2018-2019 C. Staps % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -16,7 +16,7 @@ % This work consists of the files memorygraphs.sty and the documentation in % memorygraphs.tex and example-fibonacci.tex. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{memorygraphs}[2018/12/26 v0.1 Draw memory graphs using TikZ] +\ProvidesPackage{memorygraphs}[2019/01/06 v0.1.1 Draw memory graphs using TikZ] \RequirePackage{tikz} \usetikzlibrary{arrows.meta,calc,positioning,shapes} @@ -90,15 +90,18 @@ anchor=mid, every block, }, - block/.append code={\let\arg\memorygraphs@arg}, + block/.append code={% + \let\arg\memorygraphs@arg% + \gdef\memorygraphs@arity{0}% + }, block mark north east/.style={ append after command={ \pgfextra \pgfinterruptpath \draw[#1] - ($(\tikzlastnode.head north east)-(0,.5\pgflinewidth)$) + ($(\tikzlastnode.head north east)-(\ifnum\memorygraphs@arity=0 .5\pgflinewidth\else0\fi,.5\pgflinewidth)$) -- +(0,-\memorygraphs@marklength) - -- ($(\tikzlastnode.head north east)-(0+\memorygraphs@marklength,.5\pgflinewidth)$) + -- ($(\tikzlastnode.head north east)-(\ifnum\memorygraphs@arity=0 .5\pgflinewidth\else0\fi+\memorygraphs@marklength,.5\pgflinewidth)$) -- cycle; \endpgfinterruptpath \endpgfextra @@ -109,9 +112,9 @@ \pgfextra \pgfinterruptpath \draw[#1] - ($(\tikzlastnode.head south east)+(0,.5\pgflinewidth)$) + ($(\tikzlastnode.head south east)+(\ifnum\memorygraphs@arity=0 -.5\pgflinewidth\else0\fi,.5\pgflinewidth)$) -- +(0,\memorygraphs@marklength) - -- ($(\tikzlastnode.head south east)+(0-\memorygraphs@marklength,.5\pgflinewidth)$) + -- ($(\tikzlastnode.head south east)+(\ifnum\memorygraphs@arity=0 -.5\pgflinewidth\else0\fi-\memorygraphs@marklength,.5\pgflinewidth)$) -- cycle; \endpgfinterruptpath \endpgfextra @@ -151,6 +154,11 @@ rectangle split every empty part={}, rectangle split empty part width=.2em, }, + arity/.append code={% + \pgfmathsetcount\c@pgf@counta{\pgfkeysvalueof{/pgf/rectangle split parts}}% + \ifnum\c@pgf@counta=0\else\advance\c@pgf@counta by-1 \fi + \xdef\memorygraphs@arity{\the\c@pgf@counta}% + }, ref/.style={ {Circle[length=3pt]}-Latex, shorten <=-1.5pt, -- cgit v1.2.3