jupyter-book / mystmd

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

Lots of issues trying LaTeX #141

Closed drscotthawley closed 1 year ago

drscotthawley commented 1 year ago

Describe the bug

(EDIT: edited to show standard/reproducible JAES template, rather than my specific document.)

context Hi guys. Saw Steve's post about "Writing a Scientific Paper in MyST Markdown" and Rowan's seminar next week. Since I'm starting two new scientific papers, I decided to try MyST.

Followed the instructions https://curvenote.com/blog/how-to-use-latex-with-myst-markdown, ...downloaded a ZIP of my stuff from Overleaf, using the template files from the Journal of the Audio Engineering society.

Installed myst via npm, ran it in the directory where my .tex file is and....

expectation I expected to get a wonderful rendering of my scientific document.

bug But instead lots of errors occur .

/tmp/aes-template$ cp ~/Downloads/JAES_Latex_template.zip .
/tmp/aes-template$ unzip JAES_Latex_template.zip 
Archive:  JAES_Latex_template.zip
  inflating: jaes-sample1-bibtex.tex  
  inflating: jaes.bib                
  inflating: jaes.bst                
  inflating: jaes.cls                
  inflating: cuted.sty               
  inflating: readme.txt              
  inflating: jaes-sample2-bibitem.tex  
  inflating: jaes-guide.pdf          
  inflating: headshot2.jpg           
  inflating: headshot1.jpg           
  inflating: fig1_example.eps        
  inflating: fig2_example.eps        
  inflating: jaes-sample1-bibtex.pdf  
  inflating: jaes-sample2-bibitem.pdf  
