0
$\begingroup$

I want to have enter image description here

as a Legend in a figure.

But don't get further than

enter image description here

$\endgroup$
3
  • $\begingroup$ test1 = Plot[X^2, {X, 0, 10}, PlotStyle -> {{RGBColor[0.5, 0.5, 0.5], Dashing[{0.1, 0.01}]}}, PlotLegends -> {Style[ Subscript[ToExpression["\\ell", TeXForm], L] "[Lambda]", FontSize -> 20, FontFamily -> "Times"]}] $\endgroup$
    – Purple
    May 25 at 9:19
  • $\begingroup$ You are trying to attach display items together by just writing one after the other. That is multiplication. Multiplication is commutative (see Orderless) so Mathematica will re-arrange the terms. This is wrong for your use case: a b c. You want this instead of Row[{a, b, c}]. That said, I suggest writing plot labels directly inside of strings, as I demonstrate in the answer below. $\endgroup$
    – Szabolcs
    May 25 at 10:15
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    May 25 at 13:44
2
$\begingroup$

$\ell$ is written as \[ScriptL] in Mathematica. It can also by typed as ESC scl ESC.

To type $\ell_L^{(i)}(\lambda)$, and use it as a label, do the following:

  1. Type "\[ScriptL]"
  2. Select the $\ell$, then press Ctrl-Shift-T (Command-Shift-T on macOS) to convert it to Traditional Form. This ensures correct spacing in the formulas you are about to enter.
  3. Press <- to enter the Traditional Form inline cell you just created. There will be no visual indication that the cursor is within the inline cell.
  4. Press Ctrl-- to create a subscript, then enter L
  5. Press Ctrl-5 to jump to superscript, enter (i)
  6. Press -> to exit superscript, type ( ESC l ESC )

This is what it looks like on my machine:

enter image description here

Most of this is documented here: http://reference.wolfram.com/language/tutorial/TwoDimensionalExpressionInput.html You can also search for "two dimensional input".

Step 2. is critical to get good-looking output, but this is not documented very clearly anywhere I know of. Command-Shift-T is, but this specific usage of it to achieve good spacing in strings is not.

If you want a look that fits well with a LaTeX document, consider using my MaTeX package instead.

$\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.