<?xml version="1.0" encoding="utf-8" ?> <!-- for emacs: -*- coding: utf-8 -*- --> <!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head><title>creating a package</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_an_spexample_spof_spa_sppackage.html">next</a> | <a href="_loaded__Packages.html">previous</a> | <a href="_get__Package_lp__String_rp.html">forward</a> | <a href="_loaded__Packages.html">backward</a> | <a href="_packages.html">up</a> | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div> </td> </tr> </table> <div><a href="index.html" title="">Macaulay2Doc</a> > <a href="___The_sp__Macaulay2_splanguage.html" title="">The Macaulay2 language</a> > <a href="_packages.html" title="">packages</a> > <a href="_creating_spa_sppackage.html" title="">creating a package</a></div> <hr/> <div><h1>creating a package</h1> <div>There are four parts to a Macaulay2 package: a preamble, which is initiated by the <a href="_new__Package_lp__String_rp.html" title="package item: start a new package">newPackage</a> function, a section where one defines which variables will be exported to global variables, a section containing the actual coding that constitutes the package, and a section containing documentation and tests for the new package.<p/> A basic template for new packages:<pre>newPackage( ... ) export{ ... } exportMutable{ ... } -- Macaulay2 code goes here beginDocumentation() document { ... } -- several document's and TEST's, interspersed TEST " ... "</pre> The name of the package must be the name of the file, without the '.m2' suffix. Thus a package 'PACKAGENAME' will be in a file named 'PACKAGENAME.m2'. If the package were more complex, then by convention, there should be a directory named 'PACKAGENAME' on the load <a href="_path.html" title="list of directories to look in">path</a>, and the file 'PACKAGENAME.m2' in this directory would load the necessary files.</div> <div><h3>Menu</h3> <ul><li><span><a href="_an_spexample_spof_spa_sppackage.html" title="">an example of a package</a></span></li> </ul> <h4>Parts of a package</h4> <ul><li><span>newPackage, see <span><a href="_new__Package_lp__String_rp.html" title="package item: start a new package">newPackage(String)</a> -- package item: start a new package</span></span></li> <li><span><a href="_export.html" title="package item: export functions">export</a> -- package item: export functions</span></li> <li><span><a href="_export__Mutable.html" title="package item: export writable variables">exportMutable</a> -- package item: export writable variables</span></li> <li><span><a href="_begin__Documentation.html" title="package item: start documentation section">beginDocumentation</a> -- package item: start documentation section</span></li> <li><span><a href="_document.html" title="package item: documentation node">document</a> -- package item: documentation node</span></li> <li><span><a href="___T__E__S__T.html" title="package item: register a test of the package">TEST</a> -- package item: register a test of the package</span></li> </ul> <h4>Documenting, testing, and distributing a package</h4> <ul><li><span><a href="_writing_spdocumentation.html" title="">writing documentation</a></span></li> <li><span><a href="_check.html" title="perform tests of a package">check</a> -- perform tests of a package</span></li> <li><span><a href="_informing_spothers_spabout_spyour_sppackage.html" title="">informing others about your package</a></span></li> </ul> </div> </div> </body> </html>