Skip to content

Commit e1f56a2

Browse files
committed
Fix CODEGEN library math rendering: put $$ delimiters on separate lines
The aligned/cases math environments had $$ on the same line as \begin{}/\end{}, which broke remark-math parsing in Astro/MDX.
1 parent fba4cf7 commit e1f56a2

File tree

1 file changed

+72
-36
lines changed

1 file changed

+72
-36
lines changed

src/content/docs/developer/codegen-library.mdx

Lines changed: 72 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,10 +1051,12 @@ None.
10511051

10521052
#### Equations
10531053

1054-
$$\begin{aligned}
1054+
$$
1055+
\begin{aligned}
10551056
\dot{x}_i &= K_i \, x_k \\
10561057
0 &= K_p \, x_k + x_i - x_j
1057-
\end{aligned}$$
1058+
\end{aligned}
1059+
$$
10581060

10591061
#### Initialization
10601062

@@ -1092,7 +1094,8 @@ $$0 = \begin{cases}
10921094
\dot{x}_i = K_i x_k & \text{if } z = 0 \\
10931095
x_i - x_i^{min} & \text{if } z = -1 \\
10941096
x_i - x_i^{max} & \text{if } z = 1
1095-
\end{cases}$$
1097+
\end{cases}
1098+
$$
10961099

10971100
$$0 = K_p x_k + x_i - x_j$$
10981101

@@ -1149,17 +1152,21 @@ $z_1 \in \{-1, 0, 1\}$ and $z_2 \in \{-1, 0, 1\}$
11491152

11501153
#### Equations
11511154

1152-
$$\begin{cases}
1155+
$$
1156+
\begin{cases}
11531157
0 = K_p x_k - x_p & \text{if } z_1 = 0 \\
11541158
0 = x_p - x_p^{min} & \text{if } z_1 = -1 \\
11551159
0 = x_p - x_p^{max} & \text{if } z_1 = 1
1156-
\end{cases}$$
1160+
\end{cases}
1161+
$$
11571162

1158-
$$\begin{cases}
1163+
$$
1164+
\begin{cases}
11591165
\dot{x}_i = K_i x_k & \text{if } z_2 = 0 \\
11601166
0 = x_i - x_i^{min} & \text{if } z_2 = -1 \\
11611167
0 = x_i - x_i^{max} & \text{if } z_2 = 1
1162-
\end{cases}$$
1168+
\end{cases}
1169+
$$
11631170

11641171
$$0 = x_p + x_i - x_j$$
11651172

@@ -1244,7 +1251,8 @@ $$\text{if } z = 0: \quad
12441251
0 = K_p x_k + x_1 - x_j \\
12451252
\dot{x}_1 = K_i \, x_k \\
12461253
0 = x_2 - x_1
1247-
\end{cases}$$
1254+
\end{cases}
1255+
$$
12481256

12491257
$$\text{if } z = 2: \quad
12501258
\begin{cases}
@@ -1258,7 +1266,8 @@ $$\text{if } z = 2: \quad
12581266
0 = x_j^{max} - x_j \\
12591267
\dot{x}_1 = 0 \\
12601268
\dot{x}_2 = K_i \, x_k
1261-
\end{cases}$$
1269+
\end{cases}
1270+
$$
12621271

12631272
$$\text{if } z = -2: \quad
12641273
\begin{cases}
@@ -1272,7 +1281,8 @@ $$\text{if } z = -2: \quad
12721281
0 = x_j^{min} - x_j \\
12731282
\dot{x}_1 = 0 \\
12741283
\dot{x}_2 = K_i \, x_k
1275-
\end{cases}$$
1284+
\end{cases}
1285+
$$
12761286

12771287
#### Discrete Transitions
12781288

@@ -1367,11 +1377,13 @@ $z \in \{-1, 0, 1\}$
13671377

13681378
#### Equations
13691379

1370-
$$\begin{cases}
1380+
$$
1381+
\begin{cases}
13711382
T \, \dot{x}_j = G \, x_i - x_j & \text{if } z = 0 \\
13721383
0 = x_j - x_{max} & \text{if } z = 1 \\
13731384
0 = x_j - x_{min} & \text{if } z = -1
1374-
\end{cases}$$
1385+
\end{cases}
1386+
$$
13751387

13761388
#### Discrete Transitions
13771389

@@ -1427,11 +1439,13 @@ $z \in \{-1, 0, 1\}$
14271439

14281440
#### Equations
14291441

1430-
$$\begin{cases}
1442+
$$
1443+
\begin{cases}
14311444
T \, \dot{x}_j = G \, x_i - x_j & \text{if } z = 0 \\
14321445
0 = x_j - x_{max} & \text{if } z = 1 \\
14331446
0 = x_j - x_{min} & \text{if } z = -1
1434-
\end{cases}$$
1447+
\end{cases}
1448+
$$
14351449

14361450
#### Discrete Transitions
14371451

