# [OS X TeX] Find in texshop

Maarten Sneep maarten.sneep at xs4all.nl
Sun Dec 18 10:31:43 EST 2005

On 18 Dec 2005, at 16:09, Christopher Allen wrote:

>> Common usage for a word like figure is "see figure~\ref
>> {fig:blah}", so just adding the spaces probably won't be enough.
>> You can try to use regular expressions:
>>
>> \sfigure[\s~]
>>
>> (search for whitespace (space, tab, return), figure (not case-
>> sensitive, if you want) followed by whitespace or a tilde).
>
> I still think the space before "figure" is far more important than
> examination of things afterward. I would guess that he wants to
> find things like your "see figure~\ref{fig:blah}" which will be
> found by only searching for white space before "figure." I
> particularly think that avoiding the search after "figure" would be
> important so you can find things like "figures" and "figure," and
> "figure." and "figure;" and "figure'" and more. There are very few
> marks that can show up adjacent to and preceding "figure" in
> standard English; there are more and more frequently used ones that
> show up afterward.

Yes, you're right. Still, since TeX treats a space essentially the
same as a return, a \s before is the important alteration with
respect to you plain search pattern.

> Could you do [\s"'(] or something like that prior to figure?

[\s'(]figure would probably be enough, since in TeX the " isn't
normally used. To capture the whole word, this pattern
(:?\s|'|\()figures?
is probably better, since it captures the plural as well (the last
letter may or may not be there.

Since I don't know the exact intentions of the OP, this may actually
be better:
\bfigures?\b
(the \b indicates a word boundary, anything that is not a letter,
with some strings attached. It will find the figure in \begin{figure}
as well).

> I don't know the limits of regular expressions.

Regular expression are very powerful, though not easy to master. I
can recommend to read the section on regular expressions in the
separately, and they are the best introduction I've found so far.
(http://www.barebones.com)

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/