Incomptatibilité entre les options "answer" et "content command" d'une question ouverte \AMCOpen

Added by Michel Perez almost 3 years ago

Bonjour,
J'essaie de faire une question ouverte avec un tableau pré-rempli à finir de remplir.
Pour cela, j'utilise l'option "contentcommand" de la commande "\AMCOpen" qui affiche le tableau parfaitement dans la case.
Par contre, je n'arrive pas à mettre le tableau complètement rempli dans la version corrigée avec l'option "answer" car il ne s'affiche pas si l'option contentcommand est appelée.

Merci de votre aide,

Michel Perez

Voici mon code:

% Ici la réponse:
\newcommand \repVolumeTemperature{
\begin{minipage}{\textwidth}
\begin{center}
\begin{tabular}{| x{3.5cm} | x{1cm} | x{2.5cm} | x{2.5cm} | x{2.5cm} | x{2.5cm} |}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
[3 sign. figures] x%x
$A$ & $B$ & $C$ & $D$ & $E$ \\
\hline
Temperature (K) &\cellcolor{gray} &\cellcolor{gray} &10 &20&30 \\
\hline
Volume (L) &\cellcolor{gray} & 40 &\cellcolor{gray} &50 &\cellcolor{gray} \\
\hline
\end{tabular}
\end{center}
\end{minipage}
}

Ici le tableau à moitié rempli:
\newcommand \quesVolumeTemperature{
\begin{minipage}{\textwidth}
\begin{center}
\begin{tabular}{| x{3.5cm} | x{1cm} | x{2.5cm} | x{2.5cm} | x{2.5cm} | x{2.5cm} |}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
[3 sign. figures] & $A$ & $B$ & $C$ & $D$ & $E$ \\
\hline
Temperature (K) &\cellcolor{gray} &\cellcolor{gray} & & & \\
\hline
Volume (L) &\cellcolor{gray} & &\cellcolor{gray} & &\cellcolor{gray} \\
\hline
\end{tabular}
\end{center}
\end{minipage}
}

% et ici la question:
\begin{question}{VolumeTemperature}
Give the numerical expressions of $V_B$, $T_C$, $V_D$, $T_D$ and $T_E$ in the following table.

\AMCOpen{lines=5,lineheight=0.5cm,answer=\repVolumeTemperature,contentcommand=quesVolumeTemperature}{
\wrongchoice[V]{Vide}\scoring{0}
\wrongchoice[F]{Faux}\scoring{0}
\wrongchoice[J]{1}\scoring{1}
\wrongchoice[J]{2}\scoring{2}
\wrongchoice[J]{3}\scoring{3}
\wrongchoice[J]{4}\scoring{4}
\correctchoice[J]{5}\scoring{5}

}

Replies (6)

RE: Incomptatibilité entre les options "answer" et "content command" d'une question ouverte \AMCOpen - Added by Frédéric Bréal almost 3 years ago

Je n'arrive pas à compiler.
Il y a 2 environnements tabular déclarés mais un seul de fermé dans chaque commande.
Je ne connais pas le commande x{3.5cm} |.

Pouvez-vous mettre le fichier tex en pièce jointe mais réduit au maximum (Exemplet Complet Minimum) ?

RE: Incomptatibilité entre les options "answer" et "content command" d'une question ouverte \AMCOpen - Added by Michel Perez almost 3 years ago

Désolé, je n'avais pas tout mis. Voici la version simplifiée qui ne nécessite pas de définition externe:

% Ici la réponse:
\newcommand \repVolumeTemperature{
\begin{minipage}{\textwidth}
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
[3 sign. figures] & $A$ & $B$ & $C$ & $D$ & $E$ \\
\hline
Temperature (K) & --- &--- &10 &20&30 \\
\hline
Volume (L) & --- & 40 & --- &50 & --- \\
\hline
\end{tabular}
\end{center}
\end{minipage}
}

