Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

braces for Math in LaTeX

Tags:

latex

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 ?

like image 384
Tim Avatar asked Apr 13 '10 01:04

Tim


2 Answers

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.

like image 140
Scott Wales Avatar answered Sep 30 '22 00:09

Scott Wales


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 [/].

like image 41
Vlad Avatar answered Sep 29 '22 22:09

Vlad