Skip to content

Commit

Permalink
Merge pull request #4 from t-makaro/wordwrap
Browse files Browse the repository at this point in the history
Wordwrap
  • Loading branch information
t-makaro authored May 17, 2018
2 parents 9799836 + 635b23d commit 89ad2a7
Show file tree
Hide file tree
Showing 8 changed files with 167 additions and 71 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This template is ready for anyone to use.
6. In/Out text colours updated to match Jupyter
7. Markdown paragraphs are no longer auto-indented in the pdf
8. Syntax highlighting improvements. (Bonus if using XeLaTeX)
9. Raw pyout text wrapping improvements.

Quick Comparison:
![comparison](example/comparison.png)
Expand Down Expand Up @@ -55,15 +56,12 @@ classicm.tplx **(Recommended)**| m for modified. Similar to classic.tplx, but in
jupyter.tplx | Deprecated. Simply redirects to classic.tplx and will be removed in the future
style_jupyter.tplx | DO NOT use this directly. Inherit from this template if you want to build your own.

## Issues (in common with default template)
1. raw pyout text, and code cells will not wrap text (at 87 characters the text will spill into the margin)

## Todo
- [ ] Create a "lab.tplx" to distinguish between slight differences in the styles of the Classic notebook and Jupyter lab. (Once Jupyter lab hits release) Font, color changes. (Easy)
- [x] Add an optional to the "style_*.tplx" templates to allow them to be inherited from any template without worrying about spacing. (Easy)
- [x] Create a dual of the template that has the in/put prompts above cells instead of on the left and increase margins in that template. (Easy)
- [ ] Let the ```--no-prompt``` nbconvert flag remove prompts. (Easy, but compatibility issues with older versions of nbconvert maybe?)
- [ ] Find a solution to text wrapping in verbatim environments with commandchars. (Very Hard)
- [x] Find a solution to text wrapping in verbatim environments with commandchars. (Very Hard)
- [x] Improve syntax highlighting. (Hard)
- [x] Fix page breaks. (Moderate)

Expand Down
220 changes: 156 additions & 64 deletions example/test.ipynb

Large diffs are not rendered by default.

Binary file modified example/test_classic_template.pdf
Binary file not shown.
Binary file modified example/test_classicm_template.pdf
Binary file not shown.
Binary file modified example/test_default_template.pdf
Binary file not shown.
4 changes: 3 additions & 1 deletion nb_pdf_template/templates/classicm.tplx
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@

((* block style_settings *))
\leftmarginsfalse
((* endblock style_settings *))
((* endblock style_settings *))

((* set charlim = 94 *))
6 changes: 5 additions & 1 deletion nb_pdf_template/templates/style_jupyter.tplx
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,14 @@
% Output
%===============================================================================

((*- if charlim is not defined -*))
((* set charlim = 86 *))
((*- endif -*))

((* block execute_result scoped *))
((*- for type in output.data | filter_data_type -*))
((*- if type in ['text/plain']*))
((( draw_cell(output.data['text/plain'] | escape_latex, cell, 'Out', 'outcolor') )))
((( draw_cell(output.data['text/plain'] | wrap_text(charlim) | escape_latex, cell, 'Out', 'outcolor') )))
((* else -*))
((( " " )))
((( draw_prompt(cell, 'Out', 'outcolor') )))((( super() )))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup

setup(name='nb_pdf_template',
version='1.1.2',
version='1.2.0',
description='LaTeX templates for jupyter notebook conversion to pdf',
url='https://github.com/t-makaro/nb_pdf_template',
author='Tyler Makaro',
Expand Down

0 comments on commit 89ad2a7

Please sign in to comment.