I'm trying to make a macro to print a TikZ diagram with "variable" labels. MWE:
\documentclass{standalone}
\usepackage{tikz}
\newcommand[3]{\myDiagram}{
\begin{tikzpicture}
\node[label={270:$1$}] (1) at (270:1) {};
\node[label={30:$2$}] (2) at (30:1) {};
\node[label={150:$3$}] (3) at (150:1) {};
\draw
(1) edge node[label={#1}] {} (2)
(1) edge node[label={#2}] {} (3)
(2) edge node[label={#3}] {} (3)
;
\end{tikzpicture}
}
\begin{document}
\myDiagram{$1$}{$2$}{$3$}
\end{document}
Expected Behaviour: A diagram which substitutes labels from argument. I.e. My MWE's Output should be the same as this:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node[label={270:$1$}] (1) at (270:1) {};
\node[label={30:$2$}] (2) at (30:1) {};
\node[label={150:$3$}] (3) at (150:1) {};
\draw
(1) edge node[label={$1$}] {} (2)
(1) edge node[label={$2$}] {} (3)
(2) edge node[label={$3$}] {} (3)
;
\end{tikzpicture}
\end{document}
Actual Behaviour: I keep getting a Missing \endcsname inserted.
What I've Tried: Variations on this question's answers (I couldn't find much else in the way of similar questions).
Please explain what I'm doing wrong here and how I can fix it. Thanks in advance.