Dears,
I am facing the following problem. Given a set of points, I have to draw the geometric shape of these points, however, I have to do this programmatically. Take a look at this MWE.
\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}
\begin{figure}
\begin{tikzpicture}
% nodes
\coordinate (a) at (0, 0);
\coordinate (b) at (1, 0);
\coordinate (c) at (1, 1);
\coordinate (d) at (0, 1);
% block
\def\blockA{a, b, c, d}
% draw cycle
% - static way
\draw[fill=gray!50, draw = white] (a) -- (b) -- (c) -- (d) -- cycle;
% - desired way
\foreach \v [count=\i] in \blockA {
% ...
}
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
I need to find proper ways to implement the % - desired way
. I would like to know if anyone has ever worked with this. If anyone has any questions or suggestions, please feel free to let me know.
Thank you and best regards.
\blockA
macro, since you can just write\foreach \v [count=\i] in {a, b, c, d}
then use\v
inside parentheses to create node names. But it needs a bit more of work to draw the line.