Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Define an output format for objects that can be copy-pasted as the original expression
ResourceFunction["AddCustomTypesetting"][symbol, fun] creates a MakeBoxes rule that will typeset any expression of the form symbol[…] as fun[symbol[…]], but still copies as the original expression. | |
ResourceFunction["AddCustomTypesetting"][patt, fun] creates a MakeBoxes rule for any expression matching pattern patt. | |
ResourceFunction["AddCustomTypesetting"][spec, fun, limit] defines a custom ByteCount limit for embedding the full expression in the notebook. | |
Make NonCommutativeMultiply appear as a CenterDot multiplication:
In[1]:= | ![]() |
In[2]:= | ![]() |
Out[3]= | ![]() |
Copy-paste the output and check that it still represents the original expression:
In[4]:= | ![]() |
Out[4]= | ![]() |
The noncommutativity holds:
In[5]:= | ![]() |
Out[14]= | ![]() |
Remove the custom typesetting rule:
In[15]:= | ![]() |
In[16]:= | ![]() |
Out[16]= | ![]() |
Define a custom data object that formats as a summary panel:
In[17]:= | ![]() |
In[18]:= | ![]() |
Out[18]= | ![]() |
The panel still works as an input expression:
In[19]:= | ![]() |
Out[19]= | ![]() |
If the underlying expression is very large, it will not be automatically embedded into the notebook:
In[20]:= | ![]() |
Out[20]= | ![]() |
Set a very low ByteCount limit for embedding the expression:
In[21]:= | ![]() |
In[22]:= | ![]() |
Out[22]= | ![]() |
In[23]:= | ![]() |
Out[23]= | ![]() |
Typeset differently depending on the format:
In[24]:= | ![]() |
In[25]:= | ![]() |
Out[25]= | ![]() |
In[26]:= | ![]() |
Out[26]= | ![]() |
Make a custom object that still looks like the original expression:
In[27]:= | ![]() |
In[28]:= | ![]() |
Out[28]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License