jupyter-book / mystmd

Command line tools for working with MyST Markdown.
https://mystmd.org/guide
MIT License
191 stars 62 forks source link

Latex compilation breaks #807

Closed iarayad closed 9 months ago

iarayad commented 9 months ago

Description

I am using a myst template created by me to compile a pdf that includes latex and Python code.

Whenever I compile the document in versions v1.1.29 or newer, I get the error TypeError: Cannot read properties of undefined (reading 'map') . In older versions, the pdf compiles just fine.

Unfortunately, I have not been able to produce a minimal example. There is a .md file that I include which breaks things down, but I don't know what part exactly. For example, if I comment out the whole file at once, compilation works, but if I comment it out in "parts", then compilation may still break.

The file that makes compilation break contains math cells using :::{math}, ```{math}, :::{admonition}, ```{embed}, and a markdown list. The files that do not break compilation do not use :::{math}, ```{math}, or :::{admonition}, so the error may be related to these.

Here is an extended version of the log in case it helps:

...
📖 Built algorithms.ipynb in 285 ms.
📖 Built benchmark.md in 279 ms.
📖 Built conclusion.md in 278 ms.
📖 Built finding_effective_model.ipynb in 279 ms.
📖 Built implementation.md in 272 ms.
📖 Built scipost-template/python_style.tex in 259 ms.
📖 Built scipost-template/README.md in 258 ms.
📖 Built scipost-template/template.tex in 257 ms.
TypeError: Cannot read properties of undefined (reading 'map')

It seems to be an uncaught Javascript error.

Proposed solution

I don't know.

Additional notes

The code used to reproduce the error can be found here by running myst build paper.md --pdf. The merge request jobs can be found here. I am sorry that I cannot provide a shorter failing example.

welcome[bot] commented 9 months ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
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! :tada:

akhmerov commented 9 months ago

For completeness, here's a reproduction script (non-minimal), and assumes that myst 1.1.34 is installed:

git clone ssh://git@gitlab.kwant-project.org:443/qt/pymablock.git --branch paper --depth 1
cd pymablock/paper
myst build paper.md

Expected: export/paper.pdf is created What actually happens: no output, uncaught JS error in terminal.

Extra observations:

rowanc1 commented 9 months ago

Thank you for the report! Have been able to reproduce the bug locally, but haven't figured it out quite yet. @fwkoch can you take a look at this?!

fwkoch commented 9 months ago

This was a problem with how myst was parsing references with implicit labels, e.g. {eq}`unitarity` - I fixed it up here: https://github.com/executablebooks/mystmd/pull/808

I'll plan to publish a new release today with this fix.

fwkoch commented 9 months ago

Ok - this is released with v1.1.36 - hopefully that works well for you.

Let us know if you still run into problems or have any other questions with your MyST template!

iarayad commented 9 months ago

awesome, thank you!!