diff --git a/preview/glossy/0.2.1/src/themes.typ b/preview/glossy/0.2.1/src/themes.typ index 9e734f6..8ff4163 100644 --- a/preview/glossy/0.2.1/src/themes.typ +++ b/preview/glossy/0.2.1/src/themes.typ @@ -1,3 +1,5 @@ +#import "themes/academic.typ": theme-academic #import "themes/basic.typ": theme-basic +#import "themes/chicago-index.typ": theme-chicago-index #import "themes/compact.typ": theme-compact #import "themes/twocol.typ": theme-twocol diff --git a/preview/glossy/0.2.1/src/themes/academic.typ b/preview/glossy/0.2.1/src/themes/academic.typ new file mode 100644 index 0000000..1093fd2 --- /dev/null +++ b/preview/glossy/0.2.1/src/themes/academic.typ @@ -0,0 +1,50 @@ +// Inspired by academic textbook glossaries +#let theme-academic = ( + section: (title, body) => { + set text(font: "New Computer Modern") + heading(level: 1, title) + v(1em) + body + }, + + group: (name, index, total, body) => { + if name != "" and total > 1 { + v(1.5em) + align(left, text(weight: "bold", size: 1.2em, name)) + v(0.75em) + line(length: 100%, stroke: 0.5pt) + v(0.75em) + } + body + }, + + entry: (entry, index, total) => { + let short-display = text(weight: "bold", entry.short) + let long-display = if entry.long == none { + [] + } else { + [. #entry.long] + } + + let description = if entry.description == none { + [] + } else { + [. #entry.description] + } + + block( + below: 1em, + text( + size: 0.95em, + { + grid( + columns: (1fr, auto), + gutter: 0.75em, + [#short-display#long-display#description], + text(fill: rgb("#666666"), entry.pages) + ) + } + ) + ) + }, +) diff --git a/preview/glossy/0.2.1/src/themes/chicago-index.typ b/preview/glossy/0.2.1/src/themes/chicago-index.typ new file mode 100644 index 0000000..fa3c82e --- /dev/null +++ b/preview/glossy/0.2.1/src/themes/chicago-index.typ @@ -0,0 +1,47 @@ +// Inspired by the Chicago Manual of Style's index format +#let theme-chicago-index = ( + section: (title, body) => { + set par(hanging-indent: 1em) + heading(level: 1, smallcaps(title)) + body + }, + + group: (name, index, total, body) => { + if name != "" and total > 1 { + v(1em) + text(weight: "medium", style: "italic", name) + v(0.5em) + } + body + }, + + entry: (entry, index, total) => { + let short-display = text(weight: "regular", entry.short) + let long-display = if entry.long == none { + [] + } else { + [ — #entry.long] // Using em-dash for Chicago style + } + + let description = if entry.description == none { + [] + } else { + text(style: "italic", [: #entry.description]) + } + + block( + below: 0.65em, + text( + size: 0.9em, + { + grid( + columns: (1fr, auto), + gutter: 1em, + [#short-display#entry.label#long-display#description], + [#entry.pages] + ) + } + ) + ) + }, +) diff --git a/preview/glossy/0.2.1/tests/theme-gallery/ref/1.png b/preview/glossy/0.2.1/tests/theme-gallery/ref/1.png index 43f436f..a1d63ee 100644 Binary files a/preview/glossy/0.2.1/tests/theme-gallery/ref/1.png and b/preview/glossy/0.2.1/tests/theme-gallery/ref/1.png differ diff --git a/preview/glossy/0.2.1/tests/theme-gallery/test.typ b/preview/glossy/0.2.1/tests/theme-gallery/test.typ index 3677581..d99effe 100644 --- a/preview/glossy/0.2.1/tests/theme-gallery/test.typ +++ b/preview/glossy/0.2.1/tests/theme-gallery/test.typ @@ -27,22 +27,32 @@ #show: init-glossary.with(myGlossary, show-term: (body) => [#emph(body)]) -#text(size: 18pt, weight: "bold")[Theme Gallery] +#set page( + margin: 1cm, + height: auto, +) -First, we refer to each term at least once so they'll actually show up in the -glossaries. Our terms include: @atom, @iphone, @html:cap, @css, and @tps. +#text(size: 24pt, weight: "bold")[`glossy`: theme gallery] + +#text(size: 1pt, fill: rgb(0,0,0,0))[ + First, we refer to each term at least once so they'll actually show up in the + glossaries. Our terms include: @atom, @iphone, @html:cap, @css, and @tps. +] +#v(-2em) -// TODO: ask Discord if there's a way to get a symbol (ie function) name as a // TODO: figure out if there's a way to get a symbol (ie function) name as a // string or content #let themes = ( + ("theme-academic", theme-academic), ("theme-basic", theme-basic), + ("theme-chicago-index", theme-chicago-index), ("theme-compact", theme-compact), ) #for theme in themes { block( breakable: false, + width: 100%, spacing: 2em, inset: 1em, stroke: 1pt+gray, @@ -53,7 +63,7 @@ glossaries. Our terms include: @atom, @iphone, @html:cap, @css, and @tps. // HACK: special case theme-twocol so we can restrict the height #block( breakable: false, - spacing: 2em, + spacing: 1em, inset: 1em, stroke: 1pt+gray, height: 1.5in, diff --git a/preview/glossy/0.2.1/themeshots.png b/preview/glossy/0.2.1/themeshots.png index bc758a6..a1d63ee 100644 Binary files a/preview/glossy/0.2.1/themeshots.png and b/preview/glossy/0.2.1/themeshots.png differ