[IPython-User] Some thoughts on typography; how do they fit with current progress?

Adam Hughes hughesadam87@gmail....
Mon Feb 10 12:02:56 CST 2014

If this turns out to be a double post, SORRY!

I've been reading as much as I can about typography in the notebooks and
really am having fun playing with the .css files.  The info I can find is
scattered between blogs, github etc, so my perspective is probably limited.
 Therefore, I wanted to pass some ideas to the list and see if they are
congruent with the current state of development in ipython, and if I can

Before I get to that, I noticed that the notebook viewer does not render
the background image of a notebook that, on my local machine, appears fine.
 It also does not center the notebook within the viewing frame.  Is this
expected?  IE, that some disparity between rendering in the nbviewer and on
a local machine is unavoidable?

Attached is a screen shot of a really zaney notebook that I made on my
local machine.  And here is a link to the online version (it should be
identical except for a few changes in the text).  Obviously my
sophisticated background (source is a url) has disappeared.


In any case, the richness of the CSS really inspired me.  I really liked
Brian Granger's "load_style()" function, and shamelessly bundled some of
this behavior in an active project of ours.  (Tried to give credit and cite
original sources in the source code)  We put a few .css files along with
the bundle with the intention of having users changing the notebook style
in one line.  Basically as follows:

from pyparty.bundled import loadstyle

This was fairly easy to implement, and I am considering making this into a
small side project (maybe called nbstyle) that could be used by a lot of
users until an official alternative is released that either incorporates
it, or supplants the need for it entirely.  The reason that I'm so keen on
typography  is because we need style sheets for major publication styles
like IEEE and APS.  If these existed, a user could literally type one line:


And the notebook would format in place.  I think journals would eat it up
if supplemental notebooks were rendered in similar typeset to the
publication.  I think that pushing forward on this front is really
important; appearance is everything unfortunately.

Therefore, if you guys think that this would help compliment the notebook,
and that there's not already an official PR in to address this, I'd like to
put a small side package together that would do the following:

1. Accumulate as many .css files that we can collect and bake them directly
in so that they can be loaded into loadstyle() by name (while still
supporting url and local .css file loads as Brian has already designed it)
2. Start seriously trying to reproduce styles from important publication
3. Potentially provide a "builder" tool that publicizes the most salient
CSS features in a pythonic interface.  For example maybe the builder API
might look like this:

from nbstyles import Builder

b = Builder(startwith='APS.css')
b.set_background( 'red' )
b.set_logo('our_lab.png', alight='top right')
b.code_text = 'Helvetica'

That would allow a user to take a style, modify certain features of it and
save the changes without ever mucking with .css.

What are your impressions of this?  Again, I'd like to make this quickly as
a bandaid until the features are treated in earnest by the core developers.

Also, I don't have any javascript skills, but realize that a certain level
of customiziation beyond the CSS is available through editing the .js file.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20140210/525b510f/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: doge.png
Type: image/png
Size: 1089452 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/ipython-user/attachments/20140210/525b510f/attachment-0001.png 

More information about the IPython-User mailing list