--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/ef91712a-0bac-4889-8531-1966bb27c63dn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/85d86bb4-8709-479c-9834-a309b71face6n%40googlegroups.com.
I've tried all the options above without success.
@@@02:This is the maximum I could achieve:
This is a roundtrip.The node server generates the html code whichwill be sent to the browser.The browser contacts a server again to getthe MathJax code.
Three servers are envolved:1: Ubuntu server as host2: Apache web server3: Node serverMathJax version: 3.2.2
@@@03:What I want is to generate the html codeas the first step on the Node server.The problem is that I can't accessthe "mathjax-img" on the Node server.
const packages = 'base, autoload, require, ams, newcommand, noundefined, img'.split(/\s*,\s*/);MathJax = {options: {}, tex: {packages: packages, noundefined: {color: 'red', background: '', size: ''}, formatError(_, error) {throw error;}}, svg: {fontCache: 'local'}, startup: {typeset: false}};// Load all the needed components
require('mathjax-full/components/src/startup/lib/startup.js');require('mathjax-full/components/src/core/core.js');
require('mathjax-full/components/src/adaptors/liteDOM/liteDOM.js');
require('mathjax-full/components/src/input/tex-base/tex-base.js');require('mathjax-full/components/src/input/tex/extensions/all-packages/all-packages.js');require('mathjax-full/components/src/input/tex/extensions/noundefined/noundefined');
require('mathjax-img/img.min.js');
require('mathjax-full/components/src/output/svg/svg.js');require('mathjax-full/components/src/output/svg/fonts/tex/tex.js');require('mathjax-full/components/src/a11y/assistive-mml/assistive-mml.js');require('mathjax-full/components/src/startup/startup.js');// Let MathJax know these are loadedMathJax.loader.preLoad('core'
, 'adaptors/liteDOM'
, 'input/tex-base', '[tex]/all-packages', '[tex]/noundefined', '[tex]/img', 'output/svg', 'output/svg/fonts/tex', 'a11y/assistive-mml');MathJax.config.startup.ready();
MathJax.tex2svgPromise('\\img{test.svg}').then((m) => console.log(MathJax.startup.adaptor.outerHTML(m)));
node -r esm tex2svg
npm install mathjax-full@3npm install mathjax-img
@@@06:
I could recompile the whole "MathJAx"using the "github" or the "npm" method.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/1c1c15ce-9aa7-49a6-957d-e5bc9e0fa2c0n%40googlegroups.com.
BEGIN STATEMENT 01STEP 1:Mathjax img extension + MathJax.tex2svggenerates a valid SVG file (string) that contains a link to thespecified image (jpg, png or in my case SVG).STEP 2:The generated SVG file (that contains the link to the SVG file specified in the /img extension)will be passed to the browser's SVG engine.(So the /img extension allows us to generate an SVG that contains a link to another SVG file.)END STATEMENT 01Question 1:Is "STATEMENT 01" correct?
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<style>svg a {fill: blue; stroke: blue}[data-mml-node="merror"] > g {fill: red; stroke: red}[data-mml-node="merror"] > rect[data-background] {fill: yellow; stroke: none}[data-frame],[data-line] {stroke-width: 70px; fill:none}.mjx-dashed {stroke-dasharray: 140}.mjx-dotted {stroke-linecap: round; stroke-dasharray: 0,140}use[data-c], path {stroke-width: 3px}</style>
Question 2:How could I see the SVG string generated by the MathJax.tex2svg above?
Question 3:Will the /img extension work in Mathjax 4?
https://github.com/pkra/mathjax-img
Environment:(Mathjax 3 + /img extension) --> fabric.js --> browser (Chrome and Firefox)
The result:No node.js is envolved, browserfy is used to bundle everything into one Javasript file.The SVG output of (Mathjax 3 + /img extension)is processed by fabric.js. I can see the rectangle specified in the "/img[ ][ ]{}"string but I can't see the image. That's why I want do some research.
<mjx.svg>
Question 2:How could I see the SVG string generated by the MathJax.tex2svg above?
Use console.log() to print it to the browser console? Usesvg.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');to get an escaped HTML string and insert that into the body of the page? Use alert(svg) to display it in a dialog box?Am I missing something in your question?
Question 3:Will the /img extension work in Mathjax 4?
If you are using the one atit is already a v4 extension. There is a breaking change between v3 and v4 that prevents this v4 extension from working in v3, but it looks like it was updated about 7 months ago, so you can probably go back to an earlier version to get a v3 one, or can use the code atfor a v3 version.
Environment:(Mathjax 3 + /img extension) --> fabric.js --> browser (Chrome and Firefox)The result:No node.js is envolved, browserfy is used to bundle everything into one Javasript file.The SVG output of (Mathjax 3 + /img extension)is processed by fabric.js. I can see the rectangle specified in the "/img[ ][ ]{}"string but I can't see the image. That's why I want do some research.
If you haven't set svg.fontCache to "local" or "none", that could be the problem (start with "none" until you get things working). Also, the source link should be a full URL to the SVG file; a relative link may not work. If neither of those are it, try saving the svg string into a file and loading that separately into the browser to make sure it works.I don't know anything about fabric.js, but it might be that it doesn't handle nested SVGs. Also, the MathJax SVG has width and height attributes that are in ex units, and that might be an issue. Try removing those attributes (and the vertical-align style) and see if that helps.Davide
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/fe897586-daa9-48b3-9f6a-92eb41053f70n%40googlegroups.com.
Using tex-svg.js and tex-mml-chtml.js on the same page it seems to cause a conflict and this error appears
"Uncaught TypeError: MathJax.tex2svgPromise is not a function"
The combined components, like tex-mml-chtml.js and tex-svg.js are not designed to be used in combination, since
they both include copies of the startup code that does things like setup the tex2svgPromise() routines, and one will wipe out the work of the other.
You can, however load one of them and configure it to load the pieces you need from the other. For example
would let you have both SVG- and CHTML-based typeset functions.
QUESTION 1:
What should I do if I want to use MathJax.tex2svgPromise?
<script>MathJax = {loader: {load: ['[img]/img.min.js'],paths: {img: 'https://cdn.jsdelivr.net/npm/mathjax-img@3'}},tex: {packages: {'[+]': ['img']},inlineMath:[['$', '$'], ['\\(', '\\)']]},svg: {fontCache: 'global'
},startup: {ready() {MathJax.startup.defaultReady();// MathJax.tex2svgPromise() is available here}}};</script>
QUESTION 2:Where can I see the Mathjax version number in the source code?
MathJax.tex2svgPromise('{a}').then(svg => console.log(svg)).catch(err => console.log(err));
--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/f6dcd119-2c4c-43e6-9ffc-72b0d4292ef0n%40googlegroups.com.
<!DOCTYPE html><html><head><script src="node_modules/fabric/dist/fabric.min.js"></script>
</head><body><canvasid="canvas"style="border: 4px solid black"width="400"height="300"></canvas><script>
var canvas = new fabric.Canvas("canvas");
</script><script>MathJax = {loader: {
load: ['[img]/img.min.js'],
paths: {img: 'https://cdn.jsdelivr.net/npm/mathjax-img@3'}},tex: {packages: {'[+]': ['img']},
inlineMath: [['$', '$'], ['\\(', '\\)']]
},svg: {fontCache: 'local'},startup: {ready() {MathJax.startup.defaultReady();
MathJax.tex2svgPromise('xyz = \\vcenter{\\img[width=100px,height=120px]{https://www.math.union.edu/~dpvc/pix/dpvc.jpg}}').then(svg => {svg = svg.querySelector('svg');svg.setAttribute('width', (parseFloat(svg.getAttribute('width')) * 8) + 'px');svg.setAttribute('height', (parseFloat(svg.getAttribute('height')) * 8) + 'px');svg = svg.outerHTML.replace(/ href=/g, ' xlink:href=');fabric.loadSVGFromString(svg, function(objects, options) {var obj = fabric.util.groupSVGElements(objects, options);canvas.add(obj).requestRenderAll();});}).catch(err => console.log(err));}}};</script><script type="text/javascript" id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>\[xyz = \vcenter{\img[width=100px,height=120px]{https://www.math.union.edu/~dpvc/pix/dpvc.jpg}}\]</body></html>
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/c41c084f-92f3-4530-8870-7046d233f55fn%40googlegroups.com.
I see import references like this: #js ....
If the reference starts with # the system cant find the referenced file.
02: questionI used full path in a couple of js files. It is working but I did not modify every file (unfinished project).I will use CJS/ES5 because browserify.js doesn't support ES6.What should I do?
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/c9ee7ae1-1910-4867-8ee5-8aab11433e32n%40googlegroups.com.
//BEGIN Mathjax 4 beta
require('./mathjax-full/components/mjs/startup/lib/components/startup.js');
require('./mathjax-full/components/mjs/core/core.js');
require('./mathjax-full/mjs/handlers/html/HTMLHandler.js');
require('./mathjax-full/mjs/adaptors/browserAdaptor');
require('./mathjax-full/components/mjs/input/tex-base/tex-base.js');
require('./mathjax-full/components/mjs/input/tex/extensions/all-packages/all-packages.js');
require('./mathjax-full/components/mjs/input/tex/extensions/noundefined/noundefined');
require('/mathjax/mathjax-img-main/img.min.js');
require('./mathjax-full/components/mjs/output/svg/svg.js');
require('./mathjax-full/mjs/components/startup.js');
//END Mathjax 4 beta
Error: Can't walk dependency graph: Cannot find module '#default-font/svg/default.js' from 'src/mathjax-full/mjs/output/svg/DefaultFont.js'
NOTE:"default-font" folderand"default.js" filedon't exist.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/4e7bf283-e6e3-4dcf-91ca-361ab9246b99n%40googlegroups.com.