Matnlarga ishlov berish LaTex text Formatting


The checkboxes and oneparcheckboxes environments


Download 0.75 Mb.
bet8/18
Sana09.04.2023
Hajmi0.75 Mb.
#1344635
1   ...   4   5   6   7   8   9   10   11   ...   18
Bog'liq
Matnlarga ishlov berish

2. The checkboxes and oneparcheckboxes environments
Now let’s see the two environments that print checkboxes in front of the choices for the students to mark their answers. These two environments, the checkboxes and oneparcheckboxes environments, are analogous to the previous ones, but instead of letters they print a box next to the question options. In the following example we illustrate both of them:
% Check boxes environment
\documentclass{exam}
\begin{document}
\begin{questions}
\question My first question with multiple choices.
\begin{checkboxes}
\choice The first choice.
\choice The second choice.
\choice The third choice.
\choice The fourth choice.
\end{checkboxes}
\question Another question with multiple choices.
\begin{oneparcheckboxes}
\choice The first choice.
\choice The second choice.
\choice The third choice.
\choice The fourth choice.
\end{oneparcheckboxes}
\end{questions}
\end{document}

You can see the output below. Note that now, since we didn’t leave a blank line between the question and the \verb|oneparcheckboxes| environment, the options are typeset right after the question, following it
on the same paragraph. By default, the space to be marked by the student is a circle. However, we will see in the following section of the tutorial how to customize it.
A couple of questions with check boxes.

3. Solutions to multiple-choice questions
The exam document class defines several environments for solutions, the contents of which will be printed only if you use the document class option answers, or give the command \printanswers. Each of the environments for multiple-choice questions that we have introduced allows you to designate one or more of the choices as “correct choices”, and to have the correct choices printed with emphasis when solutions are being printed.
The command to define a correct choice is \CorrectChoice, which is used in place of the command \choice. Now let’s see with an example how this would be used:
% Typeset exams with solutions in LaTeX
\documentclass{exam}
\begin{document}
\begin{questions}
\question This question has one correct answer. Mark it.
\begin{checkboxes}
\choice The correct answer is after the second wrong answer.
\choice The correct answer is after this answer.
\choice This is the correct answer.
\CorrectChoice Previous anwers are false.
\end{checkboxes}
\printanswers
\question This question has one correct answer. Mark it.
\begin{checkboxes}
\choice The correct answer is after the second wrong answer.
\choice The correct answer is after this answer.
\choice This is the correct answer.
\CorrectChoice Previous anwers are false.
\end{checkboxes}
\end{questions}
\end{document}
You can see the questions produced by this code in the next image. Note that, in the first question,
the command \CorrectChoice acted just like the normal \choice command since the answers were not activated yet. However, in the second question, we can see the correct answer in boldface, with a tick in its checkbox. A similar result is produced when we use the choices environment: the correct answer is printed in boldface, although no tick is shown.

Questions showing the correct answer.

Download 0.75 Mb.

Do'stlaringiz bilan baham:
1   ...   4   5   6   7   8   9   10   11   ...   18




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling