Skip to content

Commit

Permalink
feat(examples): added example for groups
Browse files Browse the repository at this point in the history
  • Loading branch information
slashformotion committed Apr 7, 2024
1 parent f3861a0 commit a0afe31
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 1 deletion.
Binary file modified examples/full-example/main.pdf
Binary file not shown.
Binary file added examples/groups/groups.pdf
Binary file not shown.
52 changes: 52 additions & 0 deletions examples/groups/groups.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#import "../../glossarium.typ": make-glossary, print-glossary, gls, glspl
// Replace the local import with a import to the preview namespace.
// If you don't know what that mean, please go read typst documentation on how to import packages at https://typst.app/docs/packages/.

#show: make-glossary

#set page(numbering: "1", paper: "a5")

//I recommend setting a show rule for the links to that your reader understand that they can click on the references to go to the term in the glossary.
#show link: set text(fill: blue.darken(60%))

= Groups example

Reference to @ntc \
Reference to @bor

#pagebreak()
= Glossary with group enabled
#print-glossary(
(
(
key: "ntc",
short: "NTC",
long: "Linear Transform Coding",
desc: [This is the opposite of @ltc.],
group: "Nonlinear",
),
(
key: "ltc",
short: "LTC",
long: "This is the opposite of @ltc.",
desc: [ Transform Coding constraint to linear transforms.],
group: "Linear",
),
(
key: "bor",
short: "DEF",
long: "Default",
desc: lorem(25),
),
(
key: "bor2",
short: "DEF2",
long: "Default2",
desc: lorem(25),
group: "", // Please note that an empty group has the same effect as no group
),

),
show-all: true,
group-pagebreak: true, // break page for each group
)
Binary file modified examples/import-terms-from-yaml-file/main.pdf
Binary file not shown.
3 changes: 2 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ local:
cp -r * ~/.local/share/typst/packages/local/glossarium/{{version}}

build-examples:
find examples/* -type d -exec bash -c "echo Compiling {} && typst compile --root . {}/main.typ" \;
@find examples/**/*.pdf -delete
@find examples/**/*.typ -type f -exec sh -c "echo --------- Compiling {} && time typst compile --root . {}" \;

# format typst code (use typstfmt)
fmt:
Expand Down

0 comments on commit a0afe31

Please sign in to comment.