如何将问题编号添加到考试的成绩表中?

如何将问题编号添加到考试的成绩表中?

对于考试,每个问题都有名称。因此,我想将问题包含在成绩表中,包括问题编号和左对齐的名称。

以下示例显示问题居中且不包含问题编号。我该怎么做?理想情况下,我希望1. What's the difference between a duck?在成绩表中显示。

以下是代码:

\documentclass[addpoints]{exam}

\qformat{
  \large\textbf{Question \thequestion~: \thequestiontitle}
  \quad (\thepoints)\hfill
  \vrule depth 1em width 0pt
}

\begin{document}

\begin{center}
    \gradetable[v][questions]
\end{center}

\begin{questions}
    \titledquestion{What's the difference between a duck?}[42]
    Lorem ipsum.
\end{questions}
\end{document}

在此处输入图片描述

答案1

加载文档类后添加以下几行。

\usepackage{regexpatch}
\makeatletter
\xpatchcmd*\@multicolumntable{|c|c|c|c}{|l|c|c|c}{}{}
\xpatchcmd\questions{\def\@currentlabel{\thequestiontitle}}{\def\@currentlabel{\thequestion. \thequestiontitle}}{}{}
\makeatother

在此处输入图片描述

\documentclass[addpoints]{exam}
\usepackage{regexpatch}
\makeatletter
\xpatchcmd*\@multicolumntable{|c|c|c|c}{|l|c|c|c}{}{}
\xpatchcmd\questions{\def\@currentlabel{\thequestiontitle}}{\def\@currentlabel{\thequestion. \thequestiontitle}}{}{}
\makeatother

\qformat{
  \large\textbf{Question \thequestion~: \thequestiontitle}
  \quad (\thepoints)\hfill
  \vrule depth 1em width 0pt
}

\begin{document}

\begin{center}
    \gradetable[v][questions]
\end{center}

\begin{questions}
    \titledquestion{What's the difference between a duck?}[42]
    Lorem ipsum.
\end{questions}
\end{document}

相关内容