diff --git a/main.typ b/main.typ index fef9e24..4aea8fd 100644 --- a/main.typ +++ b/main.typ @@ -116,21 +116,27 @@ Here’s a simple table: #figure( table( - columns: 3, - table.header[Name][Age][Role], - "Alice", "24", "Engineer", - "Bob", "30", "Designer", - "Carol", "28", "Researcher", + columns: 4, + table.header[Name][Age][Role][Lorem], + "Alice", "24", "Engineer", lorem(8), + "Bob", "30", "Designer", lorem(8), + "Carol", "28", "Researcher", lorem(7), ), caption: [Example table], -) +) == Figures #figure( image("example.png", width: 60%), caption: [An example image with caption.], -) +) +#figure( + image("example.png", width: 60%), + caption: [An example image with caption.], +) + +A reference to an image (see @image-1[] and @image-2 and @table-1) == Footnotes This is a sentence with a footnote. #footnote("This is the footnote text.") diff --git a/template.typ b/template.typ index 8e98d58..9fea1bb 100644 --- a/template.typ +++ b/template.typ @@ -1,3 +1,6 @@ +#import "@preview/headcount:0.1.0": * +#import "@preview/tablex:0.0.9": tablex + #let indent = 1cm #let indent-par(body) = par(h(indent) + body) @@ -49,6 +52,7 @@ ] } + // This function gets your whole document as its `body` and formats // it as an article in the style of the IEEE. #let ludf( @@ -152,25 +156,72 @@ } else { text(12pt, it) } - "" - v(-indent) } // Style bibliography. - // show std.bibliography: set block(spacing: 0.5em) set std.bibliography(title: "Izmantotā literatūra un avoti") set quote(block: true) show table.cell.where(y: 0): strong + // Tables & figures + set figure(numbering: dependent-numbering("1.1.")) + + show figure.where(kind: image): set figure(supplement: "att") + show figure.caption.where(kind: image): set align(start) + show figure.where(kind: image): set figure.caption( + position: bottom, + separator: ". ", + ) + show heading: reset-counter(counter(figure.where(kind: image))) + + show figure.where(kind: table): set figure(supplement: "tabula") + show figure.caption.where(kind: table): set align(end) + show figure.where(kind: table): set figure.caption( + position: top, + separator: " ", + ) + show heading: reset-counter(counter(figure.where(kind: table))) + + show figure.where(kind: raw): set figure.caption(position: top) + + show figure.where(kind: "attachment"): set figure.caption(position: top) + + + // Adapt supplement in caption independently from supplement used for references. + show figure: fig => { + let prefix = fig.supplement + let numbers = numbering(fig.numbering, ..fig.counter.at(fig.location())) + // Wrap figure captions in block to prevent the creation of paragraphs. In + // particular, this means `par.first-line-indent` does not apply. + // See https://github.com/typst/templates/pull/73#discussion_r2112947947. + show figure.caption: it => block[ + #emph([#numbers~#prefix#it.separator])*#it.body* + ] + fig + } + + // Code blocks + show raw: set text( + font: ( + "TeX Gyre Cursor", + "JetBrainsMono NF", + "JetBrains Mono", + "Fira Code", + ), + features: (calt: 0), + ligatures: false, + spacing: 100%, + ) + // Main body. set par( justify: true, leading: 1.5em, - first-line-indent: indent, + first-line-indent: (amount: indent, all: true), spacing: 1.5em, ) @@ -243,3 +294,4 @@ bibliography } +