GithubHelp home page GithubHelp logo

mszell / nb_pdf_template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from t-makaro/nb_pdf_template

0.0 1.0 0.0 1.97 MB

A more accurate representation of jupyter notebooks when converting to pdfs.

License: MIT License

Python 6.14% PowerShell 0.57% Jupyter Notebook 93.29%

nb_pdf_template's Introduction

classic.tplx

A more accurate representation of jupyter notebooks when converting to pdfs. This template was designed to make converted jupyter notebooks look (almost) identical to the actual notebook. If something doesn't exist in the original notebook then it doesn't belong in the conversion.

Note for nbconvert 5.5.0

As of nbconvert 5.5.0, the majority of these improvements have been merged into nbconvert's default template. Version 3.x of this package will continue to support nbconvert 5.5.0 and lower, whereas in the future version 4.x will only support nbconvert 5.5.0 and newer. Versions 3.x, and 4.x will overlap support for nbconvert version 5.5.0.

Note for nbconvert 6.0.0

nbconvert 6.0.0 is not yet released, but it will be changing the conversion template in a backward incompatible manner. A version 5.x of this repository will be made to support nbconvert >=6.0.0

Improvements

  1. \maketitle is removed (If you want a title then add a markdown cell to the top of your notebook).
  2. Sections are no longer numbered automatically (notebooks don't number sections so the pdf shouldn't).
  3. Markdown paragraphs are no longer auto-indented in the pdf.
  4. Syntax highlighting improvements. (Bonus if using XeLaTeX)
  5. BOXES! are drawn around code cells. (This change was merged into nbconvert 5.5.0)
  6. In/Out counts will move to the left as the execution count increases instead of pushing code to the right (only numbers are displayed by default to save page width). (This change was merged into nbconvert 5.5.0)
  7. $\LaTeX$ and $\Tex$ in markdown cells will no longer cause conversion to fail. (This change was merged into nbconvert 5.4.0)
  8. "\LaTeX" and "\TeX" are no longer converted into a logo on conversion to pdf unless they are in math mode. (This and the above point replicate the functionality of these commands in notebook markdown).
  9. In/Out prompt colours updated to match Jupyter. (This change was merged into nbconvert 5.5.0)
  10. Output text wrapping improvements. (This change was merged into nbconvert 5.5.0)
  11. Code cell text wrapping. (This change was merged into nbconvert 5.5.0)

Quick Comparison: comparison for a closer look see the example directory.

Installation

pip install nb_pdf_template
python -m nb_pdf_template.install

Updating

pip install -U nb_pdf_template
python -m nb_pdf_template.install

Manual Install:

Drop all of the "*.tplx" files into the folder containing the other LaTeX nbconvert templates. If using anaconda, it should be something like:

*/Anaconda3/Lib/site-packages/nbconvert/templates/latex

Use

From the command line:

jupyter nbconvert --to pdf filename.ipynb --template classic

Adding:

c.LatexExporter.template_file = 'classic'

to the jupyter_nbconvert_config.py file will let you drop the "--template classic", and to the jupyter_notebook_config.py file will let you use "download as pdf" from within the Jupyter notebook.

Replace classic with your template of choice.

Templates

This package offers the following templates:

Template Use
classic.tplx (Recommended) For most accurate recreation of the default Jupyter Notebook style.
classicm.tplx m for modified. Similar to classic.tplx, but in/out prompts are above cells instead of in the margin. Bonus left margins are smaller so code cells are wider.

Tips (Good for any template)

Moved to the wiki

nb_pdf_template's People

Contributors

t-makaro avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.