overleaf/services/web/public/coffee/directives/mathjax.coffee

28 lines
733 B
CoffeeScript
Raw Normal View History

2014-07-17 08:23:43 -04:00
define [
"base"
2018-07-13 16:02:52 -04:00
], (App) ->
2014-07-17 08:23:43 -04:00
App.directive "mathjax", () ->
return {
link: (scope, element, attrs) ->
2018-07-13 16:02:52 -04:00
mathjaxConfig =
extensions: ["Safe.js"]
messageStyle: "none"
imageFont:null
"HTML-CSS": { availableFonts: ["TeX"] },
TeX:
equationNumbers: { autoNumber: "AMS" },
useLabelIDs: false
skipStartupTypeset: true
tex2jax:
processEscapes: true,
inlineMath: [ ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ]
if attrs.delimiter != 'no-single-dollar'
mathjaxConfig.tex2jax.inlineMath.push(['$','$']);
MathJax?.Hub?.Config(mathjaxConfig);
2014-07-17 08:23:43 -04:00
setTimeout () ->
2015-02-23 12:46:17 -05:00
MathJax?.Hub?.Queue(["Typeset", MathJax?.Hub, element.get(0)])
2014-07-17 08:23:43 -04:00
, 0
}