Skip to content

Commit

Permalink
First kinda working draft
Browse files Browse the repository at this point in the history
  • Loading branch information
mvuorre committed Oct 9, 2023
1 parent 6532910 commit 7f76d9f
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 21 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# Quarto-apaish Format
# APA7ish Quarto templates

## Installing

_TODO_: Replace the `<github-organization>` with your GitHub organization.
Use quarto-apaish in an existing Quarto project

```bash
quarto use template <github-organization>/quarto-apaish
quarto add mvuorre/quarto-apaish
```

This will install the format extension and create an example qmd file
that you can use as a starting place for your document.
Create a new Quarto project using quarto-apaish:

## Using
```bash
quarto use template mvuorre/quarto-apaish
```

_TODO_: Describe how to use your format.
## Templates:

- Typst (PDF output): [source](template.qmd), [PDF](template.pdf)
9 changes: 7 additions & 2 deletions _extensions/quarto-apaish/typst-show.typ
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ $if(by-author)$
$for(by-author)$
$if(it.name.literal)$
( name: [$it.name.literal$],
affiliation: [$for(it.affiliations)$$it.name$$sep$, $endfor$],
email: [$it.email$] ),
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$
),
Expand All @@ -39,6 +41,9 @@ $endif$
$if(abstract)$
abstract: [$abstract$],
$endif$
$if(keywords)$
keywords: [$keywords$],
$endif$
$if(margin)$
margin: ($for(margin/pairs)$$margin.key$: $margin.value$,$endfor$),
$endif$
Expand Down
19 changes: 14 additions & 5 deletions _extensions/quarto-apaish/typst-template.typ
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
date: none,
abstract: none,
cols: 1,
margin: (x: 1.25in, y: 1.25in),
margin: (x: 1in, y: 1in),
paper: "us-letter",
lang: "en",
region: "US",
font: (),
fontsize: 11pt,
sectionnumbering: none,
toc: false,
keywords: none,
doc,
) = {
set page(
Expand Down Expand Up @@ -52,9 +53,11 @@
row-gutter: 1.5em,
..authors.map(author =>
align(center)[
#author.name \
#text(weight: "semibold")[#author.name] \
#author.affiliation \
#author.email
#author.email \
#author.orcid \
#author.url
]
)
)
Expand All @@ -67,8 +70,14 @@
}

if abstract != none {
block(inset: 2em)[
#text(weight: "semibold")[Abstract] #h(1em) #abstract
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
]
}

Expand Down
9 changes: 9 additions & 0 deletions bibliography.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@Manual{R,
title = {R: A Language and Environment for Statistical Computing},
author = {{R Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
year = {2023},
url = {https://www.R-project.org/},
}
Binary file added template.pdf
Binary file not shown.
117 changes: 110 additions & 7 deletions template.qmd
Original file line number Diff line number Diff line change
@@ -1,18 +1,121 @@
---
title: Untitled
title: APA7-ish Quarto Typst PDF template

author:
- name: Norah Jones
orcid: 0000-0000-0000-0000
affiliation:
- ref: a
- ref: b
email: [email protected]
url: https://example.org/
- name: John Hamm
affiliation:
- ref: a
affiliations:
- id: a
name: University A
- id: b
name: University B
department: Some department
city: A City
country: A Country

abstract: |
This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format.
keywords: "Template, APA, Typst, PDF"

bibliography: bibliography.bib
csl: https://www.zotero.org/styles/apa
citeproc: true

format:
quarto-apaish-typst: default
quarto-apaish-typst:
toc: false
columns: 2
fontsize: 11pt
papersize: a4
mainfont: Libertinus
section-numbering: "" # https://typst.app/docs/reference/meta/numbering/
---

## Introduction
# Introduction

This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format.

## Markdown

*Italics*, **bold**.

> Blockquotes
- Lists

1. Numbers

# Methods

Maths (LaTeX) inline ($E=mc^2$) and blocks:

$$
x^2 + y^2 = z^2.
$$ {#eq-1}
The latter are easily cited (e.g. @eq-1).
# Results
## Code
```{r}
pi / 3
```
## Tables
Tables don't work particularly well.
```{r}
#| label: tbl-1
#| tbl-cap: Mtcars table.
#| echo: false
library(gt)
mtcars[1:6, 1:6] |>
gt() |>
tab_footnote("Note.", cells_column_labels(1))
```
@tbl-1 shows what happens if you run `mtcars[1:6, 1:6]` in R [@R].
## Figures
Figures are just fine.
```{r}
#| label: fig-1
#| fig-cap: Mtcars figure.
#| fig-width: 4
#| fig-height: 4
#| echo: false
plot(mtcars[, 3:5])
```
@fig-1 shows what happens if you run `plot(mtcars[, 3:5])` in R [@R].
# Discussion
*TODO* Create an example file that demonstrates the formatting and features of your format.
This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format.
## More Information
This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format. This document is a template demonstrating the Apaish format.
You can learn more about creating custom Typst templates here:
# References
<https://quarto.org/docs/prerelease/1.4/typst.html#custom-formats>
::: {#refs}
:::
# Appendices
Additional information.

0 comments on commit 7f76d9f

Please sign in to comment.