Skip to content

Commit f586c17

Browse files
committed
Final commit
Wrapping up the code for release.
1 parent f1b6b09 commit f586c17

File tree

7 files changed

+714
-6
lines changed

7 files changed

+714
-6
lines changed

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,30 @@ Enter your chemical formula or reaction into the `#ce"` method like this:
1313
```
1414
![result](https://raw.githubusercontent.com/Typsium/typsium/main/tests/README-graphic1/ref/1.png)
1515

16-
You can also embed any kind of content into your chemical reactions like by using square brackets instead of a passing in a string. This will also apply any styling to the reaction.
16+
You can also embed any kind of content into your chemical reactions like by using square brackets instead of a passing in a string. This will also apply any styling to the reaction.
17+
18+
> **Warning:** Currently, brackets inside another bracket will not be parsed correctly.
19+
1720
```typst
1821
#ce[...]
1922
```
23+
2024
![result2](https://raw.githubusercontent.com/Typsium/typsium/main/tests/README-graphic1/ref/1.png)
2125

22-
There are many different kinds of arrows to choose from. And you can add additional arguments to them (such as the top or bottom text) by adding square brackets.
26+
There are many different kinds of arrows to choose from.
27+
```typst
28+
#ce[->]\
29+
#ce[=>]\
30+
#ce[<=>]\
31+
#ce[<=]\
32+
#ce("<->")\
33+
#ce("<-")\
34+
```
35+
36+
And you can add additional arguments to them (such as the top or bottom text) by adding square brackets.
37+
2338
```typst
24-
//show arrows and how they look
39+
#ce("->[top text][bottom text]")
2540
```
2641

2742
The molecule parsing is flexible and allows many different ways of writing, so you can just copy paste in your formulas and they will probably work. Oxidation numbers can be added like this`^^`, radicals can be added like this`.` and hydration groups can be added like this`*`.

src/lib.typ

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
#import "model/reaction-element.typ": reaction
1111

1212
#let ce(formula) = {
13+
14+
show "*": sym.dot
15+
1316
if type(formula) == str{
1417
let result = string-to-reaction(formula)
1518
if result.len() == 1{

src/resources/arrow1.svg

Lines changed: 277 additions & 0 deletions
Loading

src/resources/arrow2.svg

Lines changed: 153 additions & 0 deletions
Loading

tests/0. Example book/main.png

43 KB
Loading

tests/0. Example book/main.typ

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#import "@preview/cram-snap:0.2.2": *
22
#import "../../src/lib.typ": *
3+
//#import "@preview/typsium:0.3.0": *
34
#import "@preview/zebraw:0.5.5": *
5+
#import "@preview/cuti:0.3.0":*
46

5-
#set page(flipped: false, margin: 0.8cm)
7+
#set page(margin: 0.8cm, height: auto)
68
#set text(size: 14pt)
79
#show raw: set text(font: "IBM Plex Sans", size: 11pt)
810
#show: set-group(grow-brackets:false, affect-layout:false)
@@ -18,6 +20,16 @@
1820
stroke-color: "343434",
1921
)
2022

23+
#align(center)[
24+
#text(size: 24pt, weight: "bold", fill: rgb("2c5aa0"))[
25+
#show raw: set text(size: 24pt)
26+
Basic Usage
27+
]
28+
#v(-0.9em)
29+
#line(length: 60%, stroke: 1pt + rgb("2c5aa0"))
30+
#v(-0.3em)
31+
]
32+
2133
#table(inset: 0.7em)[
2234
Effect
2335
][
@@ -42,6 +54,10 @@
4254
#ce("[Fe(CN)6]^4+")
4355
][
4456
```typ #ce("[Fe(CN)6]^4+")```
57+
][
58+
#ce[CuSO4*5H2O]
59+
][
60+
```typ #ce[CuSO4*5H2O]```
4561
][
4662
#ce[->]
4763
][
@@ -59,12 +75,40 @@
5975
roman-oxidation
6076
][
6177
```typ #show: set-element(roman-charge: true)``` \ ```typ #show: set-element(roman-oxidation: true)```
78+
]
79+
#align(center)[
80+
#text(size: 24pt, weight: "bold", fill: rgb("2c5aa0"))[
81+
#show raw: set text(size: 24pt)
82+
Content in #raw("ce", lang: "typ")
83+
]
84+
#v(-0.9em)
85+
#line(length: 60%, stroke: 1pt + rgb("2c5aa0"))
86+
#v(-0.3em)
87+
]
88+
89+
#table(inset: 0.7em)[
90+
effect
91+
][
92+
content
6293
][
6394
#ce[#text(red)[H2]]
6495
][
6596
```typ #ce[2#text(red)[H2]]```
6697
][
67-
#ce[$overbrace("H2O","water")$]
98+
$overbrace(#ce("H2O"),"water")$
99+
][
100+
```typ $overbrace(#ce("H2O"),"water")$ ```
101+
][
102+
#ce[*H2O*]
103+
][
104+
```typ #ce[*H2O*]```
105+
][
106+
#ce[#fakeitalic[H2O]]
68107
][
69-
```typ #ce[$overbrace("H2O","water")$]```
108+
```typ
109+
#import "@preview/cuti:0.3.0":* //or newer
110+
#ce[#fakeitalic[H2O]]
111+
112+
```
70113
]
114+
//...

tests/arrow-align/test.svg

Lines changed: 216 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)