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

Get website documentation to display math #773

Merged

Conversation

guyer
Copy link
Member

@guyer guyer commented Jan 13, 2021

Fixes #762

@guyer
Copy link
Member Author

guyer commented Jan 15, 2021

Try as I might, I couldn't get sphinx.ext.mathjax working satisfactorily. The math renders fine, but MathJax is pointedly not TeX, and definitely not LaTeX. We import some packages and define some commands in conf.py and I couldn't make enough of it work:

  • The SIunits package is archaic. There's an siunitsx proxy for MathJax 2.x, but it's buggy, and it's really clunky to load it in sphinx.
  • changepage is for the PDF rendering, not web
  • defining \abs is OK
  • Making \erf a math operator stymies me. MathJax 3.x has a physics package that includes \abs and \erf, but for the life of me I can't get it to load. MathJax 3.x also broke my def of \abs.

I'm fed up and am giving up. SVG is good enough.

Sphinx 4.x apparently migrated to MathJax 3.x. At such point as conda-forge starts supplying Sphinx 4.x, it may be worth revisiting this.

@guyer guyer requested review from tkphd and wd15 January 15, 2021 00:43
@tkphd
Copy link
Contributor

tkphd commented Jan 15, 2021

Can we cheat using \mathrm{erf}?

@guyer
Copy link
Member Author

guyer commented Jan 15, 2021

Can we cheat using \mathrm{erf}?

mayhaps

Copy link
Contributor

@tkphd tkphd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes appear straightforward; docs build locally and look fine (i.e., equations are present & accounted for). MathJax support would be a good follow-up issue.

@guyer guyer mentioned this pull request Jan 15, 2021
@wd15
Copy link
Contributor

wd15 commented Jan 15, 2021

I'm not seeing the equations locally. What am I doing wrong?

Edit: I didn't have a working latex in the environment

@wd15
Copy link
Contributor

wd15 commented Jan 15, 2021

Works for me. Could we set it to fail if latex doesn't run from some reason?

@guyer
Copy link
Member Author

guyer commented Jan 15, 2021

Could we set it to fail if latex doesn't run from some reason?

I don't know, but it would be desirable. That was why I missed that it didn't build right on CircleCI.

@guyer
Copy link
Member Author

guyer commented Jan 19, 2021

Could we set it to fail if latex doesn't run from some reason?

imgmath logs and raises an error when it can't find a LaTeX component it needs, but then it discards the error.

It seems like the CI command needs to grep for ".* command '.*' cannot be run \(needed for math display\), check the imgmath_.* setting" and exit non-zero, but doing that, while still outputting the log is beyond my shelling.

Something, something, tee?

@wd15
Copy link
Contributor

wd15 commented Jan 19, 2021

Could we set it to fail if latex doesn't run from some reason?

imgmath logs and raises an error when it can't find a LaTeX component it needs, but then it discards the error.

It seems like the CI command needs to grep for ".* command '.*' cannot be run \(needed for math display\), check the imgmath_.* setting" and exit non-zero, but doing that, while still outputting the log is beyond my shelling.

Something, something, tee?

Thanks for looking into it. I would say that it's probably better to get sphinx to return in a failed state rather than having the CI try to interpret the output.

@guyer guyer merged commit 0635aaf into usnistgov:master Jan 28, 2021
@guyer guyer deleted the issue762-Equations_on_Website_dont_show_right branch January 28, 2021 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Equations on Website don't show right
3 participants