7
$\begingroup$

In Mathematica 11.1 and earlier it was possible to select just part of the text in a cell, and apply a different style to it using Format → Style. For example, we could type "One two three four" in a "Text" cell, select "three" and apply the "Program" style:

enter image description here

The cell expression would look like this:

Cell[TextData[{
 "One two ",
 StyleBox["three", "Program"],
 " four."
}], "Text"]

In Mathematica 11.2, using Format → Style when only part of a cell is selected changes the style of the entire cell. Performing the same steps results in:

Cell["One two three four.", "Program"]

How can I change the style of just part of a cell in M11.2?


Related:

$\endgroup$
20
  • 1
    $\begingroup$ @Kuba That's weird because I thought that the Style font end token was exactly the same thing as the Style menu item in the Format menu. $\endgroup$
    – Szabolcs
    Commented Sep 24, 2017 at 9:47
  • 2
    $\begingroup$ At least on OSX, you can use Alt-0 on the selected text to do what you want. $\endgroup$
    – Carl Woll
    Commented Sep 24, 2017 at 15:10
  • 2
    $\begingroup$ @CarlWoll 1. Thank goodness that has not changed. 2. This is good behavior, but we should be able to also use Alt-0 as we are typing along (without first creating a format box). 3. I consider the new behavior buggy and have reported it to Support. If you hear any debate over this, please ask the debaters to go through the process of typing a long text cell with many formatted text fragments. As soon as they reach for the mouse, put them in time out. $\endgroup$
    – Alan
    Commented Sep 24, 2017 at 15:53
  • 1
    $\begingroup$ @CarlWoll I am using Win 10 with Mma 11.1. But I'm confused. Previously you said "Alt-0 behaves similarly to Alt-8" and you also reported that you needed to use ctrl-( before using Alt-8. But we should not have to use ctrl-(. Additionally, doing so will create an entire inline Cell wrapping a FormBox that wraps a StyleBox. I just want to insert a StyleBox, like Alt-8 does in Mma 11.1 under Win 10. Bottom line: it should be as easy as possible to type with style, and the new (11.2) behavior is apparently breaking this. $\endgroup$
    – Alan
    Commented Sep 24, 2017 at 16:27
  • 1
    $\begingroup$ In 11.3, we've changed it so that if you have a non-empty selection, it will apply the style to the selection. But if you have an empty selection (blinking caret), it will apply to the whole cell. I think that strikes the right balance of what we were trying to achieve. $\endgroup$
    – John Fultz
    Commented Sep 25, 2017 at 21:29

0

Your Answer

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