Anpassen von \pointpoints im Prüfungsunterricht für mehr Formen als nur Singular und Plural

Anpassen von \pointpoints im Prüfungsunterricht für mehr Formen als nur Singular und Plural

Ich sende ein Problem, das mit einem anderen gepostet wurde, hier erneut Neudefinition von \pointname für die Prüfungsklasse

Ich habe ein Problem im Zusammenhang mit der Anpassung des Befehls „\thepoints“ in der Exam-Klasse. Der Befehl „\thepoints“ in Exam.cls wird immer durch „@points @pointname“ ersetzt, wenn die Anzahl der Punkte für die Frage angegeben wurde. (@points ist der Punkteintrag und @pointname ist der Punktname.

Dieser Punktname wird durch den Befehl ''\pointpoints{point}{points}'' definiert, wobei ''\pointname' durch ''point'' ersetzt wird, wenn @points=1 oder=1/2 (Singular) und durch ''points'' ersetzt wird, wenn @points > 1 (Plural).

Ich möchte den Befehl „\thepoints“ für andere Sprachen (insbesondere Arabisch) anpassen, bei denen es mehr als zwei Fälle geben kann, z. B. vier: die Fälle „@points=1 or=1/2“, „@points=2“, „3<=@points<=10“ und „@points>10“).

Dann hat „@pointname“ vier verschiedene Wertenamen, sagen wir {WORD_1, WORD_2, WORD_3, WORD_4}.

Daher möchte ich ein Makro schreiben, das "\thepoints" durch Folgendes ersetzt:

  • „WORD_1“, wenn ‚@points=1 oder=1/2‘‘ (Beachten Sie, dass @points hier nicht geschrieben wird...)
  • „WORD_2“, wenn „@points=2“ (Beachten Sie, dass @points hier auch nicht geschrieben wird …)
  • "@points WORD_3" if '3<= @points <=10' (Hier schreiben wir den Wert von @points...)
  • "@points WORD_4" wenn '@points >10' (Hier muss auch @points geschrieben werden...)

Genauer gesagt möchte ich, dass zum Beispiel die Befehle:

\question[1] ergibt: Frage (WORD_1)

\question[2] ergibt: Frage (WORD_2)

\question[8] ergibt: Frage (8 WORD_3)

\question[14] ergibt: Frage (14 WORD_4)

Antwort1

Die Definition des \pointsMakros in exam.cls lautet:

\newcommand\points{%
  \begingroup
    \let\half=\relax
    \edef\pt@string{\@points}%
    \ifthenelse{\equal{\pt@string}{1} \or \equal{\pt@string}{\half}}
          {\point@sing}{\point@plur}%
  \endgroup
}

Sie können mehrere Fälle (vier) innerhalb der Bedingung ifthenelsewie folgt erstellen

\renewcommand\points{%
  \begingroup
    \let\half=\relax
    \edef\pt@string{\@points}%
    \ifthenelse{\equal{\pt@string}{1} \OR \equal{\pt@string}{\half}}
    {\point@labelone}{%
    \ifthenelse{\equal{\pt@string}{2}}{\point@labeltwo}{%
    \ifthenelse{\equal{\pt@string}{3} \OR \equal{\pt@string}{3\half}%
    \OR \equal{\pt@string}{4} \OR \equal{\pt@string}{4\half}%
    \OR \equal{\pt@string}{5} \OR \equal{\pt@string}{5\half}%
    \OR \equal{\pt@string}{6} \OR \equal{\pt@string}{6\half}%
    \OR \equal{\pt@string}{7} \OR \equal{\pt@string}{7\half}%
    \OR \equal{\pt@string}{8} \OR \equal{\pt@string}{8\half}%
    \OR \equal{\pt@string}{9} \OR \equal{\pt@string}{9\half}%
    \OR \equal{\pt@string}{10}\OR \equal{\pt@string}{10\half}}
     {\point@labelthree}{\point@labelfour}}}
          %
  \endgroup
}

hier bekommen Sie, was Sie brauchen. Vielleicht gibt es einen kürzeren Weg, das zu tun.

Und Sie können es mit diesem MWE testen:

\documentclass[11pt]{exam}

