|  |  | 8.2 Sharing Latex definitions with your Latex document

## 8.2 Sharing Latex definitions with your Latex document

When using Ipe figures in a Latex document, it is convenient to have access to some of the definitions from the document.

Ipe comes with a Lua script update-master that makes this easy.

In your Latex document, say master.tex, surround the interesting definitions using `%%BeginIpePreamble` and `%%EndIpePreamble`, for instance like this:

      %%BeginIpePreamble
      \usepackage{amsfonts}
      \newcommand{\R}{\mathbb{R}}
      %%EndIpePreamble

Running the script as

      ipescript update-master master.tex

extracts these definitions and saves them as a stylesheet master-preamble.isy. (This filename is fixed, and does not depend on the document name.)

Running this script as

      ipescript update-master master.tex figures/*.ipe

creates the stylesheet master-preamble.isy as above. In addition, it looks at all the Ipe figures mentioned on the command line. The script adds the new stylesheet to each figure, or updates the stylesheet to the newest version (if the figure already contains a stylesheet named "master-preamble").