Skip to content

Instantly share code, notes, and snippets.

1 + \frac{1}{2}x
1+[frac 1 2]x
1 + [frac, 1, 2]x
1+(frac 1 2)x
1 + [frac|1|2]x
1 + [frac:1:2]x
1 + <frac>1<over/>2</frac>x
x = \frac{ -b \pm \sqrt{ b^2 - 4ac } }{ 2a }
x=[frac -b±[sqrt b[sup 2]-4ac] 2a]
npm install webdriverio wdio-screenshot wdio-mocha-framework
./node_modules/.bin/wdio wdio.config.js
diff --git a/src/commands/math/commands.js b/src/commands/math/commands.js
index 483d591..1226d69 100644
--- a/src/commands/math/commands.js
+++ b/src/commands/math/commands.js
@@ -333,8 +333,8 @@ var SummationNotation = P(MathCommand, function(_, super_) {
function simplify(latex) {
return latex.length === 1 ? latex : '{' + (latex || ' ') + '}';
}
- return this.ctrlSeq + '_' + simplify(this.ends[L].latex()) +
- '^' + simplify(this.ends[R].latex());
@laughinghan
laughinghan / diacritics.patch
Created June 10, 2016 22:54
`display: block` technique for rendering diacritics
diff --git a/src/commands/math/commands.js b/src/commands/math/commands.js
index f763480..a9479f7 100644
--- a/src/commands/math/commands.js
+++ b/src/commands/math/commands.js
@@ -495,7 +495,7 @@ var DiacriticAbove = P(MathCommand, function(_, super_) {
var htmlTemplate =
'<span class="mq-diacritic mq-non-leaf">'
+ '<span class="mq-diacritic-above">'+symbol+'&nbsp;</span>'
- + '<span class="mq-non-leaf mq-inset">&0</span>'
+ + '<span class="mq-diacritic-stem mq-inset">&0</span>'
diff --git a/src/commands/math/advancedSymbols.js b/src/commands/math/advancedSymbols.js
index d17a6c5..10be401 100644
--- a/src/commands/math/advancedSymbols.js
+++ b/src/commands/math/advancedSymbols.js
@@ -166,7 +166,6 @@ for (i = 0; i < VANILLA_SYMBOLS.length; i++) {
LatexCmds.iff = LatexCmds.Longleftrightarrow;
LatexCmds.implies = LatexCmds.Longrightarrow;
-LatexCmds.enspace = LatexCmds['\\;'];

To run, put collation.html in the test/ directory and add MQ.LatexCommands = LatexCmds; to src/publicapi.js:

diff --git a/src/publicapi.js b/src/publicapi.js
index 022dfda..a30268b 100644
--- a/src/publicapi.js
+++ b/src/publicapi.js
@@ -77,6 +77,7 @@ function getInterface(v) {
 
   MQ.L = L;
 MQ.R = R;
@laughinghan
laughinghan / dump.md
Last active February 23, 2017 02:23
Dump of all LaTeX commands supported by latest master

Dump of all LaTeX commands supported by latest master (50daba7).

First apply this patch to src/publicapi.js:

diff --git a/src/publicapi.js b/src/publicapi.js
index 84b13db..9eef76e 100644
--- a/src/publicapi.js
+++ b/src/publicapi.js
@@ -79,6 +79,7 @@ function getInterface(v) {
chroma('#bef').hcl();
function hcl(h, c, l) {
var a = chroma.hcl(h, c, l).hcl()
var dh = Math.abs(h - a[0])
var dc = Math.abs(c - a[1])
var dl = Math.abs(l - a[2])
return [
chroma.hcl(h, c, l),
Math.sqrt(dh*dh + dc*dc + dl*dl),