[OS X TeX] install spell checking dictionary for Bulgarian

Richard Koch koch at uoregon.edu
Sat Jun 5 16:27:26 EDT 2021


Folks,

In macOS, there is a "class library" called Cocoa. Most macOS programs are written in Cocoa. 

TeXShop is written in Cocoa, and thus its editor is written using the NSTextEdit class in Cocoa. This NSTextEdit in turn calls the Cocoa class NSSpellChecker to spell check text.

NSSpellCheck onsults Cocoa dictionaries to spell check words. However, NSSpellCheck has hooks which allow it to be overridden so it uses different dictionaries and different ways to search them. This is transparent to the user; if NSSpellCheck is overridden, then ALL Cocoa programs use the new spell check methods. 

CocoAspell by Anton Leuski is an example of this approach. It overrides NSSpellCheck to call its own dictionaries, and is LaTeX aware and HTML aware. CocoAspell comes with a control panel to activate or deactivate it. Cocoa programs are completely unaware of this overriding. So for example, TeXShop calls NSSpellCheck and that's all it knows; it doesn't know if NSSpellCheck itself or some other overriding program like cocoAspell does the spell checking.

Therefore it is misleading to say that TeXShop or any other program "uses the standard macOS spelling program via NSSpellChecker" because maybe that standard code is used directly, or maybe it has been overridden by something else. 

It is also possible for Cocoa programmers to completely ignore NSSpellCheck and invent their own spell checking procedure, but this is hard work and prone to error. TeXShop actually provides this; under the Source tab of TeXShop Preferences, the three "Spell Checking" items at bottom right activate forms of this alternate way to spell check. However, I do not recommend using these commands (!!!)

Installing the Unix code for ispell or aspell, or a dictionary for one of these, will not affect a Cocoa program like TeXShop unless code is added to the program to use this extraneous spell checker. That is not an easy task.

The preferable approach is to write code which hooks into NSSpellCheck and overrides it, and then calls the Unix ispell to spell check. That isn't an easy task either, but once it is done, then ALL Cocoa programs can use the new spell checking method without adding a line of code to them.

Richard Koch




More information about the MacOSX-TeX mailing list