Archive for July 2005

Friday, July 29, 2005

Roman Straight Quotes in pdfLaTeX

LaTeX is amazingly powerful. Nearly anything is possible if you know the right incantations. But sometimes you need incantations for even the simplest of tasks, and finding them isn’t always easy.

In this case, I wanted to use straight quotation marks (' and ") in LaTeX’s roman font. In a word processor or HTML or pretty much any other system, you can simply type these characters on the keyboard: WYSIWYG. (Some applications “smarten” quotes by default, and you can often override this by holding down the Control key.) Typing the characters directly works in LaTeX’s monospaced font, which it expects you to use for code, but in the Roman font ' renders as . LaTeX wants to produce curly quotes from its 7-bit input; in fairness, this is nearly always the right thing to do. So it uses `` to mean and '' to mean , and there just isn’t another character on the keyboard left to mean '.

But sometimes you want ' or " so that you can abbreviate feet or inches, or write about punctuation. Turning to the Comprehensive LaTeX Symbol List (thanks to Maarten Sneep for the pointer), we see that these characters are accessible using the \textquotesingle and \textquotedbl commands. However, the commands are not built into LaTeX; before you can use them you need to import three packages:

\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{lmodern}

The fontenc package provides \textquotedbl, and the textcomp package provides \textquotesingle. Unfortunately, fontenc has a bad side effect on pdfLaTeX (on Mac OS X, at least). When you use that package, LaTeX is no longer able to find the characters it needs as font glyphs. It falls back on generating the glyphs as PostScript curves. This means that the text in the PDF output isn’t searchable—because it’s not actually text. And it is hard to read on-screen because Preview can’t use Quartz’s font smoothing technology. In fact, the PDF looks even worse than you would expect from this description, so there may be something else going on—anti-aliasing of poorly scaled bitmaps, perhaps. In any case, the lmodern package seems to be the answer to this problem. It makes the fonts look the way they did before importing fontenc.

Friday, July 22, 2005

Localization Suite 2.0

The Blue Technologies Group has released a major update to its suite of tools for localization. In theory, localizing a Mac OS X application is simple, since the framework support for it is so good. However, incremental localization, keeping all of the languages up-to-date as you revise the application, can be a nightmare. I’ve written scripts to help with this, and tried a variety of tools, but I never really liked any of them. The tools saved time, but they were complex—with many options—and yet I couldn’t really make them fit in with my workflow. Localization Suite gets a bunch of things right:

I’ve been using Localization Suite 2.0 in beta for about six months, and it’s already saved me many hours. This is a great piece of software, from a dedicated and responsive developer. Amazingly, it’s free, although grateful developers are encouraged to make a donation.

Sunday, July 10, 2005

Making Gear Pop-up Menus

New Apple engineer Corbin Dunn posted a tip for how to create pop-up menus that emanate from the “action” button, as seen in the Finder and Mail. However, it looks to me like his method will cause the menu to pop-up on mouse-up rather than mouse-down. So, when I add an action button to my app, I’ll probably use a subclass so that the button can respond to the mouse click earlier.

“untitled” vs. “Untitled”

The Cocoa-Dev mailing list has an interesting discussion of how to name untitled windows. Apple’s guidelines have long recommended “untitled” for reasons explained in the thread, however cross-platform applications from Adobe and Microsoft haven’t followed this guideline, and neither does Cocoa’s NSDocument class. Apple’s Ali Ozer says that rather than fix NSDocument, the guidelines should be changed, and he provides some necessary, but I think not sufficient, evidence that this is a good idea. Kudos to Apple for thinking this through years ago, and to today’s Mac developers for caring.

The Press and Privilege

Matt Deatherage:

These reporters are asking for absolute, unquestionable control over information up to and including sensitive national security matters—if they feel like revealing it, they will; if they don’t, you can’t make them. If they’re not going to accept the oversight of the courts in even the most extreme cases (like this one), then they have to accept the same kind of punishment that affects members of other privileged professions if they ever break confidentiality.

Otherwise, reporters truly would be above the law. That can’t be good for society.

Wednesday, July 6, 2005

Text View Bindings and Panther

Today’s MDJ reminded me of that weird regression (fixed in version 2.6.3) where DropDMG’s license agreement editor didn’t work on Mac OS X 10.3. I had rewritten the editor to use Cocoa bindings, as this improved performance and simplified the code. Unfortunately, I used NSTextView’s attributedString binding. Despite what the documentation and Interface Builder’s compatibility checker say, this binding is only available on Mac OS X 10.4. Of course, it’s still my fault for not covering this aspect of the agreement editor in my unit tests. But let this be a lesson: if you want to bind a text view on Panther, use the data binding.

Friday, July 1, 2005

ATPM 11.07

The July issue of ATPM is out: