[OS X TeX] Boldface

Alain Schremmer Schremmer.Alain at verizon.net
Sun Feb 13 23:05:42 CET 2005


I do understand about non-greedy as I did get burned that way (not too 
badly, though, as I always backup before I do something large scale).

But to really understand, I will have to do some homework on what you 
wrote. (One of these days I will try to change \NewTerm to allow the two 
forms, the one in the text and the one in the index, and then I will 
have to make a new search.)

Regards
--schremmer

Aaron Jackson wrote:

>
> 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 
> the
> 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).
>
> Aaron
>
> --------------------- 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>
>
>
>
--------------------- 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 macostex-archives mailing list