Entering text in the margins in enumerate environment

I currently trying to create a template that I could use for tests, and one thing I've always liked is when the possible points a question was worth was listed right next to the question itself.

In the past, the way I've done this is to forego the enumerate package, and just manually type numbers in, such as:

 $(+5)$ 2.  Let $U_0 = 9$ and let your common ratio be $\frac{1}{2}$. Find an explicit formula for the sequence and use this formula to find the tenth term of the sequence. Round your answer to the nearest thousandth.  \vspace{2in}


But for a template, it'd be nice to take advantage of the numbering the enumerate environment provides. So far, I have out put that looks like which is 99% there, if only I could figure out how to display the point value of a question.

If it's a lot of work, I figure I can always just list the point value for a particular question at the end, instead of in the margin, but I figured I would see if anyone have any ideas.

-
My "overkill" solution at Enclose an entry in an enumerate list in parentheses defines a \SpecialItem[\DrawAsterix], which places an asterix to the left of an the item's label. You could use this to place text of the number of points. – Peter Grill Sep 25 '12 at 3:12

For a very elementary implementation, you could insert the points using \marginpar wrapped in a macro. Here's a minimal example showing the options:

\documentclass{article}
\usepackage{showframe}% http://ctan.org/pkg/showframe
\newcommand{\points}[1]{% Print points in margin
\leavevmode\marginpar{\makebox[\marginparwidth][r]{[#1]}}\ignorespaces}
\reversemarginpar% Points in left margin by default
\begin{document}
\begin{enumerate}
\item \points{5} This is what a simple open ended question, with no other parts could look like.
\par\vfill
\item This would be where you could put a question with two parts.
\begin{enumerate}
\item \points{2} This would be part~(a).
\par\vfill
\item \points{2} This would be part~(b).
\par\vfill
\end{enumerate}
\item \points{10} This is what a multiple-choice question would look like.
\par\vfill
\end{enumerate}
\end{document}


showframe just adds a frame around the text block.

-
Any way to tweak this so the numbers appear in the left margin? Ideally near or next to the question number? – aklingensmith Sep 25 '12 at 3:28
@aklingensmith: I've updated the example with a modified \points. \reversemarginpar puts the \marginpar in the left margin by default. – Werner Sep 25 '12 at 3:41
This worked perfectly for the question I posted! Thank you so much! – aklingensmith Sep 26 '12 at 17:43

Go to http://texdoc.net and enter the package name exam. Preview the documentation, especially the section on questions and points. I think this is what you are looking for. I use this package periodically to prepare exams and quizzes. I also teach using this package to the secondary education math teachers.

-
Hmmm. I'll definitely toy around with this. It seems like this could work for a lot of what I'm looking for. I'm still curious about my question, however. – aklingensmith Sep 25 '12 at 3:14
The exam documentclass is amazing! While there are a few drawbacks (noticeably the amount of control I have over what my output looks like) there are definitely some benefits! Thank you so much for pointing this out to me! – aklingensmith Sep 26 '12 at 19:12

You can achieve what you want using a definition of an \Item command which uses parentheses as delimiters for the points of each question; this command honors the labels for nested enumerations up to level two (if more levels are required, the modification is easy):

\documentclass{article}

\makeatletter
\def\Item(#1){%
\item[{\makebox[1cm][l]{(#1)\hfill}}
\refstepcounter{enum\romannumeral\the\@enumdepth}
\ifnum\@enumdepth=1
\csname theenum\romannumeral\the\@enumdepth\endcsname.%
\else
\ifnum\@enumdepth=2
(\csname theenum\romannumeral\the\@enumdepth\endcsname)%
\else\@toodeep
\fi\fi
]}
\makeatother

\begin{document}

\begin{enumerate}
\Item(10) Why is there air?
\Item(20) What if there were no air?
\begin{enumerate}
\Item(5) Describe the effect on the balloon industry.
\Item(15) Describe the effect on the aircraft industry.
\end{enumerate}
\end{enumerate}

\end{document}


Here's now an example using the versatile exam document class, showing the points at the beginning of each question and then the points at the right in front of the last line of the questions (using \pointsdroppedatright and \droppoints):

\documentclass{exam}

\begin{document}

\begin{questions}
\question[20]
Why is there air?
\question
What if there were no air?
\begin{parts}
\part[10]
Describe the effect on the balloon industry.
\part[10]
Describe the effect on the aircraft industry.
\end{parts}
\end{questions}

\pointsdroppedatright

\begin{questions}
\question[20]
Why is there air?\droppoints
\question
What if there were no air?
\begin{parts}
\part[10]
Describe the effect on the balloon industry.\droppoints
\part[10]
Describe the effect on the aircraft industry.\droppoints
\end{parts}
\end{questions}

\end{document}


-