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

Qutip Latex matrix output #8

Open
phockett opened this issue Mar 24, 2023 · 2 comments
Open

Qutip Latex matrix output #8

phockett opened this issue Mar 24, 2023 · 2 comments

Comments

@phockett
Copy link
Owner

phockett commented Mar 24, 2023

Getting build errors for QuTip objects, specifically matrices.

! Missing } inserted.
<inserted text> 
                }
l.2540 ...& 1.000\\\end{matrix}\right)$\end{split}
                                                  
? 
! Missing { inserted.
<inserted text> 
                {
l.2540 ...& 1.000\\\end{matrix}\right)$\end{split}
                                                  
? 
! Missing $ inserted.
<inserted text> 
                $
l.2540 ...& 1.000\\\end{matrix}\right)$\end{split}
                                                  
? 
! Extra alignment tab has been changed to \cr.
<recently read> \endtemplate 
                             
l.2540 ...& 1.000\\\end{matrix}\right)$\end{split}

Seems like something similar to use of \protect in figure case (mcmtroffaes/sphinxcontrib-bibtex#276 (comment)) may be required here - something is presumably getting stripped incorrectly during preprocessing. May be to do with mixed nature of object, with text and matrix? In notebook this is clear, but in built output the label text is wrapped too?

Current example from .tex output:

\begin{sphinxVerbatimOutput}

\begin{sphinxuseclass}{cell_output}\begin{equation*}
\begin{split}Quantum object: dims = [[25], [25]], shape = (25, 25), type = oper, isherm = True $ \\ \left(\begin{matrix}1.0 & 0.0 & 0.0 & 0.0 & 0.707 & \cdots & 1.0 & 0.0 & 0.707 & 0.0 & 0.707\\0.0 & 1.000 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 1.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 1.000 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.707 & 0.0 & 0.0 & 0.0 & 1.000 & \cdots & 0.707 & 0.0 & 0.0 & 0.0 & 0.0\\\vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots & \vdots & \vdots & \vdots\\1.0 & 0.0 & 0.0 & 0.0 & 0.707 & \cdots & 1.0 & 0.0 & 0.707 & 0.0 & 0.707\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 1.000 & 0.0 & 1.000 & 0.0\\0.707 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.707 & 0.0 & 1.000 & 0.0 & 1.000\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 1.000 & 0.0 & 1.000 & 0.0\\0.707 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.707 & 0.0 & 1.000 & 0.0 & 1.000\\\end{matrix}\right)$\end{split}
\end{equation*}
\end{sphinxuseclass}\end{sphinxVerbatimOutput}
@phockett
Copy link
Owner Author

phockett commented Mar 24, 2023

For quick builds, add \nonstopmode to preamble (via _config.yml), but should be careful with this, and fix properly!

See https://tex.stackexchange.com/questions/140845/how-can-i-ignore-latex-error-while-compiling

@phockett
Copy link
Owner Author

phockett commented Apr 22, 2023

Builds with QuTip matrix output now failing completely after Docker container rebuild (v220423), but was OK in previous version (v130423) - not sure what has changed, but QuTip output produces runaway arg:

! Argument of \split has an extra }.
<inserted text>
                \par
l.2704 ...{array}\right)\end{equation*}\end{split}

Runaway argument?
\collect@body \gather@split Quantum object: dims = [[25], [25]], shap\ETC.
! Paragraph ended before \split was complete.
<to be read again>
                   \par
l.2704 ...{array}\right)\end{equation*}\end{split}

! Missing $ inserted.
<inserted text>
                $
l.2704 ...{array}\right)\end{equation*}\end{split}

! Missing } inserted.
<inserted text>
                }
l.2704 ...{array}\right)\end{equation*}\end{split}

! Missing \endgroup inserted.
<inserted text>
                \endgroup
l.2704 ...{array}\right)\end{equation*}\end{split}

! Missing \endgroup inserted.
<inserted text>
                \endgroup
l.2704 ...{array}\right)\end{equation*}\end{split}

...

(That makes 100 errors; please try again.)
Output written on QM3.pdf (55 pages).
Transcript written on QM3.log.

...

Maybe change in JupyterBook or Sphinx parsing of QuTip output? May need to modify/wrap this somehow... for now just omit it for PDF build testing.

This might be useful: qutip/qutip#2017

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

1 participant