2
$\begingroup$

I want to use a symbol to distinguish $\lambda$ in one coordinate set from another $\lambda$ in another set. Traditionally, we'd use a prime symbol ' to do this (e.g. $\lambda'$). I tried using this trick in Mathematica in order to keep this symbol from being interpreted as a derivative operation:

MakeBoxes[lambdaPrime, StandardForm] := SuperscriptBox["\[Lambda]", "'"];
MakeExpression[SuperscriptBox["\[Lambda]", "'"], StandardForm] := MakeExpression["lambdaPrime", StandardForm];

Functionally, this works great. I used it for all my fancy notations, but the typesetting looks strange. You get a tiny little ' mark way above the $\lambda$. Is there a way of accomplishing the same thing with a box that is neither a super or subscript? (Yes, I know we can use some freakish character that kind of looks like a ', but isn't). I'm thinking of something like this:

MakeBoxes[lambdaPrime, StandardForm] := Box["\[Lambda]", "'"];
MakeExpression[Box["\[Lambda]", "'"], StandardForm] := MakeExpression["lambdaPrime", StandardForm];
$\endgroup$

1 Answer 1

2
$\begingroup$

Actually, Mathematica was kind enough to tell me. If you do this:

In[] = ToBoxes[λ']
Out[] = SuperscriptBox["\[Lambda]", "\[Prime]", MultilineFunction -> None]

You can then make your boxes out of these characters:

MakeBoxes[lambdaPrime, StandardForm] := SuperscriptBox["\[Lambda]", "\[Prime]"];
MakeExpression[SuperscriptBox["\[Lambda]", "\[Prime]"], StandardForm] := MakeExpression["lambdaPrime", StandardForm];

They work great and look great!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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