Skip to content

Commit

Permalink
Add in a function to replace displayed LaTeX with inline.
Browse files Browse the repository at this point in the history
  • Loading branch information
sangwinc committed Oct 28, 2023
1 parent 20c63e0 commit 5713dca
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
3 changes: 0 additions & 3 deletions doc/en/Topics/Parsons.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,3 @@ The _Input type_ field should be **String**. The _Model answer_ field should be

TODO




13 changes: 12 additions & 1 deletion doc/en/Topics/Proof.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,20 @@ A discussion of [_Practical Online Assessment of Mathematical Proof_](https://ww

Colleagues assessing proof might also consider [semi-automatic marking](../Moodle/Semi-automatic_Marking.md) and using [Parson's problems](Parsons.md).

## Representation of text-based proof

STACK provides libraries to represent and manage lines of a text-based proof. The goals are

* to manage strings forming part of a traditional written proof;
* to represent the macro structure of a proof, arranged into nested blocks;
* to separate the text of the proof from choices of how to display a proof;
* to provide teachers with tools to assess students' attempts at [Parson's problems](Parsons.md).

The goals do not include automatic proof checking.

## Styles

From STACK 4.3 we support the following CSS styles to enable consistent display of mathematical proof, and arguments in general. General style was also introduced with the [HELM](../Reference/HELM.md) materials.
We support the following CSS styles to enable consistent display of mathematical proof, and arguments in general. General style was also introduced with the [HELM](../Reference/HELM.md) materials.

### `<div class="proof">`

Expand Down
10 changes: 9 additions & 1 deletion stack/maxima/contrib/prooflib.mac
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@

stack_include("https://raw.githubusercontent.com/maths/moodle-qtype_stack/proof-builder/stack/maxima/contrib/prooflib.mac");
stack_include("https://raw.githubusercontent.com/maths/moodle-qtype_stack/proof-builder/stack/maxima/proofsamples/odd-squaredodd.mac");

(For local testing: stack_include("contribl://prooflib.mac");)

tap:ev(proof_disp_replacesteps(proof_ans, proof_steps), map(lambda([ex], ex=dispproof), proof_types));

{@thm@}
Expand Down Expand Up @@ -162,7 +165,6 @@ proof_one_distrib(ex):= block([_a,_i,_l],

proof_ensure_list(ex):= if listp(ex) then return(ex) else return([ex]);


s_test_case(proof_alternatives(proof(A,B,C,D)), [proof(A,B,C,D)]);
s_test_case(proof_alternatives(proof_c(A,B)), [proof_c(A,B),proof_c(B,A)]);
s_test_case(proof_alternatives(proof_ind(A,B,C,D)), [proof_ind(A,B,C,D),proof_ind(A,C,B,D)]);
Expand Down Expand Up @@ -212,6 +214,12 @@ proof_steps_sub(ex, pf):= block(
apply(op(ex), map(lambda([ex2], proof_steps_sub(ex2, pf)), args(ex)))
);

/**
* Replace displayed LaTeX mathematics delimiters with inline.
*/
proof_inline_maths(st) := ssubst("\\)", "\\]", ssubst("\\(", "\\[", st));
s_test_case(proof_inline_maths("\\[ 3 = 2^{\\frac{p}{q}}\\]"), "\\( 3 = 2^{\\frac{p}{q}}\\)");

/* Make use of the existing styles. See https://docs.stack-assessment.org/en/Topics/Proof/ */
dispproof([ex]) := block([ex1],
apply(sconcat, flatten(append(["<div class=\"proof-block\">"], [simplode(ex, "<br/>")], ["</div>"])))
Expand Down

0 comments on commit 5713dca

Please sign in to comment.