TaggingRules

TaggingRules
is an option for selections that specifies a list of strings to be associated with a selection.

DetailsDetails

  • TaggingRules provides a way of storing additional information with a selection, for example, to be used by other programs in processing a notebook. It can be set to a list of one or more strings.
  • With the default setting TaggingRules->None, no additional information is associated with the selection.
  • Typically, structured metadata is broken up into pieces that can be identified using selector names in the form "selector"->data. The selector can then be individually queried using CurrentValue[obj, {TaggingRules, "selector"}].
  • Another typical method for storing highly structured data is to use subselectors inside of selectors. For example, . The subselectors can then be queried using CurrentValue[obj, {TaggingRules, "selector", "subselectori"}]. Subselectors can have their own subselectors, to an arbitrary depth.
  • TaggingRules can be set at the cell, notebook, and global level.

ExamplesExamplesopen allclose all

Basic Examples (2)Basic Examples (2)

Apply TaggingRules at the cell level:

In[1]:=
Click for copyable input
Out[1]=

Use nested rules as TaggingRules:

In[2]:=
Click for copyable input
Out[2]=

Reference specific TaggingRules values using CurrentValue:

In[1]:=
Click for copyable input
Out[1]=

Reference nested values directly by using subselectors in CurrentValue:

In[2]:=
Click for copyable input
Out[2]=
New in 4.0
New to Mathematica? Find your learning path »
Have a question? Ask support »