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
// `$ npm install speech-rule-engine` | |
var sre = require('speech-rule-engine'); | |
var mathml = '<math xmlns="http://www.w3.org/1998/Math/MathML"> <mfrac> <mn>1</mn> <mn>2</mn> </mfrac> </math>'; | |
sre.setupEngine({semantics: true, domain: "mathspeak", style: "brief"}); | |
console.log(sre.processExpression(mathml)); | |
// one-half |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>MathJax AssistiveMML Test Page</title> | |
<!-- Copyright (c) 2015 The MathJax Consortium --> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<script type="text/x-mathjax-config"> | |
MathJax.Hub.Config({ | |
jax: ["input/TeX","output/HTML-CSS"], |
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
// add to User:YOURNAME/common.js to get smooth MathJax rendering | |
var mathTags = $('.mwe-math-mathml-a11y'); | |
if (mathTags.length > 0){ //only do something when there's math on the page | |
window.MathJax = { | |
SVG: {blacker: 1}, // clearer SVG output, in case people switch to SVG output | |
AuthorInit: function () { | |
MathJax.Hub.Register.StartupHook("End",function () { //when MathJax is done... | |
MathJax.Hub.Queue( | |
function(){ | |
mathTags.removeClass('mwe-math-mathml-a11y'); // .. make the span around MathML (now MathJax output) visible |
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
var mjAPI = require("./lib/mj-page.js"); | |
var jsdom = require("jsdom").jsdom; | |
var document = jsdom("<!DOCTYPE html><html lang='en'><head><title>Test</title></head><body>\\[\sqrt{f: X \to Y }0\\]\\[\sqrt{f: X \to Y }1\\]\\[\sqrt{f: X \to Y }2\\]\\[\sqrt{f: X \to Y }3\\]\\[\sqrt{f: X \to Y }4\\]\\[\sqrt{f: X \to Y }5\\]\\[\sqrt{f: X \to Y }6\\]\\[\sqrt{f: X \to Y }7\\]\\[\sqrt{f: X \to Y }8\\]\\[\sqrt{f: X \to Y }9\\]\\[\sqrt{f: X \to Y }10\\]\\[\sqrt{f: X \to Y }11\\]\\[\sqrt{f: X \to Y }12\\]\\[\sqrt{f: X \to Y }13\\]\\[\sqrt{f: X \to Y }14\\]\\[\sqrt{f: X \to Y }15\\]\\[\sqrt{f: X \to Y }16\\]\\[\sqrt{f: X \to Y }17\\]\\[\sqrt{f: X \to Y }18\\]\\[\sqrt{f: X \to Y }19\\]\\[\sqrt{f: X \to Y }20\\]\\[\sqrt{f: X \to Y }21\\]\\[\sqrt{f: X \to Y }22\\]\\[\sqrt{f: X \to Y }23\\]\\[\sqrt{f: X \to Y }24\\]\\[\sqrt{f: X \to Y }25\\]\\[\sqrt{f: X \to Y }26\\]\\[\sqrt{f: X \to Y }27\\]\\[\sqrt{f: X \to Y }28\\]\\[\sqrt{f: X \to Y }29\\]\\[\sqrt{f: X \to Y }30\\]\\[\sqrt{f: X \to Y }31\\]\\[\sqrt{f: X \to Y }32\\]\\[\sqr |
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
var mjAPI = require("./lib/mj-single.js"); | |
mjAPI.start(); | |
var start = Date.now(); | |
for (var i = 0; i < 100; i++) { | |
var input = "\\sqrt{f: X \\to Y }" + i; | |
console.log("\\[" + input + "\\]"); | |
mjAPI.typeset({ | |
math: input, | |
format: "TeX", // "inline-TeX", "MathML" | |
svg: true |
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
// via https://github.com/mathjax/MathJax/issues/1029#issuecomment-72348069 and http://c.utz.cc/mathjax/render.js | |
var webpage = require('webpage'); | |
var capture = function (page, pageUrl, callback) { | |
page.open(pageUrl, function (status) { | |
var interval, allDone; | |
if (status !== 'success') { | |
callback(new Error('Error rendering page')); |
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
window.MathJax = { | |
jax: ["input/TeX", "output/HTML-CSS"], //just some defaults | |
extensions: ["tex2jax.js", "MathMenu.js", "MathZoom.js"], | |
TeX: { | |
extensions: ["AMSmath.js", "AMSsymbols.js"], | |
equationNumbers: { | |
autoNumber: "AMS" | |
} | |
}, | |
AuthorInit: function() { |
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
#! /usr/bin/env node | |
var mjAPI = require("MathJax-node/lib/mj-single"); | |
var typeset = mjAPI.typeset; | |
var fs = require('fs'); | |
var path = require('path'); | |
var async = require('async'); | |
var cheerio = require('cheerio'); | |
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
#!/bin/bash | |
# founds this on SO but can't find the reference | |
# Target directory | |
TARGET=$3 | |
echo "Coping to $TARGET" | |
for i in $(git diff --name-only $1 $2) | |
do | |
# First create the target directory, if it doesn't exist. | |
mkdir -p "$TARGET/$(dirname $i)" | |
# Then copy over the file. |