Skip to content

Allow semantic wrappers around matrix TeX - #1852

Closed
adamant-pwn wants to merge 1 commit into
maths:iss1848from
adamant-pwn:codex/semantic-notation-hooks
Closed

Allow semantic wrappers around matrix TeX#1852
adamant-pwn wants to merge 1 commit into
maths:iss1848from
adamant-pwn:codex/semantic-notation-hooks

Conversation

@adamant-pwn

Copy link
Copy Markdown

Summary

  • Extend stack_matrix_disp(m) with an optional TeX wrapper argument.
  • With stack_matrix_disp(m, "\\stackmatrix"), emit \stackmatrix{left}{right}{array}.
  • Carry the question's configured delimiters as the first two arguments and use dots for invisible delimiters.
  • Preserve the existing one-argument output exactly.

Motivation

This provides a small platform-neutral hook for late-bound notation. A wrapper can use the first two arguments as the question's configured fallback or ignore them in favour of another presentation. Different wrappers can distinguish semantic matrices, column vectors and row vectors without making STACK inspect Moodle course context or changing compilation, grading or input syntax.

This PR only changes the TeX emitted when an author opts in; it does not install or order wrapper definitions. The ordinary one-argument call remains unchanged.

The corresponding HTML-input distinction remains in #1848. A TeX wrapper cannot restyle STACK's ordinary HTML input grid.

The shared-question use case has also been discussed in #1327 and MathJax #3603.

Verification

  • Focused Maxima execution covers square, round, curly, vertical-bar and invisible delimiters and confirms unchanged one-argument output.
  • Added data-driven CASText tests for all five delimiter values.
  • PHP syntax and git diff --check pass.

Extend stack_matrix_disp with an optional TeX command. When present, pass the configured left and right delimiters and the delimiter-free array as three arguments so a surrounding renderer can override presentation while retaining per-question fallbacks. Preserve one-argument output exactly and document and test all five delimiter settings.
@adamant-pwn

Copy link
Copy Markdown
Author

Closing this for now. The optional wrapper is only useful for our intended case once STACK can provide a stable default command that may be overridden by the surrounding context. Without that part, this adds author-facing API without delivering the complete mechanism. I’ll retain the prototype and revisit it with a complete proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant