I'm working in a jupyter notebook, and I'm working on a markdown file. I'm using a mac with Sierra 10.12.16. I'd like to convert the markdown to a pdf and I'm wondering what the easiest way to do that would be. I've read a lot of posts about installing things like pandoc or using packages in atom. I'm wondering if there isn't a simple way with the jupyter notebook to convert the markdown file to pdf. It really seems like there should be, but I'm having trouble finding it.
I figured it out. You can just paste the markdown code in to a cell in a jupyter notebook and change the dropdown menu below "Widgets" in the notebook from "code" to "markdown". Then hit shift enter and it renders the markdown. You can then download the notebook as pdf.
Related
I love Jupyter notebook. One of reasons is it has table of contents which is very convenient to search and organize big codes. However Jupyter notebook or Jupyter lab is very slow for a big notebook file. So I am thinking to convert notebook back to py file.
I am wondering if there is any IDE where I can add markdown to the script and then can add table of contents to py file like notebook does?
Thanks
Is there plugin for PyCharm that can run code from markdown file? I would like to write some text, then make some calculations using python code and add result to my text. Then continue with my text.
PyCharm professional version supports Jupyter notebooks, using the "editor only" view mode gets pretty close to what you want.
I am trying to open a notebook file that I was working on 3 days ago, however, I get the following error Unreadable Notebook: C:\file path UnicodeDecodeError('utf-8) for Jupyter Notebook. How can I get this file to work again.
I've reinstalled Anaconda and tried opening the file on different computers but it still doesn't work
I just had this problem and this is what worked for me.
Open the problem notebook in a text editor and copy all the text. Open a new file in your text editor and paste in the text, then save the file. In my case the text editor did not have the option to save as a Jupyter Notebook, so I saved as .txt.
Move the file into your Jupyter area. Rename it so the ending is .ipynb and not .txt. Then open the file as a notebook.
As I read through the now-working notebook I saw some comments had what looked like Chinese characters in them. I don't know exactly what happened there to make those appear but if you used Ctrl+/ to comment like I do then it's possible that is where the issue is in your notebook. So if my janky method of converting file types does not work for you and you still really want to save your notebook enough to manually dig through all the markup and text then you can try checking your comments in the file to see if there are odd characters in there.
I am running jupyter notebook on Mac.
This command converts a notebook file that does not contain Chinese character to pdf successfully.
jupyter nbconvert test.ipynb --to pdf
When dealing with a notebook file that contains Chinese characters, all the Chinese characters are missing in the generated pdf file.
Is there a way to fix this?
I am willing to contribute some code to jupyter notebook project for this, I just don't know where to start.
I ran across this question while researching a similar problem on Windows. Here's my solution.
(1) I converted the ipynb file to latex using NBConvert via command line
jupyter nbconvert --to latex "your_path_to_doc.ipynb"
(2) I installed the xecjk package using MikTeX
(3) I opened the .tex file from (1) in TeXworks
(4) I inserted
\usepackage[slantfont, boldfont]{xeCJK}
\setCJKmainfont{Microsoft YaHei}
into to the document preamble.
(5) I compiled the document to pdf using XeLaTeX+MakeIndex+BibTeX in TeXworks.
You're on MacOS, so your font will differ, as will (I imagine) how you install xecjk.
Hope this helps.
jupyter uses nbconvert to convert notebook with template to PDF files with process like:
notebook -(nbconvert)-> latex -(XeLatex)-> PDF
The template that the nbconvert used do not support Chinese, causing the problem. By adding package like xeCJK and its font in the template, the problem solved.
You can find the base template under ...share/jupyter/nbconvert/templates/latex and named base.tex.j2.
Add the following snippet in the template file to make it support Chinese (MacOS):
\usepackage{xeCJK}
\setCJKmainfont{STSong}
If you want to contribute, you can read the nbconvert document here and check the open source code on Github:Jupyter/nbconvert
This code in a Markdown cell:
<img src="images/grad_summary.png" style="width:600px;height:300px;">
works fine in Jupyter browser, but in VS Code with Python extension it does not render at all, only a blank image box is shown. Both are running in the same conda environment.
This alternate method in a Markdown cell:
![title](images/grad_summary.png)
also works fine in Jupyter browser but does not render in VS Code with Python ext.
I searched stack overflow, there was something close but it did not address this issue. Any insights appreciated.
Doing what gnodab said worked for me! Install the "Markdown all in one" extension.