[OS X TeX] finding missing braces

Roussanka Loukanova rloukano at stp.lingfil.uu.se
Tue Mar 6 07:16:47 EST 2007


On Mon, 5 Mar 2007, Herbert Schulz wrote:
...

I tried your description of TeXShop's marking braces to see how it 
works on a few strings. On the way, I put some memo notes; and I, 
actually, compared TeXShop with Emacs on that "small" job of matching. I 
am including the small test tex file at the end. I used the (, ) instead 
of {, } since the later are special in the syntax of the TeX's commands.

>From my overall modest experience, I think TeXShop does excellent job, esp 
for people who are reluctant to use, and do not need to, specialized 
editors like Emacs. Emacs is more sophisticated, as it has to be, because 
of its being editor for programming. Many people would just waive away a 
hand to any suggestion to use Emacs, and would even refuse to look at it. 
They would stay with TeXShop, since it is very convenient and good. Most 
likely, it would become better and better. My guess is that people would 
be using TeXShop instead of Emacs, etc., even if TeXShop implements many of 
the auxiliary features of Emacs for (La)TeX. Again, from my modest 
experience, I can say that TeXShop is the best user-friendly editor for 
(La)TeXing and Viewing. (I'm finding myself using TeXShop more and more.)

I certainly was extra-optimistic by saying that humanity students learn 
easily Emacs. I missed to add: when and those who are required to do so in 
courses involving programming.

BTW, I find TeXShop's bouncing over the matching parenthesis too fast and 
skinny to be noticed enough usefully. Is there way this to be adjusted 
(some kind of customization)?

Roussanka


\usepackage{lmodern}
\usepackage[T1]{fontenc}

\begin{document}

\begin{enumerate}

\item Double click over a parenthesis and TeXShop finds a matching
   parenthesis (if there is such). It highlights all the text between
   the matching parentheses (including the parentheses).

$(([ ])) ( )$

\item  Missed parentheses:

   TeXShop highlights all the text between the matching parentheses
   (including the parentheses.

$(([ )) ( )$

\item  ``Crossed'' parentheses:

   TeXShop highlights all the text between the matching parentheses
   (including the parentheses).

$(([ ))] ( )$

\item TeXShop highlights only the opening parenthesis (and no other
   text) if it can't find a match.

\item Well-balanced parentheses:

   \begin{enumerate}
   \item $\Big[[(a + b) - (c + d)] + [(e - (f + g)) + g]\Big]$
   \item $(_0 (_1 (_2  S  )_2  )_1 (_3  (_4 S )_4 )_3 )_0$
   \end{enumerate}
\item Missed parentheses: \label{0}

   $(_0 (_1 (_2 S )_2 )_1 (_3 (_4 S )_4 )_3$
\end{enumerate}

Emacs would detect, and mark with a distinctive color, the unmatched
parentheses, e.g., ``[)''.

When the cursor is placed just before or over the opening \$, in a
pair \$ \ldots \$, Emacs, by \textsc{ESC CTRL}-f, would ``jump'' to
the closing \$, if \$ \ldots \$ is well-balanced.  Emacs rejects
jumping over the scope of a pair \$ \ldots \$ enclosing unmatched
parentheses.

In the tex code of the later example i.e., (\ref{0}), place the cursor
right after the ending \$ in \$ \ldots \$, issue \textsc{ESC CTRL}-b:
Emacs would jump to the faulty ``('' that has to be fixed.

Note that the above examples typeset with no problems, but the editor
detects the unmatched parentheses.
\end{document}

------------------------- 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 MacOSX-TeX mailing list