Skip to content

Commit

Permalink
Update CVPR template to be used with Typst v0.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
daskol committed Nov 28, 2024
1 parent 38f1fff commit 9f9a340
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 22 deletions.
3 changes: 3 additions & 0 deletions cvpr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ template, you can add a show rule at the top of your file.
its guidelines closely. Since writing CSL-style files is tedious task, we
adopt close enough bibliography style from Zotero.

- With Typst 0.120, multi-columna page layout is set in different way. Thus,
footnotes use full page width at the moment.

## References

+ CVPR 2022 conference [web site][4].
Expand Down
27 changes: 15 additions & 12 deletions cvpr/cvpr2022.typ
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
#let etal = emph[et~al]

#let font-family = ("Times New Roman", "CMU Serif", "Latin Modern Roman",
"New Computer Modern", "Times", "Serif")
"New Computer Modern", "Libertinus Serif")

#let font-family-sans = ("Arial", "TeX Gyre Heros", "New Computer Modern Sans",
"CMU Sans Serif", "Sans")
"CMU Sans Serif", "DejaVu Sans")

#let font-family-mono = ("CMU Typewriter Text", "Latin Modern Mono",
"New Computer Modern Mono", "Mono")
"New Computer Modern Mono", "DejaVu Sans Mono")

#let font-family-link = ("Courier New", "Nimbus Mono PS") + font-family-mono

Expand Down Expand Up @@ -106,7 +106,7 @@
width: auto,
height: 8.875in,
gap: 30pt,
) = locate(loc => {
) = context {
let margin = if margin == auto {
(top: 1in - 0.5pt, left: 0.8125in, right: 0.929in) // CVPR 2022 defaults.
} else {
Expand All @@ -129,7 +129,7 @@
dx = 7.571in + gap
offset += num-lines
xruler(right, dx, dy, width.right, height, offset, num-lines)
})
}

#let ruler = make-ruler() // Default CVPR 2022 ruler.

Expand Down Expand Up @@ -315,16 +315,17 @@
},
footer-descent: 23.4pt, // Visually perfect.
footer: if accepted != none and not accepted {
locate(loc=>{
let ix=counter(page).at(loc).first()
context {
let ix = counter(page).get().first()
return align(center, text(size: font-size.normal, [#ix]))
})
}
},
)

set text(font: font-family, size: font-size.normal)
set par(justify: true, first-line-indent: 0.166666in, leading: 0.532em)
show par: set block(spacing: 0.54em)
set par(
first-line-indent: 0.166666in, leading: 0.532em, spacing: 0.54em,
justify: true)
show raw: set text(font: font-family-mono, size: font-size.normal)

// Configure heading appearence and numbering.
Expand All @@ -340,8 +341,7 @@
show quote.where(block: true): it => {
set block(spacing: 14pt)
set pad(left: 20pt, right: 20pt)
set par(first-line-indent: 0em)
show par: set block(spacing: 9.8pt)
set par(first-line-indent: 0em, spacing: 9.8pt)
it
}

Expand Down Expand Up @@ -415,6 +415,9 @@

// NOTE It seems that there is a typo in formatting instructions and actual
// gutter is 3/8 in not 5/16 in.
//
// TODO(@daskol): Set number of columns in page settings. Otherwise,
// footnotes use all page width.
columns(2, gutter: 0.3125in, {
// Render abstract.
block(width: 100%, {
Expand Down
Binary file modified cvpr/example-paper.typst.pdf
Binary file not shown.
18 changes: 9 additions & 9 deletions cvpr/logo.typ
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#let kern(length) = h(length, weak: true)
#let TeX = style(styles => {
let e = measure(text("E"), styles)
#let TeX = context {
let e = measure(text("E"))
let T = "T"
let E = text(baseline: e.height / 2, "E")
let X = "X"
box(T + kern(-0.1667em) + E + kern(-0.125em) + X)
})
#let LaTeX = style(styles => {
let l = measure(text(10pt, "L"), styles)
let a = measure(text(7pt, "A"), styles)
}
#let LaTeX = context {
let l = measure(text(10pt, "L"))
let a = measure(text(7pt, "A"))
let L = "L"
let A = text(7pt, baseline: a.height - l.height, "A")
box(L + kern(-0.36em) + A + kern(-0.15em) + TeX)
})
#let LaTeXe = style(styles => {
}
#let LaTeXe = context {
box(LaTeX + sym.space.sixth + [2#text(baseline: 0.3em, $epsilon$)])
})
}
2 changes: 1 addition & 1 deletion cvpr/main.typ
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ because reference~@Alpher03 has just two authors.
it.caption
}
#show figure.caption.where(kind: "subfigure"): it => {
let ix = counter(figure.where(kind: "subfigure")).display("(a)")
let ix = context counter(figure.where(kind: "subfigure")).display("(a)")
[#ix~#it.body]
}

Expand Down

0 comments on commit 9f9a340

Please sign in to comment.