Skip to content

Instantly share code, notes, and snippets.

@pkra
pkra / test.svg
Last active August 29, 2015 14:07
svg equation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pkra
pkra / lens-jats-math.xml
Last active August 29, 2015 14:07
Lens: JATS sample for math-related issues.
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD with MathML3 v1.1d1 20130915//EN" "JATS-archivearticle1-mathml3.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en" dtd-version="1.1d1">
<front>
<journal-meta>
<publisher>
<publisher-name>American Mathematical Society</publisher-name>
</publisher>
</journal-meta>
<article-meta>
@pkra
pkra / config.js
Created January 2, 2015 21:41
mathjax custom configuration test (mathjax-user group question)
window.MathJax = {
jax: ["input/TeX", "output/HTML-CSS"],
extensions: ["tex2jax.js","TeX/AMSmath.js","TeX/AMSsymbols.js",
"TeX/noUndefined.js"],
TeX: {
Macros: {
RR: '{\\bf R}',
bold: ['{\\bf #1}', 1],
pd: ["{\\frac{\\partial #1}{\\partial #2}}",2],
// etc....
@pkra
pkra / simpl.html
Last active August 29, 2015 14:12
chrome android bug
<!DOCTYPE html>
<html>
<head>
<script src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML.js">
</script>
</head>
<body>
\[a_1\]
</body>
</html>
@pkra
pkra / svg-blacker-1-test.html
Last active August 29, 2015 14:13
MathJax SVG blacker=1 test
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>SVG blacker=1 test</title>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
jax: ["input/MathML","output/SVG"],
extensions: ["mml2jax.js","MathEvents.js"],
SVG: {
@pkra
pkra / SVG-blacker-10-test.html
Created January 7, 2015 09:29
SVG blacker 10 test
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>SVG blacker=10 test</title>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
jax: ["input/MathML","output/SVG"],
extensions: ["mml2jax.js","MathEvents.js"],
SVG: {
@pkra
pkra / wikipedia-test
Created February 19, 2015 15:19
Testing Browser bug with SVG text elements
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns:xlink="http://www.w3.org/1999/xlink" style="vertical-align: -15ex; " width="68.167ex" height="31ex" viewBox="0 -6922.9 29356.5 13345.7" xmlns="http://www.w3.org/2000/svg">
<defs>
<path stroke-width="10" id="E1-MJMATHI-3B1" d="M34 156Q34 270 120 356T309 442Q379 442 421 402T478 304Q484 275 485 237V208Q534 282 560 374Q564 388 566 390T582 393Q603 393 603 385Q603 376 594 346T558 261T497 161L486 147L487 123Q489 67 495 47T514 26Q528 28 540 37T557 60Q559 67 562 68T577 70Q597 70 597 62Q597 56 591 43Q579 19 556 5T512 -10H505Q438 -10 414 62L411 69L400 61Q390 53 370 41T325 18T267 -2T203 -11Q124 -11 79 39T34 156ZM208 26Q257 26 306 47T379 90L403 112Q401 255 396 290Q382 405 304 405Q235 405 183 332Q156 292 139 224T121 120Q121 71 146 49T208 26Z"></path>
<path stroke-width="10" id="E1-MJMAIN-61" d="M137 305T115 305T78 320T63 359Q63 394 97 421T218 448Q291 448 336 416T396 340Q401 326
@pkra
pkra / git-diff-copy.sh
Created March 19, 2015 13:48
Bash to copy files that changed between commits to a new folder
#!/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.
@pkra
pkra / cheerio_wrapper.js
Created April 24, 2015 19:40
Testing cheerio for MathJax-node
#! /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');
@pkra
pkra / AMS-setcounter.js
Created May 1, 2015 20:13
MathJax: automatic equation numbering: set counter macro
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() {