Hash: SHA512

by Javantea
Nov 23, 2019

This is an unorganized but researched look into the purpose and sense of whitespace -- in programming, prose, poetry, and potatoes.

The most critical uses of whitespace I can think of in my past are: Python syntax, $\LaTeX\ $, PDF, HTML, novels, and E. E. Cumming's r-p-o-p-h-e-s-s-a-g-r. I shall dissect them and we can discuss in the comments about what their purpose is.


Python's syntax is one of the few languages in the world that enforces whitespace. In order to make all Python code more readable than the worst examples of whitespace abuse, the author simply made it so that line ends indicate statement ends unless you use an extender structure or delimiter (not just backslash, but also parenthesis, square brackets, curly brackets, and triple quotes). Furthermore, nesting requires indentation which can get unwieldy if you nest say 8 layers deep. If you use 4 spaces for your indentation, 8 layers deep is 32 characters. Since linting software commonly limits you to 80 characters, it leaves only 48 characters for code. To show what 48 characters look like, here is an example from BikeIM that is 45 which is also 8 levels deep:

  red = summary & gpg3.gpg.constants.sigsum.RED

Yes, this line can be rewritten into two shorter lines like:

mask = gpg3.gpg.constants.sigsum.RED
red = summary & mask

All of this and a programmer's sense of dignity translates into a reasonable readability for most python code written with good intent. In fact, debugging often requires lots of whitespace, which makes good python look good. But of course once debugged, you can obfuscate Python just like any other language. In fact, some features of Python make it far worse than C or other typically obfuscatable languages. That said, most people only ever obfuscate Python when they are trying to harm their audience, not by simple ignorance.

Users of Python cite whitespace as their main complaint. They want a language with all of Python's features except for whitespace. For my own code, (see BikeIM if you're curious) I implement a standard where I create a comment at the bottom of every code block which describes what is closing. For example at the end of an if block, I write #end if. This is styled similarly to Basic which is really unfortunate because how awful Basic is, but I can't imagine using a different end tag for Python. Curly brace isn't descriptive and doesn't help for debugging. #end doesn't describe what is closing either. #∞ or #🔥 would be funny if only it could effectively communicate. But this doesn't solve the problem that most of Python's detractors have -- they want to be able to have JavaScript or C++ syntax but with Python's codebase. But they can't.

Screenshot of BikeIM mail1glade2.py in a typical view in the author's development environment

Screenshot of BikeIM mail1glade2.py in a typical view in the author's development environment

$\LaTeX\ $

Let's take a look at $\LaTeX\ $ for a minute. This strange game helped me understand what I was missing in $\LaTeX\ $ for these years. It's essentially a language that makes brief most of the things one needs to describe typesetting math and other things.

Normal distribution:

$\Phi(x)=\frac{1}{\sqrt{2 \pi \sigma}}e^{-\frac{(x-\mu)^2}{2\sigma^2}}$

\Phi(x)=\frac{1}{\sqrt{2 \pi \sigma}}e^{-\frac{(x-\mu)^2}{2\sigma^2}}

As you can see there is something to be said for the ability to do fractions, fractions inside a power, square root, and so forth that cannot be done without a piece of math layout software like MathJax or $\LaTeX\ $. So why does $\LaTeX\ $ layout by default like the below image?

Image of the first page of the PDF of this very document

Image of the first page of the PDF of this very document

And further why do simple $\LaTeX\ $ documents turn out like this?

Image of a sample $\LaTeX\ $ document

Image of a sample $\LaTeX\ $ document

The answer to this question that nearly everyone has is readability. Apparently if you fit your website to the width of the browser and the user uses a maximized browser (why would someone do such a thing?), it becomes rather difficult to read. So much so in fact that Firefox created a Reader View and put it in the location bar so that you can read webpages easier. What does reader view do? It changes the style, font, font size, and page width so that it looks like a it was printed by a publisher on a piece of paper. Amazing. But say you don't trust Firefox or $\LaTeX\ $ to decide your margins, who might you trust instead? Well I know some people who trust Microsoft. What does Microsoft do with their margins? 1 inch or 1.25 inches depending on which version you use and which margin you're talking about. This provides about 6.5 inches (165 mm) of width on letter, 146.6 mm (5.77 in) on A4. How much does $\LaTeX\ $ give? About 4.8 inches (122 mm) on letter and the same 4.8 inches (122 mm) on A4.

