Skip to content

Commit

Permalink
Merge branch 'dev/0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
andres-gimenez committed Apr 7, 2024
2 parents b8e4e36 + 20d0cc9 commit 1b8d875
Show file tree
Hide file tree
Showing 43 changed files with 1,661 additions and 737 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build Typst document (CI)
on:
push:
paths:
- '**/*.typ'
- '**/*.yaml'
- '**/*.toml'
workflow_dispatch:
paths:
- '**/*.typ'
- '**/*.yaml'
- '**/*.toml'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Delete samples
run: |
rm -rf ./examples/*.pdf
- name: List Files
id: file-list
shell: bash
run: |
list=$(ls -1 ./examples/*.typ);
file_list=$(echo "$list" | sed ':a;N;$!ba;s/\n/ /g')
echo "File List: $file_list"
echo "file_list=$file_list" >> $GITHUB_OUTPUT
- name: Compile Typst to PDF
uses: mkpoli/compile-typst-action@main
with:
source_paths: ${{ steps.file-list.outputs.file_list }}
root_path: '.'

- name: Delete samples
run: |
rm -rf ./doc/*.pdf
- name: Compile documentation to PDF
uses: mkpoli/compile-typst-action@main
with:
source_paths: "doc/manual.typ"
root_path: '.'

- name: Upload examples PDF file
uses: actions/upload-artifact@v3
with:
name: examples-g-exam
path: ./examples/*.pdf

- name: Upload documentation PDF file
uses: actions/upload-artifact@v3
with:
name: document-g-exam
path: ./doc/*.pdf
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
g-exam.pdf
/src/**/*.pdf
/doc/**/*.pdf
!/doc/manual.pdf
142 changes: 47 additions & 95 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,137 +1,89 @@
# g-exam

Template to create exams with header, school letterhead, grade chart, ...
This template provides a way to generate exams. You can create questions and sub-questions, header with information about the academic center, score box, subject, exam, header with student information, clarifications, solutions, watermark with information about the exam model and teacher.

## Features
#### Features

- Scoreboard.
- Scoring by questions and subquestions.
- Student information, on the first page or on all odd pages.
- Question and subcuestion.
- Show solutions and clarifications
- List of clarifications.
- Teacher's Watermark
- Exam Model Watermark

## Usage

# Examples
For information, see the [manual](./doc/manual.pdf).

### Minimal Example

``` typ
#import "@preview/g-exam:0.1.1": g-exam, g-question, g-subquestion
To use this package, simply add the following code to your document:

#show: g-exam.with(
#g-question(point: 2)[Question 1]
#v(1fr)
#g-question(point: 2)[Question 1]
#v(1fr)
)
```
## Examples

### Minimal Example with sub-question
### Minimal Example

