<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>MathBox - Empty</title>
<script src="../mathbox-bundle.js"></script>
<link rel="stylesheet" href="../build/mathbox.css">
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
</head>
<body>
<script>
// Define global DOM handler to format 'latex' into an HTML span
MathBox.DOM.Types.latex = MathBox.DOM.createClass({
render: function (el) {
this.props.innerHTML = katex.renderToString(this.children);
return el('span', this.props);
}
});
var mathbox = mathBox({
plugins: ['core', 'controls', 'cursor', 'mathbox'],
controls: {
// Orbit controls, i.e. Euler angles, with gimbal lock
klass: THREE.OrbitControls,
// Trackball controls, i.e. Free quaternion rotation
//klass: THREE.TrackballControls,
},
});
if (mathbox.fallback) throw "WebGL not supported"
var three = mathbox.three;
three.renderer.setClearColor(new THREE.Color(0xFFFFFF), 1.0);
// Do stuff with mathbox,
// for example: (see docs/intro.md)
var camera = mathbox.camera({
proxy: true,
position: [0, 0, 3],
});
var view = mathbox.cartesian({
range: [[-0.5, 1.5], [-0.1, 1]],
scale: [2.0, 1.5],
});
view.array({
data: [[1.5,0.1], [1,1]],
channels: 2, // necessary
live: false,
})
view
.point({
color: 0x3090FF,
size: 40,
})
view.html({
width: 1,
height: 1,
depth: 1,
expr: function (emit, i, j, k, l) {
// Emit latex element
emit("...") ///////////////////////////////////////////////////////////////////// This is the missing part
//emit(el('latex', null, 'c =1'));
},
})
.dom({
snap: false,
offset: [0, 0],
size: 24,
zoom: 1,
outline: 3,
});
view
.axis({
axis: 1,
width: 3,
})
.axis({
axis: 2,
width: 3,
})
.grid({
width: 1,
divideX: 11,
divideY: 16,
});
var scale =
view.scale({
divide: 3,
});
var ticks =
view.ticks({
width: 5,
size: 15,
color: 'black',
});
var format =
view.format({
digits: 2,
weight: 'bold',
});
var labels =
view.label({
color: 'black',
zIndex: 1,
});
var data =
view.interval({
expr: function (emit, x, i, t) {
emit(x, x*x/(x+1)+0.2);
},
width: 64,
channels: 2,
});
var curve =
view.line({
width: 5,
color: '#3090FF',
});
</script>
</body>
</html>