Skip to content

Custom Preamble #77

@fabh2o

Description

@fabh2o

Great plugin, thanks!
I was using LaTeXiT up until now, which is a macOS application that allows to create .svg files from LaTeX code and that embed the formula used to generate them in the svg so that if they are opened again in LaTeXiT its possible to continue the editing (i have a short example here).
I miss a feature from LaTeXiT that would make pptypst a perfect replacement, and its the possibility to specify a custom preamble which gets executed before the code entered in the input form. In this way, its possible to import packages that are used often without the need to (re)write the imports for every element added.

Here is what a preamble might look like for me:

#import "@preview/unify:0.7.1": *
#import "@preview/physica:0.9.8": *
#import "@preview/chemformula:0.1.2": ch
#add-unit("decibel_milliwatt", "dBm", "upright(\"dBm\")")
#add-unit("rpm", "rpm", "upright(\"rpm\")")
#let _qty = qty
#let qty(value, unit, per: "fraction-short", ..args) = _qty(value, unit, per: per, ..args)
#let ebl_dose(value) = qty(str(value), "micro coulomb per centi meter squared")

In this way, could directly enter

Dose #math.gt.eq #ebl_dose(800) when using PMMA #ch("(C5O2H8)_n")

and render as

Image

without having to import the packages, define the function etc. every time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions