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

Is a stand-alone installation possible? #3324

Closed
justinacolmena opened this issue Jan 16, 2025 · 4 comments
Closed

Is a stand-alone installation possible? #3324

justinacolmena opened this issue Jan 16, 2025 · 4 comments

Comments

@justinacolmena
Copy link

Does this work say for instance offline for private use as well as on the web without contacting third-party services?

Is it free and open source or are there specific service-provider domain names hard-coded in the software?

@dpvc
Copy link
Member

dpvc commented Jan 20, 2025

Does this work say for instance offline for private use as well as on the web without contacting third-party services?

Yes. See the documentation on hosting your own copy of MathJax. Note, however, that using file:// URLs can be problematic in some cases, as most browsers' security policies have a pretty restrictive idea of what the "same origin" means for file:// urls, which can make access to MathJax's fonts more difficult. You might need to use SVG output to avoid that, or use a local web server, like

python -m http.server 8000

in the directory with your HTML files and load your pages via http://localhost:8000/index.html.

Is it free and open source or are there specific service-provider domain names hard-coded in the software?

It is free and open source (the source code for v3 and above can be found here). MathJax is licensed under the Apache2 open-soutce license, which is pretty lenient.

Version 3 has no external references. Version 4 (currently in beta) references cdn.jsdelivr.net for the font packages, but there is a configuration option that lets you change that.

@justinacolmena
Copy link
Author

You might need to use SVG output to avoid that, or use a local web server,

My goal is to put it on the web and make it publicly accessible. Otherwise I have pencil and paper for equations for my private use, and I have no need of a computer for that.

Now for the svg, I make a very simple document and save it as eq1.tex. Latex offers a lot of font choices, but the defaults are very nice and suitable for educational and professional purposes.

\documentclass[]{article}
\pagestyle{empty}
\begin{document}
        $$E=mc^2$$
\end{document}

And then the following

user1@fedora0:~/Documents$ lualatex eq1.tex 
This is LuaHBTeX, Version 1.17.0 (TeX Live 2023) 
 restricted system commands enabled.
(./eq1.tex
LaTeX2e <2022-11-01> patch level 1
 L3 programming layer <2023-02-22>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2022/07/02 v1.4n Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-luatex.def)
(./eq1.aux) (/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmr.fd) [1{/var/li
b/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./eq1.aux))
 410 words of node memory still in use:
   3 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 5 attribute, 48 glue_spec
, 5 attribute_list, 1 write nodes
   avail lists: 1:1,2:23,3:8,4:1,5:23,6:2,7:40,8:5,9:22
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb></usr/
share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/share/t
exlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr7.pfb>
Output written on eq1.pdf (1 page, 23026 bytes).
Transcript written on eq1.log.
user1@fedora0:~/Documents$ pdfcrop eq1.pdf 
PDFCROP 1.40, 2020/06/06 - Copyright (c) 2002-2020 by Heiko Oberdiek, Oberdiek Package Support Group.
==> 1 page written on `eq1-crop.pdf'.
user1@fedora0:~/Documents$ magick -density 600 eq1-crop.pdf eq1.svg
user1@fedora0:~/Documents$

The resulting file eq1.svg may then be uploaded and pasted in a web document anywhere, perfectly scalable. Or, I can construct equations from scratch in plain old HTML with <div> and <hr> and <i> and <font> and <table> elements using UTF-8 math characters and allowing any font whatsoever which would be suitable to display them. What the browsers themselves should do if they were capable of MathML.

At some point, I am considering the convenience of coding math equations in straight HTML in comparison to debugging obscure \LaTeX{} issues.

What I do not want to do is create a website with a lot of cross site scripting vulnerabilities and dependencies on third party APIs to display basic content.

Mathjax fonts might not be the fonts that I want to use for my math equations, but if the fonts are available, then I might want to install them locally on my web server and include them in the <head> section of the web page directly to be served without the javascript on the same domain.

@justinacolmena
Copy link
Author

Image

@dpvc
Copy link
Member

dpvc commented Jan 21, 2025

Well, it looks like you have everything you want, without the need for MathJax. Carry on, then!

@dpvc dpvc closed this as completed Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants