feat(ggg): flashcard formatting
This commit is contained in:
parent
1a3c60aed6
commit
07b5af5a17
|
@ -1,7 +1,24 @@
|
|||
#import "@preview/cetz:0.4.0"
|
||||
|
||||
#set page(margin: 1cm, columns: 2)
|
||||
/*
|
||||
* How to use for anki
|
||||
* -------------------
|
||||
*
|
||||
* typst compile ggg-cards.typ output/{0p}ggg-cards.svg
|
||||
* ls | while read -r a && read -r b; do
|
||||
* echo "<img src='$a'/>, <img src='$b'/>";
|
||||
* done > geometrische-grundlagen-der-geometrieverarbeitung.csv
|
||||
*
|
||||
* put all images from ./output in your ankis collection.media directory
|
||||
*
|
||||
*/
|
||||
|
||||
// #set page(margin: 1cm, columns: 2)
|
||||
#show heading: it => none
|
||||
#set heading(numbering: "1.1")
|
||||
#set par(justify: true)
|
||||
|
||||
#show math.equation.where(block: false): box
|
||||
|
||||
#set math.mat(delim: "[")
|
||||
#set math.vec(delim: "[")
|
||||
|
@ -13,13 +30,29 @@
|
|||
output
|
||||
}
|
||||
|
||||
#let numberingH(c)={
|
||||
return numbering(c.numbering,..counter(heading).at(c.location()))
|
||||
}
|
||||
|
||||
#let card(
|
||||
question: "",
|
||||
answer: ""
|
||||
) = rect(width: 100%)[
|
||||
) = [
|
||||
// #rect(width: 100%)[
|
||||
#set page("a7", flipped: true, width: auto, header: [
|
||||
#context {
|
||||
let h = query(selector(heading.where(level: 1)).before(here())).last()
|
||||
let s = query(selector(heading.where(level: 2)).before(here())).last()
|
||||
text(size: 7.8pt)[#smallcaps()[#numberingH(h) #h.body / #numberingH(s) #s.body]]
|
||||
}
|
||||
])
|
||||
#page()[
|
||||
#strong(question)
|
||||
|
||||
]
|
||||
#page()[
|
||||
#answer
|
||||
]
|
||||
// ]
|
||||
]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue