[PYTHON] Jupyter Notebook memo

environment

Shortcut

Press esc to command mode

Enter: Edit cell L: Line number display. Press again to hide M: Markdown mode Y: Code mode C: Copy of cell V: Paste the copied cell K: Move to the upper cell J: Move to cell below A: Select cell above B: Select cell below DD: Delete cell Space: Scroll down Shift + Space: Scroll up When in cell edit mode

Shift + Enter: Execute cell, move to next cell ctrl + Enter: cell execution only

TeX generation

If you use Japanese, you cannot use Export as PDF on the menu bar.

Because the documentclass of \ documentclass [a4paper, dvipdfmx] {jsarticle} is generated in English.

Use the template file (jsarticle.tplx).

  1. Put jsarticle.tplx in the place where the environment variable of tex passes (such as where platex.exe is).
  2. Type the command jupyter-nbconvert --to latex% 1 --template jsarticle.tplx, which automatically converts to jsarticle, into the terminal. % 1 is the file name and% 2 is the file base name.
  3. Export the image as png. Images are saved under the directory under the file base name under the work directory as the folder name. ʻExtractbb% 2_files /*.png`

jsarticle.tplx


% Default to the notebook output style
((* if not cell_style is defined *))
    ((* set cell_style = 'style_ipython.tplx' *))
((* endif *))

% Inherit from the specified cell style.
((* extends cell_style *))

%===============================================================================
% Latex Article
%===============================================================================

((* block docclass *))
\documentclass[a4paper,dvipdfmx]{jsarticle}
((* endblock docclass *))

So far, I wrote it in sublime text-build format and executed it with build (ctrl + b). (Therefore, the file name may be% 1 or an argument.)

Jupyter2PDF.sublime-build


{
    "cmd":["Jupyter2PDF.bat","$file","$file_base_name"],
}

Jupyter2PDF.bat


@echo off
jupyter-nbconvert --to latex %1 --template jsarticle.tplx
extractbb %2_files/*.png

Below here, you have to retype the file name, not% 1 and% 2 as arguments.

  1. Run platex on the command line. I'm screaming that the platex% 2.tex.sty file isn't there, but keep pressing Enter to continue.
  2. Run dvipdfmx on the command line. dvipdfmx% 2.dvi

The pdf has been created so far.

  1. If you want to go to the tex source when you click pdf, start SumatraPDF with reuse-instance. SumatraPDF -reuse-instance% 2.pdf

LaTeX error list

! LaTeX Error: File `ucs.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name:
body...
! LaTeX Error: Unknown option `mathletters' for package `ucs'.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.54     \usepackage
                    [utf8x]{inputenc} % Allow utf-8 characters in the tex do...

?
! LaTeX Error: File `utf8x.def' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: def)

Enter file name:
! Missing $ inserted.
<inserted text>
                $
l.1047     \(\newpage
                     \)
?

Below are about 20 errors related to \ newpage.

I want to create a PDF with just Build, but it stops at platex. Can't I because I don't have ucs.sty? Please let me know.

Paste image

<img src ='image path'>

\ includegraphics {image path}

I tried various things such as [clip, width = \ columnwidth], [clip, width = 4cm], [clip], [width = 4cm], but it seems that the image cannot be pasted when [] is attached.

Recommended Posts

Jupyter Notebook memo
Jupyter Notebook memo
Introducing Jupyter Notebook
Python memo Anaconda x Jupyter Notebook
Powerful Jupyter Notebook
[MEMO] [Development environment construction] Jupyter Notebook
Jupyter notebook password
[Jupyter Notebook memo] Display kanji with matplotlib
Get started Jupyter Notebook
3 Jupyter notebook (Python) tricks
[Cloud103] # 3 Jupyter Notebook again
Shortcut key for Jupyter notebook
Introduced Jupyter Notebook to CentOS 7
Using Graphviz with Jupyter Notebook
Display HTML in Jupyter notebook
Use pip with Jupyter Notebook
Multiprocessing error in Jupyter Notebook
Try using Jupyter Notebook dynamically
[Super Basics] About jupyter Notebook
High charts on Jupyter notebook
View PDF on Jupyter Notebook
Use Cython with Jupyter Notebook
homebrew, pyenv, anaconda, Jupyter Notebook
Play with Jupyter Notebook (IPython Notebook)
[Complete version] Jupyter Notebook shortcut
Run Jupyter Notebook on windows
How to use Jupyter Notebook
python3.8 venv environment jupyter notebook
[Memo] Display Jupyter Notebook on PC in monospaced font (Mac)
Allow external connections with jupyter notebook
Formatting with autopep8 on Jupyter notebook
Snippet settings for python jupyter notebook
Jupyter Notebook essential for software development
Post a Jupyter Notebook as a blog post
Visualize decision trees with jupyter notebook
Make a sound with Jupyter notebook
Jupyter Notebook Magic Command Personal Summary
Paste Jupyter Notebook document into Wordpress
Generate Jupyter notebook ".ipynb" in Python
Simply view the Jupyter notebook file
Run azure ML on jupyter notebook
Jupyter Notebook: 4 banal tips and tricks
Use markdown with jupyter notebook (with shortcut)
Add more kernels with Jupyter Notebook
View graphs inline in Jupyter Notebook
Convenient analysis with Pandas + Jupyter notebook
Launch jupyter notebook (+ take security measures)
Easy to use Jupyter notebook (Python3.5)
Try running Jupyter Notebook on Mac
Somehow I tried using jupyter notebook
Try starting Jupyter Notebook ~ Esper training
I tried VS Code's Jupyter notebook
gzip memo
Raspberry-pi memo
Memory leak in Python Jupyter Lab (Notebook)?
Markdown to get Jupyter notebook results to Qiita
Jupyter Notebook extension, nbextensions settings for myself
HackerRank memo
Python memo
Jupyter begins
Use apache Spark with jupyter notebook (IPython notebook)