File: source.tex

package info (click to toggle)
auto-multiple-choice 1.7.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 92,612 kB
  • sloc: perl: 26,752; xml: 24,889; cpp: 1,997; python: 895; makefile: 569; sh: 233; ansic: 195
file content (96 lines) | stat: -rw-r--r-- 2,137 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{math}
\usepackage{pgffor}
\usepackage[indivanswers,completemulti]{automultiplechoice}
\usepackage{multicol}
\begin{document}

\setdefaultgroupmode{withoutreplacement}

\element{questions}{
  \begin{question}{simple}
    Just a simple test question.
    
    \begin{choices}
      {
        \correctchoice{correct}
        \wrongchoice{wrong A}
        \wrongchoice{wrong B}
        \wrongchoice{wrong C}
      }
      \lastchoices
      {
        \wrongchoice{final wrong answer}
      }
    \end{choices}
  \end{question}
}

\ExplSyntaxOn
\cs_new:Npn \amc_between:Nnn #1#2#3 {#1{\emph{between}~#2~and~#3.}}
\cs_generate_variant:Nn \amc_between:Nnn { Nxx }
\cs_new_eq:NN \betweenAnd \amc_between:Nxx
\ExplSyntaxOff

\element{questions}{
  \begin{question}{formixed}
    The value of $\pi$ is
    \begin{multicols}{3}
      \begin{choices}
        \foreach \ans in {0,1,...,5} {
          \tikzmath{
            integer \rightbound;
            \rightbound = \ans + 1;
          }
          \ifnum\ans=3
          \betweenAnd{\correctchoice}{\ans}{\rightbound}
          \else
          \betweenAnd{\wrongchoice}{\ans}{\rightbound}
          \fi
        }
      \end{choices}
    \end{multicols}
  \end{question}
}

\element{questions}{
  \begin{question}{forordered}
    The value of $\pi^2$ is
    \begin{multicols}{3}
      \begin{choices}[o]
        \foreach \ans in {1,2,...,9} {
          \tikzmath{
            integer \rightbound;
            \rightbound = \ans + 1;
          }
          \ifnum\ans=9
            \correctchoice{\emph{between} \ans{} and \rightbound{}.}
          \else
            \wrongchoice{\emph{between} \ans{} and \rightbound{}.}
          \fi
        }
      \end{choices}
    \end{multicols}
  \end{question}
}

\element{questions}{
  \begin{questionmult}{positive}
    Choose all positive numbers:
    \begin{choices}
      \correctchoice{4}
      \correctchoice{$4-\pi$}
      \wrongchoice{-1}
      \wrongchoice{0}
    \end{choices}
  \end{questionmult}
}

\begin{copieexamen}[10]

  \insertgroup{questions}

\end{copieexamen}

\end{document}