Skip to content

Commit

Permalink
Implement solution.
Browse files Browse the repository at this point in the history
  • Loading branch information
andres-gimenez committed Mar 8, 2024
1 parent 0b48aff commit 7b3d91f
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 1 deletion.
Binary file added examples/exam-006.pdf
Binary file not shown.
69 changes: 69 additions & 0 deletions examples/exam-006.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#import "../g-exam.typ": g-exam, g-question, g-subquestion, g-solution

#show: g-exam.with(
author: (
name: "Andrés Jorge Giménez Muñoz",
email: "[email protected]",
watermark: "Teacher: andres",
),
school: (
name: "Sunrise Secondary School",
logo: read("./logo.png", encoding: none),
),
exam-info: (
academic-period: "Academic year 2023/2024",
academic-level: "1º Secondary Education",
academic-subject: "Mathematics",
number: "2nd Assessment 1st Exam",
content: "Radicals and fractions",
model: "Model A"
),

languaje: "en",
decimal-separator: ",",
date: "November 21, 2023",
show-studen-data: "first-page",
show-grade-table: false,
question-point-position: right,
show-solution: true,
clarifications: "Answer the questions in the spaces provided. If you run out of room for an answer, continue on the back of the page."
)

#g-question[Given the equation $x^n + y^n = z^n$ for $(x,y,z)$ and $n$ positive integers.]
#g-subquestion(point: 10)[For what values of $n$ is the statement in the previous question true?]

#g-solution[
I know the demostration, but there's no room on the margin. For any clarification ask Andrew Whilst.
#v(1fr)
]

#g-subquestion(point: 10)[For $n=2$ there's a theorem with a special name. What's that name?

#g-solution[
Pythagorean theorem.
]
#v(1fr)
]


#g-subquestion(point: 10)[What famous mathematician had an elegant proof for this theorem but
there was not enough space in the margin to write it down?].
#v(1fr)

#g-question(point: 20)[Prove that the real part of all non-trivial zeros of the function $zeta(z) "is" 1/2$].

#g-solution(show-solution: true,
alternative-content: [#v(1fr)]
)[
I'm working on it. When I have the solution, I'll let you know.... \

#v(5pt)
]

#g-solution(show-solution: false,
alternative-content: [#v(1fr)]
)[
I'm working on it. When I have the solution, I'll let you know.... \

#v(5pt)
]
31 changes: 30 additions & 1 deletion g-exam.typ
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#let __g-question-point = state("g-question-point", 0)
#let __g-question-point-position-state = state("g-question-point-position", left)


#let __g-localization = state("localization")
#let __g-show-solution = state("g-show-solution", false)

#let __g-default-localization = (
grade-table-queston: "Question",
Expand Down Expand Up @@ -229,6 +229,29 @@
)
}

#let g-solution(
alternative-content: none,
show-solution: none,
body) = {
assert(alternative-content == none or type(alternative-content) == "content",
message: "Invalid alternative-content value")

assert(show-solution in (none, true, false),
message: "Invalid show-solution solution value")

locate(loc => {
let show-solution = if show-solution == none { __g-show-solution.final(loc) } else { show-solution }

if show-solution == true {
body
}
else {
alternative-content
}
}
)
}

#let __g-show_clarifications = (clarifications: none) => {
if clarifications != none {
let clarifications-content = []
Expand Down Expand Up @@ -302,6 +325,7 @@
show-grade-table: true,
decimal-separator: ".",
question-point-position: left,
show-solution: false,
body,
) = {

Expand All @@ -314,6 +338,9 @@
assert(decimal-separator in (".", ","),
message: "Invalid decimal separator")

assert(show-solution in (true, false),
message: "Invalid show solution value")

let __show-watermark = (
author: (
name: "",
Expand Down Expand Up @@ -585,6 +612,8 @@
)
v(10pt)
}

__g-show-solution.update(show-solution)

// show heading.where(level: 1): it => {
// set block(above: 1.2em, below: 1em)
Expand Down

0 comments on commit 7b3d91f

Please sign in to comment.