Find-Replace using LaTeX commands

1,615 views
Skip to first unread message

Tim Lahey

unread,
Jan 10, 2012, 9:55:52 PM1/10/12
to bbe...@googlegroups.com
Hi,

I've run into some problems with the find-replace command. Words using
\r and \t have problems. I'm assuming they're being interpreted as
something else. Can I change things so they're just text?

Thanks,

Tim.

Govinda

unread,
Jan 17, 2012, 3:07:10 PM1/17/12
to BBEdit Talk
Hi Tim

If I understand what you are asking correctly, then yes:
\r = the line ending character
\t = the tab character

if you want to find the *literal* string "\r", then you would search
for it this way:
\\r

The "\" char escapes whatever comes next.

-Govinda

Doug McNutt

unread,
Jan 17, 2012, 3:21:10 PM1/17/12
to bbe...@googlegroups.com


It helps to understand that when bbedit has a file open for editing the entire document is stored as 16 bit UTF characters. The \ character used as an escape elsewhere is essentially never there at all. (Editing a shell script might be an exception to that.) Also all input line ends are represented as 0X 000D, the standard for Apple of old.

If your external text uses 0x0A or a 0D0A pair they're 0x000D in memory. Only one kind of line end is allowed in a file coming in. BBEdit takes a guess at which one is the real one if your source has a plurality of them as you might find in a teletype message of old.

--

--> The U. S. Census Bureau missed a bet by not counting all of those embryos in cold storage. <--

Tim Lahey

unread,
Jan 17, 2012, 3:49:14 PM1/17/12
to bbe...@googlegroups.com
On Tue, Jan 17, 2012 at 3:21 PM, Doug McNutt <doug...@macnauchtan.com> wrote:
>
>
> It helps to understand that when bbedit has a file open for editing the entire document is stored as 16 bit UTF characters.  The \ character used as an escape elsewhere is essentially never there at all. (Editing a shell script might be an exception to that.) Also all input line ends are represented as 0X 000D, the standard for Apple of old.

That's unfortunate. LaTeX commands are built around using \ so there
are commands like \textit which is used to make text italic, \tan (for
printing tan properly) and I have custom commands like \rV. Doing
find-replace with the standard BBEdit find-replace dialog is very
annoying since BBEdit is making me do more work since I can't just
select text and do a find based upon it.

Cheers,

Tim.

--
Tim Lahey
PhD Candidate, Systems Design Engineering
University of Waterloo
http://about.me/tjlahey

Tim Lahey

unread,
Jan 17, 2012, 3:14:44 PM1/17/12
to bbe...@googlegroups.com
I know. I'm looking for a way to disable the recognition of those
characters so I don't need to do that. Since most of my text is LaTeX,
it's quite annoying to have a search error and then realise that
there's a special character and escape it.

Cheers,

Tim.

> --
> You received this message because you are subscribed to the
> "BBEdit Talk" discussion group on Google Groups.
> To post to this group, send email to bbe...@googlegroups.com
> To unsubscribe from this group, send email to
> bbedit+un...@googlegroups.com
> For more options, visit this group at
> <http://groups.google.com/group/bbedit?hl=en>
> If you have a feature request or would like to report a problem,
> please email "sup...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Rich Siegel

unread,
Jan 29, 2012, 10:34:19 AM1/29/12
to bbe...@googlegroups.com
On Tuesday, January 17, 2012, Tim Lahey <tim....@gmail.com> wrote:

>Doing find-replace with the standard BBEdit find-replace dialog is
>very annoying since BBEdit is making me do more work since I can't
>just select text and do a find based upon it.

I don't understand why not. When you select some text with a
backslash in it, and choose "Use Selection for Find", it gets
escaped correctly so that searches will find that text (assuming
it exists where you're searching). What have I missed?

R.
--
Rich Siegel Bare Bones Software, Inc.
<sie...@barebones.com> <http://www.barebones.com/>

Someday I'll look back on all this and laugh... until they
sedate me.

Tim Lahey

unread,
Jan 29, 2012, 12:55:11 PM1/29/12
to bbe...@googlegroups.com
On 2012-01-29, at 10:34 AM, Rich Siegel <sie...@barebones.com> wrote:

> On Tuesday, January 17, 2012, Tim Lahey <tim....@gmail.com> wrote:
>
>> Doing find-replace with the standard BBEdit find-replace dialog is
>> very annoying since BBEdit is making me do more work since I can't
>> just select text and do a find based upon it.
>
> I don't understand why not. When you select some text with a backslash in it, and choose "Use Selection for Find", it gets escaped correctly so that searches will find that text (assuming it exists where you're searching). What have I missed?

I didn't know about "Use Selection for Find" so I've been doing a cut
and paste into the Find dialog. It's still kind of annoying on the
replace side since I don't think of \r or \t except as LaTeX strings
so I've accidentally added return characters into my text in the past.

So, I'm guessing there isn't a way to disable \r and \t as special
characters so we don't need to escape them. That's unfortunate.

Thanks,

Tim.

Rich Siegel

unread,
Jan 30, 2012, 8:54:06 AM1/30/12
to bbe...@googlegroups.com
On Sunday, January 29, 2012, Tim Lahey <tim....@gmail.com> wrote:

>It's still kind of annoying on the replace side since I don't think of
>\r or \t except as LaTeX strings so I've accidentally added return
>characters into my text in the past.

"Use Selection for Replace" works, as well. Both share the
benefit of not messing with what's on your Clipboard.

Reply all
Reply to author
Forward
0 new messages