generates a document by evaluating all template elements in the notebook nb.


generates a document using args to fill template slots.


writes the generated document in the output file represented by output.


uses args to fill template slots and puts the result in output.


  • The notebook nb can be an explicit notebook expression, a NotebookObject, or a file name.
  • GenerateDocument typically works with template notebooks, which can usually be created interactively.
  • If the notebook nb does not contain any template elements, GenerateDocument effectively operates like NotebookEvaluate.
  • If the notebook nb contains template elements, GenerateDocument will fill template slots from args.
  • A positional template slot i is filled from the i^(th) position of args.
  • A named template slot "name" is filled from an element with key "name" in an association appearing in the first position of args.
  • A blank template notebook suitable for use with GenerateDocument can be opened in the front end using CreateNotebook["Template"].


open all close all

Basic Examples  (1)

Generate a notebook by evaluating template elements in a template notebook:

Click for copyable input

The template notebook:

The generated document:

Scope  (1)

Generalizations & Extensions  (1)

Applications  (1)

Introduced in 2014