Last active
April 16, 2017 13:34
-
-
Save hoogenm/67944125938b61323bf30cafbad7e5ea to your computer and use it in GitHub Desktop.
nbconvert to PDF, with smaller margins and smaller 8pt font (Linux)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script takes one parameter: ipynb source filename WITHOUT the .pynb extension | |
# Results in a specialized .pdf version, with smaller margins (wider page) and smaller font size (i.e. more text on a line) | |
# Tested with up-to-date jupyter/nbconvert version on April 16th, 2017 | |
jupyter nbconvert --to latex $1.ipynb | |
# -i for inplace substitution, -r for full regex | |
sed -r -i 's/documentclass\[11pt\]\{article\}/documentclass[8pt]{extarticle}/' $1.tex | |
sed -r -i 's/geometry\{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}/geometry{verbose,tmargin=0.5in,bmargin=0.5in,lmargin=0.2in,rmargin=0.2in}/' $1.tex | |
pdflatex $1 | |
rm $1.tex; rm $1.out; rm $1.aux; rm $1.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment