On Mon, Oct 22, 2007 at 01:20:00AM +0200, D Masneri wrote:
> In a LaTeX file, I want to add "\left" and "\right" in front of all  
> *closed* square brackets intervals like "[a, b]" so they are changed  
> to "\left[a, b\right]".
> 
> But I don't want to add anything in front of square brackets  
> belonging to *open* or *half-open* intervals like "]a, b]" or "[a, b[".
> 
> Inside of one equation, several kinds of intervals may appear; for  
> example:
> 
> $[a, b[ \cup ]c, d]$ (nothing should be added here),
> 
> while
> 
> $]a, b] \cap [c, d]"    should be changed to:   $]a, b] \cap \left[c,  
> d\right]"
> 
> First, I select the whole equation (including dollars); then...
> 
> Any idea?

It's not immediately obvious to me how to recognize an interval, give that
a left bracket can end an interval and a right bracket can start one...
I've assumed that any bracket not preceded by a letter character is the
start of an interval.

So, here's a substitution that I think will work:

Find
(?<![a-z])(\[)([^\[\]]+)(\])

Replace
\\left\1\2\\right\3


Ronald

-- 
------------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_script.shtml>
List archives: <http://www.listsearch.com/bbeditscripting.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to