Last active
June 21, 2019 19:40
-
-
Save jagedn/fd9646c7b97aa21fdb2d06a9ffb19e86 to your computer and use it in GitHub Desktop.
Mathml2Png en Google Sheet
This file contains hidden or 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
String.prototype.addQuery = function(obj) { | |
return this + Object.keys(obj).reduce(function(p, e, i) { | |
return p + (i == 0 ? "?" : "&") + | |
(Array.isArray(obj[e]) ? obj[e].reduce(function(str, f, j) { | |
return str + e + "=" + encodeURIComponent(f) + (j != obj[e].length - 1 ? "&" : "") | |
},"") : e + "=" + encodeURIComponent(obj[e])); | |
},""); | |
} | |
function mathml2png( math, format, scale, transparent){ | |
format = format ? format : 'AsciiMath'; | |
scale = scale ? scale : 4; | |
transparent = transparent ? transparent : false; | |
var request ={ | |
e: math, | |
f:format, | |
s:scale, | |
t:transparent | |
} | |
return "https://mathml2png.herokuapp.com/img/mathml.png".addQuery(request) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
En A1 escribe la formula, por ejemplo
En otra celda escribe
=image(mathml2png(A1;"AsciiMath";10))
los argumentos a mathml2png son: