I like to group the 2 parts of the If statement and others like it by using () to help me be able to still understand what my code is doing the next day I look at it.

I started to use 2D math in input cells, and it is a nice feature of Mathematica.

But noticed that () changes size depending on what is inside them. So I end up with non-symmetrical (different size) parentheses within the same logical grouping. An example will help show this:

enter image description here

Notice how the top () are small compared to the lower (). The code will look better on the screen if the sizes of these () are kept the same. (either both large, or both small, is not important, as long as the size is the same)

This happens with With and any other such command.

I know the () are not needed. I just use them to make the code easy to read. When I have complicated logic, these help me see the parts more clearly.

Here is the actual code that generated the above converted to InputForm in order to paste it here

If[x == 1, x = 0, x = Sqrt[y^2] ]; 

Question is: Is there a way to control this aspect of the display in input cells for 2D math so that parentheses are the same even if using 2D math?


If you want the height of the () in StandardForm input cells to be fixed to one character tall, modify the "StandardForm" style in corresponding stylesheet would help:

Cell[StyleData["StandardForm"], SpanMaxSize->0]

Note this will affect all spanning characters such as parentheses, brackets, braces and etc. Please do search span in document center for more relevant options and details.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.