
클래스를 사용하여 맞춤 질문을 만들려면 어떻게 해야 하나요 exam
? 예를 들어, A1, B1, C1이라는 레이블과 다른 색상을 사용하여 3개의 다른 질문을 만들어야 합니다.
이 같은
\begin{questions}
\Aquestion
This question starts with item label A1, and the text of this question is in blue color.
\Aquestion
This question starts with item label A2, and the text of this question is in blue color.
\Bquestion
This question starts with item label B1, and the text of this question is in red color.
\Cquestion
This question starts with item label C1, and the text of this question is in green color.
\Bquestion
This question starts with item label B2, and the text of this question is in red color.
\end{questions}
답변1
다음 방법은 완벽한 방법은 아니지만 시험 클래스 옵션을 많이 잃지 않고 예상대로 작동합니다.
우리가 시도한 단계는 다음과 같습니다.
aqn
, 등의 각 유형에 대한 카운터를 정의합니다bqn
.- ,
\def
등 내부에서 증가시킵니다 .Aquestion
Bquestion
\questionlabel
카운터와 접두사에 필요한 텍스트를 기반으로 재정의합니다 .- 물론 그 전에 서식을 추가할 수 있습니다. 하지만 이 형식은 해당 질문 아래의 모든 항목에도 적용된다는 점에 유의하세요.
위의 방법이 괜찮다면 구현할 수 있습니다. 여기에 내 코드를 제공했습니다. 분명히 더 추가하고 싶을 수도 있습니다.
\documentclass{exam}
\usepackage{color}
\newcounter{aqn}
\newcounter{bqn}
\newcounter{cqn}
\def\Aquestion{
\stepcounter{aqn}
\renewcommand*{\questionlabel}{A\theaqn.}
\color{blue}
\question }
\def\Bquestion{
\stepcounter{bqn}
\renewcommand*{\questionlabel}{B\thebqn.}
\color{red}
\question
}
\def\Cquestion{
\stepcounter{cqn}
\renewcommand*{\questionlabel}{C\thecqn.}
\color{green}
\question
}
\begin{document}
\begin{questions}
\Aquestion
This question starts with item label A1, and the text of this question is in blue color.
\Aquestion
This question starts with item label A2, and the text of this question is in blue color.
\Bquestion
This question starts with item label B1, and the text of this question is in red color.
\Cquestion
This question starts with item label C1, and the text of this question is in green color.
\Bquestion
This question starts with item label B2, and the text of this question is in red color.
\end{questions}
\end{document}