diff --git a/src/resources/formats/typst/pandoc/quarto/typst-template.typ b/src/resources/formats/typst/pandoc/quarto/typst-template.typ index 0a2e69bc55..219ac27a8d 100644 --- a/src/resources/formats/typst/pandoc/quarto/typst-template.typ +++ b/src/resources/formats/typst/pandoc/quarto/typst-template.typ @@ -61,61 +61,64 @@ } } - place( - top, - float: true, - scope: "parent", - clearance: 4mm, - block(below: 1em, width: 100%)[ + let has-title-block = title != none or (authors != none and authors != ()) or date != none or abstract != none + if has-title-block { + place( + top, + float: true, + scope: "parent", + clearance: 4mm, + block(below: 1em, width: 100%)[ - #if title != none { - align(center, block(inset: 2em)[ - #set par(leading: heading-line-height) if heading-line-height != none - #set text(font: heading-family) if heading-family != none - #set text(weight: heading-weight) - #set text(style: heading-style) if heading-style != "normal" - #set text(fill: heading-color) if heading-color != black + #if title != none { + align(center, block(inset: 2em)[ + #set par(leading: heading-line-height) if heading-line-height != none + #set text(font: heading-family) if heading-family != none + #set text(weight: heading-weight) + #set text(style: heading-style) if heading-style != "normal" + #set text(fill: heading-color) if heading-color != black - #text(size: title-size)[#title #if thanks != none { - footnote(thanks, numbering: "*") - counter(footnote).update(n => n - 1) - }] - #(if subtitle != none { - parbreak() - text(size: subtitle-size)[#subtitle] - }) - ]) - } + #text(size: title-size)[#title #if thanks != none { + footnote(thanks, numbering: "*") + counter(footnote).update(n => n - 1) + }] + #(if subtitle != none { + parbreak() + text(size: subtitle-size)[#subtitle] + }) + ]) + } - #if authors != none and authors != () { - let count = authors.len() - let ncols = calc.min(count, 3) - grid( - columns: (1fr,) * ncols, - row-gutter: 1.5em, - ..authors.map(author => - align(center)[ - #author.name \ - #author.affiliation \ - #author.email - ] + #if authors != none and authors != () { + let count = authors.len() + let ncols = calc.min(count, 3) + grid( + columns: (1fr,) * ncols, + row-gutter: 1.5em, + ..authors.map(author => + align(center)[ + #author.name \ + #author.affiliation \ + #author.email + ] + ) ) - ) - } + } - #if date != none { - align(center)[#block(inset: 1em)[ - #date - ]] - } + #if date != none { + align(center)[#block(inset: 1em)[ + #date + ]] + } - #if abstract != none { - block(inset: 2em)[ - #text(weight: "semibold")[#abstract-title] #h(1em) #abstract - ] - } - ] - ) + #if abstract != none { + block(inset: 2em)[ + #text(weight: "semibold")[#abstract-title] #h(1em) #abstract + ] + } + ] + ) + } if toc { let title = if toc_title == none { diff --git a/tests/docs/smoke-all/typst/raw-set-page-no-extra-page.qmd b/tests/docs/smoke-all/typst/raw-set-page-no-extra-page.qmd new file mode 100644 index 0000000000..b6f24736c4 --- /dev/null +++ b/tests/docs/smoke-all/typst/raw-set-page-no-extra-page.qmd @@ -0,0 +1,28 @@ +--- +format: + typst: + keep-typ: true +_quarto: + tests: + typst: + ensurePdfTextPositions: + - # Body text should be on page 1 (no spurious blank page before it) + - subject: "BODY_CONTENT_START" + relation: above + object: + role: "Page" + page: 1 + edge: bottom + - [] + noErrors: default +--- + +```{=typst} +#set page(footer: none) +``` + +BODY_CONTENT_START + +| a | b | +|---|---| +| 1 | 2 |