Best method to create shorthand for isotopes?

I’m a stable isotope geochemist with years of LaTeX experience and I’m just tipping my toes in Typst. The documents I write are often filled with many occurrences of isotopic notations, combining greek letters, subscripts and superscripts in weird positions.

I am aware that the physica package lets me type something like isotope("Bi",a:211,z:83), but I am looking for an way to create shorthands for the isotopic expressions that I will be using over and over again in the same document. I’m thinking of something like #C13 which would render globally as #super[13]C or #d18O for δ#super[18]O.

Is something like this possible? Am I missing an obvious, better solution? Thanks for any tips.

Hi,

you can definitely define custom commands for often used isotopes.

It’s quite simple:

#import "@preview/physica:0.9.4": isotope

#let C13 = isotope("C", a:"13")

#C13

You could even use a show rule to replace normal text with the isotope notation:

#show "C13": isotope("C", a:"13")

This is an C13 isotope.

which results in:

I guess that’s the easiest way to accomplish isotope notation while writing your notes.

2 Likes

To make sure you match only whole words you can use a regular expression (otherwise the show rule will also match text in words like “AC13A”):

#show regex("\bC13\b"): isotope("C", a:"13")
2 Likes

There is also chem-par which works “out-of-the-box”.

#import "@preview/chem-par:0.0.1": *

#set page(width: 30em, height: auto, margin: 1em)
#show: chem-style

The oxidation of n-butanol with K2Cr2O7 requires acidification with H2SO4 to yield butanoic acid. N,N-dimethyltryptamine.

@James

1 Like