[OS X TeX] finding missing braces

Herbert Schulz herbs at wideopenwest.com
Sun Mar 4 21:06:08 CET 2007


On Mar 4, 2007, at 1:40 PM, Rolf Schmolling wrote:

> Hello!
>
> Please accept my apologies for posting without a subject… this was  
> actually the third time I tried, because somehow everything I sent  
> went as html by mistake.
>
> Thanks for the search expression. I will try to save it somewhere  
> and try it out.
>
> I tried the texshop-wiki as well and there Herbert Schultz  
> suggested to doubleklick right after an opening brace or right  
> before a closing brace. If everything is alright all text within  
> the braces should be selected together with the two braces.  
> Unfortunately that still is semi-automatic.
>
> Someone I met in texusergroup hinted about some editors beeing  
> smart enough to do this but I really want to hang to TexShop  
> because it seems the only thing I'm able to work properly (simple  
> but elegant, no programming-skill neded, excellent sync between  
> source and pdf)…
>
> Anyway thanks a lot!
>
> Greetings,
> Rolf

Howdy,

I believe the problem is intractable. How can a program know what you  
intended? E.g., suppose you leave off a closing brace in a sentence,

\emph{emphasized text ...

how will a program know whether the closing brace goes after the word  
`emphasized' or the word `text', or ...?

I think TeXShop does a reasonable thing here; if you double click  
just before (I had said after in the forum, sorry) the opening brace  
and TeXShop finds a matching closing brace it highlights all the text  
between and including the braces while only highlights the opening  
brace if it can't find the match. The algorithm seems to just count  
{ and } until the matching } is found; it doesn't seem to know about  
comments (e.g., it will match on %}) or literal closing braces (\}),  
but that will work most of the time.

The error message you get while compiling should give you good clue  
as to where the missing closing brace occurs.

Finally, the best way to keep from having mismatched pairs is to use  
Command Completion and/or Macros to generate the pair and place the  
insertion point between the braces.

Good Luck,

Herb Schulz
(herbs at wideopenwest.com)



------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/





More information about the macostex-archives mailing list