Skip to content

Commit f591682

Browse files
committed
Update tagformat examples to use pre- and post-filter configuration
1 parent 7d46ea0 commit f591682

File tree

1 file changed

+41
-34
lines changed

1 file changed

+41
-34
lines changed

input/tex/extensions/tagformat.rst

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -93,28 +93,27 @@ automatic equation numbers generated when the ``tags`` option in the
9393
section: 1,
9494
tex: {
9595
tags: 'ams',
96+
packages: {'[+]': ['tagformat']},
9697
tagformat: {
9798
number: (n) => MathJax.config.section + '.' + n,
9899
id: (tag) => 'eqn-id:' + tag
99100
},
100-
packages: {'[+]': ['tagformat']}
101-
},
102-
loader: {load: ['[tex]/tagformat']},
103-
startup: {
104-
ready() {
105-
MathJax.startup.defaultReady();
106-
MathJax.startup.input.tex.preFilters.add(({math}) => {
101+
preFilters: [
102+
({math}) => {
107103
if (math.inputData.recompile) {
108104
MathJax.config.section = math.inputData.recompile.section;
109105
}
110-
});
111-
MathJax.startup.input.tex.postFilters.add(({math}) => {
106+
}
107+
],
108+
postFilters: [
109+
({math}) => {
112110
if (math.inputData.recompile) {
113111
math.inputData.recompile.section = MathJax.config.section;
114112
}
115-
});
116-
}
117-
}
113+
}
114+
]
115+
},
116+
loader: {load: ['[tex]/tagformat']},
118117
};
119118
120119
This arranges for automatic equation numbers to be of the form
@@ -204,7 +203,21 @@ Here is a complete example HTML document:
204203
tagformat: {
205204
number: (n) => MathJax.config.section + '.' + n,
206205
id: (tag) => 'eqn-id:' + tag
207-
}
206+
},
207+
preFilters: [
208+
({math}) => {
209+
if (math.inputData.recompile) {
210+
MathJax.config.section = math.inputData.recompile.section;
211+
}
212+
}
213+
],
214+
postFilters: [
215+
({math}) => {
216+
if (math.inputData.recompile) {
217+
math.inputData.recompile.section = MathJax.config.section;
218+
}
219+
}
220+
]
208221
},
209222
loader: {load: ['[tex]/tagformat']},
210223
startup: {
@@ -225,16 +238,6 @@ Here is a complete example HTML document:
225238
'sections', {handler: {macro: ['sections']}}
226239
);
227240
MathJax.startup.defaultReady();
228-
MathJax.startup.input.tex.preFilters.add(({math}) => {
229-
if (math.inputData.recompile) {
230-
MathJax.config.section = math.inputData.recompile.section;
231-
}
232-
});
233-
MathJax.startup.input.tex.postFilters.add(({math}) => {
234-
if (math.inputData.recompile) {
235-
math.inputData.recompile.section = MathJax.config.section;
236-
}
237-
});
238241
}
239242
}
240243
};</script>
@@ -307,7 +310,21 @@ Here is a complete example HTML document:
307310
tagformat: {
308311
number: (n) => MathJax.config.section + "." + n,
309312
id: (tag) => "eqn-id:" + tag
310-
}
313+
},
314+
preFilters: [
315+
({math}) => {
316+
if (math.inputData.recompile) {
317+
MathJax.config.section = math.inputData.recompile.section;
318+
}
319+
}
320+
],
321+
postFilters: [
322+
({math}) => {
323+
if (math.inputData.recompile) {
324+
math.inputData.recompile.section = MathJax.config.section;
325+
}
326+
}
327+
]
311328
},
312329
loader: {load: ["[tex]/tagformat"]},
313330
startup: {
@@ -328,16 +345,6 @@ Here is a complete example HTML document:
328345
"sections", {handler: {macro: ["sections"]}}
329346
);
330347
MathJax.startup.defaultReady();
331-
MathJax.startup.input.tex.preFilters.add(({math}) => {
332-
if (math.inputData.recompile) {
333-
MathJax.config.section = math.inputData.recompile.section;
334-
}
335-
});
336-
MathJax.startup.input.tex.postFilters.add(({math}) => {
337-
if (math.inputData.recompile) {
338-
math.inputData.recompile.section = MathJax.config.section;
339-
}
340-
});
341348
}
342349
}
343350
};</script>

0 commit comments

Comments
 (0)