Star

MIT License
Copyright © 2020
CONNECT-platform

linkFormula

The Formula component allows for using math formulas in your docs:

1> :Formula align=center

2>

3> ```

4> f_n =

5> \begin{cases}

6> 1 & \text{if \(n \leq 2\)} \\

7> f_{n - 1} + f_{n - 2} & \text{otherwise} \\

8> \end{cases}

9> ```

fn={1if n2fn1+fn2otherwisef_n = \begin{cases}1 & \text{if \(n \leq 2\)} \\f_{n - 1} + f_{n - 2} & \text{otherwise} \\\end{cases}1

You can also use Formula inline component:

1So lets talk about [\frak{L}_{SM}](:Formula), or lets just do it in

2the last example of the page.

So lets talk about LSM\frak{L}_{SM}, or lets just do it in the last example of the page.


error IMPORTANT

YOU MUST ENABLE FORMULAS via config to be able to use them. Read the following section to find out how to enable Formulas.


linkEnabling Formulas

Formulas are not by default plugged into CODEDOC, as they require additional resources. To enable them, simply import formulaPlugin and add it to your plugins via .codedoc/config.ts:

.codedoc/config.ts
1import { configuration } from '@codedoc/core';

2import { formulaPlugin } from '@codedoc/core/components';

3

4// ...

5

6export const config = /*#__PURE__*/configuration({

7 // ...

8 plugins: [

9 // ...

10 formulaPlugin

11 ],

12 // ...

13});


linkTeX Capabilities

CODEDOC uses KaTeX for producing its formulas, which means you can check this support table to find out which TeX functions are available. If you are lazy like me, you can also just use this nice cheatsheet:

TeX Cheatsheet

linkSyntax Collision

Markdown syntax can collide with Tex functions. For example, if you have this formula:

1\begin{pmatrix}

21 & -1 \\

3-1 & i

4\end{pmatrix}

Then the row delimiter, \\, would collide with markdown syntax. To avoid that, you can simply enclose the colliding parts with single backtick (i.e. ` character):

1> :Formula

2>

3> \begin{pmatrix}

4> 1 & -1 `\\` <!--> the `\\` is enclosed with backticks to avoid collision with markdown -->

5> -1 & i

6> \end{pmatrix}

(111i)\begin{pmatrix} 1 & -1 \\ -1 & i \end{pmatrix}1

Alternatively, you could put all of your formula in a code-block (enclose it with three backticks, i.e. ```):

1> :Formula

2>

3> ``` <!--> the whole formula is enclosed-->

4> \begin{pmatrix}

5> 1 & -1 \\ <!--> so the \\ doesn't need to be any more-->

6> -1 & i

7> \end{pmatrix}

8> ```

(111i)\begin{pmatrix}1 & -1 \\-1 & i\end{pmatrix}1

linkSize and Alignment

You can use align property to align formulas at the center. It can either be set to left or center:

1> :Formula align=center

2>

3> G_{\mu\nu} + \Lambda g_{\mu\nu} = \cfrac{8\pi G}{c^4}T_{\mu\nu}

Gμν+Λgμν=8πGc4TμνG_{\mu\nu} + \Lambda g_{\mu\nu} = \cfrac{8\pi G}{c^4}T_{\mu\nu}1

You can also utilize size property to control size of your formulas. It can either be set to normal or large:

1> :Formula size=large, align=center

2>

3> G_{\mu\nu} + \Lambda g_{\mu\nu} = \cfrac{8\pi G}{c^4}T_{\mu\nu}

Gμν+Λgμν=8πGc4TμνG_{\mu\nu} + \Lambda g_{\mu\nu} = \cfrac{8\pi G}{c^4}T_{\mu\nu}1

linkFormula Lines

Each paragraph or code-block will be assumed as one line of formula, independent of how many actual lines it consists of:

1> :Formula

2>

3> \text{let}`\;`s \equiv G \cancel{\vdash} s

4>

5> G \vdash s \implies G \vdash (G \cancel{\vdash} s) \implies \bot

6>

7> G \vdash \neg{s} \implies G \vdash (G \vdash s) \implies G \vdash s \implies \bot

8>

9> \implies \neg(G \vdash s) \land \neg(G \vdash \neg{s}) `\\` <!--> despite the newline, these will all be displayed as one "line" -->

10> \implies G `\;`\text{is not complete.} <!--> despite the newline, these will all be displayed as one "line" -->

let  sGs\text{let}\;s \equiv G \cancel{\vdash} s1
Gs    G(Gs)    G \vdash s \implies G \vdash (G \cancel{\vdash} s) \implies \bot2
G¬s    G(Gs)    Gs    G \vdash \neg{s} \implies G \vdash (G \vdash s) \implies G \vdash s \implies \bot3
    ¬(Gs)¬(G¬s)    G  is not complete.\implies \neg(G \vdash s) \land \neg(G \vdash \neg{s}) \\ \implies G \;\text{is not complete.}4

1> :Formula

2>

3> ```

4> \frak{L}_{SM} = \quad

5> \underbrace{

6> \frac{1}{4} W_{\mu\nu}

7> \cdot \frac{1}{4} W^{\mu\nu}

8> - \frac{1}{4} G^a_{\mu\nu} G^{\mu\nu}_a

9> }_{\tiny{\text{kinetic energies and self-interactions of gauge bosons}}}

10> ```

11> ```

12> \quad\quad\;+ \quad \underbrace{

13> \bar{L} \gamma^{\mu} (i\partial_\mu - \frac{1}{2}g\tau \cdot W_\mu - \frac{1}{2}g'YB_\mu)L

14> + \bar{R} \gamma^{\mu} (i\partial_\mu - \frac{1}{2}g'YB_\mu)R

15> }_{\tiny{\text{kinetic energies and electroweak interactions of fermions}}}

16> ```

17> ```

18> \quad\quad\; + \quad \underbrace{

19> \frac{1}{2}|(i\partial_\mu - \frac{1}{2}g\tau \cdot W_\mu) - \frac{1}{2}g'YB_\mu|^2 - V(\phi)

20> }_{\tiny{W\pm,Z,\gamma\text{and Higgs masses and couplings}}}

21> ```

22> ```

23> \quad\quad\; + \quad \underbrace{

24> g''(\bar{q}\gamma^\mu T_a q) G^a_\mu

25> }_{\tiny{\text{interactions between gluons and quarks}}} \\ <!--> despite the newline, these will all be displayed as one "line" -->

26> \space \\ <!--> despite the newline, these will all be displayed as one "line" -->

27> \quad\quad\; + \quad \underbrace{

28> (G_1 \bar{L}\phi R + G_2 \bar{L}\phi_c R + h.c.)

29> }_{\tiny{\text{fermion masses and couplings to Higgs}}}

30> ```

LSM=14Wμν14Wμν14GμνaGaμνkinetic energies and self-interactions of gauge bosons\frak{L}_{SM} = \quad\underbrace{ \frac{1}{4} W_{\mu\nu} \cdot \frac{1}{4} W^{\mu\nu} - \frac{1}{4} G^a_{\mu\nu} G^{\mu\nu}_a}_{\tiny{\text{kinetic energies and self-interactions of gauge bosons}}}1
  +Lˉγμ(iμ12gτWμ12gYBμ)L+Rˉγμ(iμ12gYBμ)Rkinetic energies and electroweak interactions of fermions\quad\quad\;+ \quad \underbrace{ \bar{L} \gamma^{\mu} (i\partial_\mu - \frac{1}{2}g\tau \cdot W_\mu - \frac{1}{2}g'YB_\mu)L + \bar{R} \gamma^{\mu} (i\partial_\mu - \frac{1}{2}g'YB_\mu)R}_{\tiny{\text{kinetic energies and electroweak interactions of fermions}}}2
  +12(iμ12gτWμ)12gYBμ2V(ϕ)W±,Z,γand Higgs masses and couplings\quad\quad\; + \quad \underbrace{ \frac{1}{2}|(i\partial_\mu - \frac{1}{2}g\tau \cdot W_\mu) - \frac{1}{2}g'YB_\mu|^2 - V(\phi)}_{\tiny{W\pm,Z,\gamma\text{and Higgs masses and couplings}}}3
  +g(qˉγμTaq)Gμainteractions between gluons and quarks   +(G1LˉϕR+G2LˉϕcR+h.c.)fermion masses and couplings to Higgs\quad\quad\; + \quad \underbrace{ g''(\bar{q}\gamma^\mu T_a q) G^a_\mu}_{\tiny{\text{interactions between gluons and quarks}}} \\\space \\\quad\quad\; + \quad \underbrace{ (G_1 \bar{L}\phi R + G_2 \bar{L}\phi_c R + h.c.)}_{\tiny{\text{fermion masses and couplings to Higgs}}}4
FormulaEnabling FormulasTeX CapabilitiesSyntax CollisionSize and AlignmentFormula Lines

Home Overview CLI Theme

Markdownchevron_right
Code Featureschevron_right

Images & Assets

Configurationchevron_right
Customizationchevron_right