fix: move appendix styling out of the coursework template
It is now possible to style headings as appendices in the pz-lb template via `#show: appendices_style`.
This commit is contained in:
14
README.md
14
README.md
@ -7,7 +7,7 @@ This project contains two template functions and some utilities for writing NURE
|
|||||||
|
|
||||||
### Templates
|
### Templates
|
||||||
|
|
||||||
#### `pz-lb` - For Practical and Laboratory Works
|
#### `pz-lb` - For Practice and Laboratory Works
|
||||||
This template:
|
This template:
|
||||||
- Sets up document styles;
|
- Sets up document styles;
|
||||||
- Formats the title page according to NURE/DSTU guidelines.
|
- Formats the title page according to NURE/DSTU guidelines.
|
||||||
@ -70,6 +70,18 @@ Some text
|
|||||||
#include "src/chapter2.typ"
|
#include "src/chapter2.typ"
|
||||||
// NOTE: if you want to use variables or utils provided by the package,
|
// NOTE: if you want to use variables or utils provided by the package,
|
||||||
// you have to import the package or a lib.typ inside a module.
|
// you have to import the package or a lib.typ inside a module.
|
||||||
|
|
||||||
|
|
||||||
|
// If you ever need appendices in pz-lb template use the show rule
|
||||||
|
// WARNING: when using coursework template use its own argument,
|
||||||
|
// so it can put bibliography before appendices
|
||||||
|
#show: appendices_style
|
||||||
|
|
||||||
|
= Quote
|
||||||
|
#link("https://youtu.be/bJQj1uKtnus")[
|
||||||
|
The art isn't the art, the art is never the art,
|
||||||
|
the art is the thing that happens inside you when you make it and the feeling in the heart of the beholder.
|
||||||
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Notes:
|
### Notes:
|
||||||
|
106
lib.typ
106
lib.typ
@ -87,6 +87,7 @@
|
|||||||
// spacing between lines
|
// spacing between lines
|
||||||
#let spacing = 0.95em
|
#let spacing = 0.95em
|
||||||
|
|
||||||
|
// main {{{2
|
||||||
#let style(it) = {
|
#let style(it) = {
|
||||||
set page(
|
set page(
|
||||||
paper: "a4",
|
paper: "a4",
|
||||||
@ -113,7 +114,7 @@
|
|||||||
set par(spacing: spacing)
|
set par(spacing: spacing)
|
||||||
set par(leading: spacing)
|
set par(leading: spacing)
|
||||||
|
|
||||||
// enums and lists {{{2
|
// enums and lists {{{3
|
||||||
set enum(
|
set enum(
|
||||||
numbering: i => { ua_alpha_numbering.at(i) + ")" },
|
numbering: i => { ua_alpha_numbering.at(i) + ")" },
|
||||||
indent: 1.25cm,
|
indent: 1.25cm,
|
||||||
@ -126,7 +127,7 @@
|
|||||||
|
|
||||||
set list(indent: 1.35cm, body-indent: 0.5cm, marker: [--])
|
set list(indent: 1.35cm, body-indent: 0.5cm, marker: [--])
|
||||||
|
|
||||||
// figures {{{2
|
// figures {{{3
|
||||||
show figure: it => {
|
show figure: it => {
|
||||||
v(spacing * 2, weak: true)
|
v(spacing * 2, weak: true)
|
||||||
it
|
it
|
||||||
@ -160,7 +161,7 @@
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
// appearance of references to images and tables {{{2
|
// appearance of references to images and tables {{{3
|
||||||
set ref(
|
set ref(
|
||||||
supplement: it => {
|
supplement: it => {
|
||||||
if it == none or not it.has("kind") {
|
if it == none or not it.has("kind") {
|
||||||
@ -187,7 +188,7 @@
|
|||||||
[(#it)]
|
[(#it)]
|
||||||
}
|
}
|
||||||
|
|
||||||
// headings {{{2
|
// headings {{{3
|
||||||
set heading(numbering: "1.1")
|
set heading(numbering: "1.1")
|
||||||
|
|
||||||
show heading.where(level: 1): it => {
|
show heading.where(level: 1): it => {
|
||||||
@ -222,7 +223,7 @@
|
|||||||
v(spacing * 2, weak: true)
|
v(spacing * 2, weak: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// listings {{{2
|
// listings {{{3
|
||||||
show raw: it => {
|
show raw: it => {
|
||||||
let new_spacing = 0.5em
|
let new_spacing = 0.5em
|
||||||
set block(spacing: new_spacing)
|
set block(spacing: new_spacing)
|
||||||
@ -244,6 +245,45 @@
|
|||||||
it
|
it
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// appendices {{{2
|
||||||
|
#let appendices_style(it) = {
|
||||||
|
counter(heading).update(0)
|
||||||
|
|
||||||
|
set heading(
|
||||||
|
numbering: (i, ..nums) => {
|
||||||
|
let char = upper(ua_alpha_numbering.at(i))
|
||||||
|
if nums.pos().len() == 0 { char } else {
|
||||||
|
char + "." + nums.pos().map(str).join(".")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
show heading.where(level: 1): it => {
|
||||||
|
set align(center)
|
||||||
|
set text(size: 14pt, weight: "regular")
|
||||||
|
|
||||||
|
pagebreak(weak: true)
|
||||||
|
bold[ДОДАТОК #counter(heading).display(it.numbering)]
|
||||||
|
linebreak()
|
||||||
|
it.body
|
||||||
|
v(spacing * 2, weak: true)
|
||||||
|
}
|
||||||
|
|
||||||
|
show heading.where(level: 2): it => {
|
||||||
|
set text(size: 14pt, weight: "regular")
|
||||||
|
|
||||||
|
v(spacing * 2, weak: true)
|
||||||
|
block(width: 100%, spacing: 0em)[
|
||||||
|
#h(1.25cm)
|
||||||
|
#counter(heading).display(it.numbering)
|
||||||
|
#it.body
|
||||||
|
]
|
||||||
|
v(spacing * 2, weak: true)
|
||||||
|
}
|
||||||
|
|
||||||
|
it
|
||||||
|
}
|
||||||
|
|
||||||
// Coursework template {{{1
|
// Coursework template {{{1
|
||||||
|
|
||||||
/// DSTU 3008:2015 Template for NURE
|
/// DSTU 3008:2015 Template for NURE
|
||||||
@ -504,21 +544,17 @@
|
|||||||
|
|
||||||
#{
|
#{
|
||||||
let keywords = abstract.keywords.map(upper)
|
let keywords = abstract.keywords.map(upper)
|
||||||
let is_cyrillic = word => word
|
let is_cyrillic = word => word.split("").any(char => ("А" <= char and char <= "я"))
|
||||||
.split("")
|
|
||||||
.any(char => ("А" <= char and char <= "я"))
|
|
||||||
|
|
||||||
let n = keywords.len()
|
let n = keywords.len()
|
||||||
for i in range(n) {
|
for i in range(n) {
|
||||||
for j in range(0, n - i - 1) {
|
for j in range(0, n - i - 1) {
|
||||||
if (
|
if (
|
||||||
(
|
(
|
||||||
not is_cyrillic(keywords.at(j))
|
not is_cyrillic(keywords.at(j)) and is_cyrillic(keywords.at(j + 1))
|
||||||
and is_cyrillic(keywords.at(j + 1))
|
|
||||||
)
|
)
|
||||||
or (
|
or (
|
||||||
is_cyrillic(keywords.at(j)) == is_cyrillic(keywords.at(j + 1))
|
is_cyrillic(keywords.at(j)) == is_cyrillic(keywords.at(j + 1)) and keywords.at(j) > keywords.at(j + 1)
|
||||||
and keywords.at(j) > keywords.at(j + 1)
|
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
(keywords.at(j), keywords.at(j + 1)) = (
|
(keywords.at(j), keywords.at(j + 1)) = (
|
||||||
@ -595,10 +631,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
context {
|
context {
|
||||||
for (i, citation) in query(ref.where(element: none))
|
for (i, citation) in query(ref.where(element: none)).map(r => str(r.target)).dedup().enumerate() {
|
||||||
.map(r => str(r.target))
|
|
||||||
.dedup()
|
|
||||||
.enumerate() {
|
|
||||||
enum.item(
|
enum.item(
|
||||||
i + 1,
|
i + 1,
|
||||||
format-entry(bib_data.at(citation)),
|
format-entry(bib_data.at(citation)),
|
||||||
@ -607,47 +640,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// appendices {{{2
|
appendices_style(appendices)
|
||||||
{
|
|
||||||
counter(heading).update(0)
|
|
||||||
|
|
||||||
set heading(
|
|
||||||
numbering: (i, ..nums) => {
|
|
||||||
let char = upper(ua_alpha_numbering.at(i))
|
|
||||||
if nums.pos().len() == 0 { char } else {
|
|
||||||
char + "." + nums.pos().map(str).join(".")
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
show heading.where(level: 1): it => {
|
|
||||||
set align(center)
|
|
||||||
set text(size: 14pt, weight: "regular")
|
|
||||||
|
|
||||||
pagebreak(weak: true)
|
|
||||||
bold[ДОДАТОК #counter(heading).display(it.numbering)]
|
|
||||||
linebreak()
|
|
||||||
it.body
|
|
||||||
v(spacing * 2, weak: true)
|
|
||||||
}
|
|
||||||
|
|
||||||
show heading.where(level: 2): it => {
|
|
||||||
set text(size: 14pt, weight: "regular")
|
|
||||||
|
|
||||||
v(spacing * 2, weak: true)
|
|
||||||
block(width: 100%, spacing: 0em)[
|
|
||||||
#h(1.25cm)
|
|
||||||
#counter(heading).display(it.numbering)
|
|
||||||
#it.body
|
|
||||||
]
|
|
||||||
v(spacing * 2, weak: true)
|
|
||||||
}
|
|
||||||
|
|
||||||
appendices
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Laboratory work template {{{1
|
// Practice and Laboratory works template {{{1
|
||||||
|
|
||||||
/// DSTU 3008:2015 Template for NURE
|
/// DSTU 3008:2015 Template for NURE
|
||||||
/// -> content
|
/// -> content
|
||||||
|
@ -106,7 +106,7 @@
|
|||||||
task_list: task_list,
|
task_list: task_list,
|
||||||
calendar_plan: calendar_plan,
|
calendar_plan: calendar_plan,
|
||||||
abstract: abstract,
|
abstract: abstract,
|
||||||
bib_path: "bibl.yml",
|
bib_path: bytes("bibl.yml"), // NOTE: use `bytes` as typst looks in template dir when using just filename
|
||||||
appendices: appendices,
|
appendices: appendices,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -29,3 +29,25 @@
|
|||||||
- #lorem(25);
|
- #lorem(25);
|
||||||
- #lorem(42);
|
- #lorem(42);
|
||||||
- #lorem(27).
|
- #lorem(27).
|
||||||
|
|
||||||
|
#show: appendices_style
|
||||||
|
|
||||||
|
= Quote
|
||||||
|
#link("https://youtu.be/bJQj1uKtnus")[
|
||||||
|
The art isn't the art, the art is never the art,
|
||||||
|
the art is the thing that happens inside you when you make it and the feeling in the heart of the beholder.
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
= Приклад звіту 1
|
||||||
|
#v(-spacing)
|
||||||
|
== Частина 1
|
||||||
|
#lorem(100)
|
||||||
|
== Частина2
|
||||||
|
#lorem(200)
|
||||||
|
|
||||||
|
= Приклад звіту 2
|
||||||
|
#lorem(200)
|
||||||
|
|
||||||
|
= Приклад звіту 3
|
||||||
|
#lorem(200)
|
||||||
|
Reference in New Issue
Block a user