certik / theoretical-physics

Source code of the Theoretical Physics Reference online book
https://theoretical-physics.com
MIT License
222 stars 48 forks source link

Build a version with mathjax #43

Open certik opened 9 years ago

certik commented 9 years ago

Perhaps at /dev-mathjax. The png based image math is hard to read on a high resolution (retina) display.

asmeurer commented 9 years ago

It's trivial to do

diff --git a/src/conf.py b/src/conf.py
index 8725f11..4c651a7 100644
--- a/src/conf.py
+++ b/src/conf.py
@@ -23,7 +23,7 @@ sys.path.append(os.path.abspath('../exts'))

 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.pngmath', "math_dollar"]
+extensions = ['sphinx.ext.mathjax', "math_dollar"]

 latex_preamble = r"""
 \usepackage{dsfont}

When I did this, no the complex page, there were some math errors with \atan2.

asmeurer commented 9 years ago

I guess you must have some preamble or something, which isn't being passed to mathjax. It's the same with \d and \half, which aren't even real latex.

asmeurer commented 9 years ago

Oh wow, you have quite the preamble. I think for mathjax all the \newcommands have to be defined in the file. I don't know about the rest.

emptymalei commented 9 years ago

well the rest is to put the preamble inside layout.html and put a if there to make sure these only works for the case of building using mathjax.