- Published on
Rénder SMILES rings as mobile diagrams.
- Authors

- Name
- aimode.news
- @aimode_news
This post is part of our special coverage Global Development 2011.
{\cHFFFFFF}{\cH00FFFF}{\cH00FFFF} {\cHFFFFFF}{\cH00FFFF}{\cH00FFFF} {\cHFFFFFF}{\cH00FFFF} {\cHFFFFFF}{\cH00FFFF}{\cH00FFFF} Rust./WASM plusin for parsing and playing out, then draws the result
The package is meant for Chemitry notes, reactions, reports, and teaching material where you want to live direct in your Typst source instead of Coping diagrams from a security destination.
♪ Start by reporting smiles ♪
Pass a SMILES string and the package will draw the
@preview/typed-smiles: 0.2.0
#table
Columns: (1fr, 1fr, 1fr),
I don't know.
I'm sorry.
I'm sorry.
"No, no, no, no.
[*Ethanol*]
[*Alanine*],
[*Chlobenzenzene*],
[*Furan*],
[#smiles("CCO")],
[#smiles("CC(N)C(=O)O")],
[#smiles]
[#smiles("C1=CC=CO1")]
I'm not sure.
Scaling
Use scale
I don't know if I'm going to be able to help you, but I don't think I'm going to be able to help you.
You can still override Bond-Length.
I don't know.
font-size
I don't know.
Individually when a figure needs human movement.
#table
Columns: (1fr, 1fr, 1fr),
I don't know.
I'm sorry.
I'm sorry.
"No, no, no, no.
[*Small*],
[*Default*]
[*Large*],
[#smiles("C1=CC=C1", scale: 0.8)],
("C1=CC=CC=C1"),
[#smiles("C1=CC=C1", scale: 1.4)],
I'm not sure.
Hydrogens and labels
By default, typed-smiles
Follows the our usual drawing convention:
You know, heteratoms are down, while carbon hydroggens stay intact.
Which means ordinary SMILES such as CC(O)O
I'm sorry, I'm sorry.
And...
OH
We'll show-all-h: true
When you also want
Carbon hydrogens, blacket syntax for explicat hydrogens, and label
You know, for...
I'm sorry to bother you, but I'm sorry.
To color a label and its bunds
You know, by element symbol or named color.
With font
#table
Columns: (1fr, 1fr, 1fr, 1fr,
I don't know.
I'm sorry.
I'm sorry.
"No, no, no, no.
[*Default Hetero H*]
[*All H*]
[Exxlicit bracket H*]
[*Colored label*]
[*Custom font*]
[#smiles("CC(N)C(=O)O")],
[#smiles, show-all-h: true]
[#smiles("[NH3]"],
[#smiles("Ph3}P}C=O")]
[#smiles("CCN", font: "Liberinus Serif")],
I'm not sure.
Chemical formulas and assessments
This post is part of our special coverage Global Development 2011.
I don't know, reports e
From chemformula
So the same import can handle
Ordinary formulas and text-based chemical assessments.
And...
font-size
For local formula styling; use a math-capable font for Formulas,
This is useful for salts, small inorganic.
Spectaculars, opinions, and assessments where a full Molecular diagram would be
"@preview/typed-smiles:0.0":ce
#table
Columns: (1fr, 1fr),
I don't know.
I'm sorry.
I'm sorry.
"No, no, no, no.
[#stack (spacing: 0.35 cm, strong [Formula], c("H2SO4")],
[#stack (spacing: 0.35 cm, strong [lons], c ("(NH4) 2SO4")],
[#stack (spacing: 0.35 cm, strong [Commbustion], c ("CH4 + 2O2-> CO2 + 2H2O")],
[#stack (spacing: 0.35 cm, strong [Equilibrium], c ("N2 + 3H2 < > 2NH3")],
I'm not sure.
ReactI'm sorry.
For routine reactions, use reactions
, rxn-arrow
, and mol
These.
Well, helps let you combine SMILES-based mobile diagrams with c)
I'm sorry.
Plus signs, labels, and arrow settlements in one playout. Import "@preview/typed-smiles: 0.2.0": smiles, c, rxn-arrow, mol, review
#stack
Spacing: 1 cm,
Stack()
Spacing: 0.4 cm,
This is the first time I've ever heard of this.
(center, review)
("CC(=O)O"), label: text (size: 8pt) [actic acid])
[+],
("CCO"), label: text (size: 8pt) [ethanol],
rxn-arrow.
("CCOC(=O)C"), label: text (size: 8pt) [ethyl environment])
[+],
("H2O" )
The blogger adds:
This post is part of our special coverage Syria Protests 2011.
Stack()
Spacing: 0.4 cm,
I'm sorry, I'm sorry, but I don't know.
(center, review)
("C1=CC=C1", label: text (size: 8pt) [benzene])
rxn-arrow (above:ce), below:ce ( "FeBr3"),
("BrC1=CC=C1", label: text (size: 8pt) [bromobenzene])
The blogger adds:
This post is part of our special coverage Syria Protests 2011.
I'm not sure.
Multi-step mechanisms
Reactions can point right, left, up, or down.
Spacing: 1.2em,
(Center, strong [Brominization, National, and Reduction Security])
(center, review)
("C1=CC=C1", label: text(size: 8pt) [1],
rxn-arrow (above:ce), below:ce ( "FeBr3"),
("BrC1=CC=C1", label: text (size: 8pt) [A])
Rxn-arrow (dir: "down", above: c), below: c ("H2SO4"),
Mol("BrC1=CC(=C1) [N+](=O)[O-]], label: text (size: 8pt) [B]],
Rxn-arrow,
("BrC1=CC(=C1)N"), label: text(size: 8pt) [C])
The blogger adds:
I'm not sure.
Stereochemistry and drawing examples
This post is part of our special coverage Global Development 2011.
You're not gonna get away with it.
And...
[C@H]
I'm sorry.
I'm sorry, but...
Discribe cis/trans
For essentially human drawings,
typed-smiles extensions:w!
Forces a solid wedge and!
Forces a hashed
Blacket appears like this.
I'm sorry.
SMILES blacket atoms; use {n}
#table #
Columns: (1fr, 1fr, 1fr),
I don't know.
I'm sorry.
I'm sorry.
"No, no, no, no.
[*Manual Wedge*]
[*Manual Hash*]
[*Tetrahedal@*]
[*trans alkene*]
[#smiles("C!wN")],
[#smiles("C!hN")],
[#smiles("N[C@H](C)C(=O)O")],
[#smiles("F/C=C/F")],
I'm not sure.
API# Smiles #
Renders a SMILES string as a 2D skeletal diagram.
| | | | | | | | |
Smiles-str
I'm sorry.
I'm sorry, sir, but I'm sorry.
Scale
Float
1.0 zirconium
Balanced scale for Bond left, atom labels, and bund stroke
Bond-Length
Float
Scale
Bond left scene; 1.0 equals 30 pt per Bond
font-size
I'm sorry.
11 pt
It's not like you're going to do it.
font
I'm sorry.
"New Computer Modern"
Atom label font
bund-stroke
I'm sorry.
0.9 pt *scale
I don't know.
color
Bool
It's true.
Apply Jmol CPCK atom colors
Rotation
I'm sorry.
0deg
Rotate the Molecule while keeping atom labels upright
Show-all-h
Bool
Fulse
Showed integrated hydrogens on all atoms, including carbon
Expllicit Bond-Length
,font-size
And Bond-stream
♪ ♪ values override the
I'm sorry, I'm sorry.
I'm sorry, but I'm sorry.
:
Syntax
|-------
I'm sorry.
Literal upright label at an atom position
I'm sorry.
Literal labels and bends colored like an element, here nitrogen
I'm sorry.
Literal label and bends colored with a named color
I'm sorry.
Force a solid wedge on the next single Bond
I'm sorry.
Force a Hashed wedge on the next single Bond
#ce
Re-exportschemulmula
'Sch'
But I'm not sure I'm going to do it.
Passes through the usual
Oh, my God.
I'm sorry, armed and adds optional font
And font-size
I'm sorry.
Formula won't support the heart.
Creates an arms for #reaction
I don't know. Parameter, Type, Default, Description.
| | | | | | | | |
Above
Content
None
Label above a horizon, or right of a vertical narrow
I'm sorry.
Content
None
Label below a horizonntal arow, or left of a vertical arrow
I'm sorry.
I'm sorry.
"right"
One of "right", "left", "down", or "up"
#mol
#reaction
Lays out molecules, formulas, plus signs, and rxn-arrow.
♪ values in a reaction ♪
Directing angrows move the place cursor, so multi-line programmes can
You know, be smart as a single rule.
The package uses the miles-parser
Current claims:
- Aromatic lowcase measures are not parsed by
smiles-parser
Use Kekule forms such as CC1=CC=C1
Instaad of c1cccc1
- Tetrahedral.
@
/ @
I'm sorry, I'm sorry.
/ /
- Allene, square-planar, technical-bipyramid, octahedral, and complex ring management are not yet supported.
Run native Rust tests
Cargo Test-manifest-path pugin/Cargo.toml
♪ Build the Wasm pugin used by Typst
/bild.sh
Compile the visual test document
typs/test.
Architecure
Rust Wasm pugin-- JSON CETZ drawing in Typst
The Rust handles palming and 2D coordonates.
MIT
