diff options
author | Karl Berry <karl@freefriends.org> | 2023-12-14 20:58:57 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-12-14 20:58:57 +0000 |
commit | b61e86c4c7e0871158ff4bb872e46cce0939e3d2 (patch) | |
tree | bda990e0784f115b1902fd7eed60223b7dccc4c5 /Master/texmf-dist/tex/latex/messagepassing | |
parent | fc0be36b72419e3463372dbb555354010fcda735 (diff) |
messagepassing (14dec23)
git-svn-id: svn://tug.org/texlive/trunk@69123 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/messagepassing')
-rw-r--r-- | Master/texmf-dist/tex/latex/messagepassing/messagepassing.sty | 71 |
1 files changed, 43 insertions, 28 deletions
diff --git a/Master/texmf-dist/tex/latex/messagepassing/messagepassing.sty b/Master/texmf-dist/tex/latex/messagepassing/messagepassing.sty index f807ec06ca1..cb321808bd5 100644 --- a/Master/texmf-dist/tex/latex/messagepassing/messagepassing.sty +++ b/Master/texmf-dist/tex/latex/messagepassing/messagepassing.sty @@ -20,7 +20,7 @@ %% \NeedsTeXFormat{LaTeX2e} - \ProvidesPackage{messagepassing}[2022/02/18 v1.0 A package to draw message passing diagrams] + \ProvidesPackage{messagepassing}[2023/12/13 v1.2 A package to draw message passing diagrams] \RequirePackage{tikz} \usetikzlibrary{quotes, calc, arrows.meta} \RequirePackage{xparse} @@ -85,14 +85,14 @@ \newcommand{\mp@annotaterotation}{0} \fi -\newcommand{\mp@oobcolor}{red} -\newcommand{\oobcolor}[1]{ -\renewcommand\mp@oobcolor{#1} +\newcommand{\mp@oobcolour}{red} +\newcommand{\oobcolour}[1]{ +\renewcommand\mp@oobcolour{#1} } -\newcommand{\mp@colouredboxcolor}{red} -\newcommand{\colouredboxcolor}[1]{ -\renewcommand\mp@colouredboxcolor{#1} +\newcommand{\mp@colouredboxcolour}{red} +\newcommand{\colouredboxcolour}[1]{ +\renewcommand\mp@colouredboxcolour{#1} } \newif\iftimeline @@ -153,29 +153,33 @@ } \ExplSyntaxOff %% #1: name -\newcommand{\newprocess}[1]{ +%% #2: display name +\NewDocumentCommand{\newprocess}{m o}{ \addtocounter{processnb}{1} \coordinate (#1) at (0, -\value{processnb}); -\draw (#1) node[anchor=\mp@processnameanchor] {$#1$}; +\draw (#1) node[anchor=\mp@processnameanchor] {\IfValueTF{#2}{#2}{$#1$}}; } %% #1: name -%% #2: width -\newcommand{\newprocesswithlength}[2]{ -\newprocess{#1} -\processlength{#1}{#2} +%% #2: display name +%% #3: width +\NewDocumentCommand{\newprocesswithlength}{m o m}{ +\newprocess{#1}[#2] +\processlength{#1}{#3} } %% #1: name -%% #2: state interval name -\newcommand{\newprocesswithstateinterval}[2]{ -\newprocess{#1} -\stateinterval{#1}{0}{#2} +%% #2: display name +%% #3: state interval name +\NewDocumentCommand{\newprocesswithstateinterval}{m o m}{ +\newprocess{#1}[#2] +\stateinterval{#1}{0}{#3} } %% #1: name -%% #2: width -%% #3: crash name -\newcommand{\newprocesswithcrash}[3]{ -\newprocess{#1}{#2} -\crash{#1}{#2}{#3} +%% #2: display name +%% #3: width +%% #4: crash name +\NewDocumentCommand{\newprocesswithcrash}{m o m m}{ +\newprocess{#1}[#2]{#3} +\crash{#1}{#3}{#4} } %% #1: sender's name %% #2: send date @@ -189,9 +193,14 @@ %% #3: receiver's name %% #4: receive date %% #5: message name -\newcommand{\sendwithname}[5]{ +%% #6: message name display options +\NewDocumentCommand{\sendwithname}{m m m m m o}{ +\IfValueTF{#6}{ +\draw[->] (#1) +(#2, 0) -- ($ (#3) +(#4, 0) $) node[anchor=\mp@messagelabelanchor, pos=0.3, #6] {#5}; +}{ \draw[->] (#1) +(#2, 0) -- ($ (#3) +(#4, 0) $) node[anchor=\mp@messagelabelanchor, pos=0.3] {#5}; } +} %% #1: process name %% #2: process width \newcommand{\processlength}[2]{ @@ -212,8 +221,9 @@ %% #4: receive date %% #5: state interval name %% #6: message name -\newcommand{\sendwithstateintervalandname}[6] { -\sendwithname{#1}{#2}{#3}{#4}{#6} +%% #7: message name display options +\NewDocumentCommand{\sendwithstateintervalandname}{m m m m m m o} { +\sendwithname{#1}{#2}{#3}{#4}{#6}[#7] \stateinterval{#3}{#4}{#5} } %% #1: sender's name @@ -221,8 +231,13 @@ %% #3: receiver's name %% #4: receive date %% #5: OoB message name -\newcommand{\sendoutofband}[5]{ -\draw[->, color=\mp@oobcolor] (#1) +(#2, 0) -- ($ (#3) +(#4, 0) $) node[anchor=\mp@messagelabelanchor, pos=0.3] {#5}; +%% #6: OoB message name display options +\NewDocumentCommand{\sendoutofband}{m m m m m o}{ +\IfValueTF{#6}{ +\draw[->, color=\mp@oobcolour] (#1) +(#2, 0) -- ($ (#3) +(#4, 0) $) node[anchor=\mp@messagelabelanchor, pos=0.3, #6] {#5}; +}{ +\draw[->, color=\mp@oobcolour] (#1) +(#2, 0) -- ($ (#3) +(#4, 0) $) node[anchor=\mp@messagelabelanchor, pos=0.3] {#5}; +} } %% #1: process's name %% #2: state interval date @@ -276,7 +291,7 @@ %% #5: caption \newcommand{\colouredbox}[5]{ \begin{pgfonlayer}{background} -\fill[color=\mp@colouredboxcolor!20] ($(#1) + (#3, 0)$) rectangle ($(#2) + (#4, 0)$) node[midway, color = \mp@colouredboxcolor, rotate=\mp@annotaterotation]{#5}; +\fill[color=\mp@colouredboxcolour!20] ($(#1) + (#3, 0)$) rectangle ($(#2) + (#4, 0)$) node[midway, color = \mp@colouredboxcolour, rotate=\mp@annotaterotation]{#5}; \end{pgfonlayer} } %% #1: Timeline length |