Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/preview/ttuile/0.2.0/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 vitto4

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
154 changes: 154 additions & 0 deletions packages/preview/ttuile/0.2.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<h1 align="center">
<picture><img alt="Typst" src="https://github.com/vitto4/ttuile/blob/main/docs/ttuile-header.png?raw=true"></picture>
</h1>

<p align="center">
<a href="https://typst.app">
<img alt="typst" src="https://img.shields.io/badge/Typst-%232f90ba.svg?&logo=Typst&logoColor=white"
/></a>
<a href="https://github.com/vitto4/ttuile/blob/main/LICENSE">
<img alt="MIT" src="https://img.shields.io/github/license/vitto4/ttuile"
/></a>
<a href="https://github.com/vitto4/ttuile/releases">
<img alt="GitHub Release" src="https://img.shields.io/github/v/release/vitto4/ttuile"
/></a>
</p>

<p align="center"><i>A <b>Typst</b> template for students' lab reports at <a href="https://en.wikipedia.org/wiki/Institut_national_des_sciences_appliqu%C3%A9es_de_Lyon">INSA Lyon</a>.</i></p>

<p align="center">
<a href="https://github.com/vitto4/ttuile/blob/main/template/main.pdf">
<img alt="Banner" src="https://github.com/vitto4/ttuile/blob/main/docs/ttuile-banner.png?raw=true">
</a>
</p>

> **Note**
>
> This template targets French students, so you may see French words here and there.
> Should you want to write your report in another language, there's a workaround, see [Notes](#-notes).
## 🧭 Table of contents

