Mathematica 9 is now available
Previous section-----Next section

A.8.2 Loadable Files

You can customize your Mathematica by adding files that can loaded into the system under different circumstances. Such files are conventionally placed in either system-wide or user-specific base directories.

$BaseDirectory system-wide base directory for files to be loaded by Mathematica
$UserBaseDirectory user-specific base directory for files to be loaded by Mathematica

Base directories for files to be loaded by Mathematica.

C:\Documents and Settings\All Users\Application Data\Mathematica
Windows
/Library/Mathematica Macintosh
/usr/share/Mathematica Unix

Typical values of $BaseDirectory.

C:\Documents and Settings\username\Application Data\Mathematica
Windows
~/Library/Mathematica Macintosh
~/.Mathematica Unix

Typical values of $UserBaseDirectory.

You can specify different locations for these directories by setting operating system environment variables when you launch Mathematica, as discussed in Section A.7.1.

Applications Mathematica application packages
Autoload packages to be autoloaded on startup
FrontEnd front end initialization files
Kernel kernel initialization files
Licensing license management files
SystemFiles general system files

Typical subdirectories of Mathematica base directories.

Some files in base directories serve as configuration files, automatically used by the Mathematica kernel or front end.

Kernel/init.m run when the kernel is started
Kernel/end.m run when the kernel is terminated
FrontEnd/init.m read when the front end is started
SystemFiles/FrontEnd/StyleSheets/
customized notebook style sheets
SystemFiles/FrontEnd/Palettes/ additional palettes to appear in the front end menu

Some typical kernel and front end configuration files.

Kernel configuration files can contain any Mathematica commands. These commands can test global variables such as $SystemID and $MachineName to determine what operations to perform. Front end configuration files can contain only certain special commands, as described in Section A.2.12.

Applications/name/ named add-on applications
Autoload/name/ add-ons to be loaded automatically when Mathematica is started

Subdirectories under $BaseDirectory and $UserBaseDirectory.

With the default setting for the kernel $Path variable, an add-on can be loaded from within a Mathematica session simply by using the command <<name`. This will load the init.m file for the add-on, which should in turn be set up to load other necessary files or packages.

By placing an add-on under the Autoload subdirectory of $BaseDirectory or $UserBaseDirectory, you can have Mathematica automatically load the add-on whenever you start the kernel or the front end.

init.m or Kernel/init.m an initialization file to be loaded by the kernel
FrontEnd/init.m an initialization file to be loaded by the front end
Documentation/ documentation to be found by the front end

Typical possible contents of the directory for an add-on.

Note that with the default setting for the front end documentation path, all documentation in Documentation directories will automatically show up in the front end Help Browser.



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.