@@ -31,7 +31,8 @@ Create a file named :file:`test-mathjax.mjs` containing the following:
31
31
32
32
import {init } from " @mathjax/src" ;
33
33
await init ({loader: {load: [' input/tex' ]}});
34
- console .log (MathJax .tex2mml (' x+y' ));
34
+ const mml = (await MathJax .tex2mmlPromise (' x+y' ));
35
+ console .log (mml);
35
36
36
37
then run this file from the command line using
37
38
@@ -60,9 +61,8 @@ This is you first MathJax node program!
60
61
61
62
require (" @mathjax/src" ).init ({
62
63
loader: {load: [' input/tex' ]}
63
- }).then (() =>
64
- console .log (MathJax .tex2mml (' x+y' ))
65
- );
64
+ }).then (() => MathJax .tex2mmlPromise (' x+y' ))
65
+ .then ((mml ) => console .log (mml));
66
66
67
67
then run this file using
68
68
@@ -79,8 +79,10 @@ needed components and is ready to process mathematics, at which point
79
79
the global :js:data: `MathJax ` variable will be set up for use.
80
80
81
81
In the program above, we use the ``await `` command to wait for that
82
- promise to resolve, and then call :js:meth: `MathJax.tex2mml() ` to
83
- convert a TeX or LaTeX expression into the corresponding MathML tree.
82
+ promise to resolve, and then wait for the
83
+ :js:meth: `MathJax.tex2mmlPromise() ` call to convert a TeX or LaTeX
84
+ expression into the corresponding MathML tree. The result is then
85
+ printed.
84
86
85
87
Once you have initialized MathJax, you should be able to use MathJax
86
88
in much the same way as you would in a browser. Note, however, that
0 commit comments