Skip to content

Commit

Permalink
Update the docs on display of fractions.
Browse files Browse the repository at this point in the history
  • Loading branch information
sangwinc committed Dec 28, 2024
1 parent 37049a9 commit ef0e527
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 10 additions & 2 deletions doc/en/Authoring/Question_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,23 @@ See the entry on [matrices](../CAS/Matrix.md#matrixparens).

### Inline and displayed fractions. ###

The display of fractions can take two forms: inline \( 1/x \) and displayed \( \frac{1}{x} \).
There are three ways to display fractions.

1. displayed \( \frac{1}{x} \);
2. inline \( 1/x \);
3. negative powers \( x^{-1} \).

The default behaviour is displayed, i.e. using LaTeX `\frac{}{}`.

The function `stack_disp_fractions(ex)` can be used to control the display.
The function `stack_disp_fractions(ex)` can be used to control the display globally within a question.

* `stack_disp_fractions("i")` switches display to inline.
* `stack_disp_fractions("d")` switches display to display.

Note, for CASText the display is controlled by the prevailing setting at the moment the text is displayed, not when a variable is defined in the question variables. Hence, if you would like a single inline fraction within a CASText you will need to use

Normally fractions are displayed {@1/x@}. This switches to inline {@(stack_disp_fractions("i"), 1/x)@}, which persists {@1/a@}. Switch explicitly back to displayed {@(stack_disp_fractions("d"),1/x)@}.

For scientific units we also have an input "extra option" `negpow` for student's input to be displayed as negative powers, e.g. \(m\,s^{-1}\).

We do not, currently, have support for global display of fractions using negative powers (Dec 2024). This is because the difference between displayed and inline fractions is purely notational, involving the TeX output from the division operator. Converting division to negative powers is a mathematical re-write rule and is therefore significantly more complicated. E.g. we would have to decide how to display \( \frac{1}{x^{-2}} \).
4 changes: 3 additions & 1 deletion doc/en/Topics/Units.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ Note, the input does not currently support a situation where you want to accept

The extra options to the input should be a comma separated list of tags. This input type makes use of the additional options in two ways:

1. Units can be displayed using inline fractions \(m/s\) or negative powers \(m\,s^{-1}\). Add `negpow` to the Extra Options field to use negative powers.
1. Units can be displayed using inline fractions \(\frac{m}{s}\) (by default fractions are displayed, not inline) or negative powers \(m\,s^{-1}\). Add `negpow` to the Extra Options field to use negative powers.

See the question options entry on [inline and displayed fractions](../Authoring/Question_options.md).

## Answer tests ##

Expand Down

0 comments on commit ef0e527

Please sign in to comment.