添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm attempting to convert a Jupyter Notebook to a pdf, but it throws this error at me:

nbconvert.exporters.pdf.LatexFailed: PDF creating failed, captured latex output:
Failed to run "xelatex notebook.tex -quiet" command:
notebook.tex:411: Missing $ inserted
notebook.tex:411: Extra }, or forgotten
notebook.tex:412: Missing $ inserted

It works if I take this LaTex out of my notebook:

$ y=\frac{1}{2}x+3 $

I'm not familiar with LaTex that much, but it displays correctly in the .ipynb file, so I'm assuming there is nothing wrong with this syntax. Is this an issue with nbconvert? Thank you!

After playing around a bit, I have solved the problem. It is an issue with LaTeX syntax. I wish jupyter notebooks make it to where the cell would show an error, but it doesn't. The correct syntax is the same as above except no spaces between the dollar signs. After changing that line of code to:

$y=\frac{1}{2}x+3$

nbconvert successfully made the PDF.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.