## A new way to read (and print) double-sided paper

Continuing with the theme of reading stacks of paper (see my previous two posts, I have had a marvellous idea (at least I think so; I will let you judge for yourself). Let me take you through my thought process, starting with triple-sided paper and then returning to the real world. If you think this triple-sided paper business is nonsense, stay with me for just a minute!

# A simple algorithm for reading triple-sided paper

In a comment on my previous post, blasepascal2014 gave a fairly simple algorithm for reading all the sides of a stack of triple-sided paper, though it requires making some marks on the paper, and requires you to do something different when you encountered a mark again. It does not, of course, go through the sides in order, but that’s fine. In reflecting on that solution, I realized that you can do something similar but even simpler. Here is my algorithm:

1. Read one side. When you are done, flip the sheet, and then move it to the bottom of the stack.
2. Repeat.

That’s the entire algorithm! You just do the same operation every time. If you start with a stack like this: $p_1 p_2 \dots p_n$ then after doing this once you have $p_2 \dots p_n p_1^+$, after doing it twice you have $p_3 \dots p_n p_1^+ p_2^+$, and so on. After $n$ rounds, $p_1$ is back on top but all the sheets are flipped, and you have read the front sides of all the sheets. After another $n$ rounds, you have read all the flip sides, and the sheets are now all anti-flipped (that is, double-flipped); after yet another $n$ rounds you have read all the sides and the stack is back in its original state (ready for someone else to read it, I suppose).

# Wait a minute…

1. This same algorithm works for normal double-sided paper. By doing the same action repeatedly, you read both sides of every sheet—but not in order of course. You would read all the odd pages, followed by all the even pages.
2. But wait a minute—who says what order the sides have to be in!? In theory you could print the pages of a document in whatever order you want! So why not just print them in the order that they are visited by this algorithm?

Concretely, here is what I mean. Normally, we print things double-sided like this:

This is natural for a number of reasons: the page numbers progress as you progress physically through the paper; it’s the way you would print pages for a book; and so on. But this is not a book, it is a stack of loose paper! Here’s my alternative proposal, shown for a stack of 4 sheets with eight pages:

When you are finished reading page 1, you flip the sheet over (so now page 5 is on the front) and put it on the bottom of the stack. Now the stack looks like this:

Notice how page 5 has taken its place behind page 4. After you read page 2, you do the same operation a second time, resulting in

Doing the operation 8 times in a row, you read all the pages in order, and the stack ends up restored to its original position. Sweet!

What if there are an odd number of pages? That’s fine, just leave the last side blank, like this:

# Getting practical

This is not just silly theoretical nonsense, I really think this is a superior way to print and read double-sided documents.

1. Printing and reading things this way completely removes the need for any rules, mnemonic devices, etc. to remember where you are and what to do next. No post-its, no marks, nothing. When you’re done reading a page, just flip it and move it to the back, period.
2. There is another benefit to this method: notice that in a document of length $n$, if you pick any set of up to $n/2$ consecutive pages, they will all be on different sheets of paper! This is really great when you are reading something complex where you need to refer to several pages at once—as long as the pages are not too far apart in the document, you can look at them all at once. This is particularly nice in the common situation of referring to something on the previous page. With the “standard” printing method, half the time this will be on the other side of the same sheet, and you can’t look at both pages at once. (The other half the time, of course, it is on another sheet—but it’s confusing to remember which is which!) With my printing method, the previous page will always be on the previous sheet—so you can look at it side-by-side with the current page.

There are downsides, though. One is that it’s hard to jump ahead in the document by more than one page at a time. With the traditional printing method, you can jump ahead just by moving a whole bunch of pages to the bottom of the stack all at once. With my method, you have to actually move the pages one at a time.

So how does one actually print a document like this? I’m glad you asked! I know of two ways, one low-tech and one high-tech.

The low-tech way is this: first, print the first half (rounded up) of the document single-sided. Then take the resulting stack of paper and put it back in the printer, with page 1 facing up and the top towards you. Then print the second half of the document single-sided. It just so happens that this works out nicely with most printers, so that you don’t need to reverse all the sheets before putting them back in the printer. This method is a little involved, but not too hard, and you can do it using tools you already have.

The high-tech way is to reorder the pages of your PDF before printing. Using the `pdftk` tool, I wrote a little unix script which does this: it takes a PDF as input, and outputs a new PDF with the pages rearranged in the right order. (For lack of a better term the script is called `spliff`. I’m open to other suggestions.) Then all you have to do is print the resulting PDF double-sided. I actually tried it and it works great. It felt really magical holding a phyiscal stack of 6 sheets of paper, doing the same operation 12 times in a row, and progressing through all 12 pages in order!

Feel free to use my script (besides `pdftk` it requires `zsh`), or write your own! Also, if you use this method of printing/reading double-sided, I’d love to hear about your experience, ideas for improvement, or alternatives!

Associate Professor of Computer Science at Hendrix College. Functional programmer, mathematician, teacher, pianist, follower of Jesus.
This entry was posted in pattern, solutions and tagged , , , , , . Bookmark the permalink.

### 11 Responses to A new way to read (and print) double-sided paper

1. Logan says:

This algorithm reminds me of a Möbius strip — you go all the way through just to end up right back where you started.

• Brent says:

Hmm, nice observation, it is very much like a Möbius strip! The front is connected to the back with a half twist.

I really like the way your printing method would let one spread out a stretch of contiguous pages, this has always frustrated me! Could be helpful in many use cases. However, I see a few limitations. You must know the length of the document in advance, and cannot add new pages to a document once printed. Also, you could not partition a printed document up into distinct sections, such that you could give someone just the first half and another person the second half.

• Brent says:

Good points! Those are indeed limitations. The particular use case I have in mind is to print academic papers to read, in which case the length of the document is already fixed, and it’s just for my own personal use so there’s no need to split it up.

3. Evelyn says:

I have enjoyed this series far more than I feel like is reasonable. It just makes me smile. My spouse notes that to print a paper using a one-sided printer (which is what we have at home), you have to reverse the pages before you put the paper in for the second run. He suggests that an improvement would be to print page n on the back of page 1, n-1 on the back of 2, etc, and change the reading algorithm to: read page, flip over, put on the top of a stack to the side. When you run out of paper, the second half of the paper will be sitting in the correct order in a stack. This does require two stacks of paper, but he thinks that is not as big an imposition as having to reverse the pages before you print the second half.

• Brent says:

Really? I was under the impression that you did *not* have to reverse the pages before putting them in a one-sided printer. But it might depend on the printer. Let’s try it and report back!

• Evelyn says:

OK, my printer prints the side of the paper that is face-up on the input tray and puts it face-down on the output tray, so if we put it in without reversing the papers, we’d either get the 2nd sides superimposed on the 1st or page n on the back of page n-1, depending on whether we flip the stack or not. Any printer where your output ends up in the same order as your input will require page reversing, right?
If your printer prints the front side of the input paper and spits it out printed-side up on the tray, you won’t have to reverse the pages, you can just flip the stack upside down and send it through and get page n/2+1 on the back of page 1. But I think most printers wouldn’t give you output like this because if you were just printing a document one-sided, you’d have to reverse the pages before you read it, which would be annoying.

• Brent says:

Yes, of course all printers will print a single-sided document so that you don’t have to reverse the pages before reading it. The question is whether it will print on the face-up side of the paper in the tray (like yours, apparently), or on the face-down side. If it prints on the face-down side then you can just take the output stack and put it back in the tray with the printed side up, and it will print page n/2+1 on the face-down side of the top sheet, that is, the back of page 1, and so on. I tested a printer I have here and it does indeed print on the face-down side of paper in the tray.

• Evelyn says:

Huh, somehow it seems unnatural to me for a printer to spit the page out in the same orientation as it went in. My picture of how printers work involves the paper going in and being turned around some sort of roller and put back out upside-down. Now I’m curious about whether most single-sided printers do it one way or the other. Sadly, my searches are just getting me pages about how to manually print double-sided. Regardless, we have printing and reading algorithms that work for either kind of printer!

• Brent says:

I guess it depends on how complex/fancy the printer is. I think simpler printers tend to work the way you describe. More complex printers (typically the kind that can also print double-sided) actually pull paper out the *front* of the tray and around a roller, then print on the top of the sheet (which was face-down in the tray), and then around another roller and out the top, with the printed side face-down again.