Home -> Projects -> How to Exit the Rat Race


How to Exit the Rat Race

When students go to career fairs, everyone around them tells them out to enter the rat race. I think this provides for an unbalanced experience, so at MIT’s upcoming 2020 xFair I intend to provide students with instructions on how to exit the rat race. It’s much safer to start something if you know how and when to stop!

Raw materials

pdf single double sided page distributed to students

ipython notebook used to generate the pdf

PDF Rendering

This could not possibly be an interesting topic, right? It’s not. But me bitching about PDF export tooling is entertaining, so here we go.

There are so many ways to turn an ipython notebook into a PDF. For starters, you can “print” the notebook webpage to a PDF. And you get a PDF out! Success? No. The PDF you get out looks terrible! A quarter of the page is taken up by the left margin, with no information content beyond telling you how many notebook cells you’ve read so far. Yuck. And furthermore the lines wrap differently than in the web view. Where code lines used to scroll, and you might have expected them to truncate, they instead wrap. I suppose I can see why that might be desirable, but I’m frustrated because I wanted some of those lines to truncate. I intentionally allowed boring content to go off screen because I didn’t want anyone to suffer through reading it. But now it’s back, and it’s keeping my PDF from fitting on a single page. Yuck! Turn it off! But that’s not the end of it – in addition to bad text wrapping there’s bad text non-wrapping! This is unsurprising at least, since it matches the interactive display, but some developer took the time to figure out how to make the contents of a pre tag wrap by character instead of wrapping by word or not wrapping at all. So some of my text needlessly has words split in half. So ugly.

But fortunately there are other options. One of them must be better, right? Not really. For starters, you can go to a print preview and then print. Honestly I don’t know if this produces a different result. I’d bet that it shouldn’t, but I’m not ready to bet that it doesn’t. Either way, not what I need.

You can export to latex from the command line, and there are flags for passing in custom latex templates. And some people on the internet have templates with macros to make pre text wrap in a sane way. But those custom templates have lots of hard coded sizes for things (such that you can’t reasonable change anything’s size and expect it to work). And it still doesn’t let me clip long code lines if I want to. Maybe good for future use cases, but not for this one.

I finally settled on Save As, manually editing css+html as needed to reformat, and print to PDF. This process is exactly as hideous as it sounds. But I designed this notebook to be printed, so it’s actually kind of nice to generate a PDF starting with the formatting I wrote it with and not some arbitrary transformation thereof, and for all that this method is not ok, it does do that. So what modifications are required?

Edit style.min.css:

Edit codemirror.css:

Edit the html file, because codemirror uses too much inline css:

Finally open it in a browser and print to PDF. For some reason I got a blank page at the end, but that’s hardly something to complain about after everything else I’ve done – it’s easy to remove. I’ve finally got a PDF!

The Event

TODO. It hasn’t happened yet. Or I forgot to update this site. Or I decided not to incriminate myself by saying I’ve done something instead of just admitting to having plans ;)

But the basic idea is:

  1. Get into xFair, even though I’m not allowed in. Standard methods of entry apply (just walk in, apply basic social engineering to walk in, or crawl through the air ducts)
  2. Advertise my ‘company’ to students

If step 1 falls through, then advertise outside the career fair, as close to the entrance as possible. Wish me luck!