Skip to content

Commit

Permalink
Improve documentation on subscripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
sangwinc committed Sep 19, 2024
1 parent a4765e4 commit 591c0b5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions doc/en/CAS/Subscripts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Atoms, subscripts and fine tuning the LaTeX display

Everything in Maxima is either an _atom_ or an _expression_. Atoms are either an integer number, float, string or a name. You can use the predicate `atom()` to decide if its argument is an atom. Expressions have an _operator_ and a list of _arguments_. Note that the underscore symbol is _not_ an operator. Thus `a_1` is an atom in maxima. Hence, the atoms `a1` and `a_1` are not considered to be algebraically equivalent. If you would like to consolidate subscripts in students' input see the documentation on [extra options](../Authoring/Inputs.md). Also note that since the underscore is not an operator, an expression such as `(a_b)_c` is not valid Maxima syntax, but `a_b_c` is a valid name for an atom.
Everything in Maxima is either an _atom_ or an _expression_. Atoms are either an integer number, float, string or a name. You can use the predicate `atom()` to decide if its argument is an atom. Expressions have an _operator_ and a list of _arguments_. Note that the underscore symbol is _not_ an operator. Thus `a_1` is an atom in maxima. Hence, the atoms `a1` and `a_1` are not considered to be algebraically equivalent. If you would like to consolidate subscripts in students' input see the documentation on the input option `consolidatesubscripts` in the [extra options](../Authoring/Inputs.md). Also note that since the underscore is not an operator, an expression such as `(a_b)_c` is not valid Maxima syntax, but `a_b_c` is a valid name for an atom.

You can change the TeX output for an atom with Maxima's `texput` command. E.g. `texput(blob, "\\diamond")` will display the atom `blob` as \( \diamond \). If you place `texput` commands in the question variables, this affects the display everywhere in the question including the inputs. E.g. if a student types in `blob` then the validation feedback should say something like "your last answer was: \( \diamond \)".

Expand Down Expand Up @@ -36,9 +36,10 @@ Below are some examples.

Notes

1. in the above examples three different expressions (atoms `A1`, `A_1` and the expression `A[1]`) generate the same tex code `A_{1}` \( A_{1}\), and so are indistinguishable at the display level.
2. The expression `x_t(1)` refers to the function `x_t` which is not an atom, and hence STACK's logic for displaying atoms with underscores does not apply (by design). If you want to display a function name including a subscript you can explicitly use, e.g. `texput(x_t, "x_t");` to control the display, this is just not done automatically.
3. When we split up atoms for display we have two separate atoms. E.g. `x_h` will be split into atoms `x` and `h` temporarily and the TeX display of `x` and `h` evaluated. For this reason, student's input will validate the parts of the subscript sparately. In particular, if `h` is a question variable and a student types in the atom `x_h` then since `h` is forbidden input the student's `x_h` will be invalid as well. This might cause problems, but these can be avoided when the teacher uses appropriate variable names.
1. The maxima atoms `A1` and `A_1` are different, and are _not_ algebraically equivalent. If student input is using both forms, and this causes problems, look at the documentation on `consolidatesubscripts` in the [extra options](../Authoring/Inputs.md).
2. in the above examples three different expressions (atoms `A1`, `A_1` and the expression `A[1]`) generate the same tex code `A_{1}` \( A_{1}\), and so are indistinguishable at the display level.
3. The expression `x_t(1)` refers to the function `x_t` which is not an atom, and hence STACK's logic for displaying atoms with underscores does not apply (by design). If you want to display a function name including a subscript you can explicitly use, e.g. `texput(x_t, "x_t");` to control the display, this is just not done automatically.
4. When we split up atoms for display we have two separate atoms. E.g. `x_h` will be split into atoms `x` and `h` temporarily and the TeX display of `x` and `h` evaluated. For this reason, student's input will validate the parts of the subscript sparately. In particular, if `h` is a question variable and a student types in the atom `x_h` then since `h` is forbidden input the student's `x_h` will be invalid as well. This might cause problems, but these can be avoided when the teacher uses appropriate variable names.

One situation where this design is not satisfactory is when you want to use both of the atoms `F` and `F_1` but with different display. For example `F` should display as \({\mathcal F}\) but `F_1` should display as \( F_1 \). Such a situation is not hard to imagine, as it is often considered good style to have things like \( F_1 \in {\mathcal F}\). The above design always splits up the atom `F_1` into `F` and `1`, so that the atom `F_1` will display as \({\mathcal F}_1\). (This is actually what you normally expect, especially with the Greek letter subscripts.) To avoid this problem the logic which splits up atoms containing an underscore checks the texput properties list. If an entry has been made for a specific atom then STACK's display logic uses the entry, and does not split an atom over the underscore. In the above example, use the following texput commands.

Expand Down

0 comments on commit 591c0b5

Please sign in to comment.