I have installed texlive full package:
I use TeXmaker and this is a code where I want to draw a grid as in tikzpicture. I want to just call the \gridkar
function defined below. So I defined it in \newcommand
. Unfortunately it returns two errors:
Undefined Control Sequence \gridkar
and
Package PGF Math Error: Unknown Function 'x' (in 'x')
\documentclass[12 pt]{exam}
\usepackage[T1]{fontenc}
\usepackage{tgtermes}
\usepackage{amsmath,amssymb,color}
\usepackage{enumerate,graphicx}
\usepackage{tikz}
\usepackage{xargs}
\usepackage{latexsym}
\pagestyle{head}
\firstpageheader{Math110}{October 2}{Quiz 3}
\shadedsolutions
\definecolor{SolutionColor}{rgb}{.87,.87,.87}
\newcounter{x}
\newcounter{y}
\newcommand{\gridkar}[2]
{
\begin{tikzpicture}[scale=0.4]
\forLoop{-#1}{#1}{x}
{
\draw[-] (x,-#2) -- (x,#2);
}
\forLoop{-#2}{#2}{y}
{
\draw[-] (-#1,y) -- (#1,y);
}
\end{tikzpicture}
}
\begin{document}
\noindent Name:\hfill Section: 008
\noindent Directions: For each problem please show all your work in the space provided. Calculators are permitted; however, in order to receive partial or full credit on a problem you must show your work. You could use the blank side of this sheet too.\\
\textbf{Maximum Points: 6}\hspace*{\fill}\textbf{Time Limit: 10 minutes}
\begin{questions}
\question [2]\gridkar{7}{8}
\question [3]
\question [1]
\end{questions}
\end{document}
How to fix this? Are there any package I missed out on including?
\gridkar
, but\forLoop
, which is inside of\gridkar
. Theforloop
package I would expect to be needed, but I don't know if they have a\forLoop
... they have a\forloop
.\usepackage{forloop}
; but the documentation says “Theforloop
package defines two commands\forloop
(preferred usage) and\forLoop
(deprecated)”.