You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.9 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  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. \def\rdstretch{3}
  28. \tikzstyle{msg}=[->,thick,>=latex]
  29. \tikzstyle{rndline}=[dotted]
  30. \tikzstyle{procline}=[dotted]
  31. \newenvironment{rounddiag}[2]{
  32. \begin{center}
  33. \begin{tikzpicture}
  34. \foreach \i in {1,...,#1}{
  35. \draw[procline] (0,#1-\i) node[xshift=-1em]{$p_{\i}$} -- (#2*\rdstretch+1,#1-\i);
  36. }
  37. \foreach \i in {0,...,#2}{
  38. \draw[rndline] (\i*\rdstretch+0.5,0) -- (\i*\rdstretch+0.5,#1-1);
  39. }
  40. \newcommand{\rdat}[2]{
  41. (##2*\rdstretch+0.5,#1-##1)
  42. }%
  43. \newcommand{\round}[2]{%
  44. \def\rdround{##1}
  45. \ifthenelse{\equal{##2}{}}{}{
  46. \node[yshift=-1em] at ({##1*\rdstretch+0.5-0.5*\rdstretch},0) {##2};
  47. }
  48. }%
  49. \newcommand{\rdmessage}[3]{\draw[msg]
  50. (\rdround*\rdstretch-\rdstretch+0.5,#1-##1) -- node[yshift=1.2ex]{##3}
  51. (\rdround*\rdstretch+0.5,#1-##2);}%
  52. \newcommand{\rdalltoall}{%
  53. \foreach \i in {1,...,#1}{
  54. \foreach \j in {1,...,#1}{
  55. { \rdmessage{\i}{\j}{}}}}}%
  56. }{%
  57. \end{tikzpicture}
  58. \end{center}
  59. }