我想将所有问题和子问题格式化为粗体。
\qformat
只会影响实际文本前面的内容。
梅威瑟:
\documentclass[answers]{exam}
\begin{document}
This should not be in bold
\begin{questions}
\question This is a question
\begin{solution}
This should not be in bold
\end{solution}
\begin{parts}
\part This is a subquestion
\end{parts}
\question This is a second question
\end{questions}
This should not be in bold
\end{document}
我想要This is a question
,This is a subquestion
并This is a second question
以粗体显示。
我不知道该怎么做。
答案1
像这样吗?
\documentclass[answers]{exam}
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\questions}{\par\fi\@doitem}{\par\fi\bfseries\@doitem}{}{}
\xpatchcmd{\questions}{\par\fi\@doitem}{\par\fi\bfseries\@doitem}{}{}
\xpatchcmd{\questions}{\par\fi\@doitem}{\par\fi\bfseries\@doitem}{}{}
\makeatother
\SolutionEmphasis{\normalfont}
\begin{document}
This should not be in bold
\begin{questions}
\show\question
\question This is a question
\begin{solution}
This should not be in bold
\end{solution}
\begin{parts}
\part This is a subquestion
\end{parts}
\question This is a second question
\end{questions}
This should not be in bold
\end{document}
如果您只想要以粗体显示的问题文本,这里有一组不同的补丁。
\documentclass[answers]{exam}
\usepackage{xpatch}
\makeatletter
\xpretocmd{\item@points@pageinfo}{\normalfont}{}{}
\xapptocmd{\item@points@pageinfo}{\bfseries}{}{}
\makeatother
\SolutionEmphasis{\normalfont}
\begin{document}
This should not be in bold
\begin{questions}
\question[3] This is a question
\begin{solution}
This should not be in bold
\end{solution}
\begin{parts}
\part This is a subquestion
\end{parts}
\question This is a second question
\end{questions}
This should not be in bold
\end{document}
答案2
我找到了这个解决方案:
\usepackage{xifthen}
\newcommand{\boldquestion}[2][]{%
\ifthenelse{\isempty{#1}}{%
\question \textbf{#2}%
}{%
\question[#1] \textbf{#2}%
}%
}
现在可以写:
\boldquestion[points]{Title}
或者\boldquestion{Title}