[Tex/LaTex] TeXShop Search Window

forward-inverse-searchtexshop

I've just reinstalled TeXShop [and OS X]. I would like to find/replace/replaceall only within a block of selected text. I seem to recall my old version had this feature, but I can't find it now (my search window is much more basic now). Any suggestions?

Best Answer

At least as of the 3.06 version of TexShop (and perhaps earlier), TeXShop has included a Find Panel that uses OgreKit, which is a Cocoa framework. (It was developed by Isao Sonobe, according to the TeXShop help center.)

Basically, this means that this find panel ends up being much more powerful, in particular because it can utilize regular expressions. Additionally, this OgreKit version of the find panel allows one to set the scope of any given search. The two options for setting the scope are "Entire File" and "Selection".

In order to use the OgreKit version of the find panel, you need to open TeXShop, go to Preferences, and, under the Source tab in the Preferences, change the Find Panel radio option to "OgreKit Find Panel". After changing this, you will have to restart TeXShop, but you should then be able to set the scope of a search to the text that you have selected.

Update:

However, based on my testing this feature as of TeXShop version 3.18, this feature does not seem to work with find. For example, if one selects a block of text and then uses only the find function of the find panel, it will search the entire file. This is true for any function that does not include "all". That is, the only functions that really seem to work with this scope option are find all and replace all. I'm not sure why this is the case. Nonetheless, you should be able to at least use those two "all" functions with the scope restrictor as of version 3.18 of TeXShop. I've just reported this to Richard Koch; I'll update this answer accordingly.

Related Question