SetDirectory[NotebookDirectory[]];
ClearAll["`*"]
i=PauliMatrix[0];x=PauliMatrix[1];y=PauliMatrix[2];z=PauliMatrix[3];
mList=Flatten[Table[KroneckerProduct[i1,i2,i3],{i1,{i,x,y,z}},{i2,{i,x,y,z}},{i3,{i,x,y,z}}],2];(*所有Γ矩阵的集合*)
namelist=Style[#,Blue,20,FontFamily->"Times New Roman"]&/@Flatten@Table[StringJoin[i3,"⊗",i2,"⊗",i1],{i1,{"(Subscript[τ, 0])","(Subscript[τ, x])","(Subscript[τ, y])","(Subscript[τ, z])"}},{i2,{"(Subscript[s, 0])","(Subscript[s, x])","(Subscript[s, y])","(Subscript[s, z])"}},{i3,{"(Subscript[σ, 0])","(Subscript[σ, x])","(Subscript[σ, y])","(Subscript[σ, z])"}}];(*所有可能的基矢直积*)
m1=KroneckerProduct[z,i,z];
b1=Flatten[Table[{(Subscript[C, i1,i2,i3])},{i1,{"a","b"}},{i2,{"↑","↓"}},{i3,{"k","-k"}}],2];
b1t=Flatten[Table[(Subscript[(SuperPlus[C]), i1,i2,i3]),{i1,{"a","b"}},{i2,{"↑","↓"}},{i3,{"k","-k"}}]];
SQmat[n_]:=Module[{},{namelist[[n]],Style[(b1t.mList[[n]].b1)[[1]],Black,16,FontFamily->"Times New Roman"]}]
SQmatList=Table[SQmat[n],{n,1,Length[mList]}];
TRSgrid=Grid[Prepend[Prepend[SQmatList,Style[#,Lighter@Red,16,FontFamily->"Times New Roman"]&/@{"Mass Term","Operator"}],{Style["二次量子化表示",Lighter@Red,16,FontFamily->"Times New Roman"],SpanFromLeft}],Background->{None,{Lighter[Yellow,.9],{White,Lighter[Blend[{Blue,Green}],.8]}}},Dividers->{{Darker[Gray,.6],{Lighter[Gray,.5]},Darker[Gray,.6]},{Darker[Gray,.6],Darker[Gray,.6],{False},Darker[Gray,.6]}},Frame->Darker[Gray,.6],ItemStyle->14,Spacings->{Automatic,.8}]