Matnlarga ishlov berish LaTex text Formatting


Fill in the blank questions


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

4. Fill in the blank questions
Now let’s jump to another kind of questions. The fill in the blank questions are those in which the student is asked to fill a blank space, usually in the middle of a sentence. The exam package provides a \fillin command that prints underlined empty space for creating this kind of questions. The \fillin command can take two optional arguments:

  • The first is the answer to the question, which will be typeset above the line when answers are being printed, and

  • The second optional argument is the length of the line to be printed (only if you want some length other than the default).


Let’s see with an example how these two options can affect the question:
% Fill in blank questions
\documentclass{exam}
\begin{document}
\begin{questions}
\question \fillin[Helium] is the second element of the periodic table.
\question \fillin[Sir Isaac Newton][2in] discovered the first gravitational law.
\printanswers
\question \fillin[Helium] is the second element of the periodic table.
\question \fillin[Sir Isaac Newton][2in] discovered the first gravitational law.
\end{questions}
\end{document}
Compiling this code yields the following output:
An exam with fill-in-the-blank questions.

A more interesting application of the \fillin command is using it to create True/False questions. You can see how to do that in the following example, where we define a general macro for that purpose:
% True and False questions
\documentclass{exam}
\newcommand{\tf}[1][{}]{%
\fillin[#1][0.25in]%
}
\begin{document}
\begin{questions}
\question \tf[T] This question is true.
\question \tf[F] And this question is false.
\printanswers
\question \tf[T] This question is true.
\question \tf[F] And this question is false.
\end{questions}
\end{document}
As you can see in the following image, the macro we have just defined leaves some blank space for the student to write his answer, but also stores the correct answer so that when the options to print answers are activated, a boldface “T” or “F” is shown.
True or false questions.

Finally, let’s see how we can customize the \fillin command.

  • First, we can change the default length of the underlined space. This distance is determined by the LaTeX length \fillinlinelength, and by default its value is 1in. You can change this using

\setlength\fillinlinelength{x}
where x is a TeX dimension.

  • The line is printed at a distance of \answerclearance below the baseline. This value is 0.2ex by default, but you can also change it using \setlength.

  • The last thing we can also customize is the emphasis applied to the correct answer when answers are being printed. This emphasis is determined by the declarations in the argument of the \CorrectChoiceEmphasis command. For example:

\CorrectChoiceEmphasis{\sc}
will print the correct answers using small capital letters.

Download 0.75 Mb.

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




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