/tmp/aes-template$ myst init
💾 Writing new project and site config file: myst.yml
/tmp/aes-template$ myst start
🐕 Fetching template metadata from https://api.myst.tools/templates/site/myst/book-theme
🌎 Cloning template from https://github.com/curvenote/book-theme.git
💾 Saved template to path _build/templates/site/myst/book-theme
⤵️  Installing web libraries (can take up to 60 s)
📦 Installed web libraries in 13 s
⛔️ jaes-sample1-bibtex.tex:21:1 Unhandled TEX conversion for node of "macro_markboth"
⚠️  jaes-sample1-bibtex.tex:21:15 Unknown character 
⚠️  jaes-sample1-bibtex.tex:21:19 Unknown character 
⛔️ jaes-sample1-bibtex.tex:28:1 Unhandled TEX conversion for node of "macro_authorgroup"
⚠️  jaes-sample1-bibtex.tex:29:19 Unknown character 
⚠️  jaes-sample1-bibtex.tex:29:23 Unknown character 
⛔️ jaes-sample1-bibtex.tex:30:1 Unhandled TEX conversion for node of "macro_role"
⛔️ jaes-sample1-bibtex.tex:32:1 Unhandled TEX conversion for node of "macro_role"
⛔️ jaes-sample1-bibtex.tex:33:35 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample1-bibtex.tex:33:40 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample1-bibtex.tex:33:45 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample1-bibtex.tex:33:50 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample1-bibtex.tex:33:55 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample1-bibtex.tex:33:60 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample1-bibtex.tex:33:65 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample1-bibtex.tex:33:70 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample1-bibtex.tex:33:75 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample1-bibtex.tex:33:80 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample1-bibtex.tex:33:85 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample1-bibtex.tex:39:1 Unhandled TEX conversion for node of "macro_abstract"
⛔️ jaes-sample1-bibtex.tex:125:1 Unhandled TEX conversion for node of "macro_tabcolsep"
⛔️ jaes-sample1-bibtex.tex:130:50 Unhandled TEX conversion for node of "macro_colrule"
⛔️ jaes-sample1-bibtex.tex:140:31 Unhandled TEX conversion for node of "macro_botrule"
⛔️ jaes-sample1-bibtex.tex:142:1 Unhandled TEX conversion for node of "env_tabnote"
⚠️  jaes-sample1-bibtex.tex:196:160 Unknown character 
⚠️  jaes-sample1-bibtex.tex:196:166 Unknown character 
⛔️ jaes-sample1-bibtex.tex:263:2 Unhandled TEX conversion for node of "macro_biography"
⚠️  jaes-sample1-bibtex.tex:263:23 Unknown character 
⚠️  jaes-sample1-bibtex.tex:263:27 Unknown character 
⚠️  jaes-sample1-bibtex.tex:263:61 Unknown character 
⚠️  jaes-sample1-bibtex.tex:263:65 Unknown character 
⚠️  jaes-sample1-bibtex.tex:263:771 Unknown character 
⚠️  jaes-sample1-bibtex.tex:263:775 Unknown character 
⛔️ jaes-sample1-bibtex.tex:265:2 Unhandled TEX conversion for node of "macro_biography"
⛔️ jaes-sample2-bibitem.tex:21:1 Unhandled TEX conversion for node of "macro_markboth"
⚠️  jaes-sample2-bibitem.tex:21:15 Unknown character 
⚠️  jaes-sample2-bibitem.tex:21:19 Unknown character 
⛔️ jaes-sample2-bibitem.tex:28:1 Unhandled TEX conversion for node of "macro_authorgroup"
⚠️  jaes-sample2-bibitem.tex:29:19 Unknown character 
⚠️  jaes-sample2-bibitem.tex:29:23 Unknown character 
⛔️ jaes-sample2-bibitem.tex:30:1 Unhandled TEX conversion for node of "macro_role"
⛔️ jaes-sample2-bibitem.tex:32:1 Unhandled TEX conversion for node of "macro_role"
⛔️ jaes-sample2-bibitem.tex:33:35 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample2-bibitem.tex:33:40 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample2-bibitem.tex:33:45 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample2-bibitem.tex:33:50 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample2-bibitem.tex:33:55 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample2-bibitem.tex:33:60 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample2-bibitem.tex:33:65 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample2-bibitem.tex:33:70 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample2-bibitem.tex:33:75 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample2-bibitem.tex:33:80 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample2-bibitem.tex:33:85 Unhandled TEX conversion for node of "macro_quad"
⛔️ jaes-sample2-bibitem.tex:39:1 Unhandled TEX conversion for node of "macro_abstract"
⛔️ jaes-sample2-bibitem.tex:125:1 Unhandled TEX conversion for node of "macro_tabcolsep"
⛔️ jaes-sample2-bibitem.tex:130:50 Unhandled TEX conversion for node of "macro_colrule"
⛔️ jaes-sample2-bibitem.tex:140:31 Unhandled TEX conversion for node of "macro_botrule"
⛔️ jaes-sample2-bibitem.tex:142:1 Unhandled TEX conversion for node of "env_tabnote"
⚠️  jaes-sample2-bibitem.tex:196:160 Unknown character 
⚠️  jaes-sample2-bibitem.tex:196:166 Unknown character 
⛔️ jaes-sample2-bibitem.tex:205:1 Unhandled TEX conversion for node of "env_thebibliography"
⛔️ jaes-sample2-bibitem.tex:263:2 Unhandled TEX conversion for node of "macro_biography"
⚠️  jaes-sample2-bibitem.tex:263:23 Unknown character 
⚠️  jaes-sample2-bibitem.tex:263:27 Unknown character 
⚠️  jaes-sample2-bibitem.tex:263:61 Unknown character 
⚠️  jaes-sample2-bibitem.tex:263:65 Unknown character 
⚠️  jaes-sample2-bibitem.tex:263:771 Unknown character 
⚠️  jaes-sample2-bibitem.tex:263:775 Unknown character 
⛔️ jaes-sample2-bibitem.tex:265:2 Unhandled TEX conversion for node of "macro_biography"
⛔️ jaes-sample1-bibtex.tex:101:1 Unsupported image extension ".eps" may not correctly render.
⛔️ jaes-sample1-bibtex.tex:114:1 Unsupported image extension ".eps" may not correctly render.
⛔️ jaes-sample2-bibitem.tex:101:1 Unsupported image extension ".eps" may not correctly render.
⛔️ jaes-sample2-bibitem.tex:114:1 Unsupported image extension ".eps" may not correctly render.
📖 Built jaes-sample1-bibtex.tex in 179 ms.
📖 Built jaes-sample2-bibitem.tex in 163 ms.
📚 Built 2 pages for my-myst-site in 368 ms.

    ✨✨✨  Starting Curvenote Book Theme  ✨✨✨

⚡️ Compiled in 442ms.
The path "myst-transforms" is imported in ../theme-base/packages/myst-to-react/src/myst.tsx but "myst-transforms" was not found in your node_modules. Did you forget to install it?

The path "myst-to-tex" is imported in ../theme-base/packages/myst-to-react/src/myst.tsx but "myst-to-tex" was not found in your node_modules. Did you forget to install it?

