forked from latex4ei/tex4tum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploying to gh-pages from @ 69fcc3e 🚀
- Loading branch information
0 parents
commit 05c524a
Showing
445 changed files
with
761,464 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/* loads KaTeX and checks for math elements. | ||
1. arithmatex from python-markdown | ||
2. pandoc math | ||
3. all | ||
*/ | ||
|
||
|
||
KATEX_JS='https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.15.0/katex.min.js' | ||
KATEX_CSS='https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.15.0/katex.min.css' | ||
|
||
|
||
function loadKaTeX(renderCall=renderArithmatex) { | ||
var script = document.createElement("script"); | ||
script.type = 'text/javascript'; | ||
script.src = KATEX_JS; | ||
script.onload = renderCall; | ||
|
||
var link = document.createElement('link'); | ||
link.id = 'katex-css'; | ||
link.rel = 'stylesheet'; | ||
link.type = 'text/css'; | ||
link.href = KATEX_CSS; | ||
|
||
document.head.appendChild(script); | ||
document.head.appendChild(link); | ||
} | ||
|
||
|
||
AM_INLINE='span.arithmatex' | ||
AM_DISPLAY='div.arithmatex' | ||
|
||
PD_INLINE='math inline' | ||
PD_DISPLAY='math display' | ||
|
||
var macros = { | ||
"\\(": "", | ||
"\\)": "", | ||
"\\vec": "{\\boldsymbol #1}", | ||
"\\ma": "\\boldsymbol{#1}", | ||
"\\cx": "\\boldsymbol{#1}", | ||
"\\cxc": "\\boldsymbol{#1}^{*}", | ||
"\\diff": "\\mathrm{d}\\,", | ||
"\\mat": "\\begin{bmatrix} #1 \\end{bmatrix}", | ||
"\\vect": "\\begin{pmatrix} #1 \\end{pmatrix}", | ||
"\\abs": "\\left\\vert{#1}\\right\\vert", | ||
"\\norm": "\\left\\lVert{#1}\\right\\rVert", | ||
"\\ra": "\\rightarrow", | ||
"\\Sp": "\\mathrm{Sp}\\,", | ||
"\\rank": "\\mathrm{rank}\\,", | ||
"\\e": "\\mathrm{e}", | ||
"\\i": "\\boldsymbol{\\mathrm{i}}", | ||
"\\SI": "{#1\\;\\mathrm{#2}}", | ||
"\\squared": "{^{2}}", | ||
"\\cubed": "{^{3}}", | ||
"\\per": "/", | ||
"\\tera": "T", | ||
"\\giga": "G", | ||
"\\mega": "M", | ||
"\\kilo": "k", | ||
"\\milli": "m", | ||
"\\micro": "μ", | ||
"\\nano": "n", | ||
"\\kilogram": "\\text{kg}\\,", | ||
"\\meter": "\\text{m}\\,", | ||
"\\second": "\\text{s}\\,", | ||
"\\ampere": "\\text{A}\\,", | ||
"\\kelvin": "\\text{K}\\,", | ||
"\\mol": "\\text{mol}\\,", | ||
"\\candela": "\\text{cd}\\,", | ||
"\\newton": "\\text{N}\\,", | ||
"\\hertz": "\\text{Hz}\\,", | ||
"\\pascal": "\\text{Pa}\\,", | ||
"\\volt": "\\text{V}\\,", | ||
"\\watt": "\\text{W}\\,", | ||
"\\joule": "\\text{J}\\,", | ||
"\\henry": "\\text{H}\\,", | ||
"\\farad": "\\text{F}\\,", | ||
"\\coulomb": "\\text{C}\\,", | ||
"\\ohm": "\\Omega\\,", | ||
"\\weber": "\\text{Wb}\\,", | ||
"\\tesla": "\\text{T}\\,", | ||
"\\degree": "\\text{deg}\\," | ||
}; | ||
|
||
|
||
|
||
function renderPandocMath(){ | ||
mathin = document.getElementsByClassName('math inline') | ||
Array.prototype.forEach.call(mathin, (el) => { | ||
try { | ||
katex.render(el.innerHTML, el, { displayMode: false, macros: macros }) | ||
} catch (err) { el.innerHTML = `ERROR: ${err}` } | ||
}) | ||
|
||
mathdis = document.getElementsByClassName('math display') | ||
Array.prototype.forEach.call(mathdis, (el) => { | ||
try { | ||
katex.render(el.innerHTML, el, { displayMode: true, macros: macros }) | ||
} catch (err) { el.innerHTML = `ERROR: ${err}` } | ||
}) | ||
} | ||
|
||
|
||
function renderArithmatex() { | ||
var maths = document.querySelectorAll('.arithmatex'), tex; | ||
|
||
for (var i = 0; i < maths.length; i++) { | ||
tex = maths[i].textContent || maths[i].innerText; | ||
if (tex.startsWith('\\(') && tex.endsWith('\\)')) { | ||
katex.render(tex.slice(2, -2), maths[i], {'displayMode': false, macros: macros, throwOnError: false}); | ||
} else if (tex.startsWith('\\[') && tex.endsWith('\\]')) { | ||
katex.render(tex.slice(2, -2), maths[i], {'displayMode': true, macros: macros, throwOnError: false}); | ||
} | ||
} | ||
}; | ||
|
||
|
||
loadKaTeX(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/* Auto-Tabbox – Find <div class="tabbox"> and make headings | ||
*/ | ||
|
||
|
||
var tabstyle = ` | ||
.tabs { | ||
--border: 1px solid var(--cmed); | ||
--cfg: #433; --cbg: #fff; | ||
--cdark: #888; --clight: #f5f6f7; | ||
--cmed: #d1d1d1; | ||
--clink: #07c; | ||
display: flex; | ||
flex-wrap: wrap; | ||
background: linear-gradient(0deg, var(--cbg) 1rem, var(--clight) 0%); | ||
border: var(--border); border-radius: 5px; | ||
} | ||
.tabs label { | ||
order: 1; /*Put the labels first*/ | ||
display: block; | ||
cursor: pointer; | ||
padding: .5rem .8rem; | ||
margin: .5rem 0 -1px; | ||
border-radius: 5px 5px 0 0; | ||
color: var(--clink); | ||
background: var(--clight); | ||
} | ||
.tabs label:first-of-type{ margin-left: 1rem; } | ||
.tabs .tab { | ||
order: 99; /*Put the tabs last*/ | ||
flex-grow: 1; | ||
width: 100%; | ||
display: none; | ||
z-index: 2; | ||
padding: 0 1rem; | ||
background: var(--cbg); | ||
border-top: var(--border); | ||
} | ||
.tabs input[type="radio"]:not(:checked) + label:hover { filter: brightness(90%); } | ||
.tabs input[type="radio"] { display: none; } | ||
.tabs input[type="radio"]:checked + label { | ||
border: var(--border); border-bottom: 0px; | ||
background: var(--cbg); z-index: 3; | ||
} | ||
.tabs input[type="radio"]:checked + label + .tab { display: block; } | ||
@media (max-width: 45em) { | ||
.tabs .tab, .tabs label { order: initial; } | ||
.tabs label { width: 100%; margin: 0 0 -1px !important; } | ||
} | ||
@media print { .tabs label + .tab { display: block; } .tabs label { display: none; } } | ||
` | ||
|
||
function addTabStyle(){ | ||
style = document.createElement('style'); | ||
style.type = 'text/css'; | ||
style.innerHTML = tabstyle; | ||
document.head.appendChild(style); | ||
} | ||
|
||
var numBoxes=0 | ||
|
||
function makeTabboxes(){ | ||
// secs = document.querySelectorAll('section[id=tabbox]') | ||
boxes = document.querySelectorAll('section.tabbox, div.tabbox') | ||
for (const box of boxes){ | ||
numBoxes++; | ||
if (!box.firstElementChild){ continue; } | ||
htag = box.querySelector("h1, h2, h3, h4, h5, h6").tagName.toLowerCase() | ||
hs = box.querySelectorAll(htag) | ||
|
||
if (hs[0].parentElement.classList.contains('tabbox')){ // create divs | ||
children = box.children | ||
oDiv = document.createElement('div') | ||
divs = [] | ||
for (var i = hs.length-1; i >= 0; i--){ | ||
div = oDiv.cloneNode(false) | ||
next = hs[i] | ||
while (next){ | ||
curr = next | ||
next = next.nextSibling | ||
div.appendChild(curr); | ||
} | ||
divs.push(div) | ||
} | ||
box.innerHTML = ''; | ||
for (const div of divs.reverse()){ // move divs to tabbox | ||
box.appendChild(div) | ||
} | ||
} | ||
box.classList.add('tabs') | ||
hs = box.querySelectorAll(htag) | ||
for (var i = 0; i < hs.length; i++){ | ||
label=hs[i].innerText.replace(/\W/g,''); | ||
id=`tab-${numBoxes}${label}` | ||
hs[i].parentElement.classList.add("tab") | ||
hs[i].parentElement.insertAdjacentHTML( 'beforebegin', `<input type="radio" name="tabs${numBoxes}" id="${id}"><label for="${id}">${hs[i].innerText.replace(/#$/, '')}</label>` ); | ||
hs[i].outerHTML = '';// remove heading | ||
} | ||
box.firstElementChild.setAttribute("checked", "checked"); | ||
// hs[0].parentElement.previousElementSibling.previousElementSibling | ||
// pullHeadingOut(sec.firstElementChild) | ||
} | ||
} | ||
|
||
addTabStyle() | ||
makeTabboxes() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* loads tablesort and applies to tables */ | ||
|
||
|
||
TABLESORT_JS='https://unpkg.com/[email protected]/dist/tablesort.min.js' | ||
|
||
function loadTablesort(renderCall=addTableSort) { | ||
var script = document.createElement("script"); | ||
script.type = 'text/javascript'; | ||
script.src = TABLESORT_JS; | ||
script.onload = renderCall; | ||
|
||
document.head.appendChild(script); | ||
} | ||
|
||
function addTableSort() { | ||
var tables = document.querySelectorAll("article table:not([class])") | ||
tables.forEach(function(table) { | ||
new Tablesort(table) | ||
}) | ||
} | ||
|
||
loadTablesort() |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.