2
$\begingroup$

I have a notational reason (using the Notations package) to have some symbols display as C*60 (with the 60 lined up under the *). Internally, this is represented in Mathematica as:

\!\(\*SubsuperscriptBox[\(C\), \(60\), \(*\)]\)

However, whenever I do something that executes this, it converts to (C60)*, which is internally represented as:

SuperStar[(Subscript[C, 60])]

I am needing to pass the original version, a SubsuperscriptBox, to a function and then convert it to:

SubsuperscriptBox["C", "60", "*"]

So that I can use it as the left-hand side of a Notation statement (within a ParsedBoxWrapper), but I cannot seem to get it there. I am happy passing either the original subsuperscript version or a string version of it. Are there any methods to do the conversion I am looking for? Thanks!

Edit to add requested specific detail:

I start with this:

<< Notation`

I then introduce a bunch of custom notation that doesn't figure in to the problem I am experiencing (I am generating a notation system that allows me to represent and manipulate chemical reactions using Chemistry-standard notation). After I set up the reaction arrow notation and several other components, I wish to have a streamlined method to assign labels for chemical species to internal variable/function names. I can do this manually one at a time like this:

Line by line assignments

But because this is a package I want my students to be able to use, I would prefer for them to not have to use the palettes. I would like to define a function for them to pass a list of pairs to, like this:

list approach with symbols

Or perhaps like this:

list approach with strings

I have successfully done something similar in cases where I don't have the starred-superscript, so in those cases I am confident that I can write the AssignLabels function. For a single assignment (with two parameters rather than a list of ordered pairs), it would look something like this:

enter image description here

The problem is that while I can enter the enter image description here and have it interpreted exactly as I need it to, as

SubsuperscriptBox["C", "60", "*"] 

when I directly put it into the Notation palette box, when I assign it to a variable or pass it to a function, it gets interpreted into

SuperStar[(Subscript[C, 60])]

And if I try to maintain the structure by making it a string, I cannot find a set of function calls that will convert it back to the desired target.

Does that help clarify my question?

$\endgroup$
6
  • 1
    $\begingroup$ Could you provide more details of what you're doing? $\endgroup$ Commented Apr 5, 2019 at 5:21
  • $\begingroup$ Question edited to add more details. Let me know if it isn't sufficient. Thanks! $\endgroup$ Commented Apr 5, 2019 at 22:28
  • 1
    $\begingroup$ Hi Kevin, I hope you will make your package available for everyone in thè package repository when it is finished $\endgroup$ Commented Apr 6, 2019 at 15:31
  • $\begingroup$ Thanks for the suggestion, magma! Yes, I hope to disseminate my package, and the package repository is a great place to put it. I have a lot of chemical quantum mechanics materials as well that I hope to disseminate. Highest priority is publication in peer-reviewed journals, because I am a faculty member chasing tenure, but I definitely want this material available generally as well. $\endgroup$ Commented Apr 6, 2019 at 18:44
  • $\begingroup$ @magma: I have just uploaded my package to the package repository. Until it is approved, you can access it here: kevinausman.net/home/complex-symbols-package $\endgroup$ Commented Jun 23, 2019 at 21:27

1 Answer 1

2
$\begingroup$

The simplest possibility is to just accept the fact that Mathematica parses SubsuperscriptBox["C", "60", "*"] as SuperStar[Subscript[C, 60]] and use:

AssignLabel[SuperStar[Subscript[b_, s_]], sym_Symbol] := Notation[
    DoubleLongLeftRightArrow[
        ParsedBoxWrapper @ SubsuperscriptBox[MakeBoxes[b], MakeBoxes[s], "*"],
        ParsedBoxWrapper @ SymbolName[sym]
    ]
]

Other possibilities are to create an alias that has additional pieces that prevent it from being interpreted as SuperStar or Power. I could provide an answer along those lines if you're interested.

$\endgroup$
1
  • $\begingroup$ I am extremely interested in such a solution. Thanks! $\endgroup$ Commented Apr 6, 2019 at 15:19

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.