The path "myst-to-jats" is imported in ../theme-base/packages/myst-to-react/src/myst.tsx but "myst-to-jats" was not found in your node_modules. Did you forget to install it?

🔌 Server started on port 3000!  🥳 🎉

    👉  http://localhost:3000  👈

💌 GET  / 302 - - 435.368 ms
💌 GET  /my-myst-site 500 - - 39.363 ms

The web server shows this image: Screen Shot 2023-01-19 at 12 02 12 PM

problem This is a problem for _people doing any kind of scientific publishing_ because we will need to be producing results in accordance with an approved template from a publisher or conference___. If we have to write two different versions of our document, one for true publishing, and one in Markdown just for... IDK I'm not trying to make a website, I'm trying to write a journal article, ... then user adoption of MyST will be limited. (i.e. if I should just write the LaTeX version if MyST can't help me, then...I have no reason to use MyST)

Clarification

I did not try to write a document stariting in MyST-markdown, and then try to import the LaTeX templates for the purposes of rendering a PDF. Such was my original expectation for authoring a scientific paper using MyST markdown.

But then when I read the page about using LaTeX and MyST I got the impression that I was just supposed to read in my .tex files. Rowan will probably clarify this at the seminar, and perhaps this whole Issue is just resulting from a big misunderstanding on my part!

Reproduce the bug

  1. Make sure you have a version of Latex installed, e.g.
    $ which pdflatex
    /Library/TeX/texbin/pdflatex
  2. Install myst
  3. Download the JAES Author Latex Template
  4. Create a new directory
  5. cd into the new directory created
  6. copy the JAES template into that directory
  7. unzip the JAES zip file
  8. run myst init
  9. run myst start

List your environment

$ jupyter-book --version
-bash: jupyter-book: command not found

There was no mention of jupyter-book when I followed the MyST installation instructions. If we need jupyter-book, please update the installation instructions.

welcome[bot] commented 1 year 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:

drscotthawley commented 1 year ago

I've heavily edited this Issue from its initial version. The initial version showed my specific document, and issues such as myst not finding any of the references defined in my BibTex file.

To make things more reproducible for developers, I've removed much of that and replaced it with what you get if you just try the template documents provided by the journal.

One problem with this approach is that JAES zip file includes multiple (at least two) .tex files, which could be confusing for the parser. For my initial report using my document, there was only one .tex file in the directory.

If you want to see my original version, then presumably GitHub provides a way for you to view the edit-history of this Issue.

drscotthawley commented 1 year ago

I went back and installed jupyter-book. It didn't make any difference to errors reported. But here's the version info:

$ jupyter-book --version
Jupyter Book      : 0.13.1
External ToC      : 0.2.4
MyST-Parser       : 0.15.2
MyST-NB           : 0.13.2
Sphinx Book Theme : 0.3.3
Jupyter-Cache     : 0.4.3
NbClient          : 0.5.13
drscotthawley commented 1 year ago

Note the error message ""myst-transforms" was not found in your node_modules. Did you forget to install it?. All I did was follow the installation instructions, i.e.

$ npm install -g myst-cli
rowanc1 commented 1 year ago

Thanks for the feedback, and taking the time to detail and make this reproducible!! There is a ton more to do on the latex parsing side to make this fully usable in all situations, the hard error in the rendering is something that we should fix, and at least you should have seen a partially rendered document that would have been pretty good I think.

As you suspected the currently supported workflow is in the other direction (MyST + Template --> TeX --> PDF):

write a document starting in MyST-markdown, and then use a LaTeX templates

We are madly writing docs and onboard guides!! I have already fixed up those two spurious "was not found in your node_modules" which are a problem with a library upgrade we did and they are not real errors. We also need to do a better job on the differences between JupyterBook and myst.tools, they use the same syntax but completely different engines.

This is really helpful feedback as I start to create the intro slides for next Wednesday. Hope to see you there. :)

drscotthawley commented 1 year ago

MyST + Template --> TeX --> PDF will serve my needs very well.
Looking forward to Wednesday!

drscotthawley commented 1 year ago

Feel free to close this issue if you like.

rowanc1 commented 1 year ago

I will fix some of the easy things in that template and then close this off. Looking to make progress on the LaTeX parsing side as well, so that at the very least the initial experience doesn't end in an error screen!!

drscotthawley commented 1 year ago

I'm going to close this issue, as much of it was based on misunderstanding.