Skip to content

Instantly share code, notes, and snippets.

@dpvc
dpvc / MathJax.pl
Last active June 30, 2022 10:59
Perl Pipe to MathJax
use IPC::Open2;
use JSON;
#
# Package provides
#
# my $svg = MathJax->Typeset(tex, options);
# MathJax->ResetTeX;
#
package MathJax;
@dpvc
dpvc / lazy.js
Last active April 16, 2021 15:42
Lazy typeset extension for MathJax v3
!function(){"use strict";var t,e,r={335:function(t,e,r){var a,n=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var a,n,o=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(a=o.next()).done;)i.push(a.value)}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},i=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(o(arguments[e]));return t},l=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],a=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&a>=t.length&&(t=void 0),{value:t&&
@dpvc
dpvc / tikz-filter
Last active August 6, 2020 18:49
MathJax filter for sag's produce with TikZ
#! /usr/bin/env node
/*************************************************************************
*
* tikz-filter
*
* Uses MathJax v3 to convert math to svg within TikZ svg output.
*
* ----------------------------------------------------------------------
*
@dpvc
dpvc / README.md
Last active August 5, 2020 00:15
PreTeXt script for MathJax 3 conversion to MathML, SVG, speech, and braille

You need to do

npm install mathjax-full
npm install yargs
npm install speech-rule-engine@3.1.0-beta.4

If there is a node_modules/mathjax-full/node_modules directory, you should remove it (it should only contain speech-rule engine, and the last line above

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>Change Script Sizes</title>
<script type="text/x-mathjax-config">
MathJax.Hub.Register.StartupHook("mml Jax Ready", function () {
var MML = MathJax.ElementJax.mml;
var math = MML.math.prototype.defaults;
@dpvc
dpvc / build.json
Created October 20, 2019 13:53
Persian numbers in MathJax
{
"component": "mhchem",
"targets": ["input/tex/mhchem"],
"exclude": ["input/tex/mhchem/mhchem_parser.d.ts"]
}
@dpvc
dpvc / mathjax-editing.js
Last active July 19, 2020 18:56 — forked from gdalgas/mathjax-editing.js
StackExchange MathJax editing code
// The MIT License (MIT)
//
// Copyright (c) 2016 Stack Exchange
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@dpvc
dpvc / gist:d2967efb6205cf6c7d95
Created May 29, 2015 09:48
MathJax code for requested table
\let\fnt=\rm
\bbox[1ex,#BEF]{\textstyle\fnt
\frac{3\times 10^8\ m}{s}
\ \style{background-color:white}{
\begin{array}{|c|c|}
\hline
\Rule{0px}{1.25em}{.8em}
\llap{\times}\fnt\frac{3600\ s}{1\ hr}&
\llap{\times}\fnt\frac{100\ cm}{1\ m}&
\llap{\times}\fnt\frac{1\ in}{2.54\ cm}&