@@ -1487,17 +1501,21 @@ $z_1 \in \{-1, 0, 1\}$ (rate limiter) and $z_2 \in \{-1, 0, 1\}$ (output limiter
14871501

14881502
#### Equations
14891503

1490-
$$\begin{cases}
1504+
$$
1505+
\begin{cases}
14911506
0 = x_1 - G \, x_i + x_j & \text{if } z_1 = 0 \\
14921507
0 = x_1 - T \, \dot{x}_{max} & \text{if } z_1 = 1 \\
14931508
0 = x_1 - T \, \dot{x}_{min} & \text{if } z_1 = -1
1494-
\end{cases}$$
1509+
\end{cases}
1510+
$$
14951511

1496-
$$\begin{cases}
1512+
$$
1513+
\begin{cases}
14971514
T \, \dot{x}_j = x_1 & \text{if } z_2 = 0 \\
14981515
0 = x_j - x_{max} & \text{if } z_2 = 1 \\
14991516
0 = x_j - x_{min} & \text{if } z_2 = -1
1500-
\end{cases}$$
1517+
\end{cases}
1518+
$$
15011519

15021520
$\dot{x}_{max}$ (resp. $\dot{x}_{min}$) is the maximum (resp. minimum) rate of change of $x_j$ with time.
15031521

@@ -1567,10 +1585,12 @@ None.
15671585

15681586
#### Equations
15691587

1570-
$$\begin{aligned}
1588+
$$
1589+
\begin{aligned}
15711590
T \, \dot{x}_1 &= x_j \\
15721591
0 &= G \, x_i - x_1 - x_j
1573-
\end{aligned}$$
1592+
\end{aligned}
1593+
$$
15741594

15751595
#### Initialization
15761596

@@ -1609,10 +1629,12 @@ None.
16091629

16101630
#### Equations
16111631

1612-
$$\begin{aligned}
1632+
$$
1633+
\begin{aligned}
16131634
\dot{x}_1 &= G \, x_i - x_j \\
16141635
0 &= T_p \, x_j - G \, T_z \, x_i - x_1
1615-
\end{aligned}$$
1636+
\end{aligned}
1637+
$$
16161638

16171639
#### Initialization
16181640

@@ -1657,11 +1679,13 @@ None.
16571679

16581680
State-space controllable canonical form:
16591681

1660-
$$\begin{aligned}
1682+
$$
1683+
\begin{aligned}
16611684
\dot{x}_1 &= x_2 \\
16621685
d_2 \, \dot{x}_2 &= -x_1 - d_1 x_2 + d_2 x_i \\
16631686
0 &= G(d_2 - n_2) x_1 + G(n_1 d_2 - d_1 n_2) x_2 + G n_2 d_2 x_i - d_2^2 x_j
1664-
\end{aligned}$$
1687+
\end{aligned}
1688+
$$
16651689

16661690
#### Initialization
16671691

@@ -1802,7 +1826,8 @@ $z \in \{1, 2\}$
18021826
$$0 = \begin{cases}
18031827
x_l - x_i & \text{if } z = 1 \\
18041828
x_l - x_j & \text{if } z = 2
1805-
\end{cases}$$
1829+
\end{cases}
1830+
$$
18061831

18071832
#### Discrete Transitions
18081833

@@ -1855,13 +1880,16 @@ $z \in \{-1, 0, 1\}$
18551880
$$0 = \begin{cases}
18561881
x_j & \text{if } z \in \{-1, 0\} \\
18571882
x_j - 1 & \text{if } z = 1
1858-
\end{cases}$$
1883+
\end{cases}
1884+
$$
18591885

1860-
$$\begin{cases}
1886+
$$
1887+
\begin{cases}
18611888
0 = x_1 & \text{if } z = -1 \\
18621889
\dot{x}_1 = 1 & \text{if } z = 0 \\
18631890
\dot{x}_1 = 0 & \text{if } z = 1
1864-
\end{cases}$$
1891+
\end{cases}
1892+
$$
18651893

18661894
#### Discrete Transitions
18671895

@@ -1918,13 +1946,16 @@ $z \in \{-1, 0, 1\}$
19181946
$$0 = \begin{cases}
19191947
x_j & \text{if } z \in \{-1, 0\} \\
19201948
x_j - 1 & \text{if } z = 1
1921-
\end{cases}$$
1949+
\end{cases}
1950+
$$
19221951

1923-
$$\begin{cases}
1952+
$$
1953+
\begin{cases}
19241954
0 = x_1 & \text{if } z = -1 \\
19251955
\dot{x}_1 = 1 & \text{if } z = 0 \\
19261956
\dot{x}_1 = 0 & \text{if } z = 1
1927-
\end{cases}$$
1957+
\end{cases}
1958+
$$
19281959

19291960
#### Discrete Transitions
19301961

@@ -1980,7 +2011,8 @@ $z \in \{1, 2\}$ represents the automaton state.
19802011
$$0 = \begin{cases}
19812012
x_k - v_1 & \text{if } z = 1 \\
19822013
x_k - v_2 & \text{if } z = 2
1983-
\end{cases}$$
2014+
\end{cases}
2015+
$$
19842016

19852017
#### Discrete Transitions
19862018

@@ -2128,11 +2160,13 @@ loop:
21282160

21292161
**Computation:**
21302162

2131-
$$\begin{aligned}
2163+
$$
2164+
\begin{aligned}
21322165
V_{comp} &= \left| K_v \bar{V} + (R_c + j X_c) \bar{I} \right| \\
21332166
&= \left| K_v V + (R_c + j X_c)\!\left(\frac{P}{V} - j\frac{Q}{V}\right) \right| \\
21342167
&= \frac{1}{V} \sqrt{\left(K_v V^2 + R_c P + X_c Q\right)^2 + \left(X_c P - R_c Q\right)^2}
2135-
\end{aligned}$$
2168+
\end{aligned}
2169+
$$
21362170

21372171
---
21382172

@@ -2152,10 +2186,12 @@ $$satur = m \, ve^n$$
21522186

21532187
where:
21542188

2155-
$$\begin{aligned}
2189+
$$
2190+
\begin{aligned}
21562191
n &= \frac{\log_{10}(se1/se2)}{\log_{10}(ve1/ve2)} \\[4pt]
21572192
m &= \frac{se1}{ve1^n}
2158-
\end{aligned}$$
2193+
\end{aligned}
2194+
$$
21592195

21602196
**Exception.** Returns $satur = 0$ if any of the following conditions holds:
21612197

0 commit comments

Comments
 (0)