The Physics Typesetting is too advanced to be used as a template and relies on internal Physics subroutines. But giving a look for instance to `print/casesplit/ans` you can get the idea: s is a Typesetting structure representing "how it is going to look", t is the actual thing being displayed (so not how it looks), then Typesetting:-mcomplete(s, t) looks the way you want (like s), and copy & paste correctly (like t). So all you need is to experiment a bit with creating a Typesetting structure that looks the way you want. For that, you can use the palettes.
Example: use the Fenced palette to produce <A, B> with good typesetting, then mark it with the mouse, right-click > 2D-Math > convert to atomic variable, then lprint it, and you will get this:
`#mrow(mfenced(mrow(mi("A"),mo(","),mi("B")),open = "⟨",close = "⟩"),mo("⁢"))`
Indeed, copy that cryptic stuff and paste it, press enter, and you see the nice <A, B>. You can even play around adding or removing stuff to see how you can tweak it.
Next remove those enclosing `` and # and suffix all functions with Typesetting:-. You will now get a Maple Typesetting function, that displays the same way:
Typesetting:-mrow(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi("A"),Typesetting:-mo(","),Typesetting:-mi("B")),open = "⟨",close = "⟩"),Typesetting:-mo("⁢")
Now that you have how it should look you insert this block in your print/foo to produce that s. Then construct the t, that is the easy part - say for f([a,b,c]) ,t is just that, f([a,b,c]). Taking that `print/casesplit/ans` as template, next is to return using Typesetting:-mcomplete. And you get what you want. After one or two you see you can produce excellent print/foo routines with ease.
Finally, a tip for taking advantage of typesetting already coded, that you see there. Suppose you want to reproduce the typesetting of a Ket. Go with this:
Typesetting:-mcomplete(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mspace(width = "0.3em"),Typesetting:-mi("A"),Typesetting:-mspace(width = "0.3em")),open = "|",close = "⟩"),Typesetting:-_Hold([Physics:-Ket(A)]))
That is mostly all you need. You see the s and the t you can use as you see used in print/casesplit/ans.
It's been some years now that I am about to write a new Physics export, an Applet so that one could insert "how it should look" and "what it is" and get a related print/... routine ready for use. Such a thing would be useful in Physics where the notation can be rather intricate.
Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft