如何在iPython Notebook(Jupyter)幻灯片中增加页面宽度

Val*_*tas 4 reveal.js jupyter-notebook nbconvert

在创建的ipython笔记本(jupyter)幻灯片中

ipython nbconvert presentation.ipynb --to slides --post serve
Run Code Online (Sandbox Code Playgroud)

图像质量差,因为它们似乎缩小到了页面宽度。如何增加页面宽度/在演示文稿中显示更大的图像?

我在这里找到了部分答案但这需要手动执行“ --postserve”部分,而我找不到相关文档。

Val*_*tas 6

经过长时间的搜索,我自己找到了答案:

  1. 从复制模板文件

    lib/python2.7/site-packages/nbconvert/templates/html/slides_reveal.tpl

    到笔记本的目录。

  2. 自定义它,例如在Reveal.initialize({ })添加中

    width: '80%',
    height: '100%',
    transition: 'concave',
    
    Run Code Online (Sandbox Code Playgroud)
  3. jupyter nbconvert presentation.ipynb --to slides --template slides_reveal.tpl --post serve
    
    Run Code Online (Sandbox Code Playgroud)

    要不就

    jupyter nbconvert presentation.ipynb --to slides --template slides_reveal.tpl
    
    Run Code Online (Sandbox Code Playgroud)

    然后presentation.slides.html直接在浏览器中打开。或者:

    python -m SimpleHTTPServer
    
    Run Code Online (Sandbox Code Playgroud)

    并浏览到

    http://127.0.0.1:8000/presentation.slides.html
    
    Run Code Online (Sandbox Code Playgroud)