From 07b5af5a1702127dcbf3d59347ecf0508b99aba4 Mon Sep 17 00:00:00 2001 From: Orangerot Date: Sun, 29 Jun 2025 00:25:42 +0200 Subject: [PATCH] feat(ggg): flashcard formatting --- ggg/ggg-cards.typ | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/ggg/ggg-cards.typ b/ggg/ggg-cards.typ index 5295a0f..b7c3da5 100644 --- a/ggg/ggg-cards.typ +++ b/ggg/ggg-cards.typ @@ -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 ", "; +* 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%)[ - #strong(question) - - #answer +) = [ + // #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 + ] + // ] ]