github.com/aakash4dev/cometbft@v0.38.2/spec/consensus/consensus-paper/rounddiag.sty (about) 1 % ROUNDDIAG STYLE 2 % for LaTeX version 2e 3 % by -- 2008 Martin Hutle <martin.hutle@epfl.ch> 4 % 5 % This style file is free software; you can redistribute it and/or 6 % modify it under the terms of the GNU Lesser General Public 7 % License as published by the Free Software Foundation; either 8 % version 2 of the License, or (at your option) any later version. 9 % 10 % This style file is distributed in the hope that it will be useful, 11 % but WITHOUT ANY WARRANTY; without even the implied warranty of 12 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 % Lesser General Public License for more details. 14 % 15 % You should have received a copy of the GNU Lesser General Public 16 % License along with this style file; if not, write to the 17 % Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 % Boston, MA 02111-1307, USA. 19 % 20 \NeedsTeXFormat{LaTeX2e} 21 \ProvidesPackage{rounddiag} 22 \typeout{Document Style `rounddiag' - provides simple round diagrams} 23 % 24 \RequirePackage{ifthen} 25 \RequirePackage{calc} 26 \RequirePackage{tikz} 27 28 \def\rdstretch{3} 29 30 \tikzstyle{msg}=[->,thick,>=latex] 31 \tikzstyle{rndline}=[dotted] 32 \tikzstyle{procline}=[dotted] 33 34 \newenvironment{rounddiag}[2]{ 35 \begin{center} 36 \begin{tikzpicture} 37 \foreach \i in {1,...,#1}{ 38 \draw[procline] (0,#1-\i) node[xshift=-1em]{$p_{\i}$} -- (#2*\rdstretch+1,#1-\i); 39 } 40 \foreach \i in {0,...,#2}{ 41 \draw[rndline] (\i*\rdstretch+0.5,0) -- (\i*\rdstretch+0.5,#1-1); 42 } 43 \newcommand{\rdat}[2]{ 44 (##2*\rdstretch+0.5,#1-##1) 45 }% 46 \newcommand{\round}[2]{% 47 \def\rdround{##1} 48 \ifthenelse{\equal{##2}{}}{}{ 49 \node[yshift=-1em] at ({##1*\rdstretch+0.5-0.5*\rdstretch},0) {##2}; 50 } 51 }% 52 \newcommand{\rdmessage}[3]{\draw[msg] 53 (\rdround*\rdstretch-\rdstretch+0.5,#1-##1) -- node[yshift=1.2ex]{##3} 54 (\rdround*\rdstretch+0.5,#1-##2);}% 55 \newcommand{\rdalltoall}{% 56 \foreach \i in {1,...,#1}{ 57 \foreach \j in {1,...,#1}{ 58 { \rdmessage{\i}{\j}{}}}}}% 59 }{% 60 \end{tikzpicture} 61 \end{center} 62 }