I want to announce my graduation thesis on IPython Notebook

As the title says. As a person who usually uses Notebook as a simulation platform, I would like to end the story as much as possible. It's unbearable to hit the formulas quickly. Therefore, create a slide using live_reveal, which is an extension of IPython Notebook. I got the permission of the boss of the laboratory, so I would like to announce it with a doy face.

Please check each one for installation method and easy usage. There should be some in Qiita as well.

This time, we have summarized the solutions for the cases that you actually used and had to solve.

Problems that stand in the way

Making presentation materials is fairly quick. All you have to do is cut and paste what you have written so far, put it together, and throw it into the cell. However, this alone will naturally cause problems.

Small letters

This will probably be felt by everyone. Even though it is displayed beautifully on my browser, when I project it on a projector, various people point out that the characters are too small to see. If you zoom in using the browser function, the figure will also become larger this time, and it will not work.

This is relatively easy to solve.

Around line 14 of ~ / .ipython / nbextensions / livereveal / main.css

.reveal .slides {
  text-align: left;
  font-size: 190%; //160%
  //width: 100% !important; //960px, 1366px
}

Edit as follows. Ignore the width section. The font-size was changed from 160% to 190%. By doing this, you can change the font size to the same size as when you enlarged it to 125% on the browser, and you can keep the size of objects other than characters.

The figure is not displayed in the center

In normal Notebook mode, it is displayed neatly in the center without doing anything, but in slide mode it is left-aligned. You also need to be careful about setting the width of the image. The simple solution is

<div align="center">
<img src=download1.png width=70% />
Figure 1.What a graph</div>

How to do it like this. If you do this, it will be displayed in the center ... I would like to say, but in reality it will be slightly shifted to the right.

I was very annoyed by this. The reason for this is that the area for displaying the execution number of each cell (such as "In [3]:") is taken to the left. Therefore, it is necessary to erase this area. If you google a little

You will find information such as. The above example shows how to turn off the input cell and prompt area when making a slide with nbconvert. If I try this script as it is (without the <script> tag, of course) and write it in ~ / .ipython / nbextensions / main.js and reload it, the input cell and prompt area will certainly disappear. I will. However, this is a problem when editing or when you want to use it in other normal ways, so I would like to enable it only when displaying a slide show.

In IPython, a profile can be started by specifying a group of setting files, so you can see that one of them is to create a setting for slides like this one.

ipython profile create slide

If so, you can see that a new profile called "profile_slide" has been created under ~ / .ipython.

Therefore, edit the contents of ~ / .ipython / profile_slide / static / custom / custom.js as follows.

$([IPython.events]).on('app_initialized.NotebookApp', function(){

     require(['nbextensions/livereveal/main'],function(livereveal){
       // livereveal.parameters('theme', 'transition', 'fontsize', static_prefix);
       //   * theme can be: simple, sky, beige, serif, solarized
       //   (you will need aditional css for default, night, moon themes).
       //   * transition can be: linear, zoom, fade, none
       livereveal.parameters('simple', 'fade');
       console.log('Live reveal extension loaded correctly');
    // http://hannes-brt.github.io/blog/2013/08/11/ipython-slideshows-will-change-the-way-you-work/
    function hideElements(elements, start) {
        for(var i = 0, length = elements.length; i < length;i++) {
            if(i >= start) {
                elements[i].style.display = "none";
            }
        }
    }
    var input_elements = document.getElementsByClassName('input');
    hideElements(input_elements, 0);
    var prompt_elements = document.getElementsByClassName('prompt');
    hideElements(prompt_elements, 0);
     });

});

If you edit it this way and reload the page, you'll see that the input cells and prompt area are no longer visible, as we did when we tried it earlier.

Now you can finally center the title text ...

"Can't you erase the two buttons on the left?"

That's right, it's annoying.

The way to forcibly erase is to use $ ('.reveal') in the definition of buttonExitaround line 305 of~ / .ipython / nbextensions / livereveal / main.jswhere these are defined. You can comment out the line that says .after (help_button);with" // ". You can also comment out similar parts in the buttonExit that are defined after that to hide these buttons every time.

Also, if you want to display or not display depending on the profile, as in the previous example, in the profile's custom.js

    var buttonHelp_elements = document.getElementsByClassName('buttonHelp');
    hideElements(buttonHelp_elements, 0);
    var buttonExit_elements = document.getElementsByClassName('buttonExit');
    hideElements(buttonExit_elements, 0);

You can add it as something that is not displayed. This way you can hide these buttons in certain profiles (for production).

This may also be helpful.

pdf export doesn't work !!

As a known issue, converting slides to pdf doesn't work. In the video below, the developer answers the question why it happened.

