configure.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* global MathJax */
  2. import { mathJaxLoaded } from './util'
  3. let configured = false
  4. export function configureMathJax() {
  5. if (configured) return
  6. if (!mathJaxLoaded()) return
  7. MathJax.Hub.Config({
  8. messageStyle: 'none',
  9. imageFont: null,
  10. // Fast preview, introduced in 2.5, is unhelpful due to extra codemirror refresh
  11. // and disabling it avoids issues with math processing errors
  12. // github.com/overleaf/write_latex/pull/1375
  13. 'fast-preview': { disabled: true },
  14. 'HTML-CSS': {
  15. availableFonts: ['TeX'],
  16. // MathJax's automatic font scaling does not work well when we render math
  17. // that isn't yet on the page, so we disable it and set a global font
  18. // scale factor
  19. scale: 110,
  20. matchFontHeight: false,
  21. },
  22. TeX: {
  23. equationNumbers: { autoNumber: 'AMS' },
  24. useLabelIDs: false,
  25. },
  26. skipStartupTypeset: true,
  27. tex2jax: {
  28. processEscapes: true,
  29. // Dollar delimiters are added by the mathjax directive
  30. inlineMath: [['\\(', '\\)']],
  31. displayMath: [
  32. ['$$', '$$'],
  33. ['\\[', '\\]'],
  34. ],
  35. },
  36. })
  37. configured = true
  38. }