自定义考试类别中的 answerline

自定义考试类别中的 answerline

我想创建一个类似于此示例的测验项目:

____ 1. (p. 63) In a grouped frequency distribution, the mode falls in the most 
   frequently occurring class interval, more specifically, at its

 -  a. upper nominal limit
 -  b. lower nominal limit
 -  c. upper real limit
 -  d. midpoint.

使用 Exam 类时,我无法在问题编号旁边插入 \answerline。我的代码示例如下:

\documentclass[12pt,answers]{exam}
\begin{document}
\begin{questions}
\question (p. 63) In a grouped frequency distribution, the mode falls in the most
   frequently occurring class interval, more specifically, at its
\begin{choices}
\choice upper nominal limit
\choice lower nominal limit
\choice upper real limit
\choice midpoint
\end{choices}
\end{questions}
\end{document}

答案1

您可以自定义\questionlabel以获得相同的效果:

\renewcommand\questionlabel{\rule{0.25in}{0.5pt}\thequestion. }

缺点是,如果您需要该功能,答案将不会打印出来。

答案2

这是 \answerline 的一个丑陋、粗略的版本,它可以完成您想要的功能,并且还可以打印出解决方案。我正在尝试做同样的事情,因此任何改进都会受到赞赏。

\renewcommand\answerline[1][{}]{
  \ifx\@queslevel\ques@ref
    \let\ans@l=\questionlabel
  \else
    \ifx\@queslevel\part@ref
      \let\ans@l=\partlabel
    \else
      \ifx\@queslevel\subpart@ref
        \let\ans@l=\subpartlabel
      \else
        \ifx\@queslevel\subsubpart@ref
          \let\ans@l=\subsubpartlabel
        \else
          \def\ans@l{}
        \fi
      \fi
    \fi
  \fi
  \par \vspace{-35pt}
  \ifprintanswers
    \hspace{-20mm}
    \mbox{
      \parbox[c][20pt][c]{\answerlinelength}{
        \center
        {\LARGE\bfseries #1}
        \rule{\answerlinelength}{.4pt}
      }
    }\vspace{15pt}
  \else
    \hspace{-20mm}
    \mbox{
      \parbox[c][20pt][c]{\answerlinelength}{
        \center
        {\LARGE\bfseries \color{white} X} % X for correct v-spacing
        \rule{\answerlinelength}{.4pt}
      }
    }\vspace{15pt}
  \fi
  \par
}

相关内容