Skip to content

Commit 03f2d2c

Browse files
authored
typographix-polytechnique-reports:0.1.6 (typst#1479)
1 parent bd0d6da commit 03f2d2c

22 files changed

+1609
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*.pdf
2+
!guide.pdf
3+
4+
.vscode
5+
6+
# For macOS users
7+
.DS_Store
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Contributing to the package or template
2+
3+
You can simply fork this repo and work on it on your own. Feel free to PR if this repo is still active !
4+
5+
If you plan to distribute your version of the package, please make sure you pay respect to both [Typst packages guidelines](https://github.com/typst/packages?tab=readme-ov-file#submission-guidelines) and [École polytechnique corporate identity](https://www.polytechnique.edu/presse/kit-media).
6+
7+
## Pushing to Typst packages
8+
9+
Check out [Typst packages repo](https://github.com/typst/packages) to learn more about packages release pipeline.
10+
11+
I personally suggest the following steps :
12+
13+
- fork the Typst packages repo
14+
- in the root directory, for every `x.y.z` version (if the `main` branch currently contains the `x.y.z` release) :
15+
16+
```bash
17+
git subtree add --prefix=packages/preview/typographix-polytechnique-reports/x.y.z [email protected]:remigerme/typst-polytechnique.git main
18+
```
19+
20+
You may need to pull sometimes (if the release wasn't fully ready) :
21+
22+
```bash
23+
git subtree pull --prefix=packages/preview/typographix-polytechnique-reports/x.y.z [email protected]:remigerme/typst-polytechnique.git main
24+
```
25+
26+
- PR your fork to publish the package.
27+
28+
You do not need to squash the commit history at anytime because Typst packages will do it on merge.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Rémi Germe
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Typst Polytechnique package
2+
3+
A Typst package for Polytechnique student reports.
4+
5+
For a short introduction to Typst features and detailled information about the package, check the [guide](https://github.com/remigerme/typst-polytechnique/blob/main/guide.pdf) (available from the repo only).
6+
7+
## Usage
8+
9+
If you want to use it on local, make sure you have the font "New Computer Modern Sans" installed.
10+
11+
Define variables at the top of the template :
12+
13+
```typc
14+
#let title = "Rapport de stage en entreprise sur plusieurs lignes automatiquement"
15+
#let subtitle = "Un sous-titre pour expliquer ce titre"
16+
#let logo = image("path/to/my-logo.png")
17+
#let logo-horizontal = true
18+
#let short-title = "Rapport de stage"
19+
#let authors = ("Rémi Germe")
20+
#let date-start = datetime(year: 2024, month: 06, day: 05)
21+
#let date-end = datetime(year: 2024, month: 09, day: 05)
22+
#let despair-mode = false
23+
24+
#set text(lang: "fr")
25+
```
26+
27+
These variables will be used for PDF metadata, default cover page and default header.
28+
29+
## Contributing
30+
31+
Contributions are welcomed ! See [contribution guidelines](CONTRIBUTING.md).
32+
33+
## Todo
34+
35+
- [ ] heading not at the end of a page : might be tricky
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Assets
2+
3+
## Licensing
4+
5+
Use the assets accordingly with [École polytechnique corporate identity](https://www.polytechnique.edu/en/press-room).
6+
7+
## Generation
8+
9+
Typst currently only supports `svg` integration. I generated `svg` assets using inkscape to convert `eps` files to `svg`, and remplaced colors to use colors from École polytechnique corporate identity.
10+
11+
```bash
12+
for f in *.eps; do inkscape --export-type=svg $f; done
13+
sed -i 's/2e6886/00677f/' filet-court.svg
14+
sed -i 's/a62125/ce0037/' filet-long.svg
15+
sed -i 's/dae0e5/ccd8df/' armes.svg
16+
sed -i 's/0d355c/01426a/' logo-x.svg
17+
sed -i 's/1e3f6a/01426a/' logo-x-ip-paris.svg
18+
```
19+
20+
Note : macOS users need to add an empty string `''` after `-i` flag : `sed -i '' 's/.../.../' file.svg'` or install `gnu-sed` and use it instead of macOS provided `sed`.

packages/preview/typographix-polytechnique-reports/0.1.6/assets/armes.svg

+59
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@article{example-turing,
2+
author = {TURING, A. M.},
3+
title = "{I.—COMPUTING MACHINERY AND INTELLIGENCE}",
4+
journal = {Mind},
5+
volume = {LIX},
6+
number = {236},
7+
pages = {433-460},
8+
year = {1950},
9+
month = {10},
10+
issn = {0026-4423},
11+
doi = {10.1093/mind/LIX.236.433},
12+
url = {https://doi.org/10.1093/mind/LIX.236.433},
13+
eprint = {https://academic.oup.com/mind/article-pdf/LIX/236/433/30123314/lix-236-433.pdf},
14+
}
Loading
Loading

packages/preview/typographix-polytechnique-reports/0.1.6/assets/logo-x-ip-paris.svg

+379
Loading

packages/preview/typographix-polytechnique-reports/0.1.6/assets/logo-x.svg

+279
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/***********************/
2+
/* TEMPLATE DEFINITION */
3+
/***********************/
4+
5+
/* HANDLING DATE DISPLAY */
6+
7+
#let translate_month(month) = {
8+
// Construction mapping for months
9+
let t = (:)
10+
let fr-month-s = ("Janv.", "Févr.", "Mars", "Avr.", "Mai", "Juin",
11+
"Juill.", "Août", "Sept.", "Oct.", "Nov.", "Déc.")
12+
let fr-months-l = ("Janvier", "Février", "Mars", "Avril", "Mai", "Juin",
13+
"Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre")
14+
for i in range(12) {
15+
let idate = datetime(year: 0, month: i + 1, day: 1)
16+
let ml = idate.display("[month repr:long]")
17+
let ms = idate.display("[month repr:short]")
18+
t.insert(ml, fr-months-l.at(i))
19+
t.insert(ms, fr-month-s.at(i))
20+
}
21+
22+
// Translating month
23+
let fr_month = t.at(month)
24+
fr_month
25+
}
26+
27+
#let display-date(date, short-month) = {
28+
context {
29+
// Getting adapted month string
30+
let repr = if short-month { "short" } else { "long" }
31+
let month = date.display("[month repr:" + repr + "]")
32+
33+
// Translate if necessary
34+
if text.lang == "fr" {
35+
month = translate_month(month)
36+
}
37+
38+
// Returns month and year
39+
[#month #str(date.year())]
40+
}
41+
}
42+
43+
44+
/* MAIN COVER DEFINITION */
45+
46+
#let cover(title, author, date-start, date-end, subtitle: none, logo: none, short-month: false, logo-horizontal: true) = {
47+
set page(background: move(dx: 0pt, dy: -13%, image("assets/armes.svg")))
48+
set text(font: "New Computer Modern Sans", hyphenate: false, fill: rgb(1, 66, 106))
49+
set align(center)
50+
51+
v(1.8fr)
52+
53+
set text(size: 24pt, weight: "bold")
54+
upper(title)
55+
56+
v(1.5fr)
57+
58+
if subtitle != none {
59+
set text(size: 20pt)
60+
subtitle
61+
}
62+
63+
v(1.5fr)
64+
65+
set text(size: 18pt, weight: "regular")
66+
display-date(date-start, short-month); [ \- ]; display-date(date-end, short-month)
67+
68+
image("assets/filet-court.svg")
69+
70+
set text(size: 16pt)
71+
smallcaps(author)
72+
73+
v(1fr)
74+
75+
let logo-height = if (logo-horizontal) { 20mm } else { 30mm }
76+
let path-logo-x = if (logo-horizontal) { "assets/logo-x-ip-paris.svg" } else { "assets/logo-x.svg" }
77+
78+
set image(height: logo-height)
79+
80+
if (logo != none) {
81+
grid(
82+
columns: (1fr, 1fr), align: center + horizon,
83+
logo, image(path-logo-x)
84+
)
85+
} else {
86+
grid(
87+
columns: (1fr), align: center + horizon,
88+
image(path-logo-x)
89+
)
90+
}
91+
92+
}
93+
94+
95+
/********************/
96+
/* TESTING TEMPLATE */
97+
/********************/
98+
99+
#set text(lang: "fr")
100+
101+
#cover(
102+
[A very long title over multiple lines automatically],
103+
"Jane Doe",
104+
datetime.today(),
105+
datetime.today(),
106+
subtitle: "Je n'ai pas de stage mais je suis détendu",
107+
logo-horizontal: true,
108+
)
Binary file not shown.

0 commit comments

Comments
 (0)