Commands

This reference documents how to interact with the Typst compiler.

Typstry.Commands.TypstCommands.TypstCommandType
TypstCommand(::AbstractVector{<:AbstractString})
TypstCommand(::TypstCommand; parameters...)

The Typst compiler and its parameters.

Keyword parameters have the same semantics as for a Cmd.

Interface

This type implements the Cmd interface. However, the interface is undocumented, which may result in unexpected behavior.

  • ==(::TypstCommand, ::TypstCommand)
  • Cmd(::TypstCommand; parameters...)
  • addenv(::TypstCommand, env...; inherit::Bool = true)
  • detach(::TypstCommand)
  • eltype(::Type{TypstCommand})
  • firstindex(::TypstCommand)
  • getindex(::TypstCommand, i)
  • hash(::TypstCommand, ::UInt)
  • ignorestatus(::TypstCommand)
    • Do not throw a TypstCommandError if the Typst compiler throws an error. Errors thrown by the Typst compiler are printed to stderr regardless.
  • iterate(::TypstCommand, i)
  • iterate(::TypstCommand)
  • keys(::TypstCommand)
  • lastindex(::TypstCommand)
  • length(::TypstCommand)
  • read(::TypstCommand, ::Type{String})
    • Errors thrown by the Typst compiler will be printed to stderr. Then, a Julia TypstCommandError will be thrown unless the ignorestatus flag is set.
  • read(::TypstCommand)
    • Errors thrown by the Typst compiler will be printed to stderr. Then, a Julia TypstCommandError will be thrown unless the ignorestatus flag is set.
  • run(::TypstCommand, args...; wait::Bool = true)
    • Errors thrown by the Typst compiler will be printed to stderr. Then, a Julia TypstCommandError will be thrown unless the ignorestatus flag is set.
  • setcpuaffinity(::TypstCommand, cpus)
  • setenv(::TypstString, env...; kwargs...)
  • show(::IO, ::MIME"text/plain", ::TypstCommand)
  • show(::IO, ::TypstCommand)

Examples

julia> help = TypstCommand(["help"])
typst`help`

julia> TypstCommand(help; ignorestatus = true)
typst`help`
source
Typstry.Commands.Run.@runMacro
(@run parameters...)::Nothing

Construct and run a TypstCommand.

Each parameter is evaluated and converted to a string. This is intended for convenience and interactive use. The command is ran with ignorestatus and will gracefully catch interrupts, which is useful for typst watch. If the TYPST_FONT_PATHS environment variable is not set, the command is ran with it set to julia_mono.

Examples

julia> command = :help

julia> @run

julia> @run :help

julia> @run command "he" * "lp"
source
Typstry.Commands.TypstCommands.@typst_cmdMacro
typst``
@typst_cmd(::String)

Construct a TypstCommand where each parameter is separated by a space.

Interpolation has the same syntax as command and string literal interpolation, but has the semantics of string literal interpolation. The semantics may change in the future.

Examples

julia> typst`help`
typst`help`

julia> println(typst`compile $("document.typ --jobs") $1`)
TypstCommand(["compile", "document.typ", "--jobs", "1"])
source
Typstry.Commands.JuliaMono.julia_monoConstant
julia_mono

A constant String file path to the JuliaMono typeface.

This typeface is available when using one of the following approaches:

  • TypstCommand(["compile", "input.typ", "output.pdf", "--font-path=$julia_mono"])
  • addenv(::TypstCommand, "TYPST_FONT_PATHS" => julia_mono)
  • setenv(::TypstCommand, "TYPST_FONT_PATHS" => julia_mono)
  • ENV["TYPST_FONT_PATHS"] = julia_mono

and when compiling documents with the following methods:

  • @run
  • render
  • show with the application/pdf, image/png, image/svg+xml, and image/webp MIME types and a TypstFunction, TypstString, TypstText, and Typst value

See also TypstCommand.

source