2
$\begingroup$

Bug introduced in 12.3 or earlier and persisting through 13.1.0 [CASE:4900891]


Notice how the "f" is partially cutoff in the following inline cell.

Text

Here is the textual form.

CellPrint[
 Cell[TextData[{
     "This is some text. Consider the function ",
     Cell[BoxData[
        FormBox[
          RowBox[{
             RowBox[{"f", "(", "x", ")"}], "=", 
             SuperscriptBox["x", "2"]}], TraditionalForm]],
       FormatType -> TraditionalForm],
     "."
    }], "Text", FontFamily -> "Times New Roman"]]

I can manually add a space in front of the "f" as a hack-ish fix. But is there a better way?

(I'm currently on MMA 13.0 for Mac OS (Apple Silicon) w/ MB Pro 16" macOS Monterey 12.2. But the same thing was happening on MMA 12.3 with the same machine.)

$\endgroup$
1
  • 1
    $\begingroup$ It is cut off in version 13.0.0 on Windows 10 x64: screenshot. In version 12.3.1 on the same machine it is OK on 100% Magnification, but with Magnification 125% it is also partially cut off: screenshot. Hence it strongly depends on the Magnification setting. $\endgroup$ Commented Jan 29, 2022 at 4:50

2 Answers 2

2
$\begingroup$

I reproduce the issue with version 13.0.0 on Windows 10 x64 (screenshot). With version 12.3.1 on the same machine it looks OK on 100% Magnification, but with Magnification 125% it is also partially cut off: screenshot. Hence it strongly depends on the Magnification setting. With version 8.0.4 installed on the same machine, the problem doesn't reproduce independently on the Magnification.

The simplest workaround is to not use inline cells:

CellPrint[Cell[
  BoxData[RowBox[{"This is some text. Consider the function ", 
     FormBox[RowBox[{RowBox[{"f", "(", "x", ")"}], "=", SuperscriptBox["x", "2"]}], 
      TraditionalForm], "."}]], "Text", FontFamily -> "Times New Roman"]]

screenshot

It is worth to point out that the size of the text in the FromBox is determined incorrectly:

CellPrint[Cell[
  BoxData[RowBox[{"This is some text. Consider the function ", 
     FormBox[RowBox[{RowBox[{"f", "(", "x", ")"}], "=", SuperscriptBox["x", "2"]}], 
      TraditionalForm, BaseStyle -> {Background -> Yellow}], "."}]], "Text", 
  FontFamily -> "Times New Roman"]]

screesnhot

Apparently this is the reason why the first character is cut off in the inline cell.

Since incorrect determination of the sizes of textual elements is a well-known "unsolvable" problem of Mathematica, I think the default behavior for cell rendering should be do not cut off textual elements going beyond the cell. Currently they are cut off not only for inline, but also for ordinary cells:

CellPrint[Cell[
  BoxData[FormBox[RowBox[{RowBox[{"f", "(", "x", ")"}], "=", SuperscriptBox["x", "2"]}], 
    TraditionalForm]], "Text", FontFamily -> "Times New Roman"]]

screenshot

It is interesting that version 8.0.4 installed on the same machine has no such problem independently on the Magnification:

CellPrint[
 Cell[BoxData[
   FormBox[RowBox[{RowBox[{"f", "(", "x", ")"}], "=", 
      SuperscriptBox["x", "2"]}], TraditionalForm]], "Text", 
  FontFamily -> "Times New Roman", Magnification -> 3]]

screenshot

screesnhot

I think current behavior should be considered as a regression bug in rendering of Cells (both inline and ordinary). Reported it to the support as [CASE:4900891]. Here is the response:

Thank you for taking the time to send your report.

It does appear that CellPrint is not behaving properly. I have forwarded an issue report to our developers with the information you provided, and added your contact information to the report so that you can be notified when it is resolved.

As one can see from the response, the subject-matter expertise of the support engineer isn't good in this case (it is not CellPrint, but FrontEnd's rendering of Cell is not proper). But it is good that the issue is registered.

$\endgroup$
5
  • $\begingroup$ Thank you for the excellent response and follow-up. $\endgroup$
    – bmclaurin
    Commented Jan 29, 2022 at 22:39
  • $\begingroup$ @bmclaurin I updated the answer with the response from the support. $\endgroup$ Commented Feb 1, 2022 at 8:16
  • $\begingroup$ Thank you, hoping they fix this in a future update. $\endgroup$
    – bmclaurin
    Commented Feb 2, 2022 at 21:38
  • $\begingroup$ Unfortunately, this was not fixed in 13.01, which was released a few days ago. $\endgroup$
    – bmclaurin
    Commented Feb 22, 2022 at 19:46
  • 1
    $\begingroup$ @bmclaurin You can report it too: the more times a bug is reported, the higher priority is assigned to it. $\endgroup$ Commented Feb 23, 2022 at 4:21
3
$\begingroup$

Does not appear to be cut off in version 12.3 on windows 10.

enter image description here

$\endgroup$
6
  • 1
    $\begingroup$ Interesting. I'm currently on MMA 13.0 for Mac OS (Apple Silicon) w/ MB Pro 16" macOS Monterey 12.2. But the same thing was happening on MMA 12.3 with the same machine. Can anybody else on MacOS check this? Thanks. $\endgroup$
    – bmclaurin
    Commented Jan 28, 2022 at 22:23
  • 2
    $\begingroup$ I think this post should be converted into a comment since it doesn't provide an answer to the original question. $\endgroup$ Commented Jan 29, 2022 at 11:19
  • $\begingroup$ I agree, but posting an answerer was the only way I knew of to include an image. How does one include a link to an image in a comment? $\endgroup$ Commented Jan 29, 2022 at 21:50
  • $\begingroup$ You can use the standard markdown for making a hyperlink: [Google](https://www.google.com/). $\endgroup$ Commented Jan 30, 2022 at 4:14
  • $\begingroup$ If you need to upload an image, the simplest way is to press the "edit" button under the question and insert (upload) the image there, then copy the created URL from the code of the post (at the bottom). Then cancel the edit. $\endgroup$ Commented Jan 30, 2022 at 4:17

Your Answer

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

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