\ell with argument in legend

I want to have

as a Legend in a figure.

But don't get further than

• 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"]}] May 25 at 9:19
• 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. May 25 at 10:15
• 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. May 25 at 13:44

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

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.