단수형 및 복수형보다 더 많은 형태에 대해 시험 수업에서 \pointpoints 사용자 정의

단수형 및 복수형보다 더 많은 형태에 대해 시험 수업에서 \pointpoints 사용자 정의

다른 사람과 함께 게시한 문제를 여기에 다시 보냅니다. 시험 클래스의 \pointname 재정의

시험 클래스의 ''\thepoints'' 명령 사용자 정의와 관련된 문제가 있습니다. Exam.cls의 ''\thepoints'' 명령은 문제에 대해 점수가 지정된 경우 항상 ``@points @pointname''으로 대체됩니다. (@points는 포인트 항목이고 @pointname은 포인트 이름입니다.

이 포인트 이름은 ''\pointpoints{point}{points}'' 명령으로 정의됩니다. 여기서 '\pointname'은 @points=1 또는=1/2(단수)인 경우 ''point''로 대체되고 ' @points > 1(복수)인 경우 'points''입니다.

2개 이상의 경우가 있을 수 있는 다른 언어(특히 아랍어)에 대해 '\thepoints' 명령을 사용자 정의하고 싶습니다. 예를 들어 4개의 경우: '@points=1 or=1/2', '@points=2', ' 3<=@points<=10' 및 '@points>10').

그러면 '@pointname'에는 {WORD_1, WORD_2, WORD_3, WORD_4}와 같은 4개의 서로 다른 값 이름이 있습니다.

그래서 "\thepoints"를 다음과 같이 대체하는 매크로를 작성하고 싶습니다.

  • '@points=1 or=1/2''인 경우 "WORD_1"(@points는 여기에 기록되지 않습니다...)
  • '@points=2'인 경우 "WORD_2"(@points는 여기에도 기록되지 않습니다...)
  • "@points WORD_3" if '3<= @points <=10' (여기서 @points 값을 씁니다...)
  • '@points >10'인 경우 "@points WORD_4"(여기서 @points도 여기에 써야 합니다...)

보다 정확하게는 예를 들어 다음 명령을 원합니다.

\question[1]은 다음을 제공합니다: 질문(WORD_1)

\question[2]는 다음을 제공합니다: 질문(WORD_2)

\question[8]은 다음을 제공합니다: 질문(8 WORD_3)

\question[14] 는 다음을 제공합니다: 질문(14 WORD_4)

답변1

\pointsExam.cls의 매크로 정의는 다음과 같습니다.

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

ifthenelse이렇게 조건부 안에 더 많은 케이스(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
}

여기에서 필요한 것을 얻습니다. 아마도 그렇게 하는 더 짧은 방법이 있을 것입니다.

다음 MWE로 테스트할 수 있습니다.

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

\@points단어-1 및 단어-2의 경우 매크로 에서 제거하려면 Exam.cls에서 \thepoints원래 정의를 찾을 수 없습니다 \thepoints. 해결 방법을 사용하면 다음의 도움으로 정의를 변경할 수 있습니다.\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}

우리는 다음을 얻습니다:

여기에 이미지 설명을 입력하세요

관련 정보