From d74acb880e9c978cc33508dc272051fbe3093f37 Mon Sep 17 00:00:00 2001 From: Losses Don <1384036+Losses@users.noreply.github.com> Date: Sun, 18 Jan 2026 10:42:04 -0500 Subject: [PATCH 1/3] refactor: Fix type checks and update the citation logic to adapt typst 0.13+ --- lapreprint.typ | 80 +++++++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 37 deletions(-) diff --git a/lapreprint.typ b/lapreprint.typ index fde21dd..c21e3b3 100644 --- a/lapreprint.typ +++ b/lapreprint.typ @@ -52,9 +52,9 @@ let spacer = text(fill: gray)[#h(8pt) | #h(8pt)] let dates; - if (type(date) == "datetime") { + if (type(date) == datetime) { dates = ((title: "Published", date: date),) - }else if (type(date) == "dictionary") { + }else if (type(date) == dictionary) { dates = (date,) } else { dates = date @@ -63,7 +63,9 @@ // Create a short-citation, e.g. Cockett et al., 2023 let year = if (date != none) { ", " + date.display("[year]") } - if (short-citation == auto and authors.len() == 1) { + if (short-citation == auto and authors.len() == 0) { + short-citation = year + } else if (short-citation == auto and authors.len() == 1) { short-citation = authors.at(0).name.split(" ").last() + year } else if (short-citation == auto and authors.len() == 2) { short-citation = authors.at(0).name.split(" ").last() + " & " + authors.at(1).name.split(" ").last() + year @@ -80,8 +82,8 @@ set page( paper-size, margin: (left: 25%), - header: locate(loc => { - if(loc.page() == 1) { + header: context { + if(counter(page).get().first() == 1) { let headers = ( if (open-access) {smallcaps[Open Access]}, if (doi != none) { link("https://doi.org/" + doi, "https://doi.org/" + doi)} @@ -92,29 +94,31 @@ (short-title, short-citation).join(spacer) )) } - }), - footer: block( - width: 100%, - stroke: (top: 1pt + gray), - inset: (top: 8pt, right: 2pt), - [ - #grid(columns: (75%, 25%), - align(left, text(size: 9pt, fill: gray.darken(50%), - ( - if(venue != none) {emph(venue)}, - if(date != none) {date.display("[month repr:long] [day], [year]")} - ).filter(t => t != none).join(spacer) - )), - align(right)[ - #text( - size: 9pt, fill: gray.darken(50%) - )[ - #counter(page).display() of #locate((loc) => {counter(page).final(loc).first()}) + }, + footer: context { + block( + width: 100%, + stroke: (top: 1pt + gray), + inset: (top: 8pt, right: 2pt), + [ + #grid(columns: (75%, 25%), + align(left, text(size: 9pt, fill: gray.darken(50%), + ( + if(venue != none) {emph(venue)}, + if(date != none) {date.display("[month repr:long] [day], [year]")} + ).filter(t => t != none).join(spacer) + )), + align(right)[ + #text( + size: 9pt, fill: gray.darken(50%) + )[ + #counter(page).display() of #counter(page).get().last() + ] ] - ] - ) - ] - ) + ) + ] + ) + } ) // Set the body font. @@ -267,21 +271,23 @@ let abstracts - if (type(abstract) == "content") { + if (type(abstract) == content) { abstracts = (title: "Abstract", content: abstract) } else { abstracts = abstract } - box(inset: (top: 16pt, bottom: 16pt), stroke: (top: 1pt + gray, bottom: 1pt + gray), { + if (abstract != none) { + box(inset: (top: 16pt, bottom: 16pt), stroke: (top: 1pt + gray, bottom: 1pt + gray), { - abstracts.map(abs => { - set par(justify: true) - text(fill: theme, weight: "semibold", size: 9pt, abs.title) - parbreak() - abs.content - }).join(parbreak()) - }) + abstracts.map(abs => { + set par(justify: true) + text(fill: theme, weight: "semibold", size: 9pt, abs.title) + parbreak() + abs.content + }).join(parbreak()) + }) + } if (keywords.len() > 0) { parbreak() text(size: 9pt, { @@ -292,7 +298,7 @@ } v(10pt) - show par: set block(spacing: 1.5em) + set par(spacing: 1.5em) // Display the paper's contents. body From 52a1594484fa8aa6b774b0ddbfba766acd84bc0c Mon Sep 17 00:00:00 2001 From: Losses Don <1384036+Losses@users.noreply.github.com> Date: Sun, 18 Jan 2026 10:51:22 -0500 Subject: [PATCH 2/3] fix: Wrong authors layout --- lapreprint.typ | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lapreprint.typ b/lapreprint.typ index c21e3b3..73dfead 100644 --- a/lapreprint.typ +++ b/lapreprint.typ @@ -202,7 +202,7 @@ } // Authors and affiliations if authors.len() > 0 { - box(inset: (y: 10pt), { + box(width: 100%, inset: (y: 10pt), { authors.map(author => { text(11pt, weight: "semibold", author.name) h(1pt) From 0c36c07ded484594f50b3d2d3125df89a77a5c35 Mon Sep 17 00:00:00 2001 From: Losses Don <1384036+Losses@users.noreply.github.com> Date: Sun, 18 Jan 2026 11:19:25 -0500 Subject: [PATCH 3/3] fix: Heading counter --- lapreprint.typ | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lapreprint.typ b/lapreprint.typ index 73dfead..9879bb1 100644 --- a/lapreprint.typ +++ b/lapreprint.typ @@ -133,9 +133,9 @@ // Configure headings. set heading(numbering: heading-numbering) - show heading: it => locate(loc => { + show heading: it => context { // Find out the final number of the heading counter. - let levels = counter(heading).at(loc) + let levels = counter(heading).get() set text(10pt, weight: 400) if it.level == 1 [ // First-level headings are centered smallcaps. @@ -172,7 +172,7 @@ } _#(it.body):_ ] - }) + } if (logo != none) {