Writing Mathematics in Pencil, and Why Analogue is Not Dead

It’s an old joke that mathematicians need just a pencil, paper, and a bin, while philosophers are even more frugal because they don’t need the bin. Yet nowadays more and more of the time of mathematicians, indeed all scientists, is spent at the computer. Whereas twenty years ago I would handwrite a draft of a paper before typing it in, I now do almost all the drafting directly in \LaTeX at the keyboard.

But in response to computers dominating our lives, and in a move away from the (mythical?) paperless office, people are increasingly reverting to analogue tools, encouraged by the pleasure of handling stationery and, for those of us who were brought up in an analogue world, nostalgia.

This is a good time to employ retro tools in a digital world because we can now buy online an increasingly wide variety of stationery from all around the world.

What might you gain by writing mathematics with a pencil and paper as opposed to typing it at the computer? Sitting at a desk with a pencil in hand you are free from the distractions of the windows on your computer screen. The analogue process, with its delays of turning a page, sharpening the pencil, and rubbing out mistakes, has the benefit of slowing you down and thereby promoting your flow of thought and creativity. And the touch of the paper and the smell of cedar as you sharpen the pencil refresh the senses.

161209-2045-01-5702-cropped.jpg
CW Pencil Enterprise, New York, “purveyor of superior graphite, etc.”

Donald Knuth has another reason for writing with a pencil, as explained in this 2008 interview.

I love keyboards, but my manuscripts are always handwritten. The reason is that I type faster than I think. There’s a synchronization problem. I can think of ideas at about the rate I can write them down with a pencil. But with typing I’m going faster, so I have to sync, and my thoughts have to start up and stop again in a way that involves more of my brain.

Yet more reasons for using pencils are given in the video Why Use Pencils? by T. J. Cosgrove. One of T. J.’s points is that the graphite produced by a pencil does not fade, unlike inks.

It is also worth noting that in some recently published research psychologists found evidence that students who take notes with pencil (or pen) and paper outperform those who take notes on a laptop.

So there are some good reasons for writing with a pencil. How should you choose one from among the many different types available?

I don’t know of a good source of advice on pencils for mathematicians (maybe I will write something in due course), but this blog post on pencils for musicians is largely applicable if you replace “music” by “mathematics”. The post is by Caitlin Elgin, from the wonderful Manhattan pencil shop pictured in the photo above, which I took when I visited it last year.

PCAM Authors Speaking About Their Work at SAMSI

The Statistical and Applied Mathematical Sciences Institute (SAMSI) has just run a Workshop on the Interface of Statistics and Optimization. Among the speakers were four authors of articles in The Princeton Companion to Applied Mathematics (PCAM).

In an earlier post I provided links to videos of PCAM authors giving talks related to the topics of their PCAM articles. To add to those, here are the four PCAM author talks from the SAMSI workshop.

