Skip to content

Commit

Permalink
Include point-position in question.
Browse files Browse the repository at this point in the history
  • Loading branch information
andres-gimenez committed Mar 1, 2024
1 parent 80606b8 commit 212fab4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 26 deletions.
Binary file modified examples/exam-points-position.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/exam-points-position.typ
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,6 @@

#g-question(point: 1)[Question 2]

#g-question(point: 1.5, point-position: left)[Question 3]
#g-question(point: 1.6, point-position: right)[Question 3]

#g-question()[Question 4]
31 changes: 6 additions & 25 deletions g-exam.typ
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@
body) = {
assert(point-position in (none, left, right),
message: "Invalid point position")
let __g-question-point-position = state("__g-question-point-position", none)

__g-question-number.step(level: 1)

Expand All @@ -137,19 +136,9 @@
})

locate(loc => {
if __g-question-point-position == none {
__g-question-point-position.push(__g-question-point-position-state.final(loc))
}
if point != 0 and __g-question-point-position == none {
__g-question-point-position.push(left)
let __g-question-point-position = __g-question-point-position-state.final(loc)

[kddffddekk #__g-question-point-position -----]
}

[kkk #__g-question-point-position -----]

if __g-question-point-position == left {
[bb]
v(0.1em)
{
__g-question-number.display(__g-question-numbering)
Expand All @@ -169,10 +158,9 @@
__g-paint-tab(point: point, loc: loc))
}
__g-question-number.display(__g-question-numbering)
body
body
}
else {
[ccc]
v(0.1em)
__g-question-number.display(__g-question-numbering)
body
Expand All @@ -187,23 +175,16 @@

assert(point-position in (none, left, right),
message: "Invalid point position")
let __g-question-point-position = point-position


__g-question-number.step(level: 2)

let subg-question-point = 0
if point != none { subg-question-point = point }
__g-question-point.update(p => p + subg-question-point )


locate(loc => {
if __g-question-point-position == none {
let __g-question-point-position = __g-question-point-position-state.final(loc)
}
if point != 0 and __g-question-point-position == none {
let __g-question-point-position = left
}

let __g-question-point-position = __g-question-point-position-state.final(loc)

if __g-question-point-position == left {
v(0.1em)
{
Expand Down Expand Up @@ -321,7 +302,7 @@
assert(show-studen-data in (none, true, false, "first-page", "odd-pages"),
message: "Invalid show studen data")

assert(question-point-position in (none, left, right),
assert(question-point-position in (left, right),
message: "Invalid question point position")

assert(decimal-separator in (".", ","),
Expand Down

0 comments on commit 212fab4

Please sign in to comment.