Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tex2svg: Remove non-unique title ID #10

Open
stroobandt opened this issue May 25, 2019 · 2 comments
Open

tex2svg: Remove non-unique title ID #10

stroobandt opened this issue May 25, 2019 · 2 comments

Comments

@stroobandt
Copy link

I have been using tex2svg provided by mathjax-node for years to render multiple SVG formulae for use in a single XHTML document. Recently, I was forced to move to tex2svg provided by mathjax-node-cli.

What has changed now, is the inclusion of a title ID as in:
<title id="MathJax-SVG-1-Title">upper E equals m c squared</title>

As the "MathJax-SVG-1-Title" title ID is the same for every converted formula, the XHTML document becomes invalid because of several non-unique IDs.

Has this generic title ID any use? If not, remove it.
If on the other hand a title ID is somehow required, then render it unique by concatenating it with a millisecond level Unix time serialization. Using the actual title for serialization is not sufficient because the same formula may appear more than once in a single XHTML document.

@dpvc
Copy link
Member

dpvc commented May 26, 2019

Has this generic title ID any use?

Yes, absolutely it has a use. It is for screen readers (and other assistive technology) so that they can read the mathematics properly. If you want to prevent it from being generated, you can use the --speech=false option on the command line to prevent it.

You are right that better handling of the ids would be helpful. In the meantime, if you don't use --speech-false, you could use the svgNode rather than just svg to get the actual svg tree rather than a serialization, and modify the ID yourself, then serialize it yourself using outerHTML as a work-around for now.

@stroobandt
Copy link
Author

Thanks; --speech=false did it for me.

The XHTML eventually ends up as a PDF (by means of Prince XML, so in that case, there is no substantial need for assistive speech technology.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants