|
| 1 | +# Math_Single_Line |
| 2 | + |
| 3 | +This response area is very similar to [Text](Text.md), differing in that it can display how the user's response was interpreted back to them through the 'live preview' feature. This works using the grading function, providing a `feedback.response_latex` field, which gets rendered. |
| 4 | + |
| 5 | +## compareExpressions |
| 6 | +**Input Symbols** |
| 7 | + |
| 8 | +This is a powerful feature for defining a dictionary of accepted symbols. For each symbol, you define: |
| 9 | + |
| 10 | +* **Symbol:** The LaTeX-rendered symbol (e.g., `$f(x)$`). |
| 11 | +* **Code:** The machine-readable variable name (e.g., `fx`). This is what your students will type and what the evaluation function sees. |
| 12 | +* **Alternatives:** A list of other codes you want to accept for the same symbol (e.g., `f_x`, `f(x)`, `f`). This allows you to anticipate different ways students might type the same thing. |
| 13 | +* **Visibility:** A `TRUE`/`FALSE` toggle. If "Display input symbols" is enabled in the Input tab, this setting determines whether a specific symbol is shown to the student. This allows you to show students common symbols while still accepting less common or alternative ones in the background. |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +Tolerances can also be added. These will apply to the numerical parts of the answer (e.g. the $10$ in $10x$). |
| 19 | + |
| 20 | +This is done using the `atol` and `rtol` fields under the Evaluation Function Parameters section. |
| 21 | + |
| 22 | +## Component Parameters |
| 23 | + |
| 24 | +### `post_response_text` (optional) |
| 25 | + |
| 26 | +Text block to be displayed to the left of the input field. Markdown and LaTeX are allowed following the usual syntax. |
| 27 | + |
| 28 | +### `pre_response_text` (optional) |
| 29 | + |
| 30 | +Text block to be displayed to the left of the input field. Markdown and LaTeX are allowed following the usual syntax. |
| 31 | + |
| 32 | +### Enable Handwriting Input |
| 33 | + |
| 34 | +Enables a handwriting canvas in the browser, which allows a student to draw their expression, rather than type using Sympy's syntax. |
| 35 | + |
| 36 | +### Enable Photo Upload |
| 37 | + |
| 38 | +Allows a student to upload their expression as an image, as an alternative to handwriting if the student isn't using a phone or tablet. |
| 39 | + |
| 40 | +### Handwriting and Image Handling |
| 41 | +Handwriting and students photo uploads are handled with [MathPix](https://docs.mathpix.com/#request-parameters). |
| 42 | + |
| 43 | +Our default parameters include: |
| 44 | +- **formats**: `['text']` - Returns Mathpix Markdown text with math inside delimiters |
| 45 | +- **include_line_data**: `true` - Adds line-by-line data with geometric information about detected elements |
| 46 | +- **rm_spaces**: `true` - Omits spaces around LaTeX groups and other places where spaces are superfluous |
| 47 | +- **rm_fonts**: `true` - Omits `mathbb`, `mathbf`, `mathcal`, and `mathrm` font commands |
| 48 | +- **idiomatic_braces**: `true` - Returns more compact LaTeX (e.g., `x^2` instead of `x^{2}`) |
| 49 | +- **numbers_default_to_math**: `false` - Standalone numbers are treated as text, not automatically wrapped in math mode |
| 50 | +- **math_fonts_default_to_math**: `false` - Text with math fonts is not automatically converted to math mode |
| 51 | +- **math_inline_delimiters**: `['$', '$']` - Delimiters for inline math mode in text output |
| 52 | +- **math_display_delimiters**: `['$$', '$$']` - Delimiters for display/block math mode in text output |
| 53 | + |
| 54 | +## Setting The Answer |
| 55 | + |
| 56 | +Type the correct answer into the 'Response Area Answer' using standard syntax. As the student enters the answer, this will be rendered using the 'live preview' feature, to ensure the correct expression has been entered. |
| 57 | + |
| 58 | +Use the 'Response Area Preview' to check the answer has been set correctly. |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | +## Example Student Response area |
| 63 | + |
| 64 | +Correct response given |
| 65 | + |
| 66 | + |
| 67 | +Incorrect response given |
| 68 | + |
0 commit comments