I'm fairly new to Asymptote, and am trying to create a basic number line using a for loop. I would like the for loop to also label the points for me. Could somebody tell me how to fix this?
\documentclass{article}
\begin{document}
\begin{figure}[hbt]
\centering
\begin{asy}
unitsize(0.1inch);
draw((0,0)--(50,0),);
draw((0,0)--(1,1));
draw((0,0)--(1,-1));
draw((50,0)--(49,1));
draw((50,0)--(49,-1));
draw((25,1)--(25,-1));
label("$0$",(25,0)+2*dir(270));
for(int i=1; i<12; ++i)
{
draw((25+2*i,1)--(25+2*i,-1));
label("$i$",(25+2*i,0)+2*dir(270));
}
\end{asy}
\end{figure}
\end{document}
When run, almost everything displays the way I would expect it to, except instead of labeling the numbers, it labels everything with my counter variable.
Also, earlier my system was working fine, but now it's stopped creating the .pdf files for the images. For example, my first image is supposed to be Neighborhoods-1.pdf. It creates the .asy file, but not the .pdf file. Can somebody tell me how to fix this?
\documentclass{...}
, the required\usepackage
's,\begin{document}
, and\end{document}
. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem.