mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-12 11:44:47 +00:00
Merge pull request #778 from sharelatex/as-configure-mathjax
Configure mathjax globally
This commit is contained in:
commit
c7c75af568
2 changed files with 31 additions and 16 deletions
|
@ -26,7 +26,29 @@ define [
|
|||
baseUrl: window.sharelatex.sixpackDomain
|
||||
client_id: window.user_id
|
||||
})
|
||||
|
||||
|
||||
MathJax?.Hub?.Config(
|
||||
extensions: ["Safe.js"]
|
||||
messageStyle: "none"
|
||||
imageFont:null
|
||||
"HTML-CSS":
|
||||
availableFonts: ["TeX"]
|
||||
# MathJax's automatic font scaling does not work well when we render math
|
||||
# that isn't yet on the page, so we disable it and set a global font
|
||||
# scale factor
|
||||
scale: 110
|
||||
matchFontHeight: false
|
||||
TeX:
|
||||
equationNumbers: { autoNumber: "AMS" }
|
||||
useLabelIDs: false
|
||||
skipStartupTypeset: true
|
||||
tex2jax:
|
||||
processEscapes: true
|
||||
# Dollar delimiters are added by the mathjax directive
|
||||
inlineMath: [ ["\\(","\\)"] ]
|
||||
displayMath: [ ['$$','$$'], ["\\[","\\]"] ]
|
||||
)
|
||||
|
||||
App.run ($templateCache) ->
|
||||
# UI Select templates are hard-coded and use Glyphicon icons (which we don't import).
|
||||
# The line below simply overrides the hard-coded template with our own, which is
|
||||
|
|
|
@ -4,23 +4,16 @@ define [
|
|||
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(['$','$']);
|
||||
inlineMathConfig = MathJax?.Hub?.config?.tex2jax.inlineMath
|
||||
alreadyConfigured = _.find inlineMathConfig, (c) ->
|
||||
c[0] == '$' and c[1] == '$'
|
||||
|
||||
MathJax?.Hub?.Config(mathjaxConfig);
|
||||
if !alreadyConfigured?
|
||||
MathJax?.Hub?.Config(
|
||||
tex2jax:
|
||||
inlineMath: inlineMathConfig.concat([['$', '$']])
|
||||
)
|
||||
|
||||
setTimeout () ->
|
||||
MathJax?.Hub?.Queue(["Typeset", MathJax?.Hub, element.get(0)])
|
||||
|
|
Loading…
Add table
Reference in a new issue