Compare two revisions of: List of commands

... ... @@ -1,15 +1,140 @@
1 +{{TOC}}
1 2
2 -coming soon ...
3 +A consolidated reference of commands, including ones not listed anywhere else on this wiki.
3 4
5 +<div class="alert">
6 +This list can go stale. If a command you need isn't listed, or something here looks wrong, check
7 +the wiki page for that topic (linked below where available) before assuming it doesn't exist.
8 +</div>
4 9
5 -text commandos in text-umgebung generic problem
6 -(siehe https://team.mumie.net/projects/support/wiki/The_list_of_commands )
10 +<!--
11 +Developer note: this list was cross-checked against the actual mumie source
12 +(jmmtex/jmmtex_mumie, mathletfactory_core/_lib) rather than just against example files - examples
13 +only show what happens to be used, never what's missing or what doesn't exist. Argument counts and
14 +optional-argument defaults were taken directly from each command's definition in
15 +genericproblem.tex/problemutil.tex.
16 +-->
7 17
8 -funktionelle Kommandos in generic problem
9 -(wie \number \randadjustIf, \earlierAnswer)
18 +For worked examples and explanations, see the topic-specific pages: [input.fields.md](input.fields.md),
19 +[number-fields.md](number-fields.md), [Variables.md](Variables.md), [Answer-types.md](Answer-types.md),
20 +[Feedback-and-Explanations.md](Feedback-and-Explanations.md), [Randomquestionpool.md](Randomquestionpool.md),
21 +[mc.questions.md](mc.questions.md), [JSX-Visualizations.md](JSX-Visualizations.md).
10 22
11 -funktionelle Kommandos in generic visualisation
12 -(wie \parametricCurve ...)
23 +# Authoring commands for problems
13 24
25 +`Args` is the number of mandatory arguments; `Optional default` (if present) is what an omitted
26 +optional first argument defaults to.
14 27
28 +| Command | Args | Optional default | Notes |
29 +|---|---|---|---|
30 +| `\allMustBeCorrect` | 0 | - | Requires every answer in the question to be correct for any credit to be given at all. |
31 +| `\allowForConditionInput{...}` | 2 | `[true]` | Same as `\allowForInput`, but for the input used in an explanation condition rather than the main answer. |
32 +| `\allowForInput{symbols}` | 2 | `[true]` | Extends or restricts which symbols the student may type, e.g. `\allowForInput{+ - * / pi}` to permit π. Without it, only plain digits are accepted. |
33 +| `\allowIntervalUnionsForInput` | 1 | `[true]` | Lets the student's answer be a union of several disjoint intervals instead of just one. See [Interval.md](Interval.md). |
34 +| `\assertion{...}` | 1 | - | Declares a boolean expression as a named assertion for later reference, similar in spirit to `\condition`. |
35 +| `\checkAsFunction{var(s)}{min}{max}{steps}` | 4 | `[epsilon]` default `1e-8` | Grades a function/interval answer by comparing it numerically to the solution at random points. `var(s)` accepts a comma-separated list for multivariate functions - see [input.fields.md](input.fields.md#1-checkasfunction). |
36 +| `\checkCorrect{relation}` | 1 | - | Grades the answer as correct if the given relation (e.g. an equation between variables) holds; preferred over the deprecated `\iscorrect`. |
37 +| `\checkFuncForZero{...}{min}{max}{steps}` | 4 | `[epsilon]` default `1e-8` | Like `\checkAsFunction`, but checks that an expression evaluates to zero rather than comparing two functions. |
38 +| `\checkMatrixForZero{...}{min}{max}{steps}` | 4 | `[epsilon]` default `1e-8` | Matrix counterpart of `\checkFuncForZero` - checks that every entry of a matrix expression evaluates to zero. |
39 +| `\checkStringsForRelation{...}{...}` | 2 | `[]` | Grades a text/string answer by checking whether it satisfies a given relation to the solution. |
40 +| `\chooseRandomPools{...}` | 1 | - | Picks a random subset of the listed question pools to actually present to the student. |
41 +| `\columnTitle{...}` / `\rowTitle{...}` | 1 each | - | Labels a column or row header in an `mc.matrix` question. |
42 +| `\condition` | 0 (used as a value) | - | Placeholder used inside a condition expression to refer to the surrounding condition itself. |
43 +| `\consecutivequestions{...}{...}{...}` | 3 | - | Chains several questions so they must be answered one after another rather than freely. |
44 +| `\derivative{name}{fn}{var}` | 4 | `[]` | Defines a variable as the derivative of function `fn` with respect to `var`. The 4th (optional-looking) argument is actually mandatory - check a working example before using it. |
45 +| `\drawFromSet{name}{set}` | 3 | `[type=number separator=,]` | Randomly picks one value from a given set into a variable. The default is numeric - pass `[type=string]` for symbols/strings. |
46 +| `\duration{...}{...}` | 2 | `[]` | Sets a time limit for a question or problem. |
47 +| `\earlierAnswer{...}{...}` | 2 | - | Refers back to an answer given in an earlier question, e.g. for consecutive/follow-up questions. |
48 +| `\embedmathlet{name}` | 1 | - | Embeds the interactive applet for the problem; required at the end of `\begin{content}`. |
49 +| `\explanation{...}` | 1 or 2 | - | Shows feedback text to the student depending on their answer. The 2-arg form takes an optional condition as arg 1: `\explanation[condition]{text}` - see [Feedback-and-Explanations.md](Feedback-and-Explanations.md). |
50 +| `\field{field}` | 1 | - | Sets the number field (real, rational, complex, ...) variables and answers are interpreted in - see [Valid `\field` values](#valid-field-values) below. |
51 +| `\followupQuestion{...}{...}` | 2 | `[1=1]` | Makes a question only appear depending on how an earlier question was answered. |
52 +| `\format{...}{...}` | 2 | - | Sets the display format of a matrix answer field; only valid inside `\begin{answer}` together with `\matrixType`. |
53 +| `\function{name}{expr}` | 2 or 3 | `[replace]` (3-arg form) | Defines a variable holding an algebraic expression, optionally transformed (`calculate`, `normalize`, `expand`, `derivative`, `substitute`, `sort`). `expr` must always be a pure arithmetic expression, never a relation (`=`, `<`, `>`) - see [Function.md](Function.md) for the full syntax and gotchas (e.g. `\var{}` never simplifies signs, use `[normalize]` for that). |
54 +| `\functionNormalize{...}{...}` | 2 | `[true]` | Shorthand for normalizing a function expression into a canonical algebraic form; see the `[normalize]` note on `\function` above. |
55 +| `\inputAsFunction{vars}{name}` | 2 | - | Names a multivariate function input for later reference (e.g. in `\checkStringsForRelation`). |
56 +| `\inputAsMatrix{vars}{name}` | 2 | - | Matrix counterpart of `\inputAsFunction` - names a matrix input for later reference. |
57 +| `\inputAsString{name}` | 1 | - | Names a text input for later reference, analogous to `\inputAsFunction`. |
58 +| `\iscorrect{lhs}{rel}{rhs}` | 3 | - | Older form of `\checkCorrect`; deprecated, use `\checkCorrect` instead. |
59 +| `\levelrepeatable` | 0 | - | Allows a difficulty level of the problem to be repeated rather than always advancing. |
60 +| `\levelthreshold{...}` | 1 | - | Sets the score threshold needed to advance to the next difficulty level. |
61 +| `\matrix{...}...` / `\pmatrix{...}...` / `\rowVector{...}...` | 3 | `[replace]` | Defines a matrix (or row-vector) variable, optionally computed from other matrices. See [Matrix-Variables.md](Matrix-Variables.md). |
62 +| `\matrixType{...}` | 1 | - | Sets the display type (e.g. brackets style) for a matrix answer field, used together with `\format`. |
63 +| `\MCScoreType{...}{...}` | 2 | `[]` | Configures how partial credit is computed for a multiple-choice question. |
64 +| `\number{name}{value}` | 2 | - | Defines a fixed (non-random) numeric variable. |
65 +| `\partialScore{...}{...}` | 2 | - | Awards partial credit for an answer that is only partly correct. |
66 +| `\permutechoices{begin}{end}` | 4 | `[2{}{}]` | Randomly shuffles the order of multiple-choice options between the given indices. Optional `[n][mandatory indices]` form pins some options in place - see [mc.questions.md](mc.questions.md). |
67 +| `\permutecolumns{...}{...}` | 2 | - | Randomly shuffles the columns of an `mc.matrix` question. |
68 +| `\permuterows{...}{...}` | 2 | - | Randomly shuffles the rows of an `mc.matrix` question. |
69 +| `\precision{...}{...}` / `\correctorprecision{...}{...}` / `\displayprecision{...}` | 2/2/1 | `[atleast]` for the first two | Controls how many decimal digits are shown to the student vs. required for a correct match - see [number-fields.md](number-fields.md). |
70 +| `\randadjust{vars}{script}` | 2 | - | Post-processes one or more random variables with a small script after they are drawn, e.g. to enforce a relationship between them. |
71 +| `\randadjustIf{vars}{condition}` | 2 | - | Re-draws random variables until a given condition on them is satisfied. |
72 +| `\randdouble{name}{min}{max}` | 3 | - | Draws a random decimal number between `min` and `max` into a variable. |
73 +| `\randint{name}{min}{max}` | 3 | `[4][z]` variant excludes 0 | Draws a random integer between `min` and `max` into a variable; the `[z]` variant excludes 0. |
74 +| `\randomquestionpool{...}{...}` | 2 | - | Presents one randomly chosen question out of a pool of equivalent questions - see [Randomquestionpool.md](Randomquestionpool.md). |
75 +| `\randrat{name}{...}{...}{...}{...}` | 5 | - | Draws a random rational number (fraction) into a variable, with bounds on numerator/denominator. |
76 +| `\relation{...}{...}{...}` | 3 | - | Defines a relation (e.g. `<`, `=`, `>`) between two expressions for use in grading or conditions. |
77 +| `\score{points}` | 2 | `[false]` | Sets the maximum score/points value for a question. |
78 +| `\scoreNotCanceledDown{...}` | 1 | - | For rational-field answers: still awards points if the student's fraction is mathematically correct but not fully canceled down. |
79 +| `\setRandomOne{...}{...}` | 2 | - | Randomly activates exactly one of several alternative blocks. |
80 +| `\showExplanation{always}` | 1 | - | Question-level only; makes explanations show even when the answer was correct, not just when it's wrong. |
81 +| `\showQuestionLabels{...}` | 1 | - | Controls whether automatic question numbering/labels are shown. |
82 +| `\showScore` | 0 | - | Displays the achieved score to the student after correction. |
83 +| `\solution{var}` or `\solution{var1,var2,...}` | 1 | - | Declares the correct-answer variable(s) for an answer field. A comma-separated list is used for `input.finite-number-set` (no separate set-building command exists). |
84 +| `\string{name}{value}` | 2 | - | Defines a fixed text/string variable. |
85 +| `\substitute{...}...` | 5 | `[]` | Defines a variable as another expression with one variable substituted by a value or sub-expression. |
86 +| `\text{...}` | 1 or 2 | - | The visible question/answer text shown to the student; exactly one `\text` per `\lang`/block. |
87 +| `\type{type}` | 1 | - | Sets the answer type (e.g. `input.number`, `mc.unique`, ...) for an answer block - see [Valid `\type` values](#valid-type-values) below. |
88 +| `\usedVars{...}` | 1 | - | Marks which variables were actually used/referenced, e.g. to avoid an "unused variable" warning. |
89 +| `\YesNoLabel{yes}{no}` | 3 | `[]` | Sets custom labels for the yes/no options of an `mc.yesno` question. |
15 90
91 +# Valid `\type{}` values
92 +
93 +Complete list (17):
94 +
95 +```
96 +draganddrop, graphics.function, graphics.matrix, graphics.number, input.cases.function,
97 +input.finite-number-set, input.function, input.generic, input.interval, input.matrix, input.number,
98 +input.text, input.truth-table, mc.matrix, mc.multiple, mc.unique, mc.yesno
99 +```
100 +
101 +`input.generic` is a question-level "container" type used when one question has several
102 +`\begin{answer}` blocks with *different* concrete types - each individual answer block then
103 +carries its own concrete `\type`.
104 +
105 +There is no `input.set` or `input.finite-set` - the real value is `input.finite-number-set`, and
106 +it needs no dedicated check command at all: `\solution{var1,var2,...}` with individually-defined
107 +variables is sufficient.
108 +
109 +# Valid `\field{}` values
110 +
111 +```
112 +real, rational, integer, complex, complex-rational, opnumber
113 +```
114 +
115 +Plus the calculation-only `op-*` variants (`op-double`, `op-rational`, `op-complex`,
116 +`op-complex-rational`, `op-integer`) for computed op-number expressions - not typically used as a
117 +typed answer field. See [number-fields.md](number-fields.md) for details and caveats per field.
118 +
119 +# Valid comparison / check functions
120 +
121 +```
122 +equal, equalChoice, equalFormat, equalString, equalTrimmedString, equalIgnoreCaseString,
123 +answerEqual, answerExactMatch
124 +```
125 +
126 +`equalChoice` works **only** for `mc.unique`/`mc.yesno`/`mc.multiple` (choice-index comparison) -
127 +it does not generalize to other `\type` values.
128 +
129 +# Visualization commands
130 +
131 +A separate command family for interactive geometry/graphing visualizations (JSXGraph/CindyJS-backed):
132 +`\point`, `\line`, `\circle`, `\segment`, `\vector`, `\polygon`, `\slider`, `\plot`, and a
133 +visualization-specific 4-argument `\function` overload (distinct from the problem-authoring
134 +`\function` above). See [JSX-Visualizations.md](JSX-Visualizations.md) and [CindyJS.md](CindyJS.md)
135 +for the full picture.
136 +
137 +One command worth calling out explicitly: `\set{name}{definition}{style}{bool}` (4 arguments) is a
138 +real command, but it defines a geometric set/locus object **inside a visualization** - it has no
139 +relationship to solution-set answers in problems (for those, use `\type{input.finite-number-set}`
140 +with `\solution{var1,var2,...}`).
16 141