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

Upgrade MyST-NB to get glue:math directive to work #97

Open
martinlarsalbert opened this issue May 10, 2022 · 8 comments
Open

Upgrade MyST-NB to get glue:math directive to work #97

martinlarsalbert opened this issue May 10, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@martinlarsalbert
Copy link

Describe the bug

context

The glue:math directive is not working in JupyterBook as seen in the documentation:
https://jupyterbook.org/en/stable/content/executable/output-insert.html#the-glue-math-directive
...where the equation has no number ( ).

This seems to be a bug that has been corrected in later versions of MyST-NB:
https://myst-nb.readthedocs.io/en/latest/render/glue.html#the-glue-math-directive

But JupyterBook is not compatible with this newer version of MyST-NB as it seems.
The newer MyST-NB works for html generation but not with latex builder.

expectation

bug

$ jupyter-book build mybook --builder latex

File "E:\dev\wPCC_pipeline\venv\lib\site-packages\sphinx_jupyterbook_latex\transforms.py", line 433, in apply
from myst_nb.nodes import CellInputNode, CellOutputNode
ModuleNotFoundError: No module named 'myst_nb.nodes'

problem
Apparantly "myst_nb.nodes" does no longer exist.

I removed the failing part as a dirty fix that works for me now, as I don't have any code blocks.
But I suspect that is not a good solution for all.

   class CodeBlockTransforms(SphinxPostTransform):
    """Handling any post transforms needed for code cells."""

    default_priority = 999

    def apply(self):
        if isinstance(self.env.app.builder, builders.latex.LaTeXBuilder):
            """Wrapping myst_nb code cell nodes with nodes of this extension."""
            pass
            #from myst_nb.nodes import CellInputNode, CellOutputNode
            #
            #for node in self.document.traverse(CellOutputNode):
            #    celloutput = CellOutput()
            #    celloutput.append(node.deepcopy())
            #    node.replace_self(celloutput)
            #
            #for node in self.document.traverse(CellInputNode):
            #    cellinput = CellInput()
            #    cellinput.append(node.deepcopy())
            #    node.replace_self(cellinput)

Reproduce the bug

  1. upgrade MyST-NB
  2. jupyter-book build mybook --builder latex

List your environment

Jupyter Book : 0.12.3
External ToC : 0.2.3
MyST-Parser : 0.17.2
MyST-NB : 0.15.0
Sphinx Book Theme : 0.1.10
Jupyter-Cache : 0.5.0
NbClient : 0.5.9

@martinlarsalbert martinlarsalbert added the bug Something isn't working label May 10, 2022
@welcome
Copy link

welcome bot commented May 10, 2022

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@mmcky
Copy link
Member

mmcky commented May 11, 2022

thanks for reporting this issue @martinlarsalbert

@mmcky
Copy link
Member

mmcky commented May 11, 2022

@AakashGfude this will be a blocker for upgrading jupyter-book to support the latest myst-nb so we should try and prioritise this one.

@AakashGfude
Copy link
Member

sure thing @mmcky will take this up as a priority.

@mforbes
Copy link

mforbes commented Oct 2, 2022

Can the requirements be updated to pin myst-nb to an appropriate version so that pip install brings in the correct version if installed with sphinx-jupyterbook-latex? Currently the warning comes when running Sphinx, requiring people to pin the versions themselves.

@AakashGfude
Copy link
Member

@mforbes which myst-nb version is currently throwing warning? I was assuming sphinx-jupyterbook-latex works with all versions between >=0.13 to <=0.16, as pinned https://github.com/executablebooks/sphinx-jupyterbook-latex/blob/master/setup.cfg#L34

@mforbes
Copy link

mforbes commented Oct 2, 2022

Ah. I did not notice that myst was an extra, pip install "sphinx-jupyterbook-latex[myst]" works. Please change my request to simply update the docs to mention the myst extra.

@AakashGfude
Copy link
Member

AakashGfude commented Oct 3, 2022

Thank you @mforbes for bringing this up. I have created an issue #110 and will create a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants