Skip to content

Instantly share code, notes, and snippets.

@pkra
pkra / test.svg
Last active Aug 29, 2015
svg equation
View test.svg
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 Aug 29, 2015
Lens: JATS sample for math-related issues.
View lens-jats-math.xml
<?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 Jan 2, 2015
mathjax custom configuration test (mathjax-user group question)
View config.js
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 Aug 29, 2015
chrome android bug
View simpl.html
<!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>
View SVG-blacker-10-test.html
<!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 / svg-blacker-1-test.html
Last active Aug 29, 2015
MathJax SVG blacker=1 test
View svg-blacker-1-test.html
<!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 / wikipedia-test
Created Feb 19, 2015
Testing Browser bug with SVG text elements
View wikipedia-test
<?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 Mar 19, 2015
Bash to copy files that changed between commits to a new folder
View git-diff-copy.sh
#!/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 Apr 24, 2015
Testing cheerio for MathJax-node
View cheerio_wrapper.js
#! /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
MathJax: automatic equation numbering: set counter macro
View AMS-setcounter.js
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() {