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?
Asked
Active
Viewed 2,562 times
6
LBogaardt
- 1,595
- 1
- 11
- 21
3 Answers
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]

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]

m_goldberg
- 107,779
- 16
- 103
- 257
-
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
-
It is because in the first case P is a String while in the second case it is a variable. – Alexey Popkov Aug 12 '14 at 14:14
-
Is there an easy way to use this trick within a sentence? As in something like 'Text["The variable"<>Subscript["P", "q"]<>"is positive", {0, 0}]'. – LBogaardt Aug 20 '14 at 18:18
-
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]

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]}]

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
Text[yourtext, FormatType -> StandardForm]give what you need? – kglr Aug 10 '14 at 19:06Text[Style[Subscript["P", "q"], 32], {2/4, 0}]– m_goldberg Aug 11 '14 at 03:31