# Can I make LyX automatically use 'smart' parentheses [\left( \right)] in math mode?

When I type in math mode I always prefer to use the parentheses using \left and \right.

Currently, I go into math mode and then press the button on the ribbon that appears in this mode and creates these type of parentheses.

I would prefer that when I type in ( or ) it would automatically insert \left or \right accordingly.

Is there a way to do so ? I would prefer a way that would not require me to do it for each new document I start.

Any help is greatly appreciated!

You shouldn't always use \left( .. \right), one reason being that the spacing is different. Try comparing \sin(x) and \sin\left(x\right), you'll see that the latter has the wrong spacing. Also, in many cases no scaling is required, so using them is unnecessary. Related questions:

Hence, it would be better to only use \left\right when needed, and LyX has a shortcut for inserting these: Alt + M, (. That is, press Alt + M, release both, press (.

If that is one keystroke too many, you could create a new shortcut, for example Alt + (, that inserts a \left( \right) pair. Tools --> Preferences --> Editing --> Shortcuts. Search for math-delim and you'll find the existing shortcut, double click it to change.

• I agree, in many cases \left(...\right) is excessive, for example when used in inline math, \left(...\right) very often ends up being too tall, and thus mess with line spacing. As Torbjørn mentions, use when appropriate. – daleif May 10 '13 at 11:27

I also use LyX and I also prefer using \left and \right parentheses in most cases. There is a shortcut that I use instead of clicking the "Insert delimiters" button:

From inside math mode I type

• Alt-m ( to get a pair of parentheses,
• Alt-m [ to get a pair of brackets,
• Alt-m { to get a pair of braces,
• Alt-m | to get a pair of vertical bars, etc.

Unfortunately this shortcut (as much as I know) doesn't work for double vertical lines (used to denote norms).

Hope this helps!

You can also just make a shortcut that is Shift+(, as you would normally type a parenthesis, but now it will just automatically insert a smart parenthesis.

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Could you expand your answer to explain how to achieve this? – cfr Nov 20 '14 at 3:16