[OS X TeX] Boldface

Aaron Jackson jackson at msrce.howard.edu
Sun Feb 13 16:47:58 EST 2005

On Feb 13, 2005, at 4:28 PM, Alain Schremmer wrote:

> It can matter—a bit: Say you were writing about three "occurrences" of 
> something and that you wanted to index "occurence".
> But this is really a shortcoming of NewTerm.
> I think that there are a couple of occurences of this in my book but I 
> will change the wording around it as I come across them (in one of my 
> many rereads).
> What I am curious about is what the difference is between (.+?) and 
> [^}]* (I assume that this is to allow the reference \1.)
> find
> \\textbf{(.+?)}\\index{\1}
> replace with
> \\NewTerm{\1}"
> and
> find
> \\textbf{[^}]*}\\index{
> replace with:
> \\NewTerm{

The first one says to match the characters "\textbf{" then one or more
characters in non-greedy mode followed by a "}".  You need the match to
be non-greedy since {.+} on the string "\textfb{junk}\index{more
junk}" would match "junk}\index{more junk", not just "junk".

The second one says to match the characters "\textbf{" then zero or
more characters that are not a "}" followed by a "}".

I suppose that there are subtle differences between the two that
could cause problems in special cases, but both should be functionally 
same for the most part.  I personally use the second form (you only
have to get burned by a greedy match once to understand why).


--------------------- 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 Post: <mailto:MacOSX-TeX at email.esm.psu.edu>

More information about the MacOSX-TeX mailing list