Whitespace between paragraphs is also substantial, but paragraphs are decided by the author not the software.


Now we can talk about PDF. Didn't we just? No, actually PDF is not the same as $\LaTeX\ $. Most PDFs I consume were not created with $\LaTeX\ $ but with some other piece of software. For example, the way I end up printing is creating a PDF. So if I want to print something from GIMP, it goes through a PDF printer. If I want to print a webpage, it becomes a PDF. Luckily that only happens rarely. Printing my Twitter profile as shown below gave this unsightly error which shows the ugly truth of whitespace problems: they can waste paper and time.

Printed twitter profile of Javantea

Printed twitter profile of Javantea

twitter page 2

twitter page 2

Why is this? Well, the developers of Twitter are likely to blame. But the explanation will probably need to go into the HTML section because it was not intended to be printed.

Other PDF converters have interesting whitespace bugs, but in general it does its job. Where it falls down is mostly in the non-whitespace department. It turns out that the format is complex enough that it makes it difficult to write a correct parser and renderer. For something that touts as "same everywhere" that is a bad flaw but again not related to whitespace.


The margin and padding between elements in HTML is an important issue. The defaults are simply not as functional as they should be, which leaves everyone doing it by eye. My eyes in 2005 were very different from my eyes in 2016, which explains why my websites written in 2005 (Javantea in Japan and Javantea's Fate) look quite a bit different from my websites written in 2016 (everything else). Both have fixed width which should be disasterous for mobile viewing, but both look fine in mobile Chrome. What do the defaults look like? It depends on your browser, but here is SM5 Assembler Firefox on Linux with 1920x1080 monitor:

SM5 Assembler

SM5 Assembler

Of course that lacks all the other style elements, so it's not a clear comparison, but you can see that the whitespace is missing on the left and the right. The rest of the document is fine by my standards, no worse or better than the other.

Bloggers have far more freedom than professional authors with how they use their whitespace. And they use it sometimes.


I think the last novel I read was Ready Player One, though I have probably read a few books of Gunnm since then. The author Ernest Cline uses whitespace to make the book more readable of course putting a -·-·-·- with padding above and below between separate scenes. Each quote gets its own paragraph like in most prose. The chat logs, leaderboard changes, and poems get plenty of space around them, but that is pretty standard fare for novels. I can pick up 10 novels off my bookshelf and find the same style, no more, no less. So are novels the peak of whitespace? Well, let's just agree that they have a problem that they are solving -- efficiency of paper use vs readability. Guess which one wins? Obviously efficiency of paper use.

No author would chop off a chapter of their book to save trees, right? Just like no reader would give away books they treasure to make it so that others don't have to buy more dead tree copies.

But publishers are taking a new direction -- selling PDFs which never become paper. With this new format, you can put as much whitespace as you want, never worrying that it might wreck the planet's ecosystem. So what do novels I have recently purchased as PDF do?

The Best of Bova uses whitespace to space their sections, but actually takes a more Word-style approach using 6 inches (152 mm) of the 8.5 inch page width. Ben Bova's paragraphs are tightly packed because there are few scene changes in his short story about a man flying a rocket to save a world ruined by nuclear war. Less conventional writers, such as fan fiction authors and amateurs have a lot more freedom to innovate whitespace in this new medium.

E. E. Cumming's r-p-o-p-h-e-s-s-a-g-r

I read E. E. Cumming's r-p-o-p-h-e-s-s-a-g-r in community college around 1997 or 1998. I didn't mind it at all, I recall, thinking that it was creative, short, and befitting of an insect. If we think about the length of a poem and its purpose, we should reflect that short poems like this are intended to be valuable, but not too deep. I compare it to Edna St. Vincent Millay's excellent memorizable poem and I think it fares well. It seems to describe not the shape, not the sound, not the smell, or the action, but the special jump that the insect has. How does it do that? It makes the poem very difficult to read, using jumble, obfuscation, and whitespace.


Unfortunately I don't have much time left, so the conclusion is just that we have the opportunity to use more whitespace as we print less and less stuff, so let's embrace it. If you really think someone is going to print your Special Report on Global Warming of 1.5 °C, then by all means pack it like a novel. (By the way IPCC's summary is dense and uses whitespace like a policy document.) But if your audience is going to want to read it, let's add a few more pixels.

Javantea out.




Comments: 0

Leave a reply »

  • Leave a Reply
    Your gravatar
    Your Name