-
Notifications
You must be signed in to change notification settings - Fork 563
ctu-report:0.2.0 #2052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tomkys144
wants to merge
2
commits into
typst:main
Choose a base branch
from
tomkys144:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
ctu-report:0.2.0 #2052
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2025 Tomáš Kysela | ||
|
||
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# CTU report | ||
|
||
This template serves as slight modification of [basic-report](https://github.com/roland-KA/basic-report-typst-template) to comply with CTU's graphics manual. | ||
|
||
## Fonts | ||
|
||
This template uses Technika font for headings. This can be downloaded from this repository, Petr Olšák's [CTUstyle3 repository](https://github.com/olsak/CTUstyle3) or for CTU students from [official source](https://www.cvut.cz/logo-a-graficky-manual). | ||
|
||
## Usage | ||
|
||
```typst | ||
#import "@preview/ctu-report:0.2.0": * | ||
|
||
#show: it => ctu-report( | ||
doc-category: "Laboratorní návod", | ||
doc-title: "Jak zpojit diodu", | ||
author: "Mgr. Hubert Dřímal", | ||
affiliation: "Katedra trpaslíků a permoníků", | ||
language: "cs", | ||
faculty: "F3", | ||
it, | ||
) | ||
``` | ||
Possible values for faculty: | ||
|
||
| Shortcode | Czech name | English name | | ||
|-----------------|----------------------------------------------------|----------------------------------------------------------| | ||
| CVUT (fallback) | České vysoké učení technické v Praze | Czech Technical University in Prague | | ||
| F1 | Fakulta stavební | Faculty of Civil Engineering | | ||
| F2 | Fakulta strojní | Faculty of Mechanical Engineering | | ||
| F3 | Fakulta elektrotechnická | Faculty of Electrical Engineering | | ||
| F4 | Fakulta jaderná a fyzikálně inženýrská | Faculty of Nuclear Sciences and Physical Engineering | | ||
| F5 | Fakulta architektury | Faculty of Architecture | | ||
| F6 | Fakulta dopravní | Faculty of Transportation Sciences | | ||
| F7 | Fakulta biomedicínského inženýrství | Faculty of Biomedical Engineering | | ||
| F8 | Fakulta informačních technologií | Faculty of Information Technology | | ||
| CIIRC | Český institut informatiky, robotiky a kybernetiky | Czech Institute of Informatics, Robotics and Cybernetics | | ||
| KU | Kloknerův ústav | Klokner Institute | | ||
| MUVS | Masarykův ústav vyšších studií | Masaryk Institute of Advanced Studies | | ||
| UCEEB | Univerzitní centrum energeticky efektivních budov | University Centre for Energy Efficient Buildings | | ||
| UTEF | Ústav technické a experimentální fyziky | Institute of Experimental and Applied Physics | | ||
| UTVS | Ústav tělesné výchovy a sportu | Institute of Physical Education and Sport | |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
#import "@preview/hydra:0.6.0": hydra | ||
#import "titlepage.typ": * | ||
|
||
#let ctu-report( | ||
doc-category: none, | ||
doc-title: none, | ||
author: none, | ||
affiliation: none, | ||
language: "cs", | ||
show-outline: true, | ||
faculty: "CVUT", | ||
body, | ||
) = { | ||
// ----- Global Parameters ------------------------ | ||
|
||
set document(title: doc-title, author: author) | ||
set text(lang: language) | ||
|
||
set math.equation(numbering: "(1)") | ||
|
||
counter(page).update(0) // so TOC after titlepage begins with page no 1 (roman) | ||
|
||
let body-font = "New Computer Modern" | ||
let body-size = 11pt | ||
let heading-font = "Technika" | ||
let info-size = 10pt // heading font is used in this size for kind of "information blocks" | ||
let label-size = 9pt // heading font is used in this size for different sorts of labels | ||
let in-outline = state("in-outline", true) // are we inside or outside of the outline (for roman/arabic page numbers)? | ||
// | ||
// | ||
|
||
// ----- Title Page ------------------------ | ||
|
||
let logo = "logos/" | ||
|
||
let faculties = ( | ||
"CVUT", | ||
"F1", | ||
"F2", | ||
"F3", | ||
"F4", | ||
"F5", | ||
"F6", | ||
"F7", | ||
"F8", | ||
"CIIRC", | ||
"KU", | ||
"MUVS", | ||
"UCEEB", | ||
"UTEF", | ||
"UTVS", | ||
) | ||
|
||
if language == "cs" { | ||
if faculty in faculties { | ||
logo += faculty + ".svg" | ||
} else { | ||
logo += "CVUT.svg" | ||
} | ||
} else { | ||
if faculty in faculties { | ||
logo += faculty + "_en.svg" | ||
} else { | ||
logo += "CVUT_en.svg" | ||
} | ||
} | ||
|
||
titlepage( | ||
doc-category, | ||
doc-title, | ||
author, | ||
affiliation, | ||
image(logo, height: 2.3cm), | ||
heading-font, | ||
info-size, | ||
) | ||
// ----- Basic Text- and Page-Setup ------------------------ | ||
|
||
set text( | ||
font: body-font, | ||
size: body-size, | ||
) | ||
|
||
set par( | ||
justify: true, | ||
leading: 0.65em, | ||
spacing: 1.65em, | ||
first-line-indent: 0em, | ||
) | ||
|
||
set page( | ||
paper: "a4", | ||
// horizontal 1.5cm-grid = 14u: 3u left margin, 9u text, 2u right margin | ||
// Idea: one-sided document; if printed on paper, the pages are often bound or stapled | ||
// on the left side; so more space needed on the left. On-screen it doesn't matter. | ||
// vertical 1.5cm-grid ≈ 20u: 2u top margin, 14u text, 2u botttom margin | ||
// header with height ≈ 0.6cm is visually part of text block --> top margin = 3cm + 0.6cm | ||
margin: (top: 3.6cm, left: 4.5cm, right: 3cm, bottom: 3cm), | ||
// the header shows the main chapter heading on the left and the page number on the right | ||
header: grid( | ||
columns: (1fr, 1fr), | ||
align: (left, right), | ||
row-gutter: 0.5em, | ||
text(font: heading-font, size: label-size, context { hydra(1, use-last: true, skip-starting: false) }), | ||
text( | ||
font: heading-font, | ||
size: label-size, | ||
number-type: "lining", | ||
context { | ||
if in-outline.get() { | ||
counter(page).display("i") // roman page numbers for the TOC | ||
} else { | ||
counter(page).display("1") // arabic page numbers for the rest of the document | ||
} | ||
}, | ||
), | ||
grid.cell(colspan: 2, line(length: 100%, stroke: 0.5pt)), | ||
), | ||
header-ascent: 1.5em, | ||
) | ||
|
||
// ----- Numbering Schemes ------------------------ | ||
|
||
set heading(numbering: "1.") | ||
show heading: it => { | ||
set text(font: heading-font, fill: blue, weight: "regular") | ||
block( | ||
it, | ||
height: 1 * body-size, | ||
above: 2 * body-size, | ||
below: 1 * body-size, | ||
sticky: true, | ||
) | ||
} | ||
|
||
set figure(numbering: "1") | ||
show figure.caption: it => { | ||
set text(font: heading-font, size: label-size) | ||
block(it) | ||
} | ||
|
||
// ----- Table of Contents ------------------------ | ||
|
||
// to detect, if inside or outside the outline (for different page numbers) | ||
show outline: it => { | ||
in-outline.update(true) | ||
it | ||
in-outline.update(false) | ||
} | ||
|
||
// top-level TOC entries in bold without filling | ||
show outline.entry.where(level: 1): it => { | ||
set block(above: 2 * body-size) | ||
set text(font: heading-font, weight: "bold", size: info-size) | ||
link( | ||
it.element.location(), // make entry linkable | ||
it.indented(it.prefix(), it.body() + box(width: 1fr) + it.page()), | ||
) | ||
} | ||
|
||
// other TOC entries in regular with adapted filling | ||
show outline.entry.where(level: 2).or(outline.entry.where(level: 3)): it => { | ||
set block(above: body-size) | ||
set text(font: heading-font, size: info-size) | ||
link( | ||
it.element.location(), // make entry linkable | ||
it.indented( | ||
it.prefix(), | ||
it.body() + " " + box(width: 1fr, repeat([.], gap: 2pt)) + " " + it.page(), | ||
), | ||
) | ||
} | ||
|
||
if show-outline { | ||
outline( | ||
title: if language == "cs" { | ||
"Obsah" | ||
} else { | ||
"Contents" | ||
}, | ||
indent: auto, | ||
) | ||
counter(page).update(0) // so the first chapter starts at page 1 (now in arabic numbers) | ||
} else { | ||
in-outline.update(false) // even if outline is not shown, we want to continue with arabic page numbers | ||
counter(page).update(1) | ||
} | ||
|
||
pagebreak() | ||
|
||
// ----- Body Text ------------------------ | ||
|
||
body | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Font files should not be copied to this repository. Can you please delete them?