Monday, July 2, 2007

SEEing LaTeX 4: More on Completions

Earlier, I took a look at using BibDesk to get SubEthaEdit to complete citations in LaTeX files. After working with it a few days, I've learned a few more things about BibDesk. Unfortunately, not all good.

There seems to be a rather unpleasant interaction between BibDesk's completions and SubEthaEdit's completions. Normally, SubEthaEdit injects some mode-dependent terms into the completion dictionary. For some modes, like Python, this is no big deal; most of the keywords in Python are normal English words, so they would be completed by the standard completion dictionary. For other modes, e.g., the Objective-C mode, it can make a more significant contribution; the Objective-C mode defines a large number of Cocoa class names, which you can see by typing NS and pressing F5. Also, and maybe more importantly, SubEthaEdit will search through the current file to find matches, so, e.g., variables you've defined will be completed. For LaTeX, that provides a way to have the labels for equations, figures, and the like to be completed; for user-defined macros to be easily referenced; and for names and technical terms that don't appear in the standard dictionaries to be completed.

Using BibDesk's Autocompletion input manager disables SubEthaEdit's Autocompletion features. Apparently, any input manager that extends completions will have this effect, as the SubEthaEdit FAQ notes that TextExtras will stop SubEthaEdit's Autocompletions from working. With TextExtras, that wouldn't be so bad, since it provides completions of its own, but the tradeoff with BibDesk is more extreme. You can have citations and, interestingly, the \ref and \pageref commands for cross-references completed, but lose completion of the terms in the document, whether it be LaTeX or something else. Or, you can have autocompletion of the terms in the document, but lose autocompletion of citations (cross-reference completion is handled just fine by completion of terms from the document).

An early idea on how to resolve this was that I could install TextExtras, and use its completions. I used to use it, and liked it a lot, but gave up on it some time ago. I'm not sure exactly why, now, but I think it was because an earlier version of TextExtras conflicted with the then-new autocompletions in Mac OS X 10.3 Panther. Unfortunately, I haven't been able to connect to the TextExtras page to download it since coming up with the idea!

In the end, I disabled BibDesk's Autocompletion input manager, it simply comes at too high of a cost. BibDesk has a number of system services, which allow citations to be inserted that way. It will have to do for now. A solution using AppleScript to get completions from BibDesk looks possible, but it seems best to make the issue clear now and solve it later.

This is definitely a strike against using SubEthaEdit for LaTeX.

Update: The same thing happens when BibDesk's input manager is loaded into other editors, too. In Smultron, you lose completion of words from the document; I'm not so familiar with Smultron, so I don't know if there are other features that get lost. It is truly a shame that one of the coolest features of BibDesk is also one that I just don't want to use.

No comments: