Group Abstract Group Abstract

Message Boards Message Boards

4
|
9.7K Views
|
5 Replies
|
17 Total Likes
View groups...
Share
Share this post:

Put parentheses around selection

Posted 7 years ago

Hello Suppose I wrote an expression, such as xy. Pressing Ctrl+. , I can select the expression. Now I want to put this expression in parentheses:

(xy)

This option works for putting a squre-root sign around an expression, by pressing Ctrl+2. What I am looking for is an equivalent shortcut for bracket, or the parentheses, punctuation mark.

POSTED BY: Ehud Behar
5 Replies
Posted 7 years ago

Thanks a lot for all of the comments. I am sure about to adopt one of them.

POSTED BY: Ehud Behar

I am pretty sure this was available in Mathematica 2.2, but it was removed from the GUI. This is still available as a FrontEndToken. I have a palette that activates it:

Button["(\[SelectionPlaceholder])",  
 FrontEndExecute[
  FrontEndToken[SelectedNotebook[], "SelectionParenthesize"]]]

In modern text editors like Sublime Text and Atom, when you have someting selected and type "(" the selection is parentized instead of replaced. I wish this behabior was adepted by Mathematica (and also for "{" and "[").

Related: https://mathematica.stackexchange.com/questions/84720/parenthesize-what-i-have-highlighted

POSTED BY: Gustavo Delfino

This is pretty simple to do without modifying any existing settings. After you've selected what you want wrapped in parentheses, just hit Ctrl-6 then Delete (or Backspace). It's not a single shortcut, but I've been using it for years and don't find it cumbersome.

enter image description here

POSTED BY: Jason Biggs
POSTED BY: Kuba Podkalicki
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard