imposition_booklet_problem

I have been writing short stories (or possibly novellas), somewhere between 8,000 and 12,000 words each. They're fun, unserious stories about a mall cop in a shopping mall that has gone through some quantum event that splices it with a bunch of other universes. Check out the first one.

I thought it would be fun to 'self-publish' i.e. print out the paper and put it together myself. Now there are some options, and the first few ideas didn't feel so great. Printing out on full 8.5x11" paper would be flimsy and feel like a homework packet or something. Going landscape and folding in half would be a better option, but I decided to take it one step further and fold it again.

I decided to print out 4-column, 2-row double-sided pages, cut them into quadrants, stack them up, staple in the middle, and fold.

So first, here's what the printout looks like:

image

You can see the size of the booklets will be small and compact - the satisfaction of having a thicker book even though in order to get there you have to shrink the book by like 75%.

Here's how I envisioned the stacking and folding working (and you can see the shitty prototype in action as well):

image

Sounds like a plan! Well...

As you can see in those pictures, I did something weird. Look at the page numbers. Think about this: In what order do you print the pages? The first leaf should have the LAST page and then the FIRST page, because when you fold your stack together, they will wrap around the outside. Then, on the opposite side of the paper that you print, you should have page 2 (which should be on the reverse side of 1), and then your second to last page. Next to that one, you need to have the second to last page and the third page, and so on.

Here's how I started sketching that out:

image

In this case, N is the max number of pages (have to make sure you have a number of pages evenly divisible by 8).

I drew out the first 'paper' above. When folding along the short edge, the 2 will end up on the backside of 1 and 4 on the backside of 3, etc.

From here, I just had to stare at it and try to figure out a pattern with which to build some dumb algorithm around. Here's the fun part that I came up with:

    x = 1
    n = i already set this as my max pages
    a = []
    while x < n - x:
        for k in [0, 2, 4, 6]:
            a.append(n - k - x + 1)
            a.append(x + k)
        for k in [3, 1, 7, 5]:
            a.append(x + k)
            a.append(n - k - x + 1)
        x += 8
    return a

I have some python to take my text file and convert it into a bunch of 4.25" x 2.75" pages. Then I set up a new empty array a which will be my re-ordered pages(earlier I established n as the max number of pages).

x starts at page 1 and I increment it in the loop. I'll explain the while condition later.

There are two for loops in here - one for the frontside page and one for the backside page. I discovered that the patterns for each were a little different.

Loop 1: alternate appending the max n that decrements by 2 each time and the starting pages that increment by 2 each time. I only do this 4 times because there are 4 foldable leaves on each paper.

Loop 2: Do the same thing, but the increment and decrement are in a scrambled order because they are on the backside and flipped along the short side. I'm not sure if I have a good mathematical explanation for this, it is just an observed pattern that I had to abide by. It works, though.

Once I complete both loops, I am incrementing the x by 8 (because I'm done with the 8 pages on this paper and am moving to the next). The general motion is that I'm starting at 1 and N, then 2 and N-2 then 3 and N-3 etc. Eventually, they will collide. As long as they haven't collided, keep going. while x < n - x is the part that keeps it going until they collide. Whether you have 16 or 800 pages, it will keep filling up pages until they 'collide' like this.


The one caveat here is that there's definitely a page limit to this - I don't think you'd easily be able to fold more than like 7 papers over like that and get it to lay flat. I'll start printing these out soon and build my collection of stories into little physical chunky baby copies. Gotta make cover art and stuff as well.

There are some things to tweak here - pdfs print with margins around the outside, so lining things up is difficult and I need to trim stuff etc.

Anyway: This works! And I learned that this is called imposition. Seems like it's a pretty well-solved problem (possibly ancient?? I mean, books have been published for a long time), which I'm not surprised about, but it was still a fun challenge. I don't know if my specific 8-page imposition algorithm exists or is easily findable, so if you want to do this, there is the algorithm for you. Either way, you can read up on book imposition and bookprinting because it is very interesting.