Skip to content

Commit

Permalink
v0.1.0 (#6)
Browse files Browse the repository at this point in the history
* Add a running head

* Figure example

* Init APA headers (#1)

* Adjust abstract, keywords, & date

* Add date to template

* Include apa.csl from local file

* Fix authors & institutions (#2)

* Add apa.csl

* Try to clean code

* Corresponding author email (#5)

* Authornote good enough (#5)

* Authornote good enough (#5)

* Latest pdf

* Bump version
  • Loading branch information
mvuorre authored Oct 10, 2023
1 parent 7f76d9f commit 204f94e
Show file tree
Hide file tree
Showing 7 changed files with 1,878 additions and 68 deletions.
Binary file added Thomas_Bayes.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion _extensions/quarto-apaish/_extension.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
title: Quarto-apaish
author: Matti Vuorre
version: 0.0.1
version: 0.1.0
quarto-required: ">=1.4.0"
contributes:
formats:
Expand Down
84 changes: 75 additions & 9 deletions _extensions/quarto-apaish/typst-show.typ
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,43 @@
$if(title)$
title: [$title$],
$endif$

$if(runninghead)$
runninghead: [$runninghead$],
$endif$

$if(authornote)$
authornote: [$authornote$],
$endif$

$if(by-author)$
authors: (
$for(by-author)$
$if(it.name.literal)$
( name: [$it.name.literal$],
affiliation: [$for(it.affiliations)$$it.name$$if(it.department)$, $it.department$$endif$$sep$\ $endfor$],
email: [$it.email$],
orcid: [$it.orcid$],
url: [$it.url$] ),
$endif$
$endfor$
$for(by-author)$(
name: [$it.name.literal$],
corresponding: [
$if(it.email)$
#footnote[Corresponding author: $it.name.literal$, $it.email$.]
$endif$
],
affiliations: [
$for(it.affiliations)$
$if(it.id)$$it.id$$endif$$sep$,
$endfor$
],
email: [$it.email$]
),
$endfor$
),
$endif$

$if(affiliations)$
affiliations: (
$for(affiliations)$(
id: [$it.id$],
string: [$if(it.department)$$it.department$\ $endif$$it.name$]
),
$endfor$
),
$endif$
$if(date)$
date: [$date$],
Expand Down Expand Up @@ -65,3 +90,44 @@ $endif$
cols: $if(columns)$$columns$$else$1$endif$,
doc,
)

#show heading.where(
level: 1
): it => block(width: 100%, below: 12pt)[
#set align(center)
#set text(1em, weight: "regular")
#strong(it.body)
]

#show heading.where(
level: 2
): it => block(width: 100%, below: 12pt)[
#set align(left)
#set text(1em, weight: "bold")
#strong(it.body)
]

#show heading.where(
level: 3
): it => block(width: 100%, below: 12pt)[
#set align(left)
#set text(1em, weight: "bold")
#emph(it.body)
]

#show heading.where(
level: 4
): it => text(
size: 1em,
weight: "bold",
it.body + [.]
)

#show heading.where(
level: 5
): it => text(
size: 1em,
weight: "bold",
style: "italic",
it.body + [.]
)
103 changes: 65 additions & 38 deletions _extensions/quarto-apaish/typst-template.typ
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@

#let article(
title: none,
runninghead: none,
authors: none,
affiliations: none,
date: none,
authornote: none,
abstract: none,
cols: 1,
margin: (x: 1in, y: 1in),
margin: (x: 0.75in, y: 1.25in),
paper: "us-letter",
lang: "en",
region: "US",
Expand All @@ -27,57 +30,81 @@
keywords: none,
doc,
) = {

set page(
paper: paper,
margin: margin,
numbering: "1",
number-align: bottom + center,
header-ascent: 0%,
header: locate(
loc => if [#loc.page()] == [1] {
[]
} else {
align(
center + horizon,
runninghead
)
}
),
)

set par(
justify: true,
leading: 0.55em
)

set text(
lang: lang,
region: region,
font: font,
size: fontsize
)

set heading(
numbering: sectionnumbering
)
set par(justify: true)
set text(lang: lang,
region: region,
font: font,
size: fontsize)
set heading(numbering: sectionnumbering)

if title != none {
align(center)[#block(inset: 2em)[
#text(weight: "bold", size: 1.5em)[#title]
]]
align(center)[
#block(inset: 2em, below: 0em)[
#text(weight: "bold", size: 1.5em)[#title]
]
]
}

if authors != none {
let count = authors.len()
let ncols = calc.min(count, 3)
grid(
columns: (1fr,) * ncols,
row-gutter: 1.5em,
..authors.map(author =>
align(center)[
#text(weight: "semibold")[#author.name] \
#author.affiliation \
#author.email \
#author.orcid \
#author.url
]
)
)
align(center)[
#block(inset: 10%, above: 0em, below: 0.5em)[
#for a in authors [
#text(weight: "medium", size: 1.25em)[#a.name]#super[#a.affiliations]#a.corresponding \
]
]
]
}

if date != none {
align(center)[#block(inset: 1em)[
#date
]]

if affiliations != none {
align(center)[
#block(inset: 10%, above: 0em, below: 0em)[
#for a in affiliations [
#super[#a.id] #a.string \
]
]
]
}

if abstract != none {
block(inset: 1em)[
#text(weight: "semibold")[Abstract.] #h(0.5em) #abstract
]
}

if keywords != none {
block(inset: 1em)[
#text(weight: "semibold")[Keywords.] #h(0.5em) #keywords
block(inset: 10%, above: 0em, below: 2em)[
#abstract
#if keywords != none {[
#text(weight: "regular", style: "italic")[Keywords:] #h(0.25em) #keywords
]} \
#if date != none {[
#text(weight: "regular", style: "italic")[Date:] #h(0.25em) #date
]} \
#if authornote != none {[
#text(weight: "regular", style: "italic")[Author note:] #h(0.25em) #authornote
]}
]
}

Expand Down
Loading

0 comments on commit 204f94e

Please sign in to comment.