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

Latex equation broken in RZZGate documentation #11358

Closed
aeddins-ibm opened this issue Nov 30, 2023 · 3 comments · Fixed by #11435
Closed

Latex equation broken in RZZGate documentation #11358

aeddins-ibm opened this issue Nov 30, 2023 · 3 comments · Fixed by #11435
Labels
documentation Something is not clear or an error documentation

Comments

@aeddins-ibm
Copy link
Contributor

Environment

Online docs

What is happening?

On the RZZGate docs page: https://docs.quantum.ibm.com/api/qiskit/qiskit.circuit.library.RZZGate

An equation that is a helpful reference for getting factors of 2 correct does not render. Mousing over gives the tooltip shown with the error message suggesting to use renewcommand instead of newcommand:
image

How can we reproduce the issue?

https://docs.quantum.ibm.com/api/qiskit/qiskit.circuit.library.RZZGate

What should happen?

Equation should render without an error

Any suggestions?

May just need to replace \newcommand with \renewcommand

@aeddins-ibm
Copy link
Contributor Author

aeddins-ibm commented Nov 30, 2023

This seems to affect other pages as well, such as https://docs.quantum.ibm.com/api/qiskit/qiskit.circuit.library.RXGate

Maybe worth searching the repo for all uses of \newcommand ?

@jakelishman
Copy link
Member

This sounds suspiciously like the KaTeX setup for the markdown components of the new Qiskit/documentation is defining the \th macro in its preamble, which we never used to do when we hosted the docs from this repo (hence the new errors). Let me move this issue over there for now, though it might be that we end up moving it back here and removing the \newcommand stuff.

(Personally I'm not convinced that it's a great idea to use a macro like this in simple definitions, but I know I write LaTeX differently to a lot of people.)

@jakelishman jakelishman transferred this issue from Qiskit/qiskit Nov 30, 2023
@jakelishman
Copy link
Member

jakelishman commented Nov 30, 2023

Oh, come to think of it, I think the Sphinx build used MathJax as its backend when it lived in Terra, but it's now clearly using KaTeX. KaTeX includes a \th command in its default preamble, so it looks like we're going to have to change this from the Terra side after all, so I'll transfer it back.

This is one place where the docs-build split is potentially going to cause nuisances, though - the MathJax parsing and rendering engine supports a totally different set of features to KaTeX (imo KaTeX is better).

We shouldn't really \renewcommand, because that'll be a bit fragile if we ever change the rendering engine. I think it'll be safest to remove the macro definitions and just inline the \frac\theta2 stuff. Personally I don't even think a displayed fraction is even the best typographic choice when it's up in an exponential superscript (so imo a bunch of the uses of \th macros should really be e^{-i \theta/2} ($e^{-i \theta/2}$) instead of e^{-i \frac\theta2} ($e^{-i\frac\theta2}$)).

@jakelishman jakelishman transferred this issue from Qiskit/documentation Nov 30, 2023
@jakelishman jakelishman added the documentation Something is not clear or an error documentation label Dec 1, 2023
@jakelishman jakelishman linked a pull request Dec 19, 2023 that will close this issue
@javabster javabster removed this from Docs Planning Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Something is not clear or an error documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants