CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/util/mathjax-config.js
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
// mathjax configuration: this could be cleaned up further or even parameterized with some code during startup
7
// ATTN: do not use "xypic.js", frequently causes crash!
8
9
exports.MathJaxConfig = {
10
skipStartupTypeset: true,
11
extensions: ["tex2jax.js", "asciimath2jax.js", "Safe.js"], // "static/mathjax_extensions/xypic.js"
12
// NOTE: "output/CommonHTML" is the output default: http://docs.mathjax.org/en/latest/output.html
13
// However, **DO NOT** use "output/CommonHTML" for the output JAX; it completely breaks
14
// Sage worksheet output right now. Maybe when/if worksheets are rewritten
15
// using React, we can change, but not now. Using "output/SVG" works just fine.
16
// https://github.com/sagemathinc/cocalc/issues/1962
17
jax: ["input/TeX", "input/AsciiMath", "output/SVG"],
18
// http://docs.mathjax.org/en/latest/options/tex2jax.html
19
tex2jax: {
20
inlineMath: [
21
["$", "$"],
22
["\\(", "\\)"],
23
],
24
displayMath: [
25
["$$", "$$"],
26
["\\[", "\\]"],
27
],
28
processEscapes: true,
29
ignoreClass: "tex2jax_ignore",
30
skipTags: ["script", "noscript", "style", "textarea", "pre", "code"],
31
},
32
33
TeX: {
34
MAXBUFFER: 100000, // see https://github.com/mathjax/MathJax/issues/910
35
extensions: ["autoload-all.js", "noUndefined.js", "noErrors.js"],
36
Macros: {
37
// get these from sage/misc/latex.py
38
Bold: ["\\mathbb{#1}", 1],
39
ZZ: ["\\Bold{Z}", 0],
40
NN: ["\\Bold{N}", 0],
41
RR: ["\\Bold{R}", 0],
42
CC: ["\\Bold{C}", 0],
43
FF: ["\\Bold{F}", 0],
44
QQ: ["\\Bold{Q}", 0],
45
QQbar: ["\\overline{\\QQ}", 0],
46
CDF: ["\\Bold{C}", 0],
47
CIF: ["\\Bold{C}", 0],
48
CLF: ["\\Bold{C}", 0],
49
RDF: ["\\Bold{R}", 0],
50
RIF: ["\\Bold{I} \\Bold{R}", 0],
51
RLF: ["\\Bold{R}", 0],
52
CFF: ["\\Bold{CFF}", 0],
53
GF: ["\\Bold{F}_{#1}", 1],
54
Zp: ["\\ZZ_{#1}", 1],
55
Qp: ["\\QQ_{#1}", 1],
56
Zmod: ["\\ZZ/#1\\ZZ", 1],
57
},
58
noErrors: {
59
// http://docs.mathjax.org/en/latest/tex.html#noerrors
60
inlineDelimiters: ["$", "$"],
61
multiLine: true,
62
style: {
63
"font-size": "85%",
64
"text-align": "left",
65
color: "red",
66
padding: "1px 3px",
67
background: "#FFEEEE",
68
border: "none",
69
},
70
},
71
noUndefined: {
72
// http://docs.mathjax.org/en/latest/tex.html#noundefined
73
attributes: {
74
mathcolor: "red",
75
mathbackground: "#FFEEEE",
76
mathsize: "90%",
77
},
78
},
79
},
80
81
// do not use "xypic.js", frequently causes crash!
82
"HTML-CSS": {
83
linebreaks: {
84
automatic: true,
85
},
86
},
87
SVG: {
88
linebreaks: {
89
automatic: true,
90
},
91
},
92
showProcessingMessages: false,
93
};
94
95