The LaTeX Package scrlayer-notecolumn

The scrlayer-notecolumn package uses KOMA-Script’s scrlayer to provide any number of note columns. Note columns are similar to the margin columns that LaTeX provides using \marginpar. With scrlayer-notecolumn, however, these are not limited to a margin but can be defined anywhere on the page. In addition, page breaks within the note columns are supported.

Before KOMA-Script v3.33 scrlayer-notecolumn was part of KOMA-Script itself. It still depends on KOMA-Script package scrlayer at least version 3.33. This package was created as an example of the capabilities of the basic scrlayer concept. As such, it is primarily an experiment or a proof of concept. It was not originally intended for production use, but has proven to be quite useful in that context. For this reason, it was spun off from KOMA-Script as a standalone package. However, this status has minor implications for support. There are no plans to add further features to the package. That said, we would very much like others to build on the ideas in the package to develop and make available enhanced versions of it.

The package is hosted on Codeberg. Further information can be found in the CTAN catalog entry.

Usage

The package is loaded as usual using:

\usepackage[<options>]{scrlayer-notecolumn}

Here, <options> stands for one or more of the options listed under “Options”. Additionally, the options from scrlayer are supported. Therefore, to specify options for scrlayer, it is not necessary to explicitly load that package yourself beforehand.

Since the package relies on the use of a page style defined with scrlayer, and since, after loading scrlayer, only the page style empty is initially such a scrlayer page style, it is recommended to also load the KOMA-Script package scrlayer-scrpage or the package scrlayer-fancyhdr and use one of the page styles provided by them. With scrlayer-scrpage, this happens automatically after loading that package.

Options

As mentioned earlier, scrlayer-notecolumn supports all the options of scrlayer. In addition, it offers its own options:

autoclearnotecolumns
By default, scrlayer-notecolumn hooks itself into \clearpage (and therefore also into \cleardoublepage) to force the output of notes that have already been created but not yet printed. To do this, additional pages containing only the notes and no main text may be printed. However, this can be prevented by using autoclearnotecolumns=false. In that case, the user is responsible for ensuring that, for example, no notes are lost at the end of the document. The user must therefore insert \clearnotecolumns at an appropriate location, such as immediately before \end{document}.
autoconvertpagestyles
Since version 0.4.4233, scrlayer-notecolumn attemptes to automatically convert page styles that were not defined using scrlayer into page styles based on scrlayer. This happens when the respective page style is selected. This feature is experimental but is nevertheless enabled by default. It can be disabled with autoconvertpagestyles=false. However, in that case, notes will no longer be displayed on pages with those page styles. Therefore, it is generally recommended to use only page styles defined using scrlayer instead. By default, this is the case for the empty style. Using a scrlayer page style can be achieved very easily using the KOMA-Script package scrlayer-scrpage. For users of the fancyhdr package, there is the package scrlayer-fancyhdr.

Usage of Note Columns

\makenote[name]{note}
This command writes a <note> into the note column <name>. For details on how this works via an auxiliary file, see the detailed user manul. If the optional argument [<name>] is omitted, the predefined margin note column marginpar is used. Note that commands within <note> are expanded as soon as the note is created. This can be prevented with \protect. For so-called fragile commands, this is absolutely necessary. Commands defined with \NewDocumentCommand or \DeclareRobustCommand are automatically robust, meaning they are expanded only when the note is output.
\makenote*[<name>]{<note>}
Using \detokenize prevents commands within <note> from being expanded. This is desirable in many cases. However, if counter commands are used within <note>, for example, this can result in the value at the time the note is output—rather than the value at the time the note is created—being used or modified.
\syncwithnotecolumn[<name>]
A synchronization point is set between the main text and the note column <name>. This means that additional vertical spacing may be inserted in the main text. Without the optional argument, synchronization occurs with the predefined note column marginpar. Using a synchronization point may increase the number of LaTeX runs required.
\syncwithnotecolumns[<list of names>]
Not only is a synchronization point set between the main text and all note columns specified in the <list of names>, but the note columns are also synchronized with each other.
\clearnotecolumn[<name>]
Forces the output of all pending notes from the specified note column. If necessary, pages with empty main text but containing the note column’s content are also output. The contents of other margin columns may also be printed, provided they belong on these pages. Without the optional argument, the remaining notes from the predefined margin column marginpar are printed.
\clearnotecolumns[<list of names>]
All pending notes from all note columns specified in the <list of names> are output, as explained for \clearnotecolumn. Without the optional argument, the pending notes from all defined note columns are automatically output.

Declaration of New Note Columns

By default, only the margin column marginpar is defined. This is positionally largely identical to the margin column used by \marinpar. It also takes \reversemarginpar and \normalmarginpar into account, though not on a per-note basis, but only on a per-page basis.

\DeclareNoteColumn[<list of settings>]{<name>}
A note column <name> is defined according to the <list of settings>. The available settings are font=<font attributes>, marginpar, normalmarginpar, reversemarginpar, position=<distance from the left margin>, width=<width>. For more details, see the detailed instructions.
\DeclareNewNoteColumn[<list of Settings>]{<name>}
Same as \DeclareNoteColumn, with the difference that if a note column <name> already exists, an error is reported. This prevents an existing note column from being accidentally assigned different settings.
\ProvideNoteColumn[<list of settings>]{<name>}
Same as \DeclareNoteColumn, with the difference that if a note column <name> already exists, the new definition is ignored.
\RedeclareNoteColumn[<list of settings>]{<name>}
Same as \DeclareNoteColumn, with the difference that only existing note columns can be assigned new settings. If a note column named <name> does not yet exist, an error is reported.

Example

An example in English is available within the package at source code. The resulting PDF can usually also be found in the CTAN release (see above).