Math Typesetting
Mathematical notation in a project can be enabled by using third party JavaScript libraries.
Installation
In this example we will be using
KATEX
.
- Create a macro under
/template/macros/math.html
with a macro named math
.
- Within this macro reference the Auto-render Extension or host these scripts locally.
- Import the macro in your templates like so:
{% import 'macros/math.html' as macros %}
{% if page.extra.math or section.extra.math or config.extra.math %}
{{ macros::math() }}
{% endif %}
- To enable KaTex globally set the parameter
extra.math
to true
in a project's configuration
- To enable KaTex on a per page basis include the parameter
extra.math = true
in content files
Examples
Inline math
Inline math 1:
φ=21+5=1.6180339887…
Find
{x,y,z}∈N
where:
{x2+7xy+y2=z23x2−xyz−y2=z2 Block math
Find{x,y,z}∈Nwhere{x2+7xy+y2=z23x2−xyz−y2=z2
adgbehcfi
LT(λ)=(x,s)∈T∑logP(s∣x)−i=1∑m2σ2λi2
(k=1∑nakbk)2≤(k=1∑nak2)(k=1∑nbk2)
xNa(NHX4)HPOX4Δ(NaPOX3)Xx+xNHX3↑+xHX2O
ZnX2++2OHX−+2HX+amphoteres HydroxidZn(OH)X2↓+2OHX−+2HX+Hydroxozikat[Zn(OH)X4]X2−
HgX2+IX−redHgIX2IX−red[HgXIIIX4]X2−
f(x)=∫−∞∞f^(ξ)e2πiξxdξ
37=122732−1=122732⋅732732−1=122732732732−1=12731−7321≈1273(1−2⋅7321)
f(n)={n/2,3n+1,if n is evenif n is odd
n123Left0.24−1−20Center11892000Right125−81+10i
f(yx+xy)(u+1)1+{x,y}+a3/2
maxs.t.z=cTxAx≤bx≥0(PC)add ⇃slack varmaxs.t.z=cTxAx+s=bx,s≥0(PS)dualitydualitysome steps skippedmins.t.v=bTyATy≥cy≥0(DC)minus ⇂surplus varmins.t.v=bTyATy−t=cy,t≥0(DS)
s1s2s3ratios1x2s3ratiox1x2s3ratiox1x2s2x1−2−208−4−2∗1/23/23−3/210001000x20−4∗−310−5/2010001000100x3−2−5−125−5−25/411/425/225/413/45/419/211/3−5/341/3s110001000−1/21/43/43/2−1/20−14s201000−1/4−3/45/20−1/4−3/4∗5/2…0010s30010001000100−1/3−4/310/3−60−70−270−6035/251/2−175305/2−39/2−26530926−330
11⋮1a1a2⋮ama12a22⋮am2⋯⋯⋱⋯a1na2n⋮amn
A0.5↓F↻210.10.6↘0.5B0.7↓G0.20.8↗0.6C0.9↓H0.30.1↙0.7D0.2↓I0.40.3↖0.8E0.4↓J
3x3x1/2(log(63x2)8−x2x=2x=8
Vijk=⎩⎨⎧2yu+yl−2xu+xl,C1[6xu3−yl3+2yl2+xu2xl+(xu−yl)2xl2+2yu2−xu2(xu−xl)xu−xl1[6(yu+yl)2−2yu+ylxl+2xl2],if xu<yl−(yu−xu)2xu2−xl2],if xu∈[yl,yu]otherwise
Ez=kλz∫−ab(z2+x2)3/2dx=zkλ(z2+x2x)−ab=zkλ(z2+b2b+z2+a2a)
1a123+211