3

I want to bundle together multiple exam question papers in the form of a bound book to be handed out as practice problems. The exam question papers are mainly objective MCQs. Each chapter will have initial description (text, figures, and diagrams) followed by a series of multiple choice questions. I use the exam class to generate MCQ exams as shown in the code below. How to combine this with book templates or or other class to accomplish what I wish to do?

%\documentclass{article}
\documentclass{exam}
\usepackage{graphicx}
\usepackage[export]{adjustbox}

\begin{document}
\begin{questions}

\question
 [A]
question 1 \\
\begin{oneparchoices}
 \choice  option 1
 \choice  option 2
 \choice  option 3
 \choice  option 4
\end{oneparchoices}


\question
 [B]
question 2 \\
\begin{oneparchoices}
 \choice  option 1
 \choice  option 2
 \choice  option 3
 \choice  option 4
\end{oneparchoices}

\question
 [A]
question 3 \\
\begin{oneparchoices}
 \choice  option 1
 \choice  option 2
 \choice  option 3
 \choice  option 4
\end{oneparchoices}

\question
 [D]
question 4 \\
\begin{oneparchoices}
 \choice  option 1
 \choice  option 2
 \choice  option 3
 \choice  option 4
\end{oneparchoices}


\end{questions}

\end{document}
mntk123
  • 135
  • 5
  • 1
    You can compound your chapter introductions with a book class and insert your previously formatted exams with pdfpages help. – Ignasi Apr 16 '15 at 07:29
  • thanks, but it seems pdfpages is not working, may be because the question paper pdf contains many images. I will see if it works by changing few things. – mntk123 Apr 16 '15 at 11:48
  • I guess, the problem is from the geometry package; it seems pdfpages doesn't go well with geometry package. – mntk123 Apr 16 '15 at 12:04
  • also the limitation of pdfpages that it always inserts at new page; it is not desired in this case; even if there is a lot of space on the current page, the pdfpages will still insert on new page :( – mntk123 Apr 16 '15 at 12:06
  • I understood that you wanted to include your exams, but looks like you only want to include questions from exams. How would you like to proceed? Do you only want to \include{exam.tex}? Then you need some way of forgetting exam preamble. Can you copy and paste questions into your new book? You need to define a question environment in your book preamble. – Ignasi Apr 16 '15 at 16:28
  • okay, can you give an example of how to define a minimal question environment that allows me to write MCQs with questions numbered from given start counter to end counter. I will accept that as answer; sorry cannot upvote your comment; don't have that permission yet :) – mntk123 Apr 17 '15 at 06:30

1 Answers1

1

I assume that OP only wants to include some multiple choice questions typed like in exam class, i.e., a questions environment similar to enumerate but with \question[points] command instead of \item; and a multiple choice environment (oneparchoices) which is similar to an inline enumerate with \choice instead of \item.

Both environments can be build with enumitem package. It provides configurable lists and also configurable inline lists. Therefore with some help from enumitem documentation, and from \newlist vs. \newenvironment for defining an individual list style and Creating a list style with enumitem, next can be done

\documentclass{article}
\usepackage{enumitem}
\usepackage{xparse}

%Idea from https://tex.stackexchange.com/a/236668/1952
\DeclareDocumentCommand\question{o}{%
    \item\IfNoValueTF{#1}{}{(#1 points)}}

\newenvironment{questions}[1][]{\enumerate[,#1]}{\endenumerate}

\newlist{oneparchoices}{enumerate*}{1}
\setlist[oneparchoices,1]{label=\Alph*., itemjoin={{\quad}}}

\newcommand{\choice}{\item}

\begin{document}

Some questions to start with
\begin{questions}[start=4] %<--- start option fixes number for first question
\question[A] question 1 \\
\begin{oneparchoices}
 \choice  option 1
 \choice  option 2
 \choice  option 3
 \choice  option 4
\end{oneparchoices}

\question[B] question 2  \\
\begin{oneparchoices}
 \choice  option 1
 \choice  option 2
 \choice  option 3
 \choice  option 4
\end{oneparchoices}

\question question \label{q}\ref{q} without points
\end{questions}
and, now, two more
\begin{questions}[resume] %<--- resume option follows counting from last time 

\question[A] question 1 \\
\begin{oneparchoices}
 \choice  option 1
 \choice  option 2
 \choice  option 3
 \choice  option 4
\end{oneparchoices}

\question[B] question 2  \\
\begin{oneparchoices}
 \choice  option 1
 \choice  option 2
 \choice  option 3
 \choice  option 4
\end{oneparchoices}
\end{questions}
\end{document}

enter image description here

Ignasi
  • 136,588