I have also included the talk by Margaret Wright, because it provides insight into a number of important topics covered in PCAM in a very lucid way.

  • John Burns, Parameter Identification for Dynamical Systems with Structured Uncertainty (author of PCAM article Optimal Sensor Location in the Control of Energy-Efficient Buildings)

  • Jack Dongarra, The Road to Exascale and Legacy Software for Dense Linear Algebra (author of PCAM article High-Performance Computing)

  • Yonina Eldar, Phase Retrieval and Analog to Digital Compression (author of PCAM article Compressed Sensing)

  • Stephen Wright, Randomness in Coordinate Descent (author of PCAM article Continuous Optimization (Nonlinear and Linear Programming)

  • Margaret Wright, Old, New, Borrowed, and Blue in the Marriage of Statistics and Optimization

Preparing CMYK Figures for Book Printing

All printing is done in CMYK, the color space based on the four colors cyan, magenta, yellow, and black. Figures that we generate in MATLAB and other systems are invariably saved in RGB format (red, green, blue). When we send a paper for publication we submit RGB figures and they are transformed to CMYK somewhere in the production process, usually without us realizing that it has been done.

If you are one of those people who writes books and prefers to generate the final PDF yourself then you will need to convert any color figures to CMYK. The generation and use of CMYK files is something of a dark art. Here I report what I found out about it when producing the third edition (2017) of MATLAB Guide, co-authored with Des Higham. This is the first edition of the book to use color.

CMYK produces a different range of colors than RGB. Since it is a subtractive color space, designed for inks, it cannot produce some of the brilliant colors that RGB can, especially in the blues. In other words, some RGB colors are out of gamut in CMYK. (Less importantly, the converse is true: some CMYK colors cannot be produced in RGB.) This is something we are used to, but usually do not notice. Whenever we print a document on a laser printer we view a CMYK representation of the colors. In many cases, a figure will look very similar in print and on screen, but there are plenty of exceptions.

The following image shows an RGB image on the left, the result of converting that image to CMYK and then back to RGB in the middle, and a scan of a laser printer’s reproduction of the RGB image on the right. circle-rgb-cmyk-scan.jpg The differences between the RGB version and the other two versions may be shocking! Fortunately, when the CMYK version is viewed on a printed page in isolation from the RGB version (necessarily displayed on a monitor) it does not look so bad. [Of course, if you are reading a printed version of this post then the first two images will look essentially the same.]

After some experimentation, I settled on the following procedure, which I describe for a PDF workflow. For a PostScript workflow, PDF files need to be replaced by EPS files.

  • Print the whole document from an RGB file.
  • Find figures that look very different in print than on screen and select from those any where the difference is not acceptable. In most cases an unacceptable difference will be one where contrast between colors, or saturation of colors, has been reduced.
  • Edit the selected figures in Photoshop, or some other image manipulation package that can save in CMYK form, in order to produce a better looking CMYK file. In Photoshop, Image-Mode-CMYK Color converts an image to CMYK form, but before using this command you should set the correct CMYK working space under Edit-Color Settings (see the Color Space section below). You can edit the RGB image (making use of View-Proof Color to see how the image will look in CMYK, and View-Gamut Warning to see colors that will be out of gamut in CMYK) and then convert to CMYK, or you can convert to CMYK and then edit the file. Save the CMYK image as a PDF file.
  • Generate the PDF file of the book using the edited CMYK figures and the RGB forms of all the other figures, that is, those that did not need special treatment.
  • Load the PDF file into Adobe Acrobat Pro and issue the command
    Tools - Print Production - Convert Colors
    

    This converts all objects in the file to CMYK.

Of the well over 100 figures in MATLAB Guide, only two needed special treatment.

However, there was one problem with this procedure. A handful of images are screen dumps that show a MATLAB window, and these are necessarily low resolution, at 72dpi. When converted to CMYK in Adobe Acrobat these images degraded badly. The solution was to resample the images to 150dpi in Photoshop via Image-Image Size and save to PDF; conversion in Acrobat then worked fine. (Such resampling is probably good practice anyway.)

This is not quite the full story. Here are some more gory details, which are worth reading if you are actually producing a book.

Color Spaces

There is no unique CMYK or RGB color space: these spaces are device dependent. RGB spaces can have different white points and CMYK spaces are designed for particular combinations of paper and ink. Adobe Acrobat Pro offers “U.S. Web Coated (SWOP) v2”, “Uncoated FOGRA29 (ISO 12647-2:2004)” and many other inscrutably named CMYK profiles. So “convert to CMYK” is an ill-defined instruction unless the precise profile is specified. The conversion settings I used are shown in this screen dump of the dialog box, and were provided by the company who printed the book. Your settings might need to be different. acrobat-cymk-conversion.jpg There are a couple of things to note. First, Adobe Acrobat does not remember the settings in the dialog box, so they need to be re-entered every time. Second, since “Embed profile” is not selected with the settings shown, there is no way to tell which profile has been used once the conversion has been done.

Does it really matter what CMYK profile you use? Yes, if you want the best possible results. Consider the following figure. circle-rgb_cmtk-2convs.jpg On the left is the result of converting the original RGB image to “U.S. Web Coated (SWOP) v2” and on the right is the result of converting to “Photoshop 5 default CMYK” (and converting back to RGB in both cases, the latter conversion producing no visual difference in Photoshop). There is a significant difference between the two conversions in every color except white! In principle, both conversions will produce the same result when printed with the target ink and paper, but if you choose the profile without knowing the target you have little idea what the printed result will be.

Photography Books

An important assumption in the process described above is that the accuracy of the color reproduction is not vital. For photography books this assumption clearly does not hold and conversion to CMYK enters a new and frightening realm where images might need to be individually fine-tuned. Indeed high quality photography books typically undergo one or more proof stages using actual galley proofs from the ultimate printing device, sometimes with the author present at the printing press.

Generating CMYK Files in MATLAB

Most of the figures in MATLAB Guide are (naturally) produced in MATLAB. Figures saved with the print function are by default in RGB mode. CMYK is supported for EPS and PS files only, using the ‘-cmyk’ option. This is not very useful if you are using a PDF workflow, as I do.

Instead of using the print function I experimented with export_fig, which is available on MathWorks File Exchange and can save in CMYK format to PDF, EPS, or TIFF files. export_fig creates a PDF file via an EPS file using Ghostscript.

This sounds straightforward, but I found that many of the PDF files generated by export_fig were not fully in CMYK Mode. A PDF file can contain objects in different color spaces and I had files where a color plot was in CMYK but the colorbar was in RGB! The question arises of how one can check whether a given PDF file has any RGB objects. Unfortunately, there seems to be no simple way to do so in Adobe Acrobat Pro. What one can do is invoke

Tools - Print Production - Preflight - PDF analysis - 
List objects using ICCbased CMYK - Analyze

then open up

Overview - color spaces

(I am using Adobe Acrobat Pro XI, 11.0.18; usage could differ in other versions). This should contain “DeviceCMYK color space”, but if it contains “DeviceRGB color space” or “DeviceGray color space” then RGB or Grayscale objects are present. If the latter terms appear in a multi-page PDF file, double clicking on the corresponding icon should take you to the last such object.

You can also open up

Overview - Images

to get a list of pages and object types on those pages. Double clicking on a page icon takes you to that page.