Como personalizar a solução da questão de múltipla escolha na classe de documentos do exame?

Como personalizar a solução da questão de múltipla escolha na classe de documentos do exame?

Quero que meu documento seja exibido como esta imagem

\documentclass[cancelspace,10pt]{exam}
\usepackage{multicol}
%**********************************************************  End of Listing Setting
\usepackage[explicit]{titlesec}
\usepackage[dotinlabels]{titletoc}
\usepackage{pifont}
\usepackage{times,color}
\usepackage{tikz}
\usepackage{circuitikz}
\usepackage{enumerate}

\usepackage{xepersian}
% *********************************************************** Document Font
\settextfont[Scale=1.2]{B Nazanin}
%*******************************************
\renewcommand*\questionlabel{\color{blue}\thequestion-}
\renewcommand*\thechoice{\arabic{choice}} 
\renewcommand*\choicelabel{\thechoice)}
%*******************************answer
\renewcommand{\solutiontitle}{\noindent\textbf{solution:}\par\noindent}
\shadedsolutions
\definecolor{SolutionColor}{rgb}{0.8,0.9,1}
\printanswers
% *********************************************************** begin Doc
%\DefaultMathsDigits
\begin{document}
% ----------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%end-title
\begin{persian}
\begin{questions}
% *********************************************************** Start Doc

\begin{latin}
%#############################################################################
% *********************************************************** Start     QUESTION #1
\question
She's not very .............. in the way she treats her children;they may be punished today for somthing they were rewarded for yesterday!
% *********************************************************** Choices
\begin{multicols}{4}
\begin{choices}
        %****************************************************************************     Choice 1
    \choice
    a
    %****************************************************************************     Choice 2
    \choice
           b
    %****************************************************************************     Choice 3
    \choice
    c
    %****************************************************************************     Choice 4
    \choice
    d
\end{choices}
\end{multicols}
  \begin{solutionorbox}[2in]

a

\end{solutionorbox}
% *********************************************************** End QUESTION #1


\end{latin}
\end{questions}
\end{persian}
\end{document}

Responder1

Acho que você pode usar esse código para modificar o seu.

\documentclass{exam}

\usepackage{xcolor}
\usepackage{ifthen}

\shadedsolutions
\definecolor{SolutionColor}{rgb}{0.8,0.9,1}
\printanswers

\newcommand{\answer}{unknown}

\newcommand{\correct}[1]
{
    \ifthenelse{\equal{#1}{a}}{\renewcommand{\answer}{The first }}{}
    \ifthenelse{\equal{#1}{b}}{\renewcommand{\answer}{The second }}{}
    \ifthenelse{\equal{#1}{c}}{\renewcommand{\answer}{The third }}{}
    \ifthenelse{\equal{#1}{d}}{\renewcommand{\answer}{The fourth }}{}

    \renewcommand{\solutiontitle}{\noindent \textbf{Solution:} \answer option is correct.\par\noindent}

    \begin{solutionorbox}[2in]
        #1 
    \end{solutionorbox}
}

\begin{document}

\correct{a}

\correct{b}

\correct{c}

\correct{d}

\end{document}

Exibirá

insira a descrição da imagem aqui

Editar

No \correctcomando editado, você precisa digitar o formato \correct{option}{the answer}com optionDEVE no formato numérico. No seu exemplo, a opção é 1, 2, 3ou 4.

\documentclass{exam}

\usepackage{xcolor}
\usepackage{ifthen}

\usepackage{fmtcount}

\shadedsolutions
\definecolor{SolutionColor}{rgb}{0.8,0.9,1}
\printanswers

\newcommand{\correct}[2]
{ 
    \renewcommand{\solutiontitle}{\noindent \textbf{Solution:} The \textcolor{red}{\ordinalstringnum{#1}} option is correct.\par\noindent}

    \begin{solutionorbox}[2in]
        \textcolor{red}{#2}
    \end{solutionorbox}
}

\begin{document}

\correct{1}{c}

\correct{2}{d}

\correct{1}{You should choose this as your answer}

\correct{2}{I think this is the right answer}

\end{document}

insira a descrição da imagem aqui

Segunda edição:

Por favor, substitua \newcommand{\correct}[2]o código acima por este.

\newcommand{\answer}{unknown}

\newcommand{\correct}[2]
{    

   \ifthenelse{\equal{#1}{1}}{\renewcommand{\answer}{pertama }}{}
   \ifthenelse{\equal{#1}{2}}{\renewcommand{\answer}{kedua }}{}
   \ifthenelse{\equal{#1}{3}}{\renewcommand{\answer}{ketiga }}{}
   \ifthenelse{\equal{#1}{4}}{\renewcommand{\answer}{keempat }}{}


   \renewcommand{\solutiontitle}{\noindent \textbf{Solution:} The \answer option is correct.\par\noindent}

   \begin{solutionorbox}[2in]
       #2
   \end{solutionorbox}
}

Se você precisar usar o idioma persa, basta substituir pertama, kedua, ketigae keempatpelo seu.

Responder2

Aqui está uma solução possível. Defini um \CorrectSolutioncomando com um argumento opcional que será passado para o argumento opcional de solutionorbox:

\CorrectSolution[2in]

e um \coreectoptioncomando a ser usado dentro do choicesambiente para selecionar a resposta correta:

\begin{choices}
    \correctoption{a}
    \choice b
    \choice c
    \choice d
\end{choices}

então \CorrectSolutionpegará automaticamente o valor da resposta certa e o converterá em sua string ordinal associada com a ajuda do fmtcountpacote.

O código:

\documentclass[cancelspace,10pt]{exam}
\usepackage{multicol}
\usepackage{fmtcount}
\usepackage{color}

\renewcommand*\questionlabel{\color{blue}\thequestion-}
\renewcommand*\thechoice{\arabic{choice}} 
\renewcommand*\choicelabel{\thechoice)}

%*******************************answer
\renewcommand{\solutiontitle}{\noindent\textbf{solution:}\par\noindent}
\shadedsolutions
\definecolor{SolutionColor}{rgb}{0.8,0.9,1}

\newcounter{tmp}
\newcommand\correctoption[1]{\gdef\Correctoption{#1}\choice#1\setcounter{tmp}{\value{choice}}}
\newcommand\CorrectSolution[1][-1t]{%
  \begin{solutionorbox}[#1]
    The  \ordinalstring{tmp} option is correct.\par\Correctoption  
  \end{solutionorbox}%
}

\printanswers

\begin{document}

\begin{questions}
\question
She's not very .............. in the way she treats her children;they may be punished today for somthing they were rewarded for yesterday!
\begin{multicols}{4}
\begin{choices}
    \correctoption{a}
    \choice b
    \choice c
    \choice d
\end{choices}
\end{multicols}
\CorrectSolution[2in]

\question
What is the answer to the ultimate question of life, the universe, and everything?\begin{multicols}{4}
\begin{choices}
    \choice 15
    \choice 23
    \choice $\pi$
    \correctoption{42}
    \choice 31
\end{choices}
\end{multicols}
\CorrectSolution[2in]

\end{questions}

\end{document}

insira a descrição da imagem aqui

Como meu sistema não possui a B Nazaninfonte, comentei essa linha. Também removi pacotes e configurações que não eram relevantes para a resposta.

informação relacionada