tags:

views:

262

answers:

2

Hi,

Is there any convenient way to type in braces in Math in Latex?

Especially when I have already typed in a lot of "(" and ")" instead of "\left(" and "\right)", how can I do a quick replacement? similarly for "{" and "}" and "[" and "]"?

Is it important to make such changes? I am writing a thesis.

Thanks and regards!

BTW: I mainly edit latex file in Texmaker and I know how to use emacs. If there is other editor that can do such replacement in a quick way, please let me know.


EDIT:

If there is nothing taking more than one line height inside the braces, is there any difference in their appearances between using \left and \right and not using? Is it still necessary to use \left and \right ?

+3  A: 

Assuming that you don't want to replace ('s with \left('s in your source files, you can try this hack:

\def\oparen{\left(} \def\cparen{\left)}
{\catcode`\(=\active \gdef({\oparen} \catcode`\)=\active \gdef){\cparen}}
\everymath={\catcode`\(=\active \catcode`\)=\active}

But this will probably break some of the macros using parentheses.

The same trick possible with {/} (use with extreme care!) and [/].

Vlad
+5  A: 

The point of the \left( \right) syntax is to have brackets automatically resize to fit their content.

A search/replace is a simple way to correct your brackets (M-% ( RET \left( RET in emacs for example, which will let you check each occurrence), or your editing environment might have a quick way to type them.

Scott Wales
Thanks Scott! If there is nothing taking more than one line height inside the braces, is there any difference in their appearances between using \left and \right and not using? Is it still necessary to use \left and \right ?
Tim
@Tim As long as there's nothing like superscripts, fractions, etc. they should appear identical
Scott Wales
Nested parentheses will also have their sizes changed, so that outer levels are larger
Scott Wales
Thanks! You mean without \left and \right, the nested parentheses will have different sizes? But I don't see any difference?
Tim
It may depend on the document style and packages, I'm sure I've seen LaTeX do it before
Scott Wales