TeX/LaTeX on Mac OS X

If you want to start with TeX and LaTeX on Mac OSX, I recommend the MacTeX Distribution, which supplies virtually all you need to start with in a single installer.

The bundle includes TeXShop a simple, yet practical GUI in which you write LaTeX and produce PDF at the click of a button.

Oops…

How I got started with LaTeX

A comment posted the other day made me consider writing up a bit on how I got started with LaTeX, so here goes.

When the idea of writing a book was born, I dreaded the thought of using a typical word processor to do the job; I've used MS-Word (in umpteen versions except the latest: I refuse to) and OpenOffice.org on larger documents before, and the programs suck. Both programs are good enough to write up a shopping list or an invitation to a booze-up on the weekend but little else. I had a publisher (that's the guy who made me start writing the book), and he recommended I do it in LaTeX. His main arguments being I could use Unix tools to "manage" the creation of the book (grep, sed, etc.), and write it with my favorite text editor. That was the argument that really got me.

I ordered two books: Leslie Lamport's LaTeX: a document preparation system (Lamport invented LaTeX, so that is the reference), and Frank Mittelbach's The LaTeX Companion, 2nd ed (an excellent and very thick book that shows you how to use LaTeX' packages with a trillion examples). There are plenty more books, so take your pick. Oh, and I recently read (and loved) LaTeX Hacks which, to my knowledge, doesn't exist in English. The books took a while to be delivered by the post office, so I started off with some online resources.

There is an incredible amount of good stuff on LaTeX, and here are a few I liked best: start off on the LaTeX project page of course, where they tell you (in just a few words), what LaTeX is all about. This bit is very important to understand: LaTeX is a document preparation system for high-quality typesetting. Read that short page five times, go grab a coffee and read it again, and then go to their documentation page.

WikiPedia's LaTeX article gives a bit more insight and some goodish links. The next bit is: don't get confused by all the maths stuff: many clever people use LaTeX for typesetting mathematic formulae; now, that doesn't interest me in the slightest, but unfortunately a lot of documentation focusses on that (it is after all one of the many powerful facets of TeX, the underlying system in LaTeX). Anyways, just forget about those (unless of course, you are a mathematician and want formulae).

A goodish document is Getting Started with LaTeX, by Wilkins, available as PDF and as LaTeX source (is that cool?). Very good, because it is geared towards how you get started with the tools, is Talbot's LaTeX for complete novices (PDF). WikiBooks has a book on LaTeX (PDF) that is also worth looking at. Cambridge University has a good list of introductions, some as PDF, others as PostScript, most in HTML, so you'll be ok with that. And, last but not least, the FAQ. If you're conversant in the German language, consider listening to a podcast on the use of LaTeX, available for download at Pofacs: it is a bit long-winded, and I didn't like it very much, but you might. A Germany site for LaTeX is Dante where you'll find further links and literature, including a list of books.

So, and then? Well, LaTeX exists for most, if not all, Linux distributions, so there is no problem getting the software. You'll also find it for Windows, Mac OS X and probably for your toaster as well (BTW, Mittelbach's Companion has a CD on it, with a TeX/LaTeX distribution on it, but I didn't further look at that, as I had all I required to start with).

I started with your typical Hello World type document: nice and easy, to get a feel for the tools, the debug output (which sucks) and all the intermediate files LaTeX gives you. The first thing I did was create a small Makefile (you can use a shell script to do the same) which cleaned up all the stuff, just so I could start-over if I wanted to. After getting the hang of things (which takes an hour or two), I sat back and read the books.

And the rest? Well, the rest is history, as they say. I am certainly not proficient in LaTeX, but I fully understand what it can be used for, and let me tell you: you can use it for any writing. The most important to remember is to structure your text and use macros. For everything. The rest is easy.

As soon as I've completed this project, I'll be re-structuring my office. With that will come using LaTeX for all correspondence (yep, you can also write letters with it; packages g-brief, dinbrief, etc), and I'll report on that in due course.

LaTeX is really, really worth looking into.

Scared? I can imagine: I was.

Then why not start off easy? LyX is a document processor with a GUI-frontend to a LaTeX back-end. It runs on Linux and Windows (Win32 and Cygwin), and is probably a good way to start easy, with a bit of GUI support. There is another project known as Kile, an integrated LaTeX environment, which runs on a number of platforms. I've glanced at LyX, and it really looks very good, but I can't say much about either of these programs. If you do try them, or if you have experience with either, I'd be interested in your opinion.

Exposé with 150 apps?

Ever wondered what Mac Dock and Exposé look like with 150 apps running?

Expose

More...

Mail.app yok

I've stopped using Apple's Mail.app (Mail.app yok) on the Mac, and I'm back to using Thunderbird. Thunderbird properly supports IMAP IDLE, correctly identifies the number of unread messages in folders, and just works better than Mail.app, for me. It also supports Growl, which I enjoy using.

Mail.app is more beautiful, but I can live with that.

Growl

Growl logoGrowl is a notification system for Mac OS X which allows supported applications, of which there are lots, to send you alerts or notifications. These pop up as bubbles on the screen. There are several built-in styles, and more available.

Installation is easy and well documented. After installing it, browse the applications catalog. I very much enjoy the Firefox addon that notifies of completed downloads, and there are plenty of others!

The Growl developers thankfully thought of CLI users: they supply a command-line tool aptly named growlnotify which can be used to similarly send a notification from a shell script, for example.

But what about the world outside of your Mac?

The Tao of Mac have created a small PHP class, netgrowl.php which can be used on web pages (or from the command line with php -f filename.php) to send Growl notifications. A Perl port of that is also available as Mac::Growl::Net.

Very useful indeed.

The source code is available under a BSD license, and further language bindings can be had for the asking.

More pain with attachments

I've created six files with bogus extensions. The filename prefix denotes the actual content (text/plain, image/png and application/octet-stream), and I simply tacked on an extension for decoration.

What happens when I send off a message with all six files attached? Let me look at three e-mail clients I use regularly.

Lotus Notes 7.0.2 on Mac OS X displays the problem right after attaching the files. Note how the icons match the file extensions and not their content (remember: the file's content are the first three letters of the name, the rest is decorum):

Not a single one is right.

In Thunderbird version 2.0.0.6 we have a very similar situation after attaching the files:

All wrong again.

Mutt interprets the files with these content-types and gets none right. The reason is explained in the manual: Mutt consults the mime.types file to determine the type from the extension.

A  2 exe.jpg                 [image/jpeg, base64, 56K]
A  3 exe.txt   [text/plain, quoted, unknown-8bit, 56K]
A  4 png.jpg                [image/jpeg, base64, 133K]
A  5 png.txt  [text/plain, quoted, unknown-8bit, 133K]
A  6 txt.exe        [applica/x-msdos-pr, quoted, 0.1K]
A  7 txt.jpg                [image/jpeg, quoted, 0.1K]

Is it trivial to determine a file's content? Let me use the Unix file command and see.

$ file ???.???
exe.jpg: MS-DOS executable (EXE), OS/2 or MS Windows
exe.txt: MS-DOS executable (EXE), OS/2 or MS Windows
png.jpg: PNG image data, 500 x 778, 8-bit/color RGB, non-interlaced
png.txt: PNG image data, 500 x 778, 8-bit/color RGB, non-interlaced
txt.exe: ASCII text
txt.jpg: ASCII text

Yes, it is trivial.

Lotus Notes: the missing attachment

I drove somebody crazy this morning by sending him this image found chez Volker.

My correspondent uses Lotus Notes and didn't see the image. I saw by his reply though, that he had actually received it, so I started digging a little.

I sent myself a similar message, following the steps as I'd done them before. In Mail.app I composed a new message

and addressed it to my Lotus Notes account. Upon opening the document in Notes, I see

nada. Zilch. Zip. Nothing. Niente. Nichts.

What is going on? The Notes view shows a message without the attachment indicator with a size of 140K, so that looks alright. The missing attachment indicator signalizes that the image is inline, which also appears to be correct, so why can't I see the image when i open the document?

Well, let me see what Lotus Domino Web Access, a.k.a. iNotes does:

Voila! There it is, so what is the problem? Accessing my Notes mail file via IMAP, I see that the attachment looks so:

o-xT07SCuVSk.jpg    [image/jpeg, base64, 179K]

What has happened?

Mail.app sent the message with a content-type of image/jpeg as the file extension suggests. Let me extract the file and check it

$ file o-xT07SCuVSk.jpg
o-xT07SCuVSk.jpg: PNG image data, 500 x 778, 8-bit/color RGB, non-interlaced

Whoops That file contains a PNG data stream, and not a JPEG image.

The Lotus client apparently checks the MIME content-type, but since it cannot decode the file as a JPEG stream, it just does nothing. I'd say iNotes didn't do anything to it at all, but just sent the whole thing down the pipe to the browser, which in the case of Firefox at least, was clever enough to do something with it, i.e. render the PNG image.

Interesting. The culprit here, IMHO is Mail.App which simply used the filename to determine the content type. The same holds true for Thunderbird and for one or two other programs I've tested.

Sloppy programming. On all sides. E-mail programs should check the file's content before setting any-old MIME content-type on send, and clients should verify content-types before attempting to display content.

Update: more pain.