|
97 | 97 | "```\n", |
98 | 98 | "<div hidden>\n", |
99 | 99 | "\n", |
| 100 | + "\\def\\require#1{}\n", |
| 101 | + "$\\require{begingroup}\\require{newcommand}$\n", |
100 | 102 | "$\\gdef\\vec#1{\\boldsymbol{#1}}$\n", |
| 103 | + "$\\gdef\\i{\\mathrm{i}}$\n", |
101 | 104 | "\n", |
102 | 105 | "\\vskip-\\parskip\n", |
103 | 106 | "\\vskip-\\baselineskip\n", |
|
107 | 110 | "\n", |
108 | 111 | "<div hidden>\n", |
109 | 112 | "\n", |
| 113 | + "\\def\\require#1{}\n", |
| 114 | + "$\\require{begingroup}\\require{newcommand}$\n", |
110 | 115 | "$\\gdef\\vec#1{\\boldsymbol{#1}}$\n", |
| 116 | + "$\\gdef\\i{\\mathrm{i}}$\n", |
111 | 117 | "\n", |
112 | 118 | "\\vskip-\\parskip\n", |
113 | 119 | "\\vskip-\\baselineskip\n", |
|
123 | 129 | "but in LaTeX, it doesn't have any effect on later math expressions.\n", |
124 | 130 | "Using `\\gdef` works in both.\n", |
125 | 131 | "Sadly, `\\gdef` isn't activated by default in MathJax,\n", |
126 | | - "therefore we need some additional configuration in our `conf.py` file:\n", |
| 132 | + "so we have to use `\\require` to activate the `newcommand` and `begingroup` extensions.\n", |
| 133 | + "Since `\\require` is a MathJax feature that's unknown to LaTeX,\n", |
| 134 | + "we'll have to provide a dummy definition to not confuse LaTeX\n", |
127 | 135 | "\n", |
128 | | - "```python\n", |
129 | | - "mathjax_config = {\n", |
130 | | - " 'TeX': {\n", |
131 | | - " 'extensions': ['newcommand.js', 'begingroup.js'],\n", |
132 | | - " },\n", |
133 | | - "}\n", |
134 | | - "\n", |
135 | | - "```\n", |
136 | | - "\n", |
137 | | - "With the above definition and the `conf.py` setting in place,\n", |
| 136 | + "With the above definitions,\n", |
138 | 137 | "you can use your new macro like this:\n", |
139 | 138 | "\n", |
140 | 139 | "```\n", |
141 | 140 | "$2 \\vec{a} + \\vec{b}$\n", |
142 | 141 | "```\n", |
143 | 142 | "\n", |
144 | | - "... which looks like this: $2 \\vec{a} + \\vec{b}$" |
| 143 | + "... which looks like this: $2 \\vec{a} + \\vec{b}$.\n", |
| 144 | + "\n", |
| 145 | + "You can of course use as many `\\gdef` lines as you want." |
145 | 146 | ] |
146 | 147 | }, |
147 | 148 | { |
|
556 | 557 | "name": "python", |
557 | 558 | "nbconvert_exporter": "python", |
558 | 559 | "pygments_lexer": "ipython3", |
559 | | - "version": "3.7.2+" |
| 560 | + "version": "3.7.3rc1" |
560 | 561 | } |
561 | 562 | }, |
562 | 563 | "nbformat": 4, |
|
0 commit comments