\def\sample{What is the Pythagorean theorem}


\makeatletter
\newcommand\point@labelone{word-1}
\newcommand\point@labeltwo{word-2}
\newcommand\point@labelthree{word-3}
\newcommand\point@labelfour{word-4}


\renewcommand\points{%
  \begingroup
    \let\half=\relax
    \edef\pt@string{\@points}%
    \ifthenelse{\equal{\pt@string}{1} \OR \equal{\pt@string}{\half}}
    {\point@labelone}{%
    \ifthenelse{\equal{\pt@string}{2}}{\point@labeltwo}{%
    \ifthenelse{\equal{\pt@string}{3} \OR \equal{\pt@string}{3\half}%
    \OR \equal{\pt@string}{4} \OR \equal{\pt@string}{4\half}%
    \OR \equal{\pt@string}{5} \OR \equal{\pt@string}{5\half}%
    \OR \equal{\pt@string}{6} \OR \equal{\pt@string}{6\half}%
    \OR \equal{\pt@string}{7} \OR \equal{\pt@string}{7\half}%
    \OR \equal{\pt@string}{8} \OR \equal{\pt@string}{8\half}%
    \OR \equal{\pt@string}{9} \OR \equal{\pt@string}{9\half}%
    \OR \equal{\pt@string}{10}\OR \equal{\pt@string}{10\half}}
     {\point@labelthree}{\point@labelfour}}}
          %
  \endgroup
}

\makeatother

\pointformat{(\thepoints)}

\begin{document}

\begin{questions}

\question[\half] \sample

\question[1] \sample

\question[2] \sample

\question[4] \sample

\question[12] \sample

\end{questions}

\end{document}

Um \@pointsaus dem \thepointsMakro zu entfernen, falls ich die ursprüngliche Definition von Wort-1 und Wort-2 in exam.cls nicht finden kann \thepoints, können Sie mit einem Workaround die Definition mithilfe von ändern\pointformat

\documentclass[11pt]{exam}

\def\sample{What is the Pythagorean theorem}


\makeatletter
\newcommand\point@labelone{word-1}
\newcommand\point@labeltwo{word-2}
\newcommand\point@labelthree{word-3}
\newcommand\point@labelfour{word-4}


\renewcommand\points{%
  \begingroup
    \let\half=\relax
    \edef\pt@string{\@points}%
    \ifthenelse{\equal{\pt@string}{1} \OR \equal{\pt@string}{\half}}
    {\point@labelone}{%
    \ifthenelse{\equal{\pt@string}{2}}{\point@labeltwo}{%
    \ifthenelse{\equal{\pt@string}{3} \OR \equal{\pt@string}{3\half}%
    \OR \equal{\pt@string}{4} \OR \equal{\pt@string}{4\half}%
    \OR \equal{\pt@string}{5} \OR \equal{\pt@string}{5\half}%
    \OR \equal{\pt@string}{6} \OR \equal{\pt@string}{6\half}%
    \OR \equal{\pt@string}{7} \OR \equal{\pt@string}{7\half}%
    \OR \equal{\pt@string}{8} \OR \equal{\pt@string}{8\half}%
    \OR \equal{\pt@string}{9} \OR \equal{\pt@string}{9\half}%
    \OR \equal{\pt@string}{10}\OR \equal{\pt@string}{10\half}}
     {\point@labelthree}{\point@labelfour}}}
          %
  \endgroup
}

\renewcommand\thepoints{%
  \if@placepoints
    \if@bonus
      \@points \@bonuspointname 
    \else
    \let\half=\relax
    \edef\pt@string{\@points}%
    \ifthenelse{\equal{\pt@string}{1} \OR \equal{\pt@string}{\half}%
                                      \OR \equal{\pt@string}{2}}
    {\@pointname}{\@points \@pointname}
     \fi
  \fi
}% thepoints

\makeatother

\pointformat{(\thepoints)}

\begin{document}

\begin{questions}

\question[\half] \sample

\question[1] \sample

\question[2] \sample

\question[4] \sample

\question[12] \sample

\end{questions}

\end{document}

Wir erhalten:

Bildbeschreibung hier eingeben

verwandte Informationen