# [OS X TeX] Find in texshop

Maarten Sneep maarten.sneep at xs4all.nl
Sun Dec 18 10:53:40 EST 2005

A double answer:

On 18 Dec 2005, at 16:32, Themis Matsoukas wrote:

> But would the space in front of figure find things like "blah blah.
> Figure 2 shows ..." ?
> BTW, I normally say "see figure \ref{...}" without a forced "~"
> space. And of course, "figure" in my posting is only an example;
> the question is how to find a whole word, excluding from the search
> long strings that contain the word. The problem with regular
> expressions is that I have to think of all possible characters that
> could surround my string (and if I had the time to do that, I'd
> rather be doing something else!)

I would advise to use the forced space: it prevents an ugly linebreak
between figure and the orphaned number.

The word boundary \b in regular expressions is probably your friend,
although I'm not sure how it handles a backslash. It probably
considers the point between the backslash and the word as a boundary.
So commands are found.

On 18 Dec 2005, at 16:33, Jonathan Kew wrote:

> Better to search for
>
> 	\bfigure
>
> where "\b" indicates a "word boundary" (i.e., a boundary between
> alphabetic and non-alphabetic characters, roughly speaking). This
> is more general, and also avoids actually selecting the preceding
> character. Could even use
>
> 	\bfigures?\b
>
> to find either "figure" or "figures", with word boundaries both sides.

I agree in general, although this finds the figure in \begin{figure}
as well, so you have to be careful. Hey, that is the case with
regular expressions: power comes with responsibility.

Maarten
------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/