How to build a better lung

During the most recent meeting of Geology 601 (Crises in Earth History), we discussed how oxygen has influenced the evolution of different species. I was surprised to learn that bird lungs operate quite differently from ours. Instead of inhaling and then reversing flow when exhaling (“tidal” breathing), birds have a clever lung design that permits them to circulate air in a single direction continuously. The page reached by clicking on the image at right explains it nicely (I love the diagram). One key advantage of this lung design is the much higher oxygen utilization you get, which is handy if you’re a bird and may need to operate at higher elevations. Presumably we’re stuck with our low-efficiency in-out lungs because we lacked evolutionary pressure to improve upon them. :)

How to embed fonts in a PDF file

This is an issue that comes up every now and then, for example when you create a PDF file that’s designed for actual printing (like in a book). The fonts used by PDF (or PS) files can be either embedded or simply “linked” to fonts already installed on the system. The advantage to linking is that the file size can be a lot smaller; the PDF file doesn’t need to carry around a full description of how to render each font. Unfortunately, the destination system doesn’t always have the fonts you want. The safest solution is to embed every font description in the PDF file.

But how do you make this magic happen? There are two important steps I learned about today. (These apply to linux/unix/Mac systems.)

1. Tell pdflatex, dvips, and dvipdf to embed the fonts.

The best instructions I’ve seen for this are here. Basically, you run `updmap` to find out where your config file is, then edit it to indicate that you want the fonts to be embedded. Re-run `updmap` to make those config settings stick, and then you can do pdflatex or dvips or dvipdf (as desired) to create files with embedded fonts.

That will get you most of the way there. However, if you’re including figures (say, .eps files) that also have their own fonts that weren’t embedded, and those font names aren’t recognized, you may get an error like:

dvips: Font Helvetica used in file fancy_widget.eps is not in the mapping file.

You can’t embed the font if your system doesn’t have a mapping for it. Oops! This usually happens with fonts like Helvetica, Times, and Symbol; these are proprietary font names, so their mappings aren’t found in most open source systems. But you can fix this problem, as described in this excellent font reference, by replacing the font names with their open-source equivalents:

2. Replace proprietary font names with their open-source equivalents.

Since .eps is a text format, you can just open the .eps file in a text editor and search/replace the font names. Markus Neteler makes this even easier with a handy bit of sed:

cat original_graphics.eps | sed 's+Times-Bold+NimbusSanL-Bold+g' |\
sed 's+Times-Roman+NimbusSanL-Regu+g' |\
sed 's+Times+NimbusSanL-Regu+g' |\
sed 's+Helvetica-BoldOblique+NimbusSanL-BoldItal+g' |\
sed 's+Helvetica-Oblique+NimbusSanL-ReguItal+g' |\
sed 's+Helvetica-Bold+NimbusSanL-Bold+g' |\
sed 's+Helvetica-Bold-iso+NimbusSanL-Bold+g' |\
sed 's+Helvetica+NimbusSanL-Regu+g' |\
sed 's+Helvetica-iso+NimbusSanL-Regu+g' |\
sed 's+Symbol+StandardSymL+g' > new_graphics.eps

For the particular file I was working on today, a couple of additional fonts didn’t show up on Markus’s list. They were all variants on the Courier font. After some hunting around, I figured out that Courier is “Nimbus Mono L”, so here’s the translation:

Courier NimbusMonL-Regu
Courier-Bold NimbusMonL-Bold
Courier-Oblique NimbusMonL-ReguObli
Courier-BoldOblique NimbusMonL-BoldObli

Finally, you may want to check the file to confirm that the fonts were embedded. It seems that you can use a utility called ‘pdffonts’ to do this from the command-line, but I don’t have it on my system. Alternatively, you can fire up Adobe Reader, go to “File->Document Properties”, click on the “Fonts” tab, and browse to see that each font is marked “embedded.”

“O let not Time deceive you”

Last semester, I joked that I’d somehow gotten ahold of a virtual Time-Turner, since I was taking a class at USC that occurred at the same time I was teaching at Cal State LA, on Thursday evenings. This was possible since I was taking the class through the Distance Education Network, and therefore could view the 2.5-hour lecture on my computer at a later date (usually the weekend).

Santa sometimes has a funny sense of humor, and this Christmas he brought me (among many other wonderful things) an actual Time-Turner. And yet — while it was pretty cool to be able to turn time last semester, unlike Hermione I didn’t actually end up with any more hours in the week. By the end of the term, I was aching for a break. So I held my Time-Turner and realized that, rather than a symbol of incentive for double-booking, really it was more of a warning — a caution against that kind of stacked-up crazy schedule.

But did I heed the warning of the Time-Turner? No. By the time January rolled around, I’d already committed to an even crazier term: working, teaching an entirely new class at Cal State LA, taking yet another class at USC, all the while trying to write a Master’s thesis so I can graduate this spring. None of them are technically overlapping in time, but (just as when the Time-Turner let me spread things out) all together it’s still a gradually suffocating weight.

Thank goodness my teaching duties end with the winter quarter at Cal State LA. As of March 15, I’ll have one less thing to occupy my energies. And if I ever propose this sort of schedule again in the future, someone kindly strangle me with the Time-Turner’s chain.