Personalización del entorno de preguntas en la clase de examen

Personalización del entorno de preguntas en la clase de examen

¿Cómo puedo hacer preguntas personalizadas usando examla clase? Por ejemplo, necesito crear 3 preguntas diferentes, pero con etiquetas A1, B1 y C1 y posiblemente con colores diferentes.

Algo como esto

\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}

Respuesta1

Es posible que el siguiente método no sea infalible, pero funciona como se esperaba sin perder muchas de las opciones de la clase de examen.

Pasos que hemos probado:

  • Defina contadores para cada uno de los tipos aqn, por ejemplo bqn, etc.
  • Incrementarlos dentro de \deffor Aquestion, Bquestion, etc.
  • Redefina el \questionlabelsegún su contador y el texto requerido para anteponerlo.
  • Por supuesto, puedes agregar cualquier formato antes de eso. Pero tenga en cuenta el hecho de que este formato también se aplica a cualquier cosa debajo de esas preguntas.

Si el método anterior le parece bien, puede implementarlo. He dado mi código aquí. Obviamente, es posible que desees agregar algunos más.

\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}

Producción:

producción

información relacionada