6
$\begingroup$

The cell enter image description here corresponds to the textual form

Cell[TextData[{
   "The ", StyleBox["average rate of change", FontWeight->"Bold"],
   " in ",
   Cell[BoxData[FormBox["f", TraditionalForm]]],
   " on the interval ",
   Cell[BoxData[FormBox[
      RowBox[{"[", RowBox[{"a", ",", RowBox[{"a", "+", "h"}]}], "]"}], TraditionalForm]]],
   " is the slope of the corresponding secant line: \n",
   Cell[BoxData[FormBox[GridBox[{
       {GridBox[{{
           RowBox[{SubscriptBox["m", "sec"], "=", FractionBox[
             RowBox[{RowBox[{"f", "(", RowBox[{"a", "+", "h"}], ")"}], "-", 
              RowBox[{"f", "(", "a", ")"}]}], "h"]}]}
       },
       GridBoxAlignment->{"Columns" -> {{"="}}}]}},
      GridBoxItemSize->{"Columns" -> {{
           Scaled[0.96]}}}], TraditionalForm]]],
   "\nThe ", StyleBox["instantaneous rate of change", FontWeight->"Bold"],
   " in ",
   Cell[BoxData[FormBox["f", TraditionalForm]]],
   " at ",
   Cell[BoxData[FormBox["a", TraditionalForm]]],
   " is "
  }], "Definition",
   CellChangeTimes->{{3.454944654993936*^9, 3.45494474976772*^9}, {
    3.4549518777111692`*^9, 3.454951884742343*^9}, {
    3.460806271054368*^9, 3.4608062731390657`*^9}, {
    3.478189589239235*^9, 3.478189591304613*^9}, {3.487447061963195*^9, 
    3.487447061963235*^9}}]

I can't figure out how to enter this in the Mathematica user interface. It seems as though the displayed equation on the second line is an inline cell that is aligned using GridBox, but I don't see how to create that effect.

$\endgroup$
5
  • $\begingroup$ Are you sure it was created in the front end? Maybe it was imported from TeX, MathML or something. Or it was modified manually, adding GridBoxItemSize option there. $\endgroup$
    – swish
    Apr 12, 2014 at 20:52
  • $\begingroup$ Well, that's always possible. I doubt it was modified manually, but it could have been imported from TeX. So you think there's no way of doing this in the front end? $\endgroup$
    – rogerl
    Apr 12, 2014 at 21:03
  • $\begingroup$ Maybe there is, I just tried to do this and didn't find anything. $\endgroup$
    – swish
    Apr 12, 2014 at 21:13
  • $\begingroup$ Use the palette Writing Assistant available in the Palettes menu. See the options under Math Cells drop-down menu in the Writing and Formatting section of the palette. $\endgroup$
    – kglr
    Apr 12, 2014 at 21:38
  • $\begingroup$ @kguler Yes, that kind of works. It adds a new cell, which can then be merged with the text cells above and/or below and gives me pretty much what I want. However, it does seem to use inline styling rather than display styling (for example, limits on sums are to the right of the summation sign rather than above and below). $\endgroup$
    – rogerl
    Apr 12, 2014 at 21:55

3 Answers 3

6
$\begingroup$

This is different but you may find it useful. The second line will be evaluated in place code with panel, just Ctrl+9 to create an inline cell and type:

enter image description here

select this and evaluate in place with Ctrl+Shift+Enter

enter image description here

$\endgroup$
1
  • 3
    $\begingroup$ The code can also be Pane[HoldForm[\[Placeholder]], Full, Alignment -> Center], which can then be edited, in case the expression to be centered cannot be put into Mathematica code. (+1) $\endgroup$
    – Michael E2
    Apr 14, 2014 at 0:09
5
$\begingroup$

It turns out, after lots of poking around, that the fact that the cell is inline is not really the relevant thing. What is relevant is that each stylesheet has a property, LimitsPositioningTokens, that specifies which symbols should use the off-to-the-side limits positioning by default. For the Text style, that list includes all the usual things, including lim, $\Sigma$, and $\Pi$. Removing those symbols from the list produces the positioning that I wanted.

Additionally, it turns out that the portion of the book quoted in the original question was not imported --- it was all hand entered. There is a useful video here that describes the process of putting the interactive book together. It is only 30 minutes long, so it does not go into great detail, but there was a lot of useful information there if you are planning any kind of real doc-writing project in Mathematica.

$\endgroup$
3
$\begingroup$

The nested single-element GridBoxes make it likely that this format was generated by code. In fact, the inline cell expression matches exactly that generated by the Equal Symbol Aligned Math Cell from the Writing Assistant palette (in V9, at least):

screenshot showing the Writing Assistant palette

$\endgroup$
2
  • 1
    $\begingroup$ Yes, I noticed that as well. What I don't understand is that the palette element inserts an inline cell, so that constructs are built with inline visuals (for example, the limits on a sum are below and to the side, rather than above and below, the summation sign). And if I try to convert this to an equation style, either manually by editing the text in the notebook file or visually in the front end, the equal sign alignment is lost. I find document construction with Mathematica to be really difficult and not well documented. Is there a good discussion somewhere of how to do this? $\endgroup$
    – rogerl
    Apr 13, 2014 at 15:37
  • $\begingroup$ Oops, I somehow missed the comments to this effect under the question. I'm afraid I am not aware of a good resource for this. Judging from the source that ships with Mathematica, it would seem that WRI frequently writes box language directly to obtain finicky formatting -- bypassing not only the UI but also functions like Grid, etc. $\endgroup$
    – WReach
    Apr 13, 2014 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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