From 120acf4918347731e777f3ea404cafb56244b55a Mon Sep 17 00:00:00 2001 From: Jessica Lawshe Date: Fri, 13 Jul 2018 15:02:52 -0500 Subject: [PATCH] Optional $ MathJax delimiter --- .../public/coffee/directives/mathjax.coffee | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/services/web/public/coffee/directives/mathjax.coffee b/services/web/public/coffee/directives/mathjax.coffee index 6d37353c07..269526287e 100644 --- a/services/web/public/coffee/directives/mathjax.coffee +++ b/services/web/public/coffee/directives/mathjax.coffee @@ -1,25 +1,27 @@ define [ "base" -], (App) -> - mathjaxConfig = - extensions: ["Safe.js"] - messageStyle: "none" - imageFont:null - "HTML-CSS": { availableFonts: ["TeX"] }, - TeX: - equationNumbers: { autoNumber: "AMS" }, - useLabelIDs: false - tex2jax: - inlineMath: [ ['$','$'], ["\\(","\\)"] ], - displayMath: [ ['$$','$$'], ["\\[","\\]"] ], - processEscapes: true - skipStartupTypeset: true - - MathJax?.Hub?.Config(mathjaxConfig); - +], (App) -> App.directive "mathjax", () -> return { link: (scope, element, attrs) -> + 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); + setTimeout () -> MathJax?.Hub?.Queue(["Typeset", MathJax?.Hub, element.get(0)]) , 0