Wolfram Research

Function Repository Resource:

AssociationNotebook

Source Notebook

Create a structured notebook containing data from an association

Contributed by: Richard Hennigan (Wolfram Research)

ResourceFunction["AssociationNotebook"][assoc]

creates a Notebook with the same structure as assoc.

Details and Options

ResourceFunction["AssociationNotebook"] has the following options:
"Title" None choose a title to insert into the notebook
"MaxOpenSize" 4096 specify a threshold for having sections start closed

Examples

Basic Examples

Create a Notebook from an Association:

In[1]:=
ResourceFunction[
 "AssociationNotebook"][<|"Text" -> "Hello world", "Data" -> <|"Expression" -> f[x], "List" -> {a + b, c + d}|>|>]
Out[1]=

View the notebook:

In[2]:=
NotebookPut@%
Out[2]=

Use a list of rules:

In[3]:=
NotebookPut@
 ResourceFunction[
  "AssociationNotebook"][{"Section 1" -> "Text 1", "Section 2" -> "Text 2"}]
Out[3]=

Scope

Strings are represented as “Text” cells:

In[4]:=
NotebookPut@
 ResourceFunction[
  "AssociationNotebook"][<|
   "Text Example" -> "This string will be in a text cell."|>]
Out[4]=

Lists are converted to multiple “Item” cells:

In[5]:=
NotebookPut@
 ResourceFunction[
  "AssociationNotebook"][<|"List Example" -> {"a", "b", "c"}|>]
Out[5]=

Other expressions will be displayed in StandardForm using “Input” cells:

In[6]:=
NotebookPut@
 ResourceFunction[
  "AssociationNotebook"][<|
   "Expression Example" -> ResourceObject["Gettysburg Address"]|>]
Out[6]=

Expressions held by RuleDelayed will also be unevaluated in the notebook:

In[7]:=
NotebookPut@
 ResourceFunction[
  "AssociationNotebook"][<|"Unevaluated Example" :> Print[1 + 1]|>]
Out[7]=

Options

Title

Insert a title:

In[8]:=
NotebookPut@
 ResourceFunction["AssociationNotebook"][SystemInformation["Kernel"], "Title" -> "Kernel Information"]
Out[8]=

MaxOpenSize

Specify a threshold for closing sections (in total bytes for all section cells):

In[9]:=
NotebookPut@
 ResourceFunction[
  "AssociationNotebook"][<|"Small" -> f[Range[10]], "Large" -> f[Range[10000]]|>, "MaxOpenSize" -> 10000]
Out[9]=

Applications

Browse metadata in a notebook:

In[10]:=
NotebookPut@
 ResourceFunction["AssociationNotebook"][
  ResourceObject["MoveMouse"][All]]
Out[10]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

See Also

License Information