2 Loading Initialization Files and Search Paths

Warning: The texi2any-config.pm file related paths and even the use of texi2any-config.pm files is not definitive.

You can write so-called initialization files, or init files for short, to modify almost every aspect of output formatting. The program loads init files named texi2any-config.pm each time it is run. Those files are looked for in the following directories:

datadir/texi2any/

(where datadir is the system data directory specified at compile-time, e.g., /usr/local/share)

sysconfdir/texi2any/

(likewise specified at compile time, e.g., /usr/local/etc)

~/.texi2any/

(where ~ is the current user’s home directory)

./.texi2any/

(under the current directory)

./

(the current directory)

All texi2any-config.pm files found are loaded, in the above order. Thus, ./texi2any-config.pm can override entries in, say, /usr/local/share/makeinfo/texi2any-config.pm.

However, the most common way to load an initialization file is with the --init-file option, explicitly specifying the file to be loaded. By default the following directories are searched, in the following order. Only the first file found is used:

  1. The current directory ./;
  2. ./.texi2any/ under the current directory;
  3. ~/.texi2any/ where ~ is the current user’s home directory;
  4. sysconfdir/texi2any/ where sysconfdir is the system configuration directory specified at compile-time, e.g., /usr/local/etc;
  5. datadir/texi2any/ Where datadir is the system data directory likewise specified at compile time, e.g., /usr/local/share;
  6. ./.texinfo/init/ under the current directory;
  7. ~/.texinfo/init/ under the current home directory;
  8. sysconfdir/texinfo/init/ with sysconfdir as above;
  9. datadir/texinfo/init/ with datadir as above.
  10. datadir/texinfo/ext/ with datadir as above.

The datadir/texinfo/ext/ directory contains the init files directly loaded from texi2any code. When loaded from texi2any code directly, init files are only searched for in that directory, being considered as part of the program and not as user customization. Since the directory is also in the list of directories searched for init files loaded by the --init-file option, those init files can also be loaded as regular user specified init files.

Additional directories may be prepended to the list with the --conf-dir option (see Invoking texi2any in Texinfo).