% Ici le tableau à moitié rempli:
\newcommand \quesVolumeTemperature{
\begin{minipage}{\textwidth}
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
[3 sign. figures] & $A$ & $B$ & $C$ & $D$ & $E$ \\
\hline
Temperature (K) & --- &--- &10 &20&30 \\
\hline
Volume (L) & --- & 40 & --- &50 & --- \\
\hline
\end{tabular}
\end{center}
\end{minipage}
}

% et ici la question:
\begin{question}{VolumeTemperature}
Give the numerical expressions of $V_B$, $T_C$, $V_D$, $T_D$ and $T_E$ in the following table.
\AMCOpen{lines=5,lineheight=0.5cm,answer=\repVolumeTemperature,contentcommand=quesVolumeTemperature}{
\wrongchoice[V]{Vide}\scoring{0}
\wrongchoice[F]{Faux}\scoring{0}
\wrongchoice[J]{1}\scoring{1}
\wrongchoice[J]{2}\scoring{2}
\wrongchoice[J]{3}\scoring{3}
\wrongchoice[J]{4}\scoring{4}
\correctchoice[J]{5}\scoring{5}
}
\end{question}

RE: Incomptatibilité entre les options "answer" et "content command" d'une question ouverte \AMCOpen - Added by Frédéric Bréal almost 3 years ago

Si j'ai bien compris, vous voulez qu'en mode corrigé le tableau réponse soit affiché.
Actuellement, vous avez mis le même tableau non rempli.

Mon idée, ce serait de déclarer un boolean qui en mode corrigé affiche contentcommand=quesVolumeTemperature sinon contentcommand=quesVolumeTemperature.

J'ai une commande qui affiche un texte (argument #1) en dehors des environnements question

%%pour afficher ailleurs que dans une question
\makeatletter
\newcommand{\AffichageSiCorrige}[1]{\ifAMC@correc #1\fi}
\makeatother

Pour l'instant, je n'arrive pas à l'adapter à AMCOpen d'où l'idée du if.

RE: Incomptatibilité entre les options "answer" et "content command" d'une question ouverte \AMCOpen - Added by Michel Perez almost 3 years ago

Trop bien ! Vous êtes au top ;-)
Merci infiniment !

Voici la solution que j'ai choisi en suivant votre idée:

%% Avant l'environnement 'question':
\makeatletter
%pour afficher seulement si on est en mode 'corrigé'
\newcommand{\SiCorrige}[1]{\ifAMC@correc \Large{#1}\fi}
\makeatother

%% Avant la question:
\newcommand \VolumeTemperature{
\begin{minipage}{\textwidth}
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
[3 sign. figures] x%x
$A$ & $B$ & $C$ & $D$ & $E$ \\
\hline
Temperature (K) &\cellcolor{gray} &\cellcolor{gray} &\SiCorrige{10} &\SiCorrige{92.1}&\SiCorrige{20 }\\
\hline
Volume (L) &\cellcolor{gray} & \SiCorrige{30} &\cellcolor{gray} &\SiCorrige{40} &\cellcolor{gray} \\
\hline
\end{tabular}
\end{center}
\end{minipage}
}

%%% La question:
\begin{question}{VolumeTemperature}
Give the numerical expressions of $V_B$, $T_C$, $V_D$, $T_D$ and $T_E$ in the following table.
\AMCOpen{lines=5,lineheight=0.5cm,contentcommand=VolumeTemperature}{
\wrongchoice[V]{Vide}\scoring{0}
\wrongchoice[F]{Faux}\scoring{0}
\wrongchoice[J]{1}\scoring{1}
\wrongchoice[J]{2}\scoring{2}
\wrongchoice[J]{3}\scoring{3}
\wrongchoice[J]{4}\scoring{4}
\correctchoice[J]{5}\scoring{5}
}
\end{question}

RE: Incomptatibilité entre les options "answer" et "content command" d'une question ouverte \AMCOpen - Added by Frédéric Bréal almost 3 years ago

Effectivement, c'est plus simple.
Je vais continuer à chercher avec mon idée pour élargir à des cas plus généraux.

(1-6/6)