Verified Commit e4f0657f authored by Ivan Kushpel's avatar Ivan Kushpel 🔥
Browse files

rework figures to properly number them in outlines

parent fa1bae2c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -11,3 +11,8 @@

#let docs = tidy.parse-module(read("/src/theorems.typ"))
#tidy.show-module(docs, style: tidy.styles.default)

#pagebreak(weak: true)

#let docs = tidy.parse-module(read("/src/helpers.typ"))
#tidy.show-module(docs, style: tidy.styles.default)

src/helpers.typ

0 → 100644
+18 −0
Original line number Diff line number Diff line
#import "@preview/i-figured:0.2.4": _prefix

/// Create a selector that targets figures of specific kind in the document. Useful for creating custom figure outlines.
/// -> selector | none
#let figure-selector(
  /// What kinds to use in the selector. Must be an array of kinds used in figures.
  ///
  /// If `auto`, then the default of `(raw, table, image)` is used.
  /// -> array | auto
  kinds: auto,
) = {
  if kinds == auto {
    kinds = (raw, table, image)
  }

  let selectors = kinds.map(kind => selector(figure.where(kind: _prefix + repr(kind))))
  return selectors.reduce((acc, sel) => acc.or(sel))
}
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#import "styles/text.typ": set-text

// Reexport functions to the template user
#import "helpers.typ": *
#import "theorems.typ": *
#import "pages/lib.typ" as pages

+1 −1
Original line number Diff line number Diff line
#import "pages.typ": abstract, acknowledgements, declaration, outline, title, start-content, keywords
#import "pages.typ": abstract, acknowledgements, declaration, outline, title, start-content, keywords, start-appendices
+20 −0
Original line number Diff line number Diff line
#import "@preview/i-figured:0.2.4": show-figure
#import "../utils.typ": optical-lines, binding-pagebreak

#let namedblock(
@@ -277,3 +278,22 @@
  set page(numbering: numbering)
  doc
}

/// Resets the heading number and starts numbering headings and figures differently.
/// Use this function as a show rule after the main body of the thesis.
/// -> content
#let start-appendices(
  /// The page to skip to.
  /// -> "even" | "odd" | none
  to: "odd",
  /// The numbering that applies for the rest of the document.
  /// -> function | none | str
  numbering: "A.1",
  doc,
) = {
  pagebreak(to: to, weak: true)
  counter(heading).update(0)
  set heading(numbering: numbering)
  show figure: show-figure.with(numbering: numbering)
  doc
}
Loading