我希望解决方案中的分数(例如 [1/2])能够与问题的总分数一样,在右侧齐平。
\documentclass[11pt,answers]{exam}
\RequirePackage{amssymb, amsfonts, amsmath, latexsym, verbatim, xspace, setspace, amsthm}
\RequirePackage{tikz, pgflibraryplotmarks, esint}
\begin{document}
\begin{questions}
\pointsdroppedatright
\bracketedpoints
\question[1]
Differentiate
\begin{equation*}
f(x)=x^3-2x
\end{equation*}
and evaluate at $x=0$ \droppoints
\begin{solution}
\begin{gather*}
f^{\prime}(x)=3x^2-2 \text{ [$\frac{1}{2}$]} \\
f^{\prime}(0)=-2 \text{ [$\frac{1}{2}$]}
\end{gather*}
\end{solution}
\end{questions}
\end{document}
谢谢!
答案1
这里我介绍一下\answermarks[]{}
。第一个可选参数 default1
是标记,第二个参数是要设置的方程。
注意:我擅自在 的右侧做了标记\textstyle
。要将其恢复为\displaystyle
,只需将的定义$#1$
改为即可。$\displaystyle#1$
\answermarks
为了获得框内的标记,请将的定义中的更改+2.4cm
为。-1cm
\fulltextwidth
\documentclass[11pt,answers]{exam}
\RequirePackage{amssymb, amsfonts, amsmath, latexsym, verbatim, xspace, setspace, amsthm}
\RequirePackage{tikz, pgflibraryplotmarks, esint}
\usepackage{stackengine}
\newlength\fulltextwidth
\fulltextwidth=\dimexpr\textwidth+2.4cm\relax
\newcommand\answermarks[2][1]{\def\stacktype{L}\def\useanchorwidth{T}\ensurestackMath{%
\stackon[0pt]{\displaystyle\vphantom{#1}#2}{\hspace{\fulltextwidth}\llap{\text{ [$#1$]}}}%
}}
\begin{document}
\begin{questions}
\pointsdroppedatright
\bracketedpoints
\question[1]
Differentiate
\begin{equation*}
f(x)=x^3-2x
\end{equation*}
and evaluate at $x=0$ \droppoints
\begin{solution}
\begin{gather*}
\answermarks[\frac{1}{2}]{f^{\prime}(x)=3x^2-2} \\
\answermarks[\frac{1}{2}]{f^{\prime}(0)=-2}
\end{gather*}
\end{solution}
\end{questions}
\end{document}