What I'd like to do is iterate through a loop and generate a graph on each pass. I think I have set my loop and counter up to work correctly, but I seem to be unable to use the value of the counter as an argument for making my graph.
For example, this works:
Code: Select all
\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\usepackage{forloop}
\usepackage{tkz-graph}
\usetikzlibrary{shapes.geometric}
\begin{document}
\newcounter {a}
\forloop{a}{0}{\value{a} < 2}
{
\begin{figure}
\centering
\begin{tikzpicture}
\Vertices[Lpos=90, unit=5]{circle}{0,1,2,3}
\Edges[color=black, lw=2pt](0,2)
% \Edges[color=black, lw=2pt](\value{a},1)
\end{tikzpicture}
\end{figure}
}
\end{document}
But uncommenting the second "Edge" line does not. It gives a "Missing \endcsname inserted" error.
Code: Select all
\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\usepackage{forloop}
\usepackage{tkz-graph}
\usetikzlibrary{shapes.geometric}
\begin{document}
\newcounter {a}
\forloop{a}{0}{\value{a} < 2}
{
\begin{figure}
\centering
\begin{tikzpicture}
\Vertices[Lpos=90, unit=5]{circle}{0,1,2,3}
\Edges[color=black, lw=2pt](0,2)
\Edges[color=black, lw=2pt](\value{a},1)
\end{tikzpicture}
\end{figure}
}
\end{document}
I have also tried to use \numexpr to force the argument to be evaluated as a number, but that also results in an \endcsname error.
Code: Select all
\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\usepackage{forloop}
\usepackage{tkz-graph}
\usetikzlibrary{shapes.geometric}
\begin{document}
\newcounter {a}
\forloop{a}{0}{\value{a} < 2}
{
\begin{figure}
\centering
\begin{tikzpicture}
\Vertices[Lpos=90, unit=5]{circle}{0,1,2,3}
\Edges[color=black, lw=2pt](0,2)
\Edges[color=black, lw=2pt](\numexpr{\value{a}},1)
\end{tikzpicture}
\end{figure}
}
\end{document}
If anyone has any thoughts on how to accomplish this, I'd appreciate it. The code I've included is simplified in scope as a toy example: manual generation of all of the graphs would take too long. I'm a bit of a Latex newbie, so I really appreciate any insight!
Thank you!