8

My objective is to create Multiple Choice Answer Sheet. I have managed to create the circled letter environment using tikz but my question is that if one can create a macro that will repeat the itemization input \item abcdtest as it is the same by looking like \mcquestion{n} where n will be the number of MC items that you want.

In short I want to replace:

\begin{enumerate}
\item \abcdtest
\item \abcdtest
\item \abcdtest
\item \abcdtest
\item \abcdtest
\item \abcdtest
\item \abcdtest
\item \abcdtest
\end{enumerate}

with \mcquestion{8} for example.

Here is the sample code I have so far. Any insight into the matter will help.

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{tikz}

\newcommand\abcdtest{%
\noindent\lower1.5ex\hbox{%
\begin{tikzpicture}
\foreach \i in {1,...,4}
    {
    \path (\i cm,0cm) coordinate (C\i);
    \draw (C\i) circle (0.35cm);
    }
\foreach \j/\k in {1/A,2/B,3/C,4/D}
{
\draw (\j cm,0cm) node {\k};
}
\end{tikzpicture}}}
\begin{document}
%-----------------------------------------------------------------
\begin{enumerate}
\item \abcdtest
\item \abcdtest
\end{enumerate}
\end{document}
12

The \foreach command you use isn't limited to tikz elements. It can be used anywhere. Adding

\newcommand{\mcquestion}[1]{
  \foreach \i in {1,...,#1} {
    \item \abcdtest
  }
}

to your preamble lets you have a document of

\begin{document}
\begin{enumerate}
\mcquestion{6}
\end{enumerate}
\end{document}

yielding

enter image description here

  • Thanks a lot. I was thinking about implementing it but rather in the tikz picture and not outside and I was not certain whether it would have worked. – azetina Jan 19 '12 at 21:53
  • If you did it in the picture environment, you'd also have to add the numbers. Not sure if that's worthwhile. – Mike Renfro Jan 20 '12 at 0:54
  • I understand what you are saying. Your approach serves me best. – azetina Jan 20 '12 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.