Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/MatheSchool/typst-g-exam
Browse files Browse the repository at this point in the history
…into develop
  • Loading branch information
andres-gimenez committed Oct 8, 2024
2 parents a389da5 + daf2c36 commit 8b1ac4e
Show file tree
Hide file tree
Showing 6 changed files with 215 additions and 114 deletions.
28 changes: 21 additions & 7 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: typst-community/setup-typst@v3
with:
typst-version: latest
# - uses: typst-community/setup-typst@v3
# with:
# typst-version: latest

- name: Delete samples and test
run: |
Expand All @@ -33,11 +33,16 @@ jobs:
echo "file_list_examples=$file_list_examples" >> $GITHUB_OUTPUT
- name: Compile Typst examples to PDF
uses: ammar-ahmed22/compile-typst-action@v1
uses: mkpoli/compile-typst-action@main
with:
source_paths: ${{ steps.file-list-examples.outputs.file_list_examples }}
root_path: '.'

# - name: Compile Typst examples to PDF
# uses: lvignoli/typst-action@v0
# with:
# source_file: ${{ steps.file-list-examples.outputs.file_list_examples }}

- name: List Files test
id: file-list-test
shell: bash
Expand All @@ -48,20 +53,29 @@ jobs:
echo "file_list_test=$file_list_test" >> $GITHUB_OUTPUT
- name: Compile Typst test to PDF
uses: ammar-ahmed22/compile-typst-action@v1
uses: mkpoli/compile-typst-action@main
with:
source_paths: ${{ steps.file-list-test.outputs.file_list_test }}
root_path: '.'
# - name: Compile Typst test to PDF
# uses: lvignoli/typst-action@v0
# with:
# source_file: ${{ steps.file-list-test.outputs.file_list_test }}

