I am creating exercise worksheets with solutions for students to practice determining equations from linear graphs.
But my solutions page is not compiling... again. [Previous post.]
I replaced all the \( and \) with $ and have double checked the code... so I think I'm not making the same mistake again.
Does anybody know what's going wrong?
\documentclass{article}
\usepackage{amssymb}
\newcommand{\reals}{\mathbb{R}}
\usepackage{ifthen}
\usepackage{pgf}
\pgfmathsetseed{\number\pdfrandomseed}
\usepackage{pgffor}
\usepackage{tikz}
\newcommand{\MyScale}{0.4}
\newcommand{\VertLine}
{%
%
\pgfmathrandominteger{\xvar}{-9}{9}
%
State the slope, $y_{int}$, and equation in slope-intercept form.
\newcommand{\Exercise}
{%
\begin{tikzpicture}[scale=\MyScale]
\draw[help lines, gray, thin] (-10,-10) grid (10,10);
\draw[very thick,<->] (-10.3,0)--(10.3,0);
\draw[very thick,<->] (0,-10.3)--(0,10.3);
\draw[thick, blue] (\xvar,-10)--(\xvar,10);
\end{tikzpicture}%
}
%
\newcommand{\Solution}
{%
Slope is undefined.
\ifthenelse{\equal{\xvar}{0}}{$y_{int} \in \reals $}{There is no $y_{int}$.}
Equation: $x=\xvar$%
\vspace{1cm}
}
}
\newcommand{\ManySolutions}{}
\newcommand{\ManyExercises}[1]
{%
\foreach \x in {1,...,#1}
{%
\VertLine \Exercise \par \vspace{5cm}
\xdef\ManySolutions{\ManySolutions \Solution \par}
}
}
\begin{document}
%This does not compile...
\ManyExercises{10}
%It does compile if I replace the line above with:
%% \VertLine
%% \Exercise
%% \Solution
\end{document}
\iftenelseinside tikz... I don't know if it can be called a duplicate... Different question but the answer is based on that. – koleygr Aug 29 '17 at 00:40\foreachcommand and it wsa working... So the problem was clearly in there... uncommented first line (in foreach)... works again... Then removed one by one the arguments in \ManySolutions and found out that \Solution caused the problem... Commented content... etc... – koleygr Aug 29 '17 at 01:18\realsto mathcal{R} and works. Thanks for noticing. – koleygr Aug 29 '17 at 02:23\GenericError. May be a bug or something – koleygr Aug 29 '17 at 02:32\xvar=0and the real numbers symbol is needed. Then it does not compile. I think that symbol is maybe incompatible with\foreach. – WeCanLearnAnything Aug 29 '17 at 02:32\ManySolutionsto compile either. – WeCanLearnAnything Aug 29 '17 at 02:42ifstuff and I can replace\realswithall real numbers. But now I can't get\ManySolutionsto compile, so I'm going to start a new thread. Thanks! – WeCanLearnAnything Aug 29 '17 at 03:04\mathbb{R}there... I think we have to find out – koleygr Aug 29 '17 at 03:05\ManySolutionsline in the code originally. Other problems got solved: replacing\ifthenelsewith\ifnumand\realswithall real numbersmakes the code - exercises only - compile. I started a new thread with the solutions/answer page issue here. https://tex.stackexchange.com/questions/388733/answer-page-not-working – WeCanLearnAnything Aug 29 '17 at 03:30@WeCanLearnAnything I was searching about the usage of those conditionals and found that you can put this other code
– Cragfelt Aug 29 '17 at 04:25\ifthenelse{\value{\xvar}=0}{"condition 1"}{"condition 2"}. Could work.