0
$\begingroup$

I feel Graphics will make text tilted. As

Text[Style["\!\(\*SuperscriptBox[\(R\), \(2\)]\)", 
  FontFamily -> "Times New Roman"]]

will output:

enter image description here

But

Graphics[
 Text[Style["\!\(\*SuperscriptBox[\(R\), \(2\)]\)", 
   FontFamily -> "Times New Roman"]]]

will output: enter image description here

Obviously, the text in Graphics become tilted. What's the reason and how to fix it?

$\endgroup$
8
  • $\begingroup$ This is how graphics seems to work with text. see making-single-letters-non-italic-in-graphics-text-style-objects I can give you a workaround using rasterize if you want. But I do not know why Graphics changes it to italic. It seems build in. $\endgroup$
    – Nasser
    Jun 4 at 6:02
  • $\begingroup$ @Nasser Thanks a lot. I will close this post a few minutes later. $\endgroup$
    – Y. zeng
    Jun 4 at 6:22
  • $\begingroup$ I think you should wait few days. May be someone will come with an idea or some other solution? I never noticed this myself before. $\endgroup$
    – Nasser
    Jun 4 at 6:25
  • $\begingroup$ @Nasser Try this Graphics[ Text[Style["\!\(\*SuperscriptBox[\(Ca\), \(\(2\)\(+\)\)]\)", FontFamily -> "Times New Roman"]]], you will find this is not tilted, and it is just sometimes tilted for some characters. $\endgroup$
    – Y. zeng
    Jun 4 at 6:35
  • $\begingroup$ To tell you the truth, I myself use MaTeX/Latex for all my labeling and texts of plots and graphics in Mathematica for school. It looks better and do not have to deal with such issues. $\endgroup$
    – Nasser
    Jun 4 at 6:39

1 Answer 1

2
$\begingroup$

The issue is due to the fact that you write R squared. Mma automatically makes it Italic. There is a simple workaround: write R in quotes: "R", but the power outside of the quotes, like in the image below:

enter image description here

That is:

Graphics[Text[Style[("R")^2, FontFamily -> "Times"]]]

Another way is to use the option SingleLetterItalics -> False:

Graphics[Text[Style[R^2, FontFamily -> "Times", SingleLetterItalics -> False]]]

with the following effect:

enter image description here

Have fun!

$\endgroup$
5
  • $\begingroup$ So Mathematica only will tilt the R^2, not to most characters. Am I right? $\endgroup$
    – Y. zeng
    Jun 4 at 10:45
  • $\begingroup$ @Y. zeng You are right. Es makes Italics any letter with super- and/or subscript. $\endgroup$ Jun 4 at 19:05
  • $\begingroup$ What is Es? $\endgroup$
    – Y. zeng
    Jun 6 at 2:18
  • $\begingroup$ Excuse me, it should be "It" instead of "Es". Its a miswriting. $\endgroup$ Jun 6 at 6:26
  • $\begingroup$ Okay. Thanks a lot. $\endgroup$
    – Y. zeng
    Jun 6 at 6:47

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.