Skip to content
Snippets Groups Projects
Commit ffe1d907 authored by GARION Christophe's avatar GARION Christophe
Browse files

my-tikz: move nodes command to my-tikz

parent 1ef2b785
No related branches found
No related tags found
No related merge requests found
......@@ -101,38 +101,3 @@
\newcommand{\setmark}[2]{%
\ifundef{#1}{\def#1{#2}}{}%
}
% draw CS arrays
\newcounter{nodeidx}
\setcounter{nodeidx}{0}
\newif\ifcontinuearray
\pgfkeys{
/myarray/.is family,
/myarray,
default/.style={
sep distance = 0,
array number = 0,
},
continue/.initial = false,
sep distance/.estore in=\sepDistance,
array number/.estore in=\arrayNum,
continue/.is if=continuearray
}
\newcommand{\nodes}[2][]{%
\pgfkeys{/myarray, default, #1}%
\begin{scope}[\ifcontinuearray continue \else start \fi chain=my-array-temp-{\arrayNum} going right, node
distance=\sepDistance]
\foreach \num in {#2}{
\node[minimum size=2em, draw, rectangle, on
chain=my-array-temp-{\arrayNum}] (nodearray-\arrayNum-\arabic{nodeidx}) {\num};
\stepcounter{nodeidx}
}
\end{scope}
}
\newcommand{\brckt}[4]{% from, to, lvl, text
\draw (nodearray-#1.south west) ++($(-.1, -.1) + (-.1*#3, 0)$) -- ++($(0,-.1) + (0,-#3*1.25em)$) -- node [below] {#4} ($(nodearray-#2.south east) + (.1,-.1) + (.1*#3, 0) + (0,-.1) + (0,-#3*1.25em)$) -- ++($(0,#3*1.25em) + (0,.1)$);%
}
......@@ -180,3 +180,39 @@
\alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} % \pgfkeysalso doesn't change the path
}
}
% draw CS arrays
\usetikzlibrary{intersections}
\newcounter{nodeidx}
\setcounter{nodeidx}{0}
\newif\ifcontinuearray
\pgfkeys{
/myarray/.is family,
/myarray,
default/.style={
sep distance = 0,
array number = 0,
},
continue/.initial = false,
sep distance/.estore in=\sepDistance,
array number/.estore in=\arrayNum,
continue/.is if=continuearray
}
\newcommand{\nodes}[2][]{%
\pgfkeys{/myarray, default, #1}%
\begin{scope}[\ifcontinuearray continue \else start \fi chain=my-array-temp-{\arrayNum} going right, node
distance=\sepDistance]
\foreach \num in {#2}{
\node[minimum size=2em, draw, on
chain=my-array-temp-{\arrayNum}] (nodearray-\arrayNum-\arabic{nodeidx}) {\num};
\stepcounter{nodeidx}
}
\end{scope}
}
\newcommand{\brckt}[4]{% from, to, lvl, text
\draw (nodearray-#1.south west) ++($(-.1, -.1) + (-.1*#3, 0)$) -- ++($(0,-.1) + (0,-#3*1.25em)$) -- node [below] {#4} ($(nodearray-#2.south east) + (.1,-.1) + (.1*#3, 0) + (0,-.1) + (0,-#3*1.25em)$) -- ++($(0,#3*1.25em) + (0,.1)$);%
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment