In the LaTeX kernel you see this often:

``````%<*2ekernel|autoload>
``````

What does it do? There are other similar marks. Is there any documentation for these?

-

When LaTeX2e was released, personal computers had much less power than nowadays. Moreover, TeX was often compiled with a rather small amount of available memory.

The inclusion of the New Font Selection Scheme (NFSS2), in particular, posed some challenges when LaTeXing big documents. So the developers provided a solution for people with limited memory available: if the autoload option was set during the extraction of `latex.ltx` from the sources, not all the kernel was included in the format which was then produced by running `initex` on this file: some parts of it were included "on demand", for instance the code for the `picture` environment.

Support of the `autoload` feature was introduced in the June 1995 release of the LaTeX kernel update and dropped in December 2003.

You can still find a description of this feature in the file

``````<TEX DIST ROOT>/doc/latex/base/autoload.txt
``````

On some small systems (perhaps most noticeably emTeX for PCs if your machine is unable to use the TeX386 version) LaTeX uses up a large amount of the memory available to TeX, leaving very little for storage of any further commands, complex text (such as tables), floats or cross references that may occur in a typical document. Note that these limits are built into the TeX executable and do not directly correspond to any physical memory that your machine has installed.

In order to help with this problem, we have produced an experimental configuration of LaTeX in which certain functions are not predefined in the format, but are loaded automatically from a style file the first time they are used. This saves a lot of memory in the case that a document does not use these features.

In this release two environments are ‘auto-loaded’ in this way, ‘picture’ and ‘tabbing’, as are various bits of internal code used in error handling, font loading and advanced page makeup.

-
You just beat me to it :-) –  Joseph Wright Dec 15 '11 at 22:20
@JosephWright I was using LaTeX at that time and was actually bitten by memory shortage. But happily a version of OzTeX was released that could be easily assigned more memory. –  egreg Dec 15 '11 at 22:22

The kernel files are written using the special kind of literate programming: LaTeX `dtx` system. Each `dtx` file is both documentation and code. `docstrip` program extracts the code and rearranges it into latex files. The "guards" inside `<` and `>` tell `docstrip` where the snippets belong. For example, `<*2ekernel|autoload>` says that the code belongs to the files `latex.ltx` and `latexa.ltx`

Saying `texdoc docstrip` will give you more details about these "guards".

-
You say ...`latex.ltx` and `latexa.ltx` How does `docstrip` know it is not `latexb.ltx`? –  Yiannis Lazarides Dec 15 '11 at 22:44
it is in the file `autoload.ins`, which is a `docstrip` program –  Boris Dec 15 '11 at 23:50