1. [Usage](#-usage)
1. [Documentation](#-documentation)
1. [Notes](#-notes)
1. [Contributing](#-contributing)


## 📎 Usage

Colorful lab report template more or less aligned with guidelines guidelines issued in 1st year at INSA Lyon.
It is available on _Typst Universe_ : [`@preview/ttuile:0.2.0`](https://typst.app/universe/package/ttuile).

If you wish to use it locally, you'll need to either manually include `ttuile.typ` and folder `internal/` in your project's root directory ; or upload them to the _Typst web app_ if that's what you use.

You'll find these files in the [releases](https://github.com/vitto4/ttuile/releases) section.

Your folder structure should then look something like this :

```
.
├── ttuile.typ
├── internal/
│ ├── defaults.typ
│ ├── helpers.typ
│ └── logo-insa-lyon.png
└── main.typ
```

The template is now ready to be used, and can be called supplying the following arguments.
`?` means the argument can be null if not applicable.


| Argument | Default value | Type | Description |
|:--------:|:-------------:|:----:|:------------|
| `headline` | `none` | `dictionary<str, content> \| content?` | Title of the report |
| `authors` | `none` | `array<str \| content> \| content?` | One or multiple authors to be credited in the report |
| `group` | `none` | `content?` | Your class (or group) number/letter/identifier to be displayed right after the author(s) |
| `footer-left` | `none` | `content?` | Usually your lab bench number |
| `footer-right` | `none` | `content?` | Usually the date at which the lab work/practical was carried out |
| `outlined` | `true` | `bool` | Display the table of contents ? |
| `logo` | `image("internal/logo-insa-lyon.png")` | `image \| content?` | University logo to display |

A single positional argument is accepted, being the report's body.

You can call the template using the following syntax :

```typ
// Local import
// #import "ttuile.typ": *
// Universe import
#import "@preview/ttuile:0.2.0": *
#show: ttuile.with(
// This is one way to set the headline, but the following also works :
// * headline: [You may supply just the title],
// * headline: text(fill: blue, weight: "regular")[And even style it\ however you wish],
headline: (
lead: [Compte rendu de TP n°1 :],
title: [« #lorem(8) »],
),
// Same as above :
// * authors: [You may also supply whatever you want],
authors: (
"Theresa Tungsten",
"Jean Dupont",
"Eugene Deklan",
),
group: "TD0",
footer-left: [Poste n°0],
footer-right: datetime.today().display("[day]/[month]/[year]"),
outlined: true,
// Also remove the uni logo or insert your own :
// * logo: image("your-logo.png"),
// * logo: none,
)
```

## 📚 Documentation

The package `ttuile.typ` exposes multiple functions, find out more about them in the _documentation_.

<p align="center">
<a href="https://github.com/vitto4/ttuile/blob/main/docs/DOCS.md">
To the documentation
</a>
</p>

An example file is also available in [`template/main.typ`](https://github.com/vitto4/ttuile/blob/main/template/main.typ)


## 🔖 Notes

- As mentioned previously, the template targets French students, so you'll get things like `Auteurs != Authors`, `Annexe != Appendix` and such. Thankfully I didn't cut corners there hehe, all of that can be tweaked :
```typ
#show: ttuile.with(
headline: [Yay, the French's all gone !],
authors: [*Authors:* Theresa Tungsten, Jean Dupont and Eugene Deklan],
group: "Group 1",
// This is supposed to be the lab bench number, but you may as well put whatever in there
footer-left: [Hello, world!],
footer-right: datetime.today().display("[day]/[month]/[year]"),
// You can use your own university's logotype
logo: image("path_to/logo.png"),
)
// This will fix tables and figures
#set text(lang: "en")
// And this the appendices section
#appendices-section(
...,

Check failure on line 142 in packages/preview/ttuile/0.2.0/README.md

View check run for this annotation

Typst package check / @preview/ttuile:0.2.0

packages/preview/ttuile/0.2.0/README.md#L142

Syntax error in README. expected expression If this code block is not supposed to be parsed as a Typst source,please explicitely specify another language.

Check failure on line 142 in packages/preview/ttuile/0.2.0/README.md

View check run for this annotation

Typst package check / @preview/ttuile:0.2.0

packages/preview/ttuile/0.2.0/README.md#L142

Syntax error in README. expected identifier If this code block is not supposed to be parsed as a Typst source,please explicitely specify another language.
headline: "Appendices",
supplement: "Appendix",
outline-title: "List of appendices",
)
```
- You may also tweak heading spacing : `#show heading: set block(above: 18pt, below: 5pt)`.
- The MIT license doesn't apply to the file `logo-insa-lyon.png`, it was retrieved from [INSA Lyon - éléments graphiques](https://www.insa-lyon.fr/fr/elements-graphiques). It doesn't apply either to the "INSA" branding.


## 🧩 Contributing

Contributions are welcome ! Parts of the template are very much spaghetti code, so if you know the proper way of achieving what I'm going for, an issue or PR would be greatly appreciated :)
67 changes: 67 additions & 0 deletions packages/preview/ttuile/0.2.0/internal/defaults.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/* ------------------------------- Font sizes ------------------------------- */
#let fsize-base = 12pt
#let fsize-header = 10.5pt
#let fsize-footer = 10pt
#let fsize-caption = 10pt
#let fsize-footnote = 9pt

// Headline font sizes, in order : [lead, title]
#let fsize-headline = (14pt, 18pt)

// Heading font sizes, in order : [h1, h2, h3, h4]
#let fsize-heading = (14pt, 13pt, 13pt, 12pt)

#let fsize-appendices-outline-title = (16pt,)

/* ---------------------------------- Fonts --------------------------------- */
#let ffam-base = "HK Grotesk"
#let ffam-heading = "HK Grotesk"
#let ffam-special = "Liberation Serif"
#let ffam-outline = "Libertinus Serif"


/* --------------------------------- Lengths -------------------------------- */
#let indent-base = 0.76cm
#let indent-outline = 0.4cm
#let indent-heading = 0.50cm
#let indent-numbering = 0.2cm

// Spacing around headings, in order : [above, below]
#let vspacing-heading = (15pt, 12pt)

#let vspacing-appendices-outline = 4.25pt
#let vspacing-appendices-heading = 3 * 4.25pt

/* --------------------------------- Colors --------------------------------- */

// Used for the headline
#let color-headline = color.red

// This one for figures' captions
#let color-blue-caption = color.rgb(0, 69, 134)

// Heading colors, in order : [h1, h2, h3, h4]
#let color-heading = (
color.rgb(0, 169, 51), // Green
color.rgb(52, 101, 164), // Blue
color.rgb(166, 77, 121), // Purple
black,
)


/* ---------------------------------- Misc ---------------------------------- */
#let style-numbering-h1 = "I."
#let style-numbering-h2 = "1."
#let style-numbering-h3 = "A."
#let style-numbering-base = style-numbering-h1 + style-numbering-h2 + style-numbering-h3
#let style-numbering-appendices = "A.1.1.1"

// Prefix showing before the error messages in `assert`s and `panic`s
#let prefix-errors = "[ template / ttuile ] > "

#let outline-depth = 3

// These are supposed to be random IDs used as markers/tags,
// so that we can tell for sure where the appendices begin and end.
#let metadata-appendices-start = "6a359bbd-b367-4af5-bd82-c80e83a64c78"
#let metadata-appendices-end = "ea2899f8-e9f3-4c70-b4b0-4e6afe77da9c"
Loading