2
$\begingroup$

I need to write infidelity number $\bar{F}=6.82\times 10^{-6}$ inside a plot. I tried using Epilog with TeXForm but could not succeed. It prints $\frac{1}{10^6}$ instead of $10^{-6}$. Any help? Thanks.

$\endgroup$
  • $\begingroup$ I didn't get why do you need TeXForm, but what you want can be done as simple as: Plot[Sin[x],{x,0,1}, Epilog -> Text[Row[{OverBar[F], "\[ThinSpace]=\[ThinSpace]", 6.82/10^6}],{0.5,0.5}]]. $\endgroup$ – Alx May 10 at 12:47
  • $\begingroup$ Thanks. I was using TeXForm because it gives me a nice $\times$ sign. And I would prefer $10^{-6}$ instead of taking it into the denominator (due to lack of vertical space inside the figure). $\endgroup$ – user72617 May 10 at 14:47
  • $\begingroup$ TeXForm does not output $\times$. It might output \times, but not $\times$. It is unclear what you mean. Do you want to display TeX code? TeXForm produces TeX code. Or do you want to display formatted math? I wrote my answer with the latter in mind, assuming that your question is about how to format the result, not about how to use Epilog or Text. $\endgroup$ – Szabolcs May 10 at 16:26
2
$\begingroup$

To expand on the other answers, using Inset and MaTeX

<< MaTeX`
LaTeXStuff = MaTeX["\\bar F = 6.45\\times 10^{-6}"];
Plot[Sin[x], {x, 0, 2 Pi}, Epilog -> Inset[LaTeXStuff, {4, .5}]]

enter image description here

| improve this answer | |
$\endgroup$
2
$\begingroup$

You can use Inset like this:

f = 6.82*^-6;

inset = Inset[
   Style[StringForm["F = ``", ScientificForm[f]], 14],
   Scaled[{.65, .75}], Scaled[{.5, .5}], Scaled[.3]
   ];

Plot[Sin[x], {x, 0, 2 Pi}, Epilog -> inset]

enter image description here

Kind regards,

David

| improve this answer | |
$\endgroup$
1
$\begingroup$

Method 1:

  • Type in a string such as "x".
  • Select the x only. Convert to TraditionalForm (on macOS, Command-Shift-T)
  • Press Left-Arrow, then delete the x and start typing: F Ctrl-7 _ Right-Arrow 6.82 Esc * Esc 10 Ctrl-6 -6 Right-Arrow

Method 2:

TraditionalForm@HoldForm[OverBar[F] == 6.45*^-6]

Method 3:

Use MaTeX.

<< MaTeX`

MaTeX["\\bar F = 6.45\\times 10^{-6}"]
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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