``` typst
#import "@preview/g-exam:0.1.1": g-exam, g-question, g-subquestion
```typ
#import "@preview/g-exam:0.3.0": *
#show: g-exam.with(
#g-question[Question 1]
#g-subquestion[Question 1]
#v(1fr)
#g-subquestion[Question 1]
#v(1fr)
#g-subquestion(point: 2)[Question 1]
#g-question(point: 2)[List prime numbers]
#v(1fr)
#g-question(point: 2)[Complete the following sentences]
#g-subquestion[Don Quixote was written by ...]
#v(1fr)
#g-subquestion[The name of the continent we live on is ...]
#v(1fr)
)
```

### Full sample of an exam.

1. [Example of exam with punctuation](examples/exam-001.pdf)
1. [Example of exam with question only](examples/exam-002.pdf)
1. [Example of exam with subquestion](examples/exam-003.pdf)
1. [Example of exam with punctuation](examples/exam-005.pdf)
1. [Example of exam with solution](examples/exam-005.pdf)

## Changelog

# Usage
### v0.3.0

To use this package, simply add the following code to your document:
- Include parameter question-text-parameters.
- Show solution
- Expand documentation.
- Possibility of estrablecer question-point-position to none.
- Bug fix show watermark.

### v0.2.0

### g-exam

Generate the skeleton of an exam, entering a header, student information, grade table, watermarks, ...

#### Parameters of `g-exam`

- **author**:
- **name**: Name of author of document.
- **email**: e-mail of author of document.
- **watermark**: Watermark with information about the author of the document.

- **school**:
- **name**: Name of the school or institution generating the exam.
- **logo**: Logo of the school or institution generating the exam.

- **exam-info**:
- **academic-period**: Academic period.
- **academic-level**: Academic level
- **academic-subject**: Academic subject.
- **number**: Number of exam.
- **content**: Content of exam.
- **model**: Watermark with information about the exam model.

- **localization**: Location information, in case you want to change a parameter or your language is not supported.
- **grade-table-queston: Text question in grade table**.
- **grade-table-total: Text total in grade table**,
- **grade-table-points: Text points in grade table**,
- **grade-table-calification: Text calification in grade**,
- **point: Text point**,
- **points: Text points**.
- **page: Text page**,
- **page-counter-display**: Text page conter display.
- **family-name**: Text surname or family name in studen data.
- **personal-name**: Text name or personal name in studen data.
- **group**: Text gorup in studen data.
- **date**: Text date in studen data.
- **languaje**: (str) (en, es, de, fr, pt, it) Languages for Default Localization
- **decimal-separator*: (str) (".", ",") Decimal separator

- **date**: Date of document.

- **show-studen-data**: (none, str),
- **first-page**: Show studen data only in first page.
- **odd-pages**: Show studen data in all odd pages.
- `none`: Not show studen data.
- **question-point-position**: (none, left, right)
- **right**: Show question point on the right.
- **left**: Show question point on the left.
- `none`: Not show the question point.
- **show-grade-table**: (true, false) Show grade table,
- **clarifications**: (str, (:)) Text of clarifications for students.
- **body** (body): Body of exam.

#### Parameters of `g-question`

- **point**: (none, float) Points of the question.
- **body** (body): Body of question.

#### Parameters of `g-subquestion`

- **point**: (none, float) Points of the sub-question.
- **body** (body): Body of sub-question.

# Changelog
- Control the size of the logo image.
- Convert to template
- Allow true and false values in show-studen-data.
- Show clarifications.
- Widen margin points.
- Show solution.
<!-- - ⚠️ Breaking changes:
- ?¿?¿ -->

### v0.1.1

- Fix loading image.

### v0.1.0
### v0.1.1

- Initial version submitted to typst/packages.
- Fix loading image.

# ToDo
### v0.1.0

- Initial version submitted to typst/packages.
- Multiple choice questions
- Show solution of question.

# CI

Continuous integration status:

[![.github/workflows/integration.yaml](https://github.com/MatheSchool/typst-g-exam/actions/workflows/integration.yaml/badge.svg)](https://github.com/MatheSchool/typst-g-exam/actions/workflows/integration.yaml)
75 changes: 75 additions & 0 deletions doc/example.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#import "/src/lib.typ"

// String that gets prefixed to every example code
// for compilation only!
#let example-preamble = "import cetz.draw: *;"
#let example-scope = (cetz: lib)


/// Render an example from a string
/// - source (string, raw): Example source code
/// - args (arguments): Arguments passed down to the canvas
/// - vertical (boolean): If true, show the code below the canvas
#let example(source, ..args, vertical: false) = {
if type(source) == content {
source = source.text
}

let radius = .25cm
let border = 1pt + gray
let canvas-background = yellow.lighten(95%)

let picture = lib.canvas(
eval(
example-preamble + source,
scope: example-scope
),
..args
)
let source = box(
raw(
source,
lang: "typc"
),
width: 100%
)

block(
if vertical {
align(
center,
stack(
dir: ttb,
spacing: 1em,
block(
width: 100%,
clip: true,
radius: radius,
stroke: border,
table(
columns: 1,
stroke: none,
fill: (c,r) => (canvas-background, white).at(r),
picture,
align(left, source)
)
),
)
)
} else {
block(
table(
columns: 2,
stroke: none,
fill: (canvas-background, white),
align: (center + horizon, left),
picture,
source
),
width: 100%,
radius: radius,
clip: true,
stroke: border
)
}, breakable: false)
}
Binary file added doc/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/manual.pdf
Binary file not shown.
Loading

0 comments on commit 1b8d875

Please sign in to comment.