Skip to content

Commit

Permalink
Use ORCID logo from code
Browse files Browse the repository at this point in the history
Deprecates  YAML option, fixes #14
  • Loading branch information
mvuorre committed Nov 27, 2024
1 parent 3b5b1c4 commit 36c5e8f
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 56 deletions.
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
*quarto-preprint* is a [Quarto](https://quarto.org) extension for rendering Quarto source documents to PDF documents via [Typst](https://typst.app/docs). It aims to

- Just Work™️
- Typst doesn't require complicated LaTeX installations
- Typst doesn't require complicated LaTeX installations
- Be fast
- Typst creates PDF files very quickly
- Be 100% Quarto standards compliant
- Write manuscripts without worrying about formatting & metadata
- Switch to any Quarto journal format without changing anything but `format:` (and whatever is required by the destination format)

To use (see below), install the extension and set your Quarto output format to `preprint-typst`. The extension also provides a `preprint-docx` format, which renders Quarto source documents to MS Word documents with some basic layout improvements.
To use (see below), install the extension and set your Quarto output format to `preprint-typst`. The extension also provides a `preprint-docx` format, which renders Quarto source documents to MS Word documents with some basic layout improvements.

Example output: <https://mvuorre.github.io/quarto-preprint/index.pdf>.

Expand Down Expand Up @@ -36,14 +36,11 @@ The output of Quarto documents is configured through YAML metadata either in the

```{yaml}
running-head: "*preprint* Quarto extension manual"
branding: psyarxiv
authornote: This is an example author note.
wordcount: "{{< words-body >}}"
```

`running-head` should be a text string and is used as the document's running head.

`branding` adds a specified preprint service's logo to the document. Currently only "psyarxiv" is a valid value.
`running-head` should be a text string and is used as the document's running head.

`authornote` allows adding information to the footer of the first page.

Expand All @@ -57,7 +54,7 @@ wordcount: "{{< words-body >}}"

## Contributing

Send your bug reports and pull requests to <https://github.com/mvuorre/quarto-preprint>. If you're reporting a bug, please include a reproducible example / full details of what you're trying to do, how, and what goes wrong.
Send your bug reports and pull requests to <https://github.com/mvuorre/quarto-preprint>. If you're reporting a bug, please include a reproducible example / full details of what you're trying to do, how, and what goes wrong.

## Tips

Expand Down
6 changes: 2 additions & 4 deletions _extensions/preprint/_extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@ author: Matti Vuorre
version: 0.10.2
quarto-required: ">=1.5.47"
contributes:
shortcodes:
shortcodes:
- "_extensions/andrewheiss/wordcount/words.lua"
formats:
typst:
template-partials:
- typst-template.typ
- typst-show.typ
format-resources:
- '*.svg'
citeproc: false
filters:
- at: pre-quarto
path: _extensions/andrewheiss/wordcount/citeproc.lua
- at: pre-quarto
path: _extensions/andrewheiss/wordcount/wordcount.lua
count-code-blocks: false
docx:
docx:
reference-doc: preprint.docx
17 changes: 0 additions & 17 deletions _extensions/preprint/orcid.svg

This file was deleted.

1 change: 0 additions & 1 deletion _extensions/preprint/psyarxiv.svg

This file was deleted.

23 changes: 4 additions & 19 deletions _extensions/preprint/typst-template.typ
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
show link: set text(fill: linkcolor)
show cite: set text(fill: linkcolor)

let orcidSvg = ```<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 24 24"> <path fill="#AECD54" d="M21.8,12c0,5.4-4.4,9.8-9.8,9.8S2.2,17.4,2.2,12S6.6,2.2,12,2.2S21.8,6.6,21.8,12z M8.2,5.8c-0.4,0-0.8,0.3-0.8,0.8s0.3,0.8,0.8,0.8S9,7,9,6.6S8.7,5.8,8.2,5.8z M10.5,15.4h1.2v-6c0,0-0.5,0,1.8,0s3.3,1.4,3.3,3s-1.5,3-3.3,3s-1.9,0-1.9,0H10.5v1.1H9V8.3H7.7v8.2h2.9c0,0-0.3,0,3,0s4.5-2.2,4.5-4.1s-1.2-4.1-4.3-4.1s-3.2,0-3.2,0L10.5,15.4z"/></svg>```.text

// Allow custom title for bibliography section
set bibliography(title: bibliography-title, style: bibliography-style)

Expand All @@ -60,7 +62,7 @@
link(
a.orcid,
figure(
image("orcid.svg", height: 0.9em)
image.decode(orcidSvg, height: 0.9em)
)
)
)
Expand All @@ -82,24 +84,7 @@
numbering: "1",
header-ascent: 50%,
header: locate(
// Page 1 header can include citation and branding
loc => if [#loc.page()] == [1] {
set align(right)
set text(size: 0.85em)
box(
inset: 0.2em,
[
#date
#if citation != none {linebreak(); link("https://doi.org/" + citation.doi, "https://doi.org/" + citation.doi)}
]
)
box(
inset: 0.2em,
if branding == "psyarxiv" {
image("psyarxiv.svg", width: 2.25em)
}
)
} else {
loc => if [#loc.page()] != [1] {
// Page >1 header has running head and page number
grid(
columns: (1fr, 1fr),
Expand Down
Binary file modified docs/index.pdf
Binary file not shown.
15 changes: 7 additions & 8 deletions index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ keywords: [Quarto, Typst, extension, preprint]
wordcount: "{{< words-body >}}"
date: "`r Sys.Date()`"
citation:
type: article-journal
type: article
container-title: "PsyArXiv"
doi: "an.example.doi"
url: example.com
Expand All @@ -32,7 +32,6 @@ format:
preprint-typst:
section-numbering: "1.1.1.A.a"
bibliographystyle: apa
branding: psyarxiv
authornote: This is an example author note.
keep-typ: true
---
Expand All @@ -41,23 +40,23 @@ format:

This is an example `preprint-typst` document. Let us first take a look at body text and headings.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Enim sed faucibus turpis in. Nec dui nunc mattis enim ut tellus. Bibendum ut tristique et egestas quis ipsum suspendisse ultrices gravida. Convallis posuere morbi leo urna. Sed velit dignissim sodales ut eu sem integer vitae justo. Convallis posuere morbi leo urna molestie at elementum eu facilisis. Aliquam sem et tortor consequat. Quam viverra orci sagittis eu. Sed arcu non odio euismod lacinia at quis risus sed. Egestas dui id ornare arcu odio ut sem. Lorem ipsum dolor sit amet consectetur.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Enim sed faucibus turpis in. Nec dui nunc mattis enim ut tellus. Bibendum ut tristique et egestas quis ipsum suspendisse ultrices gravida. Convallis posuere morbi leo urna. Sed velit dignissim sodales ut eu sem integer vitae justo. Convallis posuere morbi leo urna molestie at elementum eu facilisis. Aliquam sem et tortor consequat. Quam viverra orci sagittis eu. Sed arcu non odio euismod lacinia at quis risus sed. Egestas dui id ornare arcu odio ut sem. Lorem ipsum dolor sit amet consectetur.

## Heading level 2

Eget arcu dictum varius duis at. Netus et malesuada fames ac turpis. Pellentesque sit amet porttitor eget. Egestas tellus rutrum tellus pellentesque eu tincidunt tortor. Risus quis varius quam quisque id diam. Vel pretium lectus quam id leo in vitae. Sit amet aliquam id diam maecenas ultricies mi eget mauris. Auctor urna nunc id cursus metus aliquam eleifend. Arcu dictum varius duis at consectetur lorem. Tempus iaculis urna id volutpat lacus laoreet non. Adipiscing elit ut aliquam purus sit amet. At auctor urna nunc id cursus metus aliquam. Pharetra vel turpis nunc eget lorem dolor.
Eget arcu dictum varius duis at. Netus et malesuada fames ac turpis. Pellentesque sit amet porttitor eget. Egestas tellus rutrum tellus pellentesque eu tincidunt tortor. Risus quis varius quam quisque id diam. Vel pretium lectus quam id leo in vitae. Sit amet aliquam id diam maecenas ultricies mi eget mauris. Auctor urna nunc id cursus metus aliquam eleifend. Arcu dictum varius duis at consectetur lorem. Tempus iaculis urna id volutpat lacus laoreet non. Adipiscing elit ut aliquam purus sit amet. At auctor urna nunc id cursus metus aliquam. Pharetra vel turpis nunc eget lorem dolor.

### Heading level 3

Tristique et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Mauris commodo quis imperdiet massa tincidunt nunc pulvinar. Commodo elit at imperdiet dui accumsan sit amet nulla. Consectetur lorem donec massa sapien faucibus. In vitae turpis massa sed elementum tempus egestas sed sed. Aliquam faucibus purus in massa tempor. Dignissim diam quis enim lobortis scelerisque fermentum dui faucibus in. Montes nascetur ridiculus mus mauris vitae ultricies leo. Sociis natoque penatibus et magnis dis parturient montes nascetur.
Tristique et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Mauris commodo quis imperdiet massa tincidunt nunc pulvinar. Commodo elit at imperdiet dui accumsan sit amet nulla. Consectetur lorem donec massa sapien faucibus. In vitae turpis massa sed elementum tempus egestas sed sed. Aliquam faucibus purus in massa tempor. Dignissim diam quis enim lobortis scelerisque fermentum dui faucibus in. Montes nascetur ridiculus mus mauris vitae ultricies leo. Sociis natoque penatibus et magnis dis parturient montes nascetur.

#### Heading level 4

Consectetur libero id faucibus nisl. Consequat interdum varius sit amet mattis vulputate enim. Amet mattis vulputate enim nulla aliquet porttitor lacus luctus. Mauris augue neque gravida in fermentum et sollicitudin ac. Pharetra diam sit amet nisl suscipit adipiscing bibendum est ultricies. Nisi quis eleifend quam adipiscing. Diam ut venenatis tellus in. Dignissim enim sit amet venenatis urna cursus eget. Hac habitasse platea dictumst quisque sagittis. In fermentum et sollicitudin ac orci phasellus egestas tellus rutrum.
Consectetur libero id faucibus nisl. Consequat interdum varius sit amet mattis vulputate enim. Amet mattis vulputate enim nulla aliquet porttitor lacus luctus. Mauris augue neque gravida in fermentum et sollicitudin ac. Pharetra diam sit amet nisl suscipit adipiscing bibendum est ultricies. Nisi quis eleifend quam adipiscing. Diam ut venenatis tellus in. Dignissim enim sit amet venenatis urna cursus eget. Hac habitasse platea dictumst quisque sagittis. In fermentum et sollicitudin ac orci phasellus egestas tellus rutrum.

##### Heading level 5

Aliquam faucibus purus in massa tempor nec feugiat nisl pretium. Malesuada proin libero nunc consequat interdum varius. Vulputate dignissim suspendisse in est. Congue eu consequat ac felis donec et odio pellentesque diam. Viverra justo nec ultrices dui sapien. Faucibus vitae aliquet nec ullamcorper sit amet risus. Metus aliquam eleifend mi in. Risus quis varius quam quisque id diam vel quam. Et malesuada fames ac turpis egestas integer eget aliquet.
Aliquam faucibus purus in massa tempor nec feugiat nisl pretium. Malesuada proin libero nunc consequat interdum varius. Vulputate dignissim suspendisse in est. Congue eu consequat ac felis donec et odio pellentesque diam. Viverra justo nec ultrices dui sapien. Faucibus vitae aliquet nec ullamcorper sit amet risus. Metus aliquam eleifend mi in. Risus quis varius quam quisque id diam vel quam. Et malesuada fames ac turpis egestas integer eget aliquet.

## Floats

Expand Down Expand Up @@ -151,4 +150,4 @@ Code listings can also be cross-referenced (@lst-r).
```{r}
1 + 1 + 1
```
```

0 comments on commit 36c5e8f

Please sign in to comment.