2
$\begingroup$

This has been asked in various forms before, but I have not seen a satisfactory answer to the question: In many, many cases one wants mathematical expressions represented in the form of a regular array similar to LaTeX constructs such as eqnarray or simply array, while keeping the expressions formatted the way they would be if they were stand-alone expressions in a displayed equation.

In LaTeX one can force this form simply by issuing a \displaystyle directive. Is there any way to achieve this in Mathematica, in a manageable way? I have my options set to disallow scriptlevel changes already, which helps with inline expressions, but it does nothing for expressions that are part of an array of expressions, for reasons that are mysterious to me. Thus I have found myself desperate enough to sometimes edit raw box expressions to get what I want, but Mathematica's syntax for this is a nightmare. Half the time I end up with a severely broken expression after attempts like that, and I'm forced to start over.

So, what I am looking for is some sort of function that I could apply to an expression shown in TraditionalForm say, and possibly then invoke to be evaluated in-place. Is this possible? Or should I simply give up on the idea of doing any kind of serious mathematical typesetting within Mathematica?

P.S.: I have seen the suggestions in this post, which do help in creating equation arrays, but the issue is that the expressions in each of the array cells get displayed like inline expressions (with small operators, sub/superscripts squeezed in to the right of the operators, etc.).

$\endgroup$
4
$\begingroup$

I am not sure I understand what you are asking for. It seems to me that the kind of formatting style commands you are asking for are available from the Format and Cell menus.

Here is an example.

I entered the following grid of formulas into a notebook.

input

The formulas appear in the formatting that you don't like; however, after selecting each formula in the grid and choosing Format > Style > DisplayFormula and Cell > Convert To > TraditionalForm, I got

formatted

which is what I think you would to have.

Update

An attempt to answer the question raised in the comments.

There is a grid box option, GridBoxSpacing, which appears in the Option Inspector and indeed is used internally to control the spacing. It is undocumented, and I do not recommend attempting to use it directly. Rather, if you want that level of control, I recommend recourse to the Grid function. You can generate a basic 2 x 2 grid with it that works just like one created from the keyboard, but allows you to set an option the controls the spacing. Grids created this way can be extended with keyboard Ctrl+Return and Ctrl+,.

Here is an example where I use the Spacings option to generate a grid template with widened columns and compressed rows.

Grid[
  {{Placeholder[], Placeholder[]}, {Placeholder[], Placeholder[]}},
  Spacings -> {3, 0}]

grid

If you open the cell with Cell > Show Expression, you will see how the option GridBoxSpacing is used internally to control the spacing.

open_cell

$\endgroup$
  • $\begingroup$ Wow, I had never thought of that straightforward approach! Thanks! One more question: How do I control the spacing of items in an array of expressions created with Ctrl-Enter, Ctrl-,? My guess is there might be an option for this in the Option Inspector, but what is it? $\endgroup$ – Pirx Nov 8 '16 at 23:07
  • $\begingroup$ @Pirx. I am not sure what you mean by "control the spacing of items in an array of expressions". Are you asking about aligning expressions by a certain character such as an equal sign? Or something else? $\endgroup$ – m_goldberg Nov 9 '16 at 0:30
  • $\begingroup$ What I am talking about is the space in between the expressions that are arranged in the columns and/or rows of the array of expressions, similar to directives like \arraycolsep in LaTeX $\endgroup$ – Pirx Nov 9 '16 at 1:33

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.