Path: blob/main/Talk GDRIM/hedge.tex
1016 views
%% from https://tex.stackexchange.com/questions/356564/macro-for-rounded-polygon-around-some-nodes1%% answer of bitt.j2%Necessary for the mypoly command%3\usepackage{tkz-euclide}4\usepackage{xstring}56%------------------------%7%---The mypoly command---%8%------------------------%910%--Getting the last Element of a list--%11\def\splicelist#1{12\StrCount{#1}{,}[\numofelem]13\ifnum\numofelem>0\relax14\StrBehind[\numofelem]{#1}{,}[\mylast]%15\else16\let\mylast#1%17\fi18}1920%--The mypoly macro--%21%How to use:22%\myroundpoly[decorative commands]{list of names of nodes}{distance}23%list of names has to be given in clockwise order24\newcommand{\hedge}[3][thin,color=black]{25%Get the last element26\splicelist{#2}27%Calculate the auxiliary coordinates for the arcs28\foreach \vertex [remember=\vertex as \succvertex29(initially \mylast)] in {#2}{30\coordinate (\succvertex-next) at ($(\succvertex)!#3!90:(\vertex)$);31\coordinate (\vertex-previous) at ($(\vertex)!#3!-90:(\succvertex)$);32\draw[#1] (\succvertex-next) -- (\vertex-previous);33}343536%Draw the arcs37\foreach \vertex in {#2}{38\tkzDrawArc[#1](\vertex,\vertex-next)(\vertex-previous)39}40}41424344