mirror of
https://github.com/calofmijuck/blog.git
synced 2025-12-06 14:53:50 +00:00
feat: added latex macros
This commit is contained in:
164
_includes/js-selector.html
Normal file
164
_includes/js-selector.html
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
<!-- JS selector for site. -->
|
||||||
|
|
||||||
|
<!-- commons -->
|
||||||
|
|
||||||
|
{% assign urls = site.data.origin[type].jquery.js
|
||||||
|
| append: ','
|
||||||
|
| append: site.data.origin[type].bootstrap.js
|
||||||
|
| append: ','
|
||||||
|
| append: site.data.origin[type].search.js
|
||||||
|
%}
|
||||||
|
|
||||||
|
<!-- layout specified -->
|
||||||
|
|
||||||
|
{% if page.layout == 'post' or page.layout == 'page' or page.layout == 'home' %}
|
||||||
|
{% assign urls = urls | append: ',' | append: site.data.origin[type]['lazy-polyfill'].js %}
|
||||||
|
|
||||||
|
{% unless page.layout == 'home' %}
|
||||||
|
<!-- image lazy-loading & popup & clipboard -->
|
||||||
|
{% assign urls = urls
|
||||||
|
| append: ','
|
||||||
|
| append: site.data.origin[type]['magnific-popup'].js
|
||||||
|
| append: ','
|
||||||
|
| append: site.data.origin[type].clipboard.js
|
||||||
|
%}
|
||||||
|
{% endunless %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if page.layout == 'home'
|
||||||
|
or page.layout == 'post'
|
||||||
|
or page.layout == 'archives'
|
||||||
|
or page.layout == 'category'
|
||||||
|
or page.layout == 'tag'
|
||||||
|
%}
|
||||||
|
{% assign locale = site.lang | split: '-' | first %}
|
||||||
|
|
||||||
|
{% assign urls = urls
|
||||||
|
| append: ','
|
||||||
|
| append: site.data.origin[type].dayjs.js.common
|
||||||
|
| append: ','
|
||||||
|
| append: site.data.origin[type].dayjs.js.locale
|
||||||
|
| replace: ':LOCALE', locale
|
||||||
|
| append: ','
|
||||||
|
| append: site.data.origin[type].dayjs.js.relativeTime
|
||||||
|
| append: ','
|
||||||
|
| append: site.data.origin[type].dayjs.js.localizedFormat
|
||||||
|
%}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if page.content contains '<h2' or page.content contains '<h3' and site.toc and page.toc %}
|
||||||
|
{% assign urls = urls | append: ',' | append: site.data.origin[type].toc.js %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if page.mermaid %}
|
||||||
|
{% assign urls = urls | append: ',' | append: site.data.origin[type].mermaid.js %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% include jsdelivr-combine.html urls=urls %}
|
||||||
|
|
||||||
|
{% case page.layout %}
|
||||||
|
{% when 'home', 'categories', 'post', 'page' %}
|
||||||
|
{% assign js = page.layout %}
|
||||||
|
{% when 'archives', 'category', 'tag' %}
|
||||||
|
{% assign js = 'misc' %}
|
||||||
|
{% else %}
|
||||||
|
{% assign js = 'commons' %}
|
||||||
|
{% endcase %}
|
||||||
|
|
||||||
|
{% capture script %}/assets/js/dist/{{ js }}.min.js{% endcapture %}
|
||||||
|
<script defer src="{{ script | relative_url }}"></script>
|
||||||
|
|
||||||
|
{% if page.math %}
|
||||||
|
<!-- MathJax -->
|
||||||
|
<script>
|
||||||
|
/* see: <https://docs.mathjax.org/en/latest/options/input/tex.html#tex-options> */
|
||||||
|
MathJax = {
|
||||||
|
tex: {
|
||||||
|
/* start/end delimiter pairs for in-line math */
|
||||||
|
inlineMath: [
|
||||||
|
['$', '$'],
|
||||||
|
["\\(", "\\)"]
|
||||||
|
],
|
||||||
|
/* start/end delimiter pairs for display math */
|
||||||
|
displayMath: [
|
||||||
|
['$$', '$$'],
|
||||||
|
["\\[", "\\]"]
|
||||||
|
],
|
||||||
|
macros: {
|
||||||
|
ds: "\\displaystyle",
|
||||||
|
|
||||||
|
// font styles
|
||||||
|
rm: ["\\mathrm{#1}", 1],
|
||||||
|
mf: ["\\mathfrak{#1}", 1],
|
||||||
|
mc: ["\\mathcal{#1}", 1],
|
||||||
|
bb: ["\\mathbb{#1}", 1],
|
||||||
|
bf: ["\\mathbf{#1}", 1],
|
||||||
|
tt: ["\\texttt{#1}", 1],
|
||||||
|
|
||||||
|
inv: "^{-1}",
|
||||||
|
conj: "^\\ast",
|
||||||
|
trans: "^\\top",
|
||||||
|
cross: "^\\times",
|
||||||
|
bs: "\\setminus",
|
||||||
|
nsub: "\\unlhd",
|
||||||
|
pnsub: "\\lhd",
|
||||||
|
|
||||||
|
floor: ["\\left\\lfloor #1 \\right\\rfloor", 1],
|
||||||
|
ceil: ["\\left\\lceil #1 \\right\\rceil", 1],
|
||||||
|
round: ["\\left\\lfloor #1 \\right\\rceil", 1],
|
||||||
|
norm: ["\\left\\lVert #1 \\right\\rVert", 1],
|
||||||
|
abs: ["\\left\\lvert #1 \\right\\rvert", 1],
|
||||||
|
paren: ["\\left( #1 \\right)", 1],
|
||||||
|
braces: ["\\left\\{ #1 \\right\\}", 1],
|
||||||
|
span: ["\\left\\langle #1 \\right\\rangle", 1],
|
||||||
|
bar: ["\\overline{#1 \\vphantom{l}}", 1],
|
||||||
|
|
||||||
|
lcm: ["\\mathrm{lcm}"],
|
||||||
|
|
||||||
|
ra: "\\rightarrow",
|
||||||
|
la: "\\leftarrow",
|
||||||
|
lra: "\\leftrightarrow",
|
||||||
|
imp: "\\implies",
|
||||||
|
pll: "\\parallel",
|
||||||
|
|
||||||
|
N: "\\mathbb{N}",
|
||||||
|
Z: "\\mathbb{Z}",
|
||||||
|
Q: "\\mathbb{Q}",
|
||||||
|
R: "\\mathbb{R}",
|
||||||
|
C: "\\mathbb{C}",
|
||||||
|
F: "\\mathbb{F}",
|
||||||
|
|
||||||
|
Adv: ["\\mathrm{Adv}_{\\mathrm{#1}}[#2]", 2, ""],
|
||||||
|
|
||||||
|
im: "\\operatorname\{im\}",
|
||||||
|
ch: "\\operatorname\{char\}",
|
||||||
|
|
||||||
|
Aut: "\\mathrm{Aut}",
|
||||||
|
Gal: "\\mathrm{Gal}",
|
||||||
|
GF: "\\mathrm{GF}",
|
||||||
|
|
||||||
|
exists: "∃\\,",
|
||||||
|
|
||||||
|
tilde: ["\\widetilde{#1}", 1],
|
||||||
|
hat: ["\\widehat{#1}", 1],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
||||||
|
<script id="MathJax-script" async src="{{ site.data.origin[type].mathjax.js | relative_url }}"></script>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if jekyll.environment == 'production' %}
|
||||||
|
<!-- PWA -->
|
||||||
|
{% if site.pwa.enabled %}
|
||||||
|
<script defer src="{{ '/app.js' | relative_url }}"></script>
|
||||||
|
{% else %}
|
||||||
|
<script defer src="{{ '/unregister.js' | relative_url }}"></script>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<!-- GA -->
|
||||||
|
{% if site.google_analytics.id != empty and site.google_analytics.id %}
|
||||||
|
{% include google-analytics.html %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
Reference in New Issue
Block a user