4.2.2 INI Files

Using INI files is the simplest way of creating customized Python macro classes. It does require a little bit of knowledge of writing macros in Python classes (section 4.2.1), but not much. The only two pieces of information about Python macro classes you need to know are 1) the args string format, and 2) the superclass name (in most cases, you can simply use Command or Environment). The INI file features correspond to Python macros in the following way.

INI File

Python Macro Use

section name

the Python class to inherit from

option name

the name of the macro to create

option value

the args string for the macro

Here is an example of an INI file that defines several macros.

[Command]
; \program{ self }
program=self
; \programopt{ self }
programopt=self

[Environment]
; \begin{methoddesc}[ classname ]{ name  { args } ... \end{methoddesc}
methoddesc=[ classname ] name args
; \begin{memberdesc}[ classname ]{ name  { args } ... \end{memberdesc}
memberdesc=[ classname ] name args

[section]
; \headi( options:dict )[ toc ]{ title }
headi=( options:dict ) [ toc ] title

[subsection]
; \headii( options:dict )[ toc ]{ title }
headii=( options:dict ) [ toc ] title

In the INI file above, six macro are being defined. \program and \programopt both inherit from Command, the generic LaTeX macro superclass. They also both take a single mandatory argument called “self.” There are two environments defined also: methoddesc and memberdesc. Each of these has three arguments where the first argument is optional. The last two macros actually inherit from standard LaTeX sectioning commands. They add an option, surrounded by parentheses, to the options that \section and \subsection already had defined.

INI versions of plasTeX packages are loaded much in the same way as Python plasTeX packages. For details on how packages are loaded, see section 4.3.