- name: Delete Doc
run: |
rm -rf ./manual/*.pdf
- name: Compile documentation to PDF
uses: ammar-ahmed22/compile-typst-action@v1
uses: lvignoli/typst-action@v0
with:
source_paths: "manual/g-exam-manual.typ"
root_path: '.'
root_path: '.'

# - name: Compile documentation to PDF
# uses: lvignoli/typst-action@v0
# with:
# source_file: "manual/g-exam-manual.typ"

- name: Upload examples PDF file
uses: actions/upload-artifact@v3
Expand Down
85 changes: 85 additions & 0 deletions docs/pages/exams/exams.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
layout: default
title: Exams
nav_order: 4
has_children: true
has_toc: false # on by default
nav_exclude: false
---
# Exams create

Exams create


[![Example LaTex Mit template](assets/exam-latexmit-example.png){: width="450" }](../assets/exam-latexmit-example.pdf)

<!-- [Download pdf LaTex Mit template](assets/exam-latexmit-example.pdf) -->

[Edit example in typst.app](https://typst.app/project/rRYcxOVDv6fubPsGL0m43B)


<!-- {% highlight typ %}
#import "@preview/g-exam:0.4.0": *
#show: g-exam.with(
author: (
name: "Ferdinand Eisenstein",
email: "[email protected]",
watermark: "Teacher: Ferdinand",
),
{% endhighlight %} -->

```python
#import "@preview/g-exam:0.4.0": *

#show: g-exam.with(
author: (
name: "Ferdinand Eisenstein",
email: "[email protected]",
watermark: "Teacher: Ferdinand",
),
```

```typst
#import "@preview/g-exam:0.4.0": *
#show: g-exam.with(
author: (
name: "Ferdinand Eisenstein",
email: "[email protected]",
watermark: "Teacher: Ferdinand",
),
school: (
name: "Sunrise Secondary School",
logo: read("./logo.png", encoding: none),
),
exam-info: (
academic-period: "Academic year 2023/2024",
academic-level: "1st Secondary Education",
academic-subject: "Mathematics",
number: "2nd Assessment 1st Exam",
content: "Radicals and fractions",
model: "Model A"
),
language: "en",
decimal-separator: ",",
date: "November 21, 2023",
show-student-data: "first-page",
show-grade-table: false,
question-points-position: left,
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[Is it true that $x^n + y^n = z^n$ if $(x,y,z)$ and $n$ are positive integers?. Explain.]
#v(1fr)
#g-question[Prove that the real part of all non-trivial zeros of the function $zeta(z) "is" 1/2$].
#v(1fr)
#g-question[Compute
$ integral_0^infinity (sin(x))/x $
]
#v(1fr)
```
86 changes: 86 additions & 0 deletions docs/pages/exams/grade-table.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
layout: default
title: Grade table
nav_order: 2
parent: Exams
has_children: true
has_toc: false # on by default
nav_exclude: false
---
# Grade table

Grade table in exam.


[![Example LaTex Mit template](assets/exam-latexmit-example.png){: width="450" }](../assets/exam-latexmit-example.pdf)

<!-- [Download pdf LaTex Mit template](assets/exam-latexmit-example.pdf) -->

[Edit example in typst.app](https://typst.app/project/rRYcxOVDv6fubPsGL0m43B)


<!-- {% highlight typ %}
#import "@preview/g-exam:0.4.0": *
#show: g-exam.with(
author: (
name: "Ferdinand Eisenstein",
email: "[email protected]",
watermark: "Teacher: Ferdinand",
),
{% endhighlight %} -->

```python
#import "@preview/g-exam:0.4.0": *

#show: g-exam.with(
author: (
name: "Ferdinand Eisenstein",
email: "[email protected]",
watermark: "Teacher: Ferdinand",
),
```

```typst
#import "@preview/g-exam:0.4.0": *
#show: g-exam.with(
author: (
name: "Ferdinand Eisenstein",
email: "[email protected]",
watermark: "Teacher: Ferdinand",
),
school: (
name: "Sunrise Secondary School",
logo: read("./logo.png", encoding: none),
),
exam-info: (
academic-period: "Academic year 2023/2024",
academic-level: "1st Secondary Education",
academic-subject: "Mathematics",
number: "2nd Assessment 1st Exam",
content: "Radicals and fractions",
model: "Model A"
),
language: "en",
decimal-separator: ",",
date: "November 21, 2023",
show-student-data: "first-page",
show-grade-table: false,
question-points-position: left,
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[Is it true that $x^n + y^n = z^n$ if $(x,y,z)$ and $n$ are positive integers?. Explain.]
#v(1fr)
#g-question[Prove that the real part of all non-trivial zeros of the function $zeta(z) "is" 1/2$].
#v(1fr)
#g-question[Compute
$ integral_0^infinity (sin(x))/x $
]
#v(1fr)
```
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
layout: default
title: Student data
nav_order: 3
nav_order: 1
parent: Exams
has_children: true
has_toc: false # on by default
nav_exclude: false
Expand Down
117 changes: 12 additions & 105 deletions src/g-exam.typ
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,24 @@
clarifications: none,
question-text-parameters: none,
show-student-data: "first-page",
// student-data: (
// show-in-page: "first-page",
// show-name: true,
// show-surname: true,
// show-group: true,
// show-date: true
// ),
show-grade-table: true,
decimal-separator: ".",
question-points-position: left,
show-solution: true,
body,
) = {

assert(show-student-data in (none, true, false, "first-page", "odd-pages"),
message: "Invalid show studen data")
if type(show-student-data) != "dictionary" {
assert(show-student-data in (none, true, false, "first-page", "odd-pages"),
message: "Invalid show studen data")
}

assert(question-points-position in (none, left, right),
message: "Invalid question point position")
Expand Down Expand Up @@ -112,107 +121,6 @@
school: school,
exam-info: exam-info,
show-student-data: show-student-data)

// if (__page-number==1) {
// align(right)[#box(
// width:108%,
// grid(
// columns: (auto, auto),
// gutter:0.7em,
// align(left + top)[
// #if(type(school) == "dictionary") {
// if(school.at("logo", default : none) != none) {
// set image(height:2.5cm, width: 2.7cm, fit:"contain")
// if(type(school.logo) == "content") {
// school.logo
// }
// else if(type(school.logo) == "bytes") {
// image.decode(school.logo, height:2.5cm, fit:"contain")
// }
// else {
// assert(type(school.logo) in (none, "content", "bytes") , message: "school.logo be of type content or bytes.")
// }
// }
// }
// ],
// grid(
// rows: (auto, auto, auto),
// gutter:1em,
// grid(
// columns: (auto, 1fr, auto),
// align(left + top)[
// #if(type(school) == "dictionary") [
// #school.at("name", default : none) \
// ]
// #exam-info.academic-period \
// #exam-info.academic-level
// ],
// align(center + top)[
// // #exam-info.number #exam-info.content \
// ],
// align(right + top)[
// #exam-info.at("academic-subject", default: none) \
// #exam-info.number \
// #exam-info.content
// ],
// ),
// line(length: 100%, stroke: 1pt + gray),
// [22222222222222],
// if show-student-data in (true, "first-page", "odd-pages") {
// __g-student-data()
// }
// )
// )
// )]
// }
// else if calc.rem-euclid(__page-number, 2) == 1 {
// grid(
// columns: (auto, 1fr, auto),
// gutter:0.3em,
// align(left + top)[
// #if type(school) == "dictionary" [
// #school.at("name", default : none) \
// ]
// #exam-info.academic-period \
// #exam-info.academic-level
// ],
// align(center + top)[
// // #exam-info.number #exam-info.content \
// ],
// align(right + top)[
// #exam-info.at("academic-subject", default: none) \
// #exam-info.number \
// #exam-info.content
// ]
// )
// [11111111111111111]
// line(length: 100%, stroke: 1pt + gray)
// if show-student-data == "odd-pages" {
// __g-student-data(show-line-two: false)
// }
// }
// else {
// grid(
// columns: (auto, 1fr, auto),
// gutter:0.3em,
// align(left + top)[
// #if type(school) == "dictionary" [
// #school.at("name", default : none) \
// ]
// #exam-info.academic-period \
// #exam-info.academic-level
// ],
// align(center + top)[
// // #exam-info.number #exam-info.content \
// ],
// align(right + top)[
// #exam-info.at("academic-subject", default: none) \
// #exam-info.number \
// #exam-info.content \
// ]
// )
// line(length: 100%, stroke: 1pt + gray)
// }
}
),

Expand Down Expand Up @@ -243,8 +151,7 @@
)
)

set par(justify: true)
set text(font: "New Computer Modern")
// set text(font: "New Computer Modern")

__read-localization(language: language, localization: localization)
__g-question-points-position-state.update(u => question-points-position)
Expand Down
Loading

0 comments on commit 8b1ac4e

Please sign in to comment.