The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Title: Write and Render 'Typst' Documents
Version: 0.0.3
Description: Compile 'Typst' files using the 'typst-cli' (https://typst.app) command line tool. Automatically falls back to rendering via embedded 'Typst' from 'Quarto' (https://quarto.org) if 'Typst' is not installed. Includes utilities to check for 'typst-cli' availability and run 'Typst' commands.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.2
Imports: cli, fs, processx, rlang
Depends: R (≥ 4.1.0)
Suggests: jsonlite, rstudioapi, testthat (≥ 3.0.0)
SystemRequirements: Typst command line tool (<https://github.com/typst/typst>) or Quarto command line tool (<https://github.com/quarto-dev/quarto-cli>).
Config/testthat/edition: 3
URL: http://christophertkenny.com/typr/, https://github.com/christopherkenny/typr
NeedsCompilation: no
Packaged: 2025-05-30 17:08:03 UTC; chris
Author: Christopher T. Kenny ORCID iD [aut, cre]
Maintainer: Christopher T. Kenny <christopherkenny@fas.harvard.edu>
Repository: CRAN
Date/Publication: 2025-05-30 17:20:02 UTC

Find if Typst is available

Description

Find if Typst is available

Usage

has_any_typst()

has_typst_cli()

has_quarto_typst()

has_quarto_cli()

typr_has_typst()

typr_has_quarto()

typr_has_quarto_typst()

Value

a logical if Typst or Quarto are found

Examples

has_any_typst()
has_typst_cli()
has_quarto_cli()
has_quarto_typst()

Compile a Typst document

Description

Compile a Typst document

Usage

typr_compile(
  input = NULL,
  output_file = NULL,
  output_format = c("pdf", "png", "svg", "html"),
  typst_args = NULL
)

Arguments

input

either a path to a .typ file or text to use as the file

output_file

file to output to

output_format

format to use. One of c('pdf', 'png', 'svg', 'html'),

typst_args

Additional arguments to pass to Typst. Can be listed with typr_help('compile')

Value

a path to the created file

Examples


typr_compile('hello world')
typr_compile(
  input = 'Hello world', output_format = 'png',
  typst_args = c('--ppi', '300')
)


List Available Typst Fonts

Description

List Available Typst Fonts

Usage

typr_fonts()

Value

a character vector of font names

Examples


typr_fonts()


Get Help Information for a Typst command

Description

Prints a message to the terminal with help information. Silently returns the content as character which can be printed with cat().

Usage

typr_help(command = NULL)

Arguments

command

name of a command to get help for, e.g. 'compile'

Value

a character vector of information, invisibly

Examples


typr_help('compile')


Create a project from a template

Description

Create a project from a template

Usage

typr_init(template = NULL, version = NULL, dir = NULL, typst_args = NULL)

Arguments

template

a template to use, can be local or on Typst Universe. If the string does not specify ⁠@preview⁠ or ⁠@local⁠, '@preview' will be prepended.

version

a version string, e.g. ⁠0.1.0⁠

dir

The project directory

typst_args

Additional arguments to pass to Typst. Can be listed with typr_help('init')

Value

a directory, invisibly

Examples


typr_init('charged-ieee', dir = paste0(tempdir(), '/typr_example'))


Query within a Typst file

Description

Query within a Typst file

Usage

typr_query(
  input = NULL,
  selector = NULL,
  typst_args = NULL,
  as_json = !rlang::is_installed("jsonlite")
)

Arguments

input

a path to a .typ file

selector

a string to search for, e.g. a "<label>"

typst_args

Additional arguments to pass to Typst. Can be listed with typr_help('query')

as_json

if TRUE, return a list, otherwise a character string

Value

a length one character with json syntax if !as_json, otherwise a list

Examples


tf <- fs::file_temp(ext = 'typ')
writeLines(text = '= test <lbl>\n', con = tf)
typr_query(input = tf, selector = '<lbl>')


Get installed Typst version

Description

Get installed Typst version

Usage

typr_version(keep_hash = FALSE)

Arguments

keep_hash

description

Value

a version, numeric if !keep_hash

Examples


typr_version()


Watch a Typst document

Description

Watch a Typst document

Usage

typr_watch(
  input = NULL,
  output_file = NULL,
  output_format = c("pdf", "png", "svg", "html"),
  typst_args = NULL
)

typr_watch_stop()

Arguments

input

either a path to a .typ file or text to use as the file

output_file

file to output to

output_format

format to use. One of c('pdf', 'png', 'svg', 'html'),

typst_args

Additional arguments to pass to Typst. Can be listed with typr_help('watch')

Value

a path to the created file

Examples


tf <- fs::file_temp(ext = 'typ')
writeLines(text = '= test', con = tf)
typr_watch(tf)
writeLines(text = c('= test', 'hello'), con = tf)


Identify Install Typst to Use

Description

Identify Install Typst to Use

Usage

typr_which_typst()

Value

a character vector or NULL if no Typst is found

Examples

typr_which_typst()

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.