6

I am creating a figure for a document using Graphics in which there is Text with some variables and again those same variables with some subscripts. The Text with subscript is automatically Italic. I do not want this, especially because it contrasts with the variables without subscript which are not Italic. How can I change this behaviour?

LBogaardt
  • 1,595
  • 1
  • 11
  • 21

3 Answers3

5

I think this is nice, easy way to do it that will not affect the displayed font,

Graphics[Text[Style[Subscript["P", "q"], 36], {1/2, 0}], ImageSize -> Tiny]

pq

Update

The OP asks, "Is there an easy way to use this trick within a sentence?"

I ask, what is easy? But here is something using Row and not too difficult.

Graphics[
  Text[Row[{"The variable ", Subscript["P", "q"], " is positive"}], {0, 0}],
  BaseStyle -> {FontSize -> 14},
  AspectRatio -> 1/6,
  ImageSize -> Small]

sentence

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
5

While I think that m_goldberg's solution is the simplest when you type the text by hands, here is the convenient way to disable italicization of single letters which will work in all cases:

Graphics[Text[
  Style[Subscript[P, q], 36, "SingleLetterItalics" -> False], {1/2, 
   0}], ImageSize -> Tiny]

graph

Alexey Popkov
  • 61,809
  • 7
  • 149
  • 368
1

Use the option FormatType -> StandardForm inside Text.

Using the example in OP's comment:

Graphics[{Circle[], 
          Text[Style["P", 32], {0, 0}], 
          Text[Style[Subscript[P, q], 32], {1/4, 0}], 
          Text[Style[Subscript[P, q], 32], {2/4, 0}, FormatType -> StandardForm]}]

enter image description here

kglr
  • 394,356
  • 18
  • 477
  • 896
  • Interesting how 'Text[Style[Subscript["P", "q"], 36], {1/2, 0}]' and 'Text[Style[Subscript[P, q], 36], {1/2, 0}]' makes a difference. – LBogaardt Aug 12 '14 at 11:07