Commands
This reference documents how to interact with the Typst compiler.
Typstry.Commands.TypstCommandErrors.TypstCommandError — Type
TypstCommandError <: ExceptionAn Exception indicating a Typst command-line interface error from running a TypstCommand.
Interface
showerror(::IO, ::TypstCommandError)
Typstry.Commands.TypstCommands.TypstCommand — Type
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)- Can be used with
julia_mono.
- Can be used with
detach(::TypstCommand)eltype(::Type{TypstCommand})firstindex(::TypstCommand)getindex(::TypstCommand, i)hash(::TypstCommand, ::UInt)ignorestatus(::TypstCommand)- Do not throw a
TypstCommandErrorif the Typst compiler throws an error. Errors thrown by the Typst compiler are printed tostderrregardless.
- Do not throw a
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 JuliaTypstCommandErrorwill be thrown unless theignorestatusflag is set.
- Errors thrown by the Typst compiler will be printed to
read(::TypstCommand)- Errors thrown by the Typst compiler will be printed to
stderr. Then, a JuliaTypstCommandErrorwill be thrown unless theignorestatusflag is set.
- Errors thrown by the Typst compiler will be printed to
run(::TypstCommand, args...; wait::Bool = true)- Errors thrown by the Typst compiler will be printed to
stderr. Then, a JuliaTypstCommandErrorwill be thrown unless theignorestatusflag is set.
- Errors thrown by the Typst compiler will be printed to
setcpuaffinity(::TypstCommand, cpus)setenv(::TypstString, env...; kwargs...)- Can be used with
julia_mono.
- Can be used with
show(::IO, ::MIME"text/plain", ::TypstCommand)show(::IO, ::TypstCommand)
Examples
julia> help = TypstCommand(["help"])
typst`help`
julia> TypstCommand(help; ignorestatus = true)
typst`help`Typstry.Commands.Run.@run — Macro
(@run parameters...)::NothingConstruct 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"Typstry.Commands.TypstCommands.@typst_cmd — Macro
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"])Typstry.Commands.JuliaMono.julia_mono — Constant
julia_monoA 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:
@runrendershowwith theapplication/pdf,image/png,image/svg+xml, andimage/webpMIMEtypes and aTypstFunction,TypstString,TypstText, andTypstvalue
See also TypstCommand.