If you select "pdf export" from "print" in Firefox, it will try to convert to pdf including the area below. In Chrome, it's not that bad, but when you import a diagram, it exports a disappointing pdf with a number of small diagrams packed in the position you want it to zoom in.

One possible solution to this problem is to slide it with nbconvert and then convert it to pdf in your browser. However, the author stumbled on this nbconvert relatively, so in the end I took a screenshot of everything and put it together in one pdf with convert (← also refer to “IPython Notebook slides” (Forcibly) how to convert to pdf "). The point to keep in mind at this time is to match your PC to the screen size of the projector that you will actually use in your presentation before taking a screenshot. If you don't do this, you'll end up with wide slides when you put them together in a pdf later, or mass-produce slides with too large margins. Record the commands and tools you actually used for later study.

The screenshot is an application called shutter on linux and I took a screenshot of the selection. Save this one by one in one directory, being careful that the one with the youngest slide number becomes the one with the smaller number in the file name. Once all the slides have been saved, in that directory

convert -page 1024x768 -gravity Center *.jpg out.pdf

And run. As a result, all jpg image files are arranged in numerical order at 1024px in width and 768px in height (← resolution of the projector in the laboratory), and an out.pdf aligned in the center is created. All of them are treated as images, so it's cute that the file size becomes large. It is also cute that the characters are slightly blurred. It shouldn't stand out if you print it out and make it smaller! However, I don't think this is a good idea for the slides that you prepare as spares. It may be better to create a spare pdf file from scratch using PowerPoint quietly. And when this happens, there is a whisper that PowerPoint was good from the beginning ...

Future tasks

The content of the thesis is not relevant here, so I will not write it, but it is important that you can easily recreate it when there is a change. Therefore, even if you take the same scree shot and convert it to pdf, it is better to use it if it can be automated. Whether or not there is such time is another matter. It's an extension that's still under development, so there are a lot of bugs, but as a person who loves this feature and uses Notebook, I'll continue to use it. I'll definitely make it popular! (* ´ω ` *)

Recommended Posts

I want to announce my graduation thesis on IPython Notebook
I want to use R functions easily with ipython notebook
Day 65 I installed matplotlib to draw graphs on my Jupyter notebook.
I want to blog with Jupyter Notebook
I want to use Linux on mac
I want to use IPython Qt Console
I want to develop Android apps on Android
I want to display an image on Jupyter Notebook using OpenCV (mac)
I want to format and check Python code to my liking on VS Code
I want to have recursion come to my mind
I want to make fits from my head
I want to do pyenv + pipenv on Windows
I want to log file I / O on Linux
Library for "I want to do that" of data science on Jupyter Notebook
I want to develop an Android application on Android (debugging)
I want to find a popular package on PyPi
I want to AWS Lambda with Python on Mac!
I want a Spotify sleep timer on my PC
I want to use OpenJDK 11 on Ubuntu Linux 18.04 LTS / 18.10
I want to restart CentOS 8 on time every day.
I want to do Wake On LAN fully automatically
[IPython] How to Share IPython Notebook
Displaying strings on IPython Notebook
How to use IPython Notebook
I want to solve Sudoku (Sudoku)
I want to disable interrupts on Raspberry Pi (≒ DI / EI)
I want to use a virtual environment with jupyter notebook!
Run IPython Notebook on Docker
I tried to launch ipython cluster to the minimum on AWS
I tried Python! ] Can I post to Kaggle on my iPad Pro?
I want to use shortcut translation like DeepL app on Linux
I want to know if you install Python on Mac ・ Iroha
Install Anaconda on Mac and upload Jupyter (IPython) notebook to Anaconda Cloud
I want to check the position of my face with OpenCV!
I want to understand systemd roughly
I want to scrape images to learn
I want to do ○○ with Pandas
I want to copy yolo annotations
I want to debug with Python
I installed Linux on my Mac
I want to get angry with my mom when my memory is tight
I want to tweet on Twitter with Python, but I'm addicted to it
If you want to use NumPy, Pandas, Matplotlib, IPython, SciPy on Windows
I want to use the Django Debug Toolbar in my Ajax application
I want to express my feelings with the lyrics of Mr. Children
I want to pin Spyder to the taskbar
I want to detect objects with OpenCV
I want to output to the console coolly
IPython Notebook is now rendered on GitHub!
I want to print in a comprehension
I want to scrape them all together.
I want to handle the rhyme part1
I want to handle the rhyme part3
I want to build a Python environment
I want to pip install with PythonAnywhere
I want to analyze logs with Python
I was addicted to Flask on dotCloud
I want to play with aws with python
I want to display the progress bar
I want to make an automation program!
I want to embed Matplotlib in PySimpleGUI