I am pretty sure you are not looking for this, because this will need some work before you can actually do anything useful with it.
I am not familiar with the linked package neither am I familiar with quantum mechanics in any stretch of the imagination.
In case you are interested in a quick way to typeset some expression and you are not trying to do something too complicated then please do read on.
Using Format
you can specify how certain expressions are typeset by the front end.
In order to replicate the equation in the question we need to define the following:
(* an expression to represent subscripted expressions *)
Format[subs[body_, sub_]] := Subscript[body, sub]
Evaluating the former and then evaluating eg subs[x,1]
will produce in a notebook
a subscripted x
with the subscript being 1
.
Evaluating, in turn subs[x,1] // FullForm
will reveal what is actually going on. The front end displays the expression using the rule defined with Format
but the actual expression is still subs[x,1]
. Roughly speaking, that means that one can define rules for objects with Head
subs
and have them displayed in a subscripted form.
In a similar fashion, we can define a display rule for the ket notation:
Format[ket[body_]] := Row[{"\[LeftBracketingBar]", body, "\[RightAngleBracket]"}]
After evaluating the line above, one can demonstrate how eg ket[x]
displays in a notebook. Also, one can verify that eg subs[ket[x],1]
produces the expected result ie a subscripted ket notation for x
and a subscript of 1
.
Again, using FullForm
will show that the underlying expressions remain unchanged ie FullForm[subs[ket[x], 1]]
should display the typed expression.
Continuing in a similar manner we can define display rules for the ket notation with up and down double stroked arrows:
Format[upket[]] := Row[{"\[LeftBracketingBar]", "\[DoubleUpArrow]",
"\[RightAngleBracket]"}]
Format[downket[]] := Row[{"\[LeftBracketingBar]", "\[DoubleDownArrow]",
"\[RightAngleBracket]"}]
Please verify that evaluating expressions like eq subs[upket[], 1]
or subs[downket[], 2]
produces the anticipated results.
Having defined the rules for displaying subscripted expressions and the ket notation, it is trivial to reproduce the equation in the question:
a = 2;
b = Sqrt[3];
expr = subs[ket[ψ], subs[t, 2]] == a subs[upket[], 1] subs[downket[], 2] +
b subs[downket[], 1] subs[upket[], 2];
This is how expr
is displayed:

and this is the FullForm
:

Edit:
In order to address issues of non-commutativity a quick solution is to add the following Format
rule:
Format[nonCommutativeTimes[x__subs]] := Star[x]
and modify the expr
accordingly:
expr = subs[ket[ψ], subs[t, 2]] == a nonCommutativeTimes[subs[upket[], 1],
subs[downket[], 2]] + b nonCommutativeTimes[subs[downket[], 1], subs[upket[], 2]]
Evaluating, like before, produces the following:

Like I said in the introduction, this is not intended to replace any specialized package or other functionality but is only presented here as a quick way to obtain the desired result.
If one intends to work with eg algebraic expressions involving subs
and ket
then they should define the relevant functionality from scratch, or almost from scratch. For example, as far as non-commutative multiplication is concerned, there is a built-in symbol NonCommutativeMultiply
which can be used instead of the nonCommutativeTimes
Head
I used above.