如何在考试文档类中将点数信息放置在显示的方程线上

如何在考试文档类中将点数信息放置在显示的方程线上

我在文档课上准备试卷exam,其中我将要点放在右边。现在,如果我displaystyle的问题的最后一行是一条方程线,那么要点就会放在下一行。我该如何让它落在同一行?

以下是一个例子:

\begin{subparts}
    \subpart[6]
        If $ a,b $ are positive rational numbers then prove that 
\[ a^ab^b\ge\left(\frac{a+b}{2}\right)^{a+b}\ge a^bb^a. \] \droppoints
\end{subparts}

这得出

在此处输入图片描述

答案1

由于\droppoints只应该在段落末尾使用,因此合理的解决方案是将显示方程放在里面\parbox

第二个版本是偶然发现的。我真的不明白它为什么有效。

只是为了好玩,我还展示了如何将点放在边缘内,这正是我最初想要完成的。

\documentclass{exam}
\usepackage{amsmath}
\usepackage{showframe}
\begin{document}
\pointsdroppedatright
\bracketedpoints % optional
\begin{questions} 
\question 
\begin{parts} 
\part 
\begin{subparts}
\subpart[5]
Normal question.\droppoints

\subpart[6]
If $a$ and $b$ are positive rational numbers, prove that
\par\vskip\abovedisplayskip
\parbox{\linewidth}{\[
a^ab^b\ge\left(\frac{a+b}{2}\right)^{\!a+b}\ge a^bb^a\,.
\]}\droppoints% equation in \parbox

\subpart[6]
If $a$ and $b$ are positive rational numbers, prove that
\begin{equation}
a^ab^b\ge\left(\frac{a+b}{2}\right)^{\!a+b}\ge a^bb^a\,.
\tag*{\parbox{1pt}{\droppoints}}% accident
\end{equation}

\subpart[6]
If $a$ and $b$ are positive rational numbers, prove that
\begin{equation}
a^ab^b\ge\left(\frac{a+b}{2}\right)^{\!a+b}\ge a^bb^a\,.
\tag*{[\themarginpoints]}% inside margins
\end{equation}

\end{subparts}
\end{parts}
\end{questions}
\end{document}

演示

答案2

你可以将指令放在包装器\droppoints\mbox而不是之后\]

在此处输入图片描述

我忍不住要补充一点:不要写If $ a,b $ are positive rational numbers。虽然这种表达方式可能看起来很“酷”,因为它简洁,但它主要是糟糕的风格。写出来可以得到一切If $a$ and $b$ are positive rational numbers。即使没有别的,你的学生也会感激你没有被不必要的矫揉造作的术语轰炸。

\documentclass{exam}
\begin{document}
\pointsdroppedatright
\bracketedpoints % optional
\begin{questions} 
\question 
\begin{parts} 
\part 
\begin{subparts}
\subpart[6]
If $a$ and $b$ are positive rational numbers, prove that 
\[ 
a^ab^b\ge\left(\frac{a+b}{2}\right)^{\!a+b}\ge a^bb^a\,.  
\mbox{\droppoints}
\]
\end{subparts}
\end{parts}
\end{questions}
\end{document}

相关内容