Message Boards Message Boards

2
|
8921 Views
|
3 Replies
|
6 Total Likes
View groups...
Share
Share this post:

Variable Styles inside Text not supported any more?

In teaching Mathematica, I frequently annotate code with text cells that include System names and other small bits of code. Until now, if you were writing something like "The name for the number pi is Pi." you could highlight Pi, and covert it to Input style. In version 11.2, it I do this, the whole cell is converted to Input. Is there a new setting that overrides this behavior?

Ken Levasseur UMass Lowell

POSTED BY: Ken Levasseur
3 Replies

For now, you can work around it by using Cmd+0 (Mac) or Alt+0 (others) to set the style.

What happened:

Last year, we floated a proposal internally to tweak the behavior of named style application. In 11.1 (and for years earlier), if you type, say, Alt+7 (for Text style) in an empty cell, it converts the entire cell to Text. But if you do it in a non-empty cell, it only converts the things you are about to type to a Text StyleBox. The proposal was to make it consistent so that, at any point, if you have a blinking caret selection in a cell and apply a named style, it applies to the whole cell.

This would be an inconvenience to few cases where people might wish to apply named styles as they're typing inline, but it would be a convenience in other cases where one has accidentally started typing several characters or words into a cell without realizing that the wrong style had been selected. The proposal included the possibility of selecting a range of text and applying a style to that range specifically just as always had been possible, so the legacy usage would still have an easy way to be applied.

Unfortunately, we made a mistake and ended up causing named style application to always promote to the entire cell even if you have a range of text selected. This is already resolved in our internal nightly build, but did not get resolved in time for 11.2. My apologies for that.

In the mean time, the same change didn't get applied to the "Other..." style dialog, and so you can use that as a workaround.

POSTED BY: John Fultz

Thanks John

I’ll look forward to the fix.

Ken

POSTED BY: Ken Levasseur

I seem to be able to do it like this:

  • Select Pi
  • Control-9 (create inline cell)
  • convert to Input
  • Cell > Convert To > StandardForm Display

For the text "to enter pi, type Pi", the cell expression should be something like this:

Cell[TextData[{
 "To enter pi, type ",
 Cell[BoxData["Pi"], "Input"]
}], "Text",
 CellChangeTimes->{{3.716552891901293*^9, 3.716552931558848*^9}}]

I don't know whether there is a shorter way.

POSTED BY: Michael Rogers
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract