Epilog -> 
     {Text["Al" <> ToString[x]<>"Ga" <> ToString[1 - x] <> "As", {0.5, 2}]}],
  {x, 0, 1}]

But I want the values of x and 1 - x to appear as subscripts in the text string. How cam I do this?


closed as off-topic by m_goldberg, MarcoB, Carl Lange, LCarvalho, LouisB May 17 at 11:58

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, MarcoB, Carl Lange, LCarvalho, LouisB
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    $\begingroup$ Why does it have to be a string? I would do Row[{Subscript["Al", x], Subscript["Ga", 1 - x], "As"}] instead. $\endgroup$ – Carl Woll Apr 27 at 1:21

As Carl Woll say in his comment, this better done with Row.

  Plot[{}, {x, 0, 1}, 
    PlotLabel -> Row[{Subscript["Al", u], Subscript["Ga", 1 - u], "As"}]],
  {{u, 0, "Al"}, {0, 1}, SetterBar}]


  • $\begingroup$ Thanks! I was able to get this to work using Row. Although the Epilog with Text gave me more flexibility to locate the label. $\endgroup$ – Brian Apr 27 at 10:54
  • $\begingroup$ @Brian. This was only meant to illustrate the use of Row and SetterBar, so I didn't worry about placement, which wasn't relevant to you problem. I'm glad you found the answer helpful. Please consider accepting it. You can do that by clicking on the check mark that appears on the left of the answer below the down arrow. $\endgroup$ – m_goldberg Apr 27 at 15:40

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