Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have several formulas I would like to place at specific coordinates in a Graphics object I have already created. I need to be able to choose bold or not as well as how large to make it. I am unsure how to control the size of the text as well as why Mathematica will not place it. Specifically, it continues to try to evaluate my text. One of the objects I wish to place on the plot is (since it won't let me post a picture)

$$M^\mu = \oplus_{\lambda \ge \mu} \,m \, \lambda_\mu \, S^\mu$$

However, Mathematica continues to try to evaluate the direct sum rather than just place it at say the point (0,0).

Here is the code I am trying at the moment:

Graphics[{Style[HoldForm[M^μ == \!\(*UnderscriptBox[(StandardForm[⊕]), (λ ≥ μ)]\) m Subscript[λ, μ] S^μ], Medium], FormatType -> StandardForm}]

Any ideas?

share|improve this question
2  
Have a look at HoldForm. –  Andy Ross Dec 5 '12 at 2:09
    
I had tried hold form, but it still does not like the format. Here is the code I am trying at the moment. Graphics[{Style[HoldForm[M^[Mu] == \!(*UnderscriptBox[(StandardForm[[CirclePlus]]), ([Lambda] \ [GreaterEqual] [Mu])]) m Subscript[[Lambda], [Mu]] S^[Mu]], Medium], FormatType -> StandardForm}] –  Caleb Dec 5 '12 at 2:29

4 Answers 4

You may be interested to know that you can enter formatted (e.g. subscript, superscript) expression within a String, delimited by " ". Further, you can select elements of this string and size, position, and color them, using Alt+- / Alt++, Alt+(cursor key), and the formatting menu (or keyboard shortcuts). You can also use Eplilog and Text to place this string inside a Plot graphic:

Mathematica graphics

Note that the string is displayed, by default, in TraditionalForm, but you can use StandardForm[string] to override this.

share|improve this answer

Create the Graphics, then go to Graphics -> Drawing Tools, click the Mathematica Text button on the palette (looks like a Σ), click on the graphic, and type your formula as you normally would. Use Format -> Size to set the size.

I just made this using this method:

enter image description here

share|improve this answer
    
Yes, this was exactly the type of thing I was looking for, simple too! It's been so long since I've used the Graphics tool without having to program something I'd forgotten all about it. Thank you! –  Caleb Dec 5 '12 at 4:01
    
But annotations added with the Drawing Tools are evanescent: re-evaluate the input and the annotations will no longer be in the new output. –  murray Dec 5 '12 at 20:12

You might try the Mathematica Graphics primitive Text as a way to solve your problem. This allows very fine adjustment of position.

Here is an example:

Graphics[{Circle[], 
   Text[Style[(M^μ == Subscript[S, (l ≥ u)]), Bold, 16, 
        FontFamily -> "Helvetica"], {0., 0.}, {0., 0.}]}, 
   ImageSize -> Small]

which gives the result

enter image description here

share|improve this answer

I use this method all the time, but I'm far, far, far from a "good" user.

But this method lets you put math ANYWHERE, in a graphic, a table, etc.

Easier to do than explain in a text response.

Type what you want into a text cell.

Show expression on the cell.

Eg.... I typed the following into a text cell..

enter image description here

Then "Show Expression" on the cell.... you get this....

    Cell[TextData[Cell[BoxData[
 FormBox[
  RowBox[{"y", "=", 
   RowBox[{
    RowBox[{"2", 
     SuperscriptBox["x", "2"]}], "-", 
    SqrtBox["b"]}]}], TraditionalForm]],
 FormatType->"TraditionalForm"]], "Text"]

Copy the entire expression and paste into an input cell

Wrap this in Text[DisplayForm [ expr ]

So, for the above, you get

  Text[DisplayForm[FormBox[
  RowBox[{"y", "=", 
   RowBox[{
    RowBox[{"2", 
     SuperscriptBox["x", "2"]}], "-", 
    SqrtBox["b"]}]}], TraditionalForm]]]

You can now use this "Text" package anywhere....

As an example

    Graphics[{

  Circle[],

  Text[DisplayForm[FormBox[
       StyleBox[
         RowBox[{"y", " ", "=", " ", 
            RowBox[{
               SubscriptBox["log", 
                 FractionBox["1", 2]], "x"}]}],
         FontSize -> 36, FontColor -> Red], TraditionalForm]], {0, 
    0}]

  }]
share|improve this answer
    
Tom, I haven't tried this method yet. Have you tried mine? Where would one prefer this over styling a String? –  Mr.Wizard Apr 12 '13 at 14:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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