From bd8c84d3086241f36de1b38eec9ca56b3672af31 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Mon, 21 Sep 2009 22:54:55 +0000
Subject: fixme 4.0 (21sep09)

git-svn-id: svn://tug.org/texlive/trunk@15411 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/source/latex/fixme/fixme.dtx | 4651 +++++++++++++++++++-----
 1 file changed, 3696 insertions(+), 955 deletions(-)

(limited to 'Master/texmf-dist/source/latex/fixme/fixme.dtx')

diff --git a/Master/texmf-dist/source/latex/fixme/fixme.dtx b/Master/texmf-dist/source/latex/fixme/fixme.dtx
index 86600985d1c..d30152e715f 100644
--- a/Master/texmf-dist/source/latex/fixme/fixme.dtx
+++ b/Master/texmf-dist/source/latex/fixme/fixme.dtx
@@ -1,4 +1,4 @@
-% \iffalse                                                 -*- mode: LaTeX -*-
+% \iffalse
 %
 % fixme.dtx --- Doc file for the FiXme package (code and documentation)
 %
@@ -32,9 +32,36 @@
 %
 %<*driver>
 \documentclass[a4paper]{ltxdoc}
+\usepackage{xspace}
+
+\usepackage{dox}[2009/09/21]
+\doxitem[idxtype=env.]{Env}{environment}{environments}
+\doxitem[idxtype=opt.]{Option}{option}{options}
+\doxitem[idxtype=cnt.]{Counter}{counter}{counters}
+\doxitem[idxtype=lang.]{Lang}{lang}{languages}
+\doxitem{Face}{face}{faces}
+\doxitem{Color}{color}{colors}
+\doxitem[idxtype={note lt.}]{Layout}{layout}{note layouts}
+\doxitem[idxtype={env. lt.}]{EnvLayout}{envlayout}{env. layouts}
+\doxitem[idxtype={target lt.}]{TargetLayout}{targetlayout}{target layouts}
+\doxitem{Theme}{theme}{themes}
+
+% #### NOTE: I don't want to \usepackage{fixme} just for getting the file
+% information. So here what I do: generate a header with only the
+% \ProvidesPackage command, and also the \fixmelogo. Then, I \input it so that
+% \GetFileInfo works. However, I need to manually set the current file name
+% and extension that would normally be set by \RequirePackage. Also, note that
+% the call to \GetFileInfo below needs to use the extension of the header,
+% that is inc instead of sty, even the file fixme.inc does not really exist.
+\makeatletter
+  \def\@currname{fixme}
+  \def\@currext{inc}
+\makeatother
+\input{header.inc}
 % \OnlyDescription
-% \CodelineIndex
+\CodelineIndex
 % \RecordChanges
+\setcounter{secnumdepth}{4}
 \begin{document}
 \DocInput{fixme.dtx}
 \end{document}
@@ -43,7 +70,8 @@
 % \fi
 %
 % \catcode`\¡=14
-% \CheckSum{880}
+% \CheckSum{1613}
+% \GetFileInfo{fixme.inc}
 %% \CharacterTable
 %%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
 %%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
@@ -60,17 +88,58 @@
 %%   Grave accent  \`     Left brace    \{     Vertical bar  \|
 %%   Right brace   \}     Tilde         \~}
 %
-% \newcommand\version{3.4}
-% \newcommand\releasedate{2009/07/16}
-% \newcommand\packagecopyright{Copyright \copyright{} 1998, 1999, 2000, 2001,
-%   2002, 2004, 2005, 2006, 2007, 2009 Didier Verna}
-% \newcommand\fixme{\textsf{FiXme}}
-% \newcommand\auctex{AUC-\TeX}
 % \MakeShortVerb{\|}
-% \date\today
-% \title{\fixme{} -- a \LaTeXe{} package for inserting fixme notes
-%   in your documents\thanks{This document describes \fixme{} \version,
-%     release date \releasedate.}}
+%
+% \makeatletter
+% \def\ps@mystyle{
+%   \def\@oddfoot{\hfil\thepage\hfil}
+%   \def\@evenfoot{\hfil\thepage\hfil}
+%   \def\@evenhead{\hfil\slshape\leftmark}
+%   \def\@oddhead{\slshape\rightmark\hfil}}
+% \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}{%
+%     -3.25ex\@plus -1ex \@minus -.2ex}{%
+%     1.5ex \@plus .2ex}{%
+%     \normalfont\normalsize\bfseries}}
+% \makeatother
+%
+% \newcommand*\DescribeBooleanOption[1]{%
+%   {\let\oldpdo\PrintDescribeOption%
+%     \def\PrintDescribeOption##1{\oldpdo{[no]##1}}%
+%     \let\oldsoi\SpecialOptionIndex%
+%     \def\SpecialOptionIndex##1{\oldsoi{##1}\oldsoi{no##1}}%
+%     \DescribeOption{#1}}}
+%
+% \newenvironment{booleanoption}[1]{%
+%   \let\oldpon\PrintOptionName%
+%   \def\PrintOptionName##1{\oldpon{[no]##1}}%
+%   \let\oldsmoi\SpecialMainOptionIndex%
+%   \def\SpecialMainOptionIndex##1{\oldsmoi{##1}\oldsmoi{no##1}}%
+%   \begin{option}{#1}}{%
+%     \end{option}}
+%
+% ^^A Let's not depend on varioref for just that:
+% \newcommand\sectionref[1]{\ref{#1} on page \pageref{#1}}
+%
+% \newcommand\etc{\textit{etc.}\xspace}
+% \newcommand\vs{\textit{vs.}\xspace}
+% \newcommand\ie{\textit{i.e.}\xspace}
+% \newcommand\komascript{\textsc{Koma}-Script\xspace}
+% \newcommand\auctex{AUC-\TeX\xspace}
+% \newcommand\emacs{\textsf{[X]Emacs}\xspace}
+%
+% \newcommand\fx{\fixmelogo\xspace}
+% \newcommand\packagecopyright{%
+%   Copyright \copyright{} 1998--2002, 2004--2007, 2009 Didier Verna}
+%
+% \pagestyle{mystyle}
+% \newcommand\fxmarkright{%
+%   \markright{\hskip-.5\marginparwidth \fx \fileversion{} (\filedate)}}
+% \fxmarkright
+%
+% \date{\texttt{\fileversion{} (\filedate)}}
+% \title{\fx{} -- Collaborative annotation tool for \LaTeX\footnote{%
+%     \fx homepage: %
+%     \texttt{http://www.lrde.epita.fr/\~{}didier/software/latex.php\#fixme}}}
 % \author{Didier Verna\\
 %   \texttt{mailto:didier@lrde.epita.fr}\\
 %   \texttt{http://www.lrde.epita.fr/\~{}didier/}}
@@ -78,316 +147,1296 @@
 %
 %
 % \begin{abstract}
-%   In the process of writing a long document, it is a common practice to
-%   leave some parts unwritten or uncomplete, and come back to them later. In
-%   such cases, you probably want to stick clues about which parts need to be
-%   ``fixed'', where they are located, and what needs to be done. This is what
-%   I call ``fixme notes''. The purpose of this package is to provide you with
-%   convenient ways to insert \fixme{} notes in your documents.\par
-%   The \fixme{} package is \packagecopyright{}, and distributed under the
+%   \fx is a collaborative annotation tool for \LaTeX{} documents. Annotating
+%   a document here refers to inserting meta-notes, that is, notes that do not
+%   belong to the document itself, but rather to its development or reviewing
+%   process. Such notes may involve things of different importance levels,
+%   ranging from simple ``fix the spelling'' flags to critical ``this
+%   paragraph is a lie'' mentions. Annotations like this should be visible
+%   during the development or reviewing phase, but should normally disapear in
+%   the final version of the document.
+%
+%   \fx is designed to ease and automate the process of managing collaborative
+%   annotations, by offering a set of predefined note levels and layouts, the
+%   possibility to register multiple note authors, to reference annotations by
+%   listing and indexing \etc \fx is extensible, giving you the possibility to
+%   create new layouts or even complete ``themes'', and also comes with
+%   support for \auctex.
+%
+%   The \fx package is \packagecopyright{}, and distributed under the
 %   terms of the LPPL license.
 % \end{abstract}
 %
+% \tableofcontents
+%
+% \section{Installation}
+% \subsection{Extraction}
+% If you are building \fx from the tarball you need to execute the following
+% steps in order to extract the necessary files. \fx also requires the
+% \textsf{DoX} package (version 2.0, release date 2009/09/21 or later), to
+% build. It is not required to use the package.
+% \begin{verbatim}
+% [pdf]latex fixme.ins
+% [pdf]latex fixme.dtx
+% [pdf]latex fixme.dtx
+% makeindex -s gind fixme.idx
+% [pdf]latex fixme.dtx
+% [pdf]latex fixme.dtx
+% \end{verbatim}
+% After that, you need to install the generated documentation and style files
+% to a location where \LaTeX{} can find them.
+%
+% \subsection{TDS-compliant layout}
+% For a TDS-compliant layout, the following locations are suggested:
+% \begin{verbatim}
+% [TEXMF]/tex/latex/fixme/fixme.sty
+% [TEXMF]/tex/latex/fixme/layouts/fxlayout*.sty
+% [TEXMF]/tex/latex/fixme/layouts/env/fxenvlayout*.sty
+% [TEXMF]/tex/latex/fixme/layouts/target/fxtargetlayout*.sty
+% [TEXMF]/tex/latex/fixme/themes/fxtheme*.sty
+% [TEXMF]/doc/latex/fixme/fixme.[pdf|dvi]
+% \end{verbatim}
+%
+% \subsection{\auctex support}
+% \auctex is a powerful major mode for editing \TeX{} documents in
+% \emacs. In particular, it provides automatic completion of command names
+% once they are known. \fx supports \auctex by providing a style file named
+% \texttt{fixme.el} which contains \auctex definitions for the relevant
+% commands. This file should be installed in a place where \auctex can find it
+% (usually in a subdirectory of your \LaTeX{} styles directory). Please refer
+% to the \auctex documentation for more information on this.
+%
+% \section{Features summary}
+% If you're new to \fx, you might be interested in a brief summary of the
+% features it provides. Otherwise, you may only take a look at the History
+% section (section \sectionref{sec:manual:history}) to see what's new.
+% \subparagraph{Annotation levels} \fx annotations may be of four different
+% importance levels, ranging from simple not-so-important notices to critical
+% things that must absolutely be fixed in the final version.
+% \subparagraph{Layouts and themes} \fx gives you full and extensible control
+% on the layout of these annotations: they can be displayed inline, as
+% marginal paragraphs, as footnotes and also in any kind of user-defined way.
+% All these ``layouts'' may be combined together. \fx also comes with support
+% for ``themes'', globally modifying existing layouts, or providing new ones.
+% \subparagraph{Annotation targets} Annotations may be ``targeted'' to a
+% specific portion of text that will be highlighted, and on the contrary
+% ``floating'' around, in which case they may even appear in the document's
+% preamble.
+% \subparagraph{Listing and indexing} Annotations may be indexed and
+% summarized in a ``list of fixmes''.
+% \subparagraph{Logging} Annotations are recorded in the log file, and
+% (depending on their importance level) some of them are displayed on the
+% terminal during compilation. A final summary is also created at the end of
+% the compilation process.
+% \subparagraph{Modes} All these features are actually available when you're
+% working in \texttt{draft} mode. In \texttt{final} mode, the behavior is
+% slightly different: any remaining critical note generates an error (the
+% compilation aborts), while non critical ones are just removed from the
+% document's body (they're still recorded in the log file though).
+% \subparagraph{Authoring} \fx provides support for collaborative annotating
+% by allowing you to ``register'' several authors.
+% \subparagraph{Internationalization} \fx currently supports 7 different
+% languages and features automatic language tracking for multilingual
+% documents.
 %
-% \section{Description}
-% With \fixme, you can insert different kinds of notes in your documents,
-% ranging from simple not-so-important notices to critical stuff that must
-% absolutely be fixed in the final version.\par
-% \fixme{} gives you full control on the layout of these notes: they can be
-% displayed inline (directly in the text), as marginal paragraphs (the
-% default), as footnotes and even as index entries. All these possibilities
-% can be mixed together. Additionally, you can summarize all \fixme{} notes in
-% a ``list of fixme's''.\par
-% \fixme{} notes are also recorded in the log file, and (depending on their
-% importance level) some of them are displayed on the terminal during
-% compilation. A final summary is also created at the end of the compilation
-% process.\par
-% All these features are actually available when you're working in
-% \texttt{draft} mode. In \texttt{final} mode, the behavior is slightly
-% different: any remaining critical note generates an error (the compilation
-% aborts), while non critical ones are just removed from the document's body
-% (they're still recorded in the log file though).
-%
-%
-% \section{Using \fixme}
-% First of all, please note that the \texttt{ifthen} and \texttt{verbatim}
-% packages are required. You don't have to load them explicitly though. As
-% long as \LaTeXe{} can locate them, they will be used automatically.\par
-% To use \fixme, simply say |\usepackage[|\meta{options}|]{fixme}| in the
-% preamble of your document.
-%
-% \subsection{Inserting notes}
-% \subsubsection{Macros}
-% \DescribeMacro{\fixme}
-% The main command for inserting a \fixme{} note in your document is the
-% |\fixme| macro. It takes the note to insert as its mandatory argument. Notes
-% inserted via this command are considered fatal to your document's final
-% processing (see section \ref{sec:behavior}).\par
+% \section{Using \fx}
+% \subsection{Initialization}
+% \subsubsection{Requirements}
+% In order to work properly, \fx requires the presence of some \LaTeX{}
+% packages. You don't have to load them explicitly though. As long as
+% \LaTeX{} can locate them, they will be used automatically. \fx currently
+% depends on \texttt{xspace}, \texttt{ifthen}, \texttt{verbatim} and
+% \texttt{xkeyval} (version 2.5f, release date 2006/11/18 or later).
+%
+% \subsubsection{Loading the package}
+% In order to load \fx, simply say |\usepackage[|\meta{options}|]{fixme}|
+% in the preamble of your document. There is an important number of options
+% that you can use in order to customize \fx's default or global behavior.
+% These options will be discussed when appropriate.
+%
+% There might be times where you would like to use \LaTeX{} commands in
+% package options (for example, see section \sectionref{sec:manual:faces}). In
+% such a case, you should know that \LaTeX{} normally can't handle this. In
+% order to make it work, you need to use the \texttt{xkvltxp} package first,
+% like this:
+% \begin{verbatim}
+% \usepackage{xkvltxp}
+% \usepackage[myoption=\mymacro]{fixme}
+% \end{verbatim}
+%
+% \subsubsection{Global setup modification}
+% \DescribeMacro{\fxsetup}\marg{options}\\
+% Another way of customizing \fx's global behavior is to use the
+% \cs{fxsetup} command. \cs{fxsetup} understands the same options as the
+% package itself and can be used in the preamble as well as in the document's
+% body.
+%
+% \subsubsection{Local setup modification}
+% Finally, note that unless specified otherwise, all package options are also
+% understood by the annotation commands or environments described in
+% section \sectionref{sec:manual:insertion}. The effect is then local to that
+% particular command.
+%
+% \subsection{Inserting \fx notes\label{sec:manual:insertion}}
+% \subsubsection{Commands}
 % \DescribeMacro{\fxnote}
 % \DescribeMacro{\fxwarning}
 % \DescribeMacro{\fxerror}
-% As of version 2.0, \fixme{} provides three new macros that insert
-% meta-comments about the document, rather than real fixmes. These
-% comments have three different importance levels: note, warning and (non
-% critical) error. The corresponding macros obey the same syntax as |\fixme|.
-% However, none of the notes inserted via these macros are fatal.
+% \DescribeMacro{\fxfatal}\oarg{options}\marg{note}\\
+% \fx provides four annotation commands corresponding to different
+% levels of importance (notes, warnings, errors and fatal errors).
+% \cs{fxfatal} is a bit different from the other ones, as will be explained in
+% section \sectionref{sec:manual:behavior}.\par
+% \begin{quotation}\itshape
+%   \DescribeMacro{\fixme}
+%   \textbf{Warning:} as of version 4, the \cs{fixme} command is a synonym for
+%   \cs{fxfatal} and is considered deprecated.
+% \end{quotation}
+%
+% \subsubsection{Targeted commands}
+% \DescribeMacro{\fxnote*}
+% \DescribeMacro{\fxwarning*}
+% \DescribeMacro{\fxerror*}
+% \DescribeMacro{\fxfatal*}\oarg{options}\marg{note}\marg{text}\\
+% Sometimes, you might not only want to issue a \fx note, but also
+% highlight the relevant part of the text to which it applies. This is what I
+% call ``targeting'' the note. As of version 4, \fx provides starred
+% versions of its annotation commands to do that. In star form, these
+% commands expect an additional mandatory argument containing the text to be
+% highlighted.
 %
 % \subsubsection{Environments}
+% \begin{quotation}\itshape
+%   \textbf{Warning:} as of version 4.0, the environment interface has changed
+%   and is \emph{not} backward-compatible.
+% \end{quotation}
 % \DescribeEnv{anfxnote}
 % \DescribeEnv{anfxwarning}
 % \DescribeEnv{anfxerror}
-% \DescribeEnv{afixme}
-% As of version 3.0, \fixme{} provides environments for inserting longer
-% notes. These environments take one optional argument (should be short,
-% perhaps a summary of the note) that will be used in the list of fixme's and
-% in the index if required.\par
-% The \fixme{} environments behave exactly the same way as their macro
-% counterpart, except for the layout (see section \ref{sec:layout}): as they
-% are meant for longer notes, the layout is always \texttt{inline}. The
-% \texttt{index} and \texttt{marginclue} layouts are still honored however. By
-% default, \fixme{} environments are typeset in a \texttt{quotation} one.
-%
-% \subsection{Controlling the behavior of \fixme\label{sec:behavior}}
-% \DescribeEnv{final}
-% \DescribeEnv{draft}
-% The global behavior of the package is controlled via the two standard
-% options \texttt{final} and \texttt{draft}. These options are usually given
-% to |\documentclass{}| which in turn passes them to all packages.\par
-% In \texttt{draft} mode, the notes are recorded in the log file, and
-% appear in the text as specified by the layout settings (see section
-% \ref{sec:layout}). Additionally, warnings, errors and fatal errors are also
-% displayed on the terminal.\par
-% In final mode, non fatal notes (those generated by the |\fx*| commands or by
-% the |anfx*| environments) are still logged, but they're not typeset. On the
-% other hand, any remaining fatal note (generated by the |\fixme| command or
-% the |afixme| environment) will throw a \LaTeX{} error and thus interrupt or
-% abort compilation with an informative message. This will help you track down
-% forgotten important caveats in your document. Let me say it again: final
-% documents can only have notes, warnings, and (non critical) errors left.
-% Well, if, for some reason, you really want to compile in \texttt{final}
-% mode with critical \fixme{} notes left behind, you always have the
-% possibility to pass the \texttt{draft} option to \fixme{} directly\ldots\par
-% The \texttt{final} mode has been chosen as the default because \LaTeXe{}
-% itself behaves this way.\par
-%
-% \subsection{Controlling the notes layout\label{sec:layout}}
-% \fixme{} notes can appear in several forms (that can be combined) in your
-% document.
-% \subsubsection{Global layout}
-% \DescribeEnv{inline}
-% \DescribeEnv{margin}
-% \DescribeEnv{marginclue}
-% \DescribeEnv{footnote}
-% \DescribeEnv{index}
-% The layout forms currently supported are: inline (directly in the text),
-% marginal notes, marginal clues (see below), footnotes, and index entries. To
-% activate a particular layout globally (that is, for the whole document), use
-% the corresponding package option. By default, only the \texttt{margin}
-% layout is active.\par
-% Each layout option has a counterpart that deactivates it. The counterpart
-% option has the same name, prefixed with \texttt{no}. For instance, if you
-% don't want marginal notes, use the \texttt{nomargin} option.\par
-% Finally, note that \fixme{} environments behave in a special way: they are
-% always typeset \texttt{inline}, regardless of your layout settings (they
-% respect your wish for index and marginal clues though).\par
-%
-% \subsubsection{Marginal Clues}
-% Sometimes, marginal notes are too narrow for what you want to put in them,
-% so you would switch to an inline or a footnote layout. But then, it is more
-% difficult to keep track of the \fixme{} note's location on the page.\par
-% As of version 3.2, \fixme{} provides a special layout called ``marginal
-% clue'' to help locating the notes: a marginal clue does not display the
-% note's contents, but only an indication that there is a note at that place.
-% So you have to use another layout form (typically inline or footnote) in
-% order to get the actual contents.\par
-% Obviously, \texttt{margin} and \texttt{marginclue} are mutually exclusive.
-% If you try to activate both, only the most recently activated form will be
-% enabled (and you'll get a notice in the compilation log).
-%
-% \subsubsection{Local Layout}
-% \DescribeMacro{\fixme[]}
-% \DescribeMacro{\fxnote[]}
-% \DescribeMacro{\fxwarning[]}
-% \DescribeMacro{\fxerror[]}
-% As of version 3.0, \fixme{} provides a way to change the selected layout(s)
-% on a per-note basis: each note insertion command takes an optional first
-% argument that overrides the global layout. This argument consists of one or
-% more layout options (\texttt{inline}, \texttt{margin}, \texttt{marginclue},
-% \texttt{footnote} and \texttt{index}) separated by commas. Remember that
-% local layouts \emph{override} the global ones; they don't add to it.\par
-% On what occasion would one want to modify the layout for a particular note~?
-% Here is a typical situation: suppose you have a document in which \fixme{}
-% notes are typeset as margin paragraphs (this is the default). You would not
-% be able to put a note in a figure, because floats can't be nested in
-% \LaTeX{} (margin paragraphs are floats). In such a case, you would rather
-% inline the note, which can be done with something like
-% |\fixme[inline]{blah}|.\par
-%
-% \subsubsection{Class compatibility}
-% By default, \fixme{} is set to use marginal notes. You should know that this
-% is known to cause problems with at least the ACM SIG classes:
-% \texttt{acm\_proc\_article-sp} and \texttt{sig-alternate}. These classes
-% forbid the use of |\marginpar|, so if you use them, you should choose
-% another layout for \fixme{}, and also avoid using marginal clues\ldots
-%
-% \subsection{Controlling the notes logging}
-% \DescribeEnv{silent}
-% \DescribeEnv{nosilent}
-% As well as being displayed in the document itself, all \fixme{} notes are
-% ``logged'' in different ways: by default, simple notes are recorded in the
-% log file while the others are also displayed on the terminal output.\par
-% You have the ability to suppress all kind of logging by using the
-% \texttt{silent} option. By default, the behavior is that of
-% \texttt{nosilent}.
+% \DescribeEnv{anfxfatal}\oarg{options}\marg{summary}\\
+% \fx annotations are normally meant to be short: consider that they are
+% likely to go in the list of fixmes and in the index for instance. If you
+% feel the need for writing longer comments, the environments described below
+% might come in handy. \fx provides four annotation environments; one for
+% every note level. These environments take one mandatory argument (meant to
+% be a short summary of the long note) and behave in exactly the same way as
+% their command counterpart. The layout policy is a bit different though (see
+% section
+% \sectionref{sec:manual:layout}): the environment's contents will always
+% appear inline, and the \meta{summary} will obey all active annotation
+% layouts except for the \texttt{inline} one, just as if it had been passed to
+% one of the \fx annotation commands described in the previous section.
+% \begin{quotation}\itshape
+%   \DescribeEnv{afixme}
+%   \textbf{Warning:} as of version 4, the \texttt{afixme} environement is a
+%   synonym for \texttt{anfxfatal}, and is considered deprecated.
+% \end{quotation}
 %
-% \subsection{List of \fixme's}
+%
+%
+% \subsubsection{Targeted environments}
+% \DescribeEnv{anfxnote*}
+% \DescribeEnv{anfxwarning*}
+% \DescribeEnv{anfxerror*}
+% \DescribeEnv{anfxfatal*}\oarg{options}\marg{summary}\marg{text}\\
+% \fx environments can also be targeted to a specific portion of text. When
+% using the starred version, the environments expect one additional mandatory
+% argument: the text in question that will be highlighted.
+%
+% \subsection{List of \fx's\label{sec:manual:lox}}
 % \DescribeMacro{\listoffixmes}
-% \fixme{} remembers where you put \fixme{} notes in a toc-like file whose
-% extension is \texttt{lox}. The |\listoffixmes| macro generates the list of
-% all \fixme{} notes in a manner similar to that of the ``list of figures''
-% for instance. A standard layout is automatically used for the `article',
-% `report', `book' classes and their koma-script replacements. If another
-% class is used, the `article' layout is selected. Also, note that if no
-% \fixme{} note remain in the document, this macro doesn't generate an empty
-% list, but rather stays silent. It also stays silent in \texttt{final} mode,
-% regardless of the presence of remaining notes.
-%
-%
-% \section{Customizing \fixme}
-% \subsection{Customizing the notes layout}
-% \subsubsection{Macros}
-% The \texttt{inline}, \texttt{margin} and \texttt{footnote} layouts have two
-% parts: a ``prefix'' which depends on the note level, and the note
-% itself. The prefix is one of ``\fixme{} note:'', ``\fixme{} warning:'',
-% ``\fixme{} error:''  or simply ``\fixme{}:'', and appears in bold. The note
-% itself appears emphasized.
-% \DescribeMacro{\FXInline}
-% \DescribeMacro{\FXMargin}
-% \DescribeMacro{\FXFootnote}
-% These layouts are implemented thanks to the corresponding |\FX*| macros that
-% you can redefine if you wish. Each such macro takes two mandatory
-% arguments: the prefix and the note, in that order.\par
-% \DescribeMacro{\FXMarginCLue}
-% The special \texttt{marginclue} layout only outputs the prefix mentioned
-% above. Its layout is controlled by the macro |\FXMarginClue| which takes the
-% prefix as its only mandatory argument.
-% \DescribeMacro{\FXIndex}
-% The |\FXIndex| macro is used for the \texttt{index} layout. All \fixme{}
-% index entries appear under the ``\fixme{}'' key in the symbols section.
-% There are 4 subcategories under this key, as many as there are note levels.
-% By default, only the first 3 of them are used though (fatal errors do not
-% appear under a subkey, but directly under the \fixme{} key). The notes are
-% numbered in the index.\par
+% \fx remembers where you put your annotations in a toc-like file whose
+% extension is \texttt{lox}. The \cs{listoffixmes} command generates the
+% annotations lists in a manner similar to that of the ``list of figures''. A
+% standard layout is automatically selected for the \texttt{article},
+% \texttt{report}, \texttt{book} classes and their \komascript replacements.
+% If another class is used, the \texttt{article} layout is selected. Also,
+% note that if there isn't any annotation left in the document, this command
+% doesn't generate an empty list, but rather stays silent. It also stays
+% silent in \texttt{final} mode, regardless of the presence of remaining
+% annotations (see section \sectionref{sec:manual:behavior}).
 %
-% \subsubsection{Environments}
-% \DescribeMacro{\FXEnvBegin}
-% \DescribeMacro{\FXEnvEnd}
-% The optional argument of \fixme{} environments is always typeset according
-% to the \texttt{inline} layout described above. By default, \fixme{} uses a
-% \texttt{quotation} for displaying the environments'contents. If you want to
-% change that, you can redefine the macros |\FXEnvBegin| and |\FXEnvEnd| that
-% open and close the environments.
-%
-% \subsection{Customizing the notes logging}
-% \DescribeMacro{\FXNote}
-% \DescribeMacro{\FXWarning}
-% \DescribeMacro{\FXError}
-% \DescribeMacro{\FXFatal}
-% If you want a finer control on logging, you can redefine the commands used
-% to implement it. These commands (on the left) are the ones used by
-% |\fxnote|, |\fxwarning|, |\fxerror| and |\fixme| respectively. They take the
-% note itself as mandatory argument.
-%
-% \subsection{Fancy fruit salad layout}
-% \DescribeEnv{user}
-% \DescribeMacro{\FXUser}
-% If, for some totally unjustified reason, you are not happy with the
-% available layouts, you have the ability to define your own: pass the
-% \texttt{user} option to the package (it also has its \texttt{nouser}
-% counterpart), and define an |\FXUser| macro in the following manner:\\
-% |\newcommand{\FXUser}[2]{|\meta{fancy fruit salad layout job}|}|\\ The
-% arguments are the prefix, and the note itself, in that order.\par
-% Note that the \texttt{user} option can also be used in the optional argument
-% of the notes insertion commands.
+% \subsection{Controlling the behavior of \fx\label{sec:manual:behavior}}
+% \DescribeOption{final}
+% \DescribeOption{draft}
+% The behavior of \fx is controlled by the two standard options
+% \texttt{final} and \texttt{draft}. These options are usually given to
+% \cs{documentclass} which in turn passes them to all packages. In addition,
+% you can also use them as options to \cs{usepackage}, in the call to
+% \cs{fxsetup}, and even to the annotation commands and environments.
+%
+% In \texttt{draft} mode, annotations are recorded in the log file and appear
+% in the document as specified by the layout settings (see section
+% \sectionref{sec:manual:layout}). Additionally, warnings, errors and fatal
+% errors are also displayed on the terminal.
+%
+% In final mode, non fatal annotations (those generated by \cs{fxnote},
+% \cs{fxwarning}, \cs{fxerror} and their corresponding environments) are still
+% logged, but they're not typeset. On the other hand, fatal ones (those
+% generated by the \cs{fxfatal} command and the \texttt{anfxfatal}
+% environment) will throw a \LaTeX{} error and thus interrupt or abort
+% compilation with an informative message. This will help you track down
+% forgotten important caveats in your document.
+%
+% Let me rephrase: final documents can only have \fx notes, warnings, and (non
+% fatal) errors left. Of course, this is not completely true: remember that
+% these options are understood locally by all the annotation commands and
+% environments, so even in \texttt{final} mode, you can use something like
+% this:
+% \begin{verbatim}
+% \fxfatal[draft]{bla bla}
+% \end{verbatim}
+%
+% \DescribeOption{status}
+% By default, \fx is in \texttt{final} mode (\LaTeX{} itself behaves that
+% way). If you're manipulating the document status at the level of \fx
+% itself (as opposed to the \cs{documentclass} level), then the preferred way
+% to do this is to use the \texttt{status} option, and give it the value
+% \texttt{final} or \texttt{draft}.
+%
+% \subsection{Controlling the layout of annotations\label{sec:manual:layout}}
+% Annotations can appear in several forms in your document. Each of these
+% forms can be individually selected, or they can be combined together to some
+% extend.
+%
+% \subsubsection{Selecting a layout}
+% \paragraph{Individual control}
+% For each annotation layout, there is a corresponding boolean option (for
+% instance, the ``inline'' layout is controlled by the \texttt{inline}
+% option). These options are understood by the package itself, the
+% \cs{fxsetup} command and also locally by every annotation command or
+% environment. There are some restrictions on their usage however, as
+% discussed in the next section.
+%
+% To activate a note layout, use the option alone or give it a value of
+% \texttt{true}. For instance, these two forms are equivalent:
+% \begin{verbatim}
+% \fxnote[inline]{note...}
+% \fxnote[inline=true]{note...}
+% \end{verbatim}
+% For convenience, each layout option has a counterpart that deactivates the
+% corresponding layout. The counterpart option has the same name, prefixed
+% with \texttt{no} (for instance, \texttt{noinline}). Again, these options are
+% understood by the package itself, the \cs{fxsetup} command and also locally
+% by every annotation command or environment (with the same usage
+% restrictions, discussed in the next section). For instance, these two forms
+% are equivalent:
+% \begin{verbatim}
+% \fxsetup{inline=false}
+% \fxsetup{noinline}
+% \end{verbatim}
+%
+% \paragraph{Global control}
+% \DescribeOption{layout}
+% \DescribeOption{morelayout}
+% An even more convenient way to specify the required layout is to use the
+% \texttt{layout} and \texttt{morelayout} options. In fact, the use of
+% individual control is considered more or less deprecated. Both of these
+% options take a comma-separated list of the individual options described
+% above (this includes the \texttt{no}\meta{option} form as well).
+%
+% While the \texttt{morelayout} option \emph{adds} to the current layout
+% configuration, the \texttt{layout} one completely overrides it. For
+% instance, knowing that by default, only the \texttt{margin} layout is
+% active, the following forms are all equivalent:
+% \begin{verbatim}
+% \usepackage[nomargin,inline,index]{fixme}
+% \usepackage[margin=false,inline=true,index=true]{fixme}
+% \usepackage[morelayout={nomargin,inline,index}]{fixme}
+% \usepackage[layout={inline,index}]{fixme}
+% \end{verbatim}
+% Again, these two options are understood by the package itself, the
+% \cs{fxsetup} command and also locally by every annotation command or
+% environment (with the same usage restrictions, discussed in the next
+% section).
+%
+% \noindent\DescribeMacro{\fxuselayouts}\marg{name,\ldots}\\
+% Finally, an alternative way of selecting (or deselecting) several layouts
+% simultaneously is to use the \cs{fxuselayouts} command, giving it a
+% comma-separated list of layout options as its only, mandatory, argument.
+%
+% \subsubsection{Built-in \vs external layouts}
+% Annotation layouts are provided either in the core of \fx, or in separate
+% files loaded dynamically on demand. Simple layouts are typically built-in,
+% whereas those requiring additional packages are external, so that they don't
+% consume \TeX{} resources if not used. As a consequence, selecting an
+% external layout might involve loading the relevant file first.
+%
+% \noindent\DescribeMacro{\fxloadlayouts}\marg{name,\ldots}\\
+% For technical reasons, it is not possible to do such a thing outside the
+% preamble, neither in the middle of processing \cs{usepackage} options. As a
+% result, layout options are restricted and you have three possibilities for
+% using an external layout:
+% \begin{enumerate}
+% \item Use its corresponding option in a call to \cs{fxsetup} in the
+%   preamble, like this: |\fxsetup{|\meta{option}|}|. This will load it
+%   \emph{and} select it immediately.
+% \item Use the \cs{fxuselayouts} command in the preamble like this:\\
+%   |\fxuselayouts{|\meta{name}|}|. This is strictly equivalent to the
+%   previous solution.
+% \item If on the other hand you want to load one or several external layouts
+%   \emph{without} using them immediately (perhaps in order to use them
+%   locally in some specific annotation), use the \cs{fxloadlayouts} command
+%   in the preamble like this: |\fxloadlayouts{|\meta{name}|,...}|. After
+%   that, you can select any of those layouts anywhere you wish.
+% \end{enumerate}
+%
+% \newpage
+% \subsubsection{Available layouts}
+% \DescribeBooleanOption{inline}
+% \DescribeBooleanOption{margin}
+% \DescribeBooleanOption{marginclue}
+% \DescribeBooleanOption{footnote}
+% \DescribeBooleanOption{index}
+% \DescribeLayout[noprint]{inline}
+% \DescribeLayout[noprint]{margin}
+% \DescribeLayout[noprint]{marginclue}
+% \DescribeLayout[noprint]{footnote}
+% \DescribeLayout[noprint]{index}
+% Table \ref{table:layouts} lists the annotation layouts currently distributed
+% with \fx. By default, only the \texttt{margin} layout is active. While most
+% of these layouts should be self-explanatory, marginal clues deserve a bit
+% more explanation.
+% \begin{table}
+%   \centering
+%   \DeleteShortVerb{\|}
+%   \begin{tabular}{|l|c|p{7cm}|}
+%     \hline
+%     \textbf{Name} & \textbf{External} & \textbf{Description}\\
+%     \hline\hline
+%     \texttt{inline} & & Display note inline\\
+%     \texttt{margin} & & Display note in the margin\\
+%     \texttt{footnote} & & Display note in a footnote\\
+%     \texttt{index} & & Display note in the index\\
+%     \texttt{marginclue} & & Display a marginal clue\\
+%     \hline
+%   \end{tabular}
+%   \MakeShortVerb{\|}
+%   \caption{Available annotation layouts}
+%   \label{table:layouts}
+% \end{table}
+% If your preferred layout is \texttt{inline} or say, \texttt{footnote},it
+% might be somewhat difficult to localize the annotation on the page,
+% especially its vertical position. That's where marginal clues come into
+% play. A marginal clue does not display the annotation's contents, but only
+% an indication that there is one at that (vertical) position. So you need to
+% use another layout as well (again, typically \texttt{inline} or
+% \texttt{footnote}) in order to get the actual annotation.
+%
+% Obviously, the margin and margin clue layouts are mutually exclusive, so if
+% you try to activate both, only the most recently activated one will be
+% enabled (and you'll get a notice in the log file and on the terminal).
+%
+% \subsubsection{Inner layout}
+% There might be various reasons for you to change the layout locally for one
+% particular annotation: creating a floating one is an example, see also
+% section \sectionref{sec:manual:othercommonproblems} for some others. One
+% frequent reason (described below) can be handled automatically by \fx.
+%
+% Remember that the default layout is to use margin paragraphs. Unfortunately,
+% margin paragraphs are forbidden by \TeX{} in several situations, like a
+% figure's caption for instance. If you try that, you will get a cryptic ``Not
+% in outer par mode'' error message.
+%
+% \DescribeOption{innerlayout}
+% The good news is that this situation can be detected automatically. \fx
+% provides an option named \texttt{innerlayout} that allows you to specify an
+% alternative layout setting to use when \TeX{} is in \emph{inner} mode. In
+% addition to that, \fx automatically disables the \texttt{margin} and
+% \texttt{marginclue} layouts.
+%
+% Using \texttt{innerlayout} is not as trivial as it may seem: it
+% \emph{really} is an alternative layout configuration, and as such, you can
+% use any combination you like of individual layout options, or you can even
+% use the \texttt{layout} and \texttt{morelayout} options. This means that
+% your alternative layout can either \emph{add} to the existing one, or
+% \emph{override} it. Here are some examples to clarify things a little. You
+% should try to understand them.
+% \begin{itemize}
+% \item By default, the \fx inner layout is set to just \texttt{inline}.
+%   This can be simulated by the following call:
+% \begin{verbatim}
+% \usepackage[layout=margin,innerlayout={layout=inline}]{fixme}
+% \end{verbatim}
+% \item The following happens to give the same result in our particular case,
+%   while having a different semantics:
+% \begin{verbatim}
+% \usepackage[layout=margin,innerlayout=inline]{fixme}
+% \end{verbatim}
+% \item If you have set \fx to use a safe layout globally (for instance,
+%   \texttt{inline} and \texttt{index}), and you want to use the same layout
+%   in inner mode, then you should provide an \emph{empty} inner layout, like
+%   this:
+% \begin{verbatim}
+% \fxsetup{layout={inline,index},innerlayout=}
+% \end{verbatim}
+%   What would happen if you didn't provide the \texttt{innerlayout} option?
+% \end{itemize}
+%
+% \subsubsection{Other common layout
+%   problems\label{sec:manual:othercommonproblems}}
+% This section describes some other common problems that people have
+% encountered using \fx. Although \fx might not be directly responsible
+% for them, it is still good to keep them in mind.
+%
+% \subparagraph{Footnotes and margin paragraphs in floats} Using footnotes in
+% figures (and \emph{a fortiori} in a figure's caption) does not work in
+% general. Although there are some workarounds out there (for instance, using
+% \cs{footnotemark} and \cs{footnotetext} directly), there is no completely
+% reliable solution and it is not possible to detect that situation
+% automatically. Similarly, marginal paragraphs will cause problems in a
+% figure (even when not in its caption) because floats can't be nested in
+% \LaTeX. Usual symptoms of these situations are: a footnote not being
+% typeset, compilation breakage with the ``Floats lost'' message \etc If
+% you're facing this problem, you need to change your layout locally.
+%
+% \subparagraph{Marginal paragraphs showing up on the wrong margin} You want
+% to look at the \texttt{mparhack} package.
+%
+% \subparagraph{ACM classes compatibility} The ACM \textsc{Sig} classes
+% (\texttt{acm\_proc\_article-sp} and \texttt{sig-alternate}) forbid the use
+% of \cs{marginpar}, so if you use these classes, don't forget to choose
+% another layout for \fx, and also avoid using marginal clues.
+%
+% \subparagraph{Annotation indexing}
+% Remember that some characters are special in an index entry (the \texttt{!}
+% for instance). \fx currently does nothing to escape those characters, so
+% avoid using them in your annotations.
+%
+% \subsection{Corollary: floating annotations}
+% At some point, people suggested that it would be nice to have global
+% annotations, not related to any portion of the text in particular. Such
+% annotations could be general comments about the whole document, and could
+% even be issued in the preamble. This is what I call ``floating''
+% annotations.
+%
+% I know you don't care, but originally, I started writing a new set of
+% commands to do just that. However, with the flexibility that \fx 4.0
+% provides, I quickly realized that such commands were an unnecessary
+% addition.
+%
+% Since floating anotations are not supposed to relate to any part of the
+% text, they should not be typeset anywhere in it. This is especially true if
+% you want to put some of them in the document's preamble. However, even a
+% preamble annotation could be recorded and displayed in the index or in the
+% list of fixmes. And it turns out that you can specify all that with the
+% layout options described in section \sectionref{sec:manual:layout}.
+%
+% \DescribeOption{target}
+% The only remaining problem is the page number, which normally appears in the
+% list of fixmes and in the index: if you choose to reference a floating
+% annotation that way, the page number is likely to be completely meaningless.
+% To compensate, a new option named \texttt{target} is provided. When used,
+% the given value will replace the page number in both the index and the list
+% of fixmes. The target can be anything you like, but should remain rather
+% short. By default, \texttt{target} is set the special value
+% \texttt{thepage}, which as you guessed means to use the page number.
+%
+% The name "target" bears an intentional resemblance to \fx's targeted
+% commands and environments, because we are indeed targetting the note to
+% something. The only difference is that in the case of floating annotations,
+% the target is non-textual.
+%
+% Here is an example of a floating annotation that would typically appear in
+% the document's preamble:
+% \begin{verbatim}
+% \usepackage{hyperref}
+% \fxfatal[layout=index,target=hyperref]{Fill in PDF fields (title etc.)}
+% \end{verbatim}
+%
+% \subsection{Controlling the layout of
+%   environments\label{sec:manual:envlayoutcontrol}}
+% As discussed in section \sectionref{sec:manual:insertion}, the contents of a
+% \fx environment (a longer annotation) always appears inline. However, the
+% exact way this contents is typeset (in draft mode only) is subject to a
+% layout of its own, called the ``environment layout''.
+%
+% \subsubsection{Selecting a layout}
+% \DescribeOption{envlayout}
+% The desired environment layout can be selected with the \texttt{envlayout}
+% option. Contrary to the annotation layouts, only one environment layout can
+% be active at a time. The \texttt{envlayout} option is understood by the
+% package itself, the \cs{fxsetup} command and all the annotation environments
+% (not the commands!). There are some restrictions on its usage however, as
+% discussed in the next section.
+%
+% \noindent\DescribeMacro{\fxuseenvlayout}\marg{name}\\
+% An alternative way of selecting an environment layout is to use the
+% \cs{fxuseenvlayout} command, giving it the layout's name as its only,
+% mandatory, argument.
+%
+% \subsubsection{Built-in \vs external layouts}
+% Environments layouts are provided either in the core of \fx, or in separate
+% files loaded dynamically on demand. Simple layouts are typically built-in,
+% whereas those requiring additional packages are external, so that they don't
+% consume \TeX{} resources if not used. As a consequence, selecting an
+% external layout with the \texttt{envlayout} option might involve loading the
+% relevant file first.
+%
+% \noindent\DescribeMacro{\fxloadenvlayouts}\marg{name,\ldots}\\
+% For technical reasons, it is not possible to do such a thing outside the
+% preamble, neither in the middle of processing \cs{usepackage} options. As a
+% result, the \texttt{envlayout} option is restricted and you have three
+% possibilities for using an external layout:
+% \begin{enumerate}
+% \item Use the \texttt{envlayout} option in a call to \cs{fxsetup} in the
+%   preamble, like this: |\fxsetup{envlayout=name}|. This will load it
+%   \emph{and} select it immediately.
+% \item Use the \cs{fxuseenvlayout} command in the preamble like this:\\
+%   |\fxuseenvlayout{name}|. This is strictly equivalent to the previous
+%   solution.
+% \item If on the other hand you want to load one or several environment
+%   layouts \emph{without} using them immediately (perhaps in order to use
+%   them locally in some specific annotation), use the \cs{fxloadenvlayouts}
+%   command in the preamble like this: |\fxloadenvlayouts{|\meta{name}|,...}|.
+%   After that, you can select any of those layouts anywhere you wish.
+% \end{enumerate}
+%
+% \subsubsection{Available layouts\label{sec:manual:envlayoutslist}}
+% Table \ref{table:envlayouts} lists the environment layouts currently
+% distributed with \fx.
+% \begin{itemize}
+% \item \DescribeEnvLayout{plain}
+%   The \texttt{plain} environment layout prints its contents as-is, only
+%   in bold font (by default) in order to distinguish it from the surrounding
+%   text.
+% \item \DescribeEnvLayout{signature}
+%   The \texttt{signature} environment layout prints the author's tag (see
+%   \sectionref{sec:manual:modes}) as a signature instead of as a prefix. This
+%   layout is used by the \texttt{signature} theme (see section
+%   \sectionref{sec:manual:themes}).
+% \item \DescribeEnvLayout{color}
+%   \DescribeColor{fxnote}
+%   \DescribeColor{fxwarning}
+%   \DescribeColor{fxerror}
+%   \DescribeColor{fxfatal}
+%   The \texttt{color} environment layout uses one of four colors named
+%   \texttt{fx}\meta{level} (according to the annotation's importance level)
+%   to display its contents. It also avoids printing the annotation level,
+%   since that information is already conveyed by the color. This layout is
+%   used by the \texttt{color} theme (see section
+%   \sectionref{sec:manual:themes}).
+% \item  \DescribeEnvLayout{colorsig}
+%   The \texttt{colorsig} environment layout combines the features of the
+%   \texttt{signature} and \texttt{color} ones. This layout is used by the
+%   \texttt{colorsig} theme (see section \sectionref{sec:manual:themes}).
+% \end{itemize}
+% \begin{table}
+%   \centering
+%   \DeleteShortVerb{\|}
+%   \begin{tabular}{|l|c|p{7cm}|}
+%     \hline
+%     \textbf{Name} & \textbf{External} & \textbf{Description}\\
+%     \hline\hline
+%     \texttt{plain} & & Display contents as-is\\
+%     \texttt{signature} & & Display signed contents\\
+%     \texttt{color} & \texttt{*} & Display contents in color\\
+%     \texttt{colorsig} & \texttt{*} & Display signed contents in color\\
+%     \hline
+%   \end{tabular}
+%   \MakeShortVerb{\|}
+%   \caption{Available environment layouts}
+%   \label{table:envlayouts}
+% \end{table}
+%
+% \subsection{Controlling the layout of
+%   targets\label{sec:manual:targetlayoutcontrol}}
+% As discussed in section \sectionref{sec:manual:insertion}, the starred
+% versions of the \fx annotation commands and environments let you highlight a
+% portion of text which is relevant to the current annotation. The exact way
+% this textual target is typeset (in draft mode only; otherwise it is typeset
+% as-is) is subject to a layout of its own, called the ``target layout''.
+%
+% \subsubsection{Selecting a layout}
+% \DescribeOption{targetlayout}
+% The desired layout can be selected with the \texttt{targetlayout} option.
+% Contrary to the annotation layouts, only one target layout can be active at
+% a time. The \texttt{targetlayout} option is understood by the package
+% itself, the \cs{fxsetup} command and all the starred versions of the
+% annotation commands and environments. There are some restrictions on its
+% usage however, as discussed in the next section.
+%
+% \noindent\DescribeMacro{\fxusetargetlayout}\marg{name}\\
+% An alternative way of selecting a target layout is to use the
+% \cs{fxusetargetlayout} command, giving it the layout's name as its only,
+% mandatory, argument.
+%
+% \subsubsection{Built-in \vs external layouts}
+% Target layouts are provided either in the core of \fx, or in separate files
+% loaded dynamically on demand. Simple layouts are typically built-in, whereas
+% those requiring additional packages are external, so that they don't consume
+% \TeX{} resources if not used. As a consequence, selecting an external layout
+% with the \texttt{targetlayout} option might involve loading the relevant
+% file first.
+%
+% \noindent\DescribeMacro{\fxloadtargetlayouts}\marg{name,\ldots}\\
+% For technical reasons, it is not possible to do such a thing outside the
+% preamble, neither in the middle of processing \cs{usepackage} options. As a
+% result, the \texttt{targetlayout} option is restricted and you have two
+% possibilities for using an external layout:
+% \begin{enumerate}
+% \item Use the \texttt{targetlayout} option in a call to \cs{fxsetup} in the
+%   preamble, like this: |\fxsetup{targetlayout=name}|. This will load it
+%   \emph{and} select it immediately.
+% \item Use the \cs{fxusetargetlayout} command in the preamble like this:\\
+%   |\fxusetargetlayout{name}|. This is strictly equivalent to the previous
+%   solution.
+% \item If on the other hand you want to load one or several target layouts
+%   \emph{without} using them immediately (perhaps in order to use them
+%   locally in some specific annotation), use the \cs{fxloadtargetlayouts}
+%   command in the preamble like this:
+%   |\fxloadtargetlayouts{|\meta{name}|,...}|. After that, you can select any
+%   of those layouts anywhere you wish.
+% \end{enumerate}
+%
+% \subsubsection{Available layouts\label{sec:manual:targetlayoutslist}}
+% Table \ref{table:targetlayouts} lists the target layouts currently
+% distributed with \fx.
+% \begin{itemize}
+% \item \DescribeTargetLayout{plain}
+%   The \texttt{plain} target layout displays its contents as-is, only in
+%   italics (by default) in order to distinguish it from the surrounding text.
+% \item \DescribeTargetLayout{changebar}
+%   The \texttt{changebar} target layout displays a vertical bar in the
+%   margin, on the side of the target text.
+% \item \DescribeTargetLayout{color}
+%   \DescribeColor{fxtarget}
+%   The \texttt{color} target layout uses the color named \texttt{fxtarget}
+%   to display the target text. This layout is used by the \texttt{color}
+%   and \texttt{colorsig} themes (see section \sectionref{sec:manual:themes}).
+% \item \DescribeTargetLayout{colorcb}
+%   \DescribeColor{fxnote}
+%   \DescribeColor{fxwarning}
+%   \DescribeColor{fxerror}
+%   \DescribeColor{fxfatal}
+%   The \texttt{colorcb} target layout uses one of four colors named
+%   \texttt{fx}\meta{level} (according to the annotation's importance
+%   level) to display a colored vertical bar in the margin, on the side of the
+%   target text.
+% \end{itemize}
+% \begin{table}
+%   \centering
+%   \DeleteShortVerb{\|}
+%   \begin{tabular}{|l|c|p{7cm}|}
+%     \hline
+%     \textbf{Name} & \textbf{External} & \textbf{Description}\\
+%     \hline\hline
+%     \texttt{plain} & & Display target as-is\\
+%     \texttt{changebar} & \texttt{*} & Display a vertical bar aside target\\
+%     \texttt{color} & \texttt{*} & Display target in color\\
+%     \texttt{colorcb} & \texttt{*} & Display a colored vertical bar aside
+%     target\\
+%     \hline
+%   \end{tabular}
+%   \caption{Available target layouts}
+%   \label{table:targetlayouts}
+%   \MakeShortVerb{\|}
+% \end{table}
+%
+% \subsection{Faces\label{sec:manual:faces}}
+% In the \fx jargon, a ``face'' characterizes the visual aspect of some
+% portion of text. If you're familiar with the \emacs editor, this will come
+% as no surprise to you. \fx provides several faces that allow you to further
+% customize the layout of annotations or their targets.
+%
+% \subsubsection{Setting face values}
+% There are different ways to customize a face. The first one is to use the
+% corresponding face option. For each face \meta{name}, their is a
+% \meta{name}\texttt{face} option. For instance, the ``inline'' face is
+% controlled by the \texttt{inlineface} option. Face options are
+% understood by the package itself, the \cs{fxsetup} command and locally by
+% all annotation commands or environments. Here is an example:
+% \begin{verbatim}
+% \fxsetup{inlineface=\bfseries}
+% \end{verbatim}
+%
+% Since you will probably want to use \LaTeX{} commands in face values, you
+% should know that \LaTeX{} normally can't handle such commands in package
+% options. If you want this to work, you need to use the \texttt{xkvltxp}
+% package first, like this:
+% \begin{verbatim}
+% \usepackage{xkvltxp}
+% \usepackage[inlineface=\bfseries]{fixme}
+% \end{verbatim}
+%
+% \noindent\DescribeMacro{\fxsetface}\marg{name}\marg{value}\\
+% Another way to customize a face is to use the \cs{fxsetface} command by
+% providing the face name and the face value as two mandatory arguments. For
+% example:
+% \begin{verbatim}
+% \fxsetface{inline}{\bfseries}
+% \end{verbatim}
+%
+% \subsubsection{Available faces}
+% \subparagraph{The \texttt{inline} face}
+% \DescribeFace{inline}
+% By default, the \texttt{inline} annotation layout displays its contents in
+% bold font, to distinguish the note from the surrounding text. This is
+% controlled by the \texttt{inline} face whose value is \cs{bfseries} by
+% default.
+%
+% \subparagraph{The \texttt{margin} face}
+% \DescribeFace{margin}
+% By default, the \texttt{margin} and \texttt{marginclue} layouts display
+% their contents in footnote size. This is controlled by the \texttt{margin}
+% face whose value is \cs{footnotesize} by default.
+%
+% \subparagraph{The \texttt{env} face}
+% \DescribeFace{env}
+% By default, the \texttt{plain} environment layout displays its contents in
+% bold font, to distinguish it from the surrounding text. This is controlled
+% by the \texttt{env} face whose value is \cs{bfseries} by default. The
+% \texttt{color} and \texttt{colorsig} environment layouts honor this face as
+% well, but reset it to \meta{nothing} first. You should probably keep the
+% same value for the \texttt{inline} and \texttt{env} faces, since they are
+% both used to display annotations within the document's body.
+%
+% \subparagraph{The \texttt{signature} face}
+% \DescribeFace{signature}
+% The \texttt{signature} environment layout honors the \texttt{env} face, and
+% adds a \texttt{signature} face on top of it for the signature part. It is
+% set to \cs{itshape} by default. The \texttt{colorsig} environment layout
+% honors this face as well.
+%
+% \subparagraph{The \texttt{target} face}
+% \DescribeFace{target}
+% By default, the \texttt{plain} target layout displays its contents in
+% italics, to distinguish it from the surrounding text. This is controlled by
+% the \texttt{target} face whose value is \cs{itshape} by default. The
+% \texttt{changebar}, \texttt{color} and \texttt{colorcb} target layouts honor
+% this face as well, but reset it to \meta{nothing} first.
+%
+% \subsection{Controlling the logging of annotations}
+% As well as being displayed in the document itself, all annotations are
+% ``logged'' in different ways: by default, simple notes are recorded in the
+% log file while the others (warnings, errors and fatal errors) are also
+% displayed on the terminal output during compilation.
+%
+% \DescribeBooleanOption{silent}
+% You have the ability to suppress logging altogether by using the
+% \texttt{silent} option. This option is understood by the package itself, the
+% \cs{fxsetup} command and all annotation commands and environments. Just
+% as individual layout options, \texttt{silent} is a boolean option, so all
+% those forms are possible: \texttt{silent}, equivalent to
+% \texttt{silent=true}, and \texttt{nosilent}, equivalent to
+% \texttt{silent=false} (the default).
+%
+% \subsection{Controlling the language of \fx\label{sec:manual:i18n}}
+% \subsubsection{Available languages}
+% \DescribeOption{english}
+% \DescribeOption{french}
+% \DescribeOption{francais}
+% \DescribeOption{spanish}
+% \DescribeOption{italian}
+% \DescribeOption{german}
+% \DescribeOption{ngerman}
+% \DescribeOption{danish}
+% \DescribeOption{croatian}
+% \fx currently supports English (the default), French, Spanish, Italian,
+% German, Danish and Croatian. You can select your preferred language by using
+% the corresponding language option. These options usually appear in the call
+% to \cs{documentclass} or \cs{usepackage}, but they are also understood by
+% \cs{fxsetup} and all the annotation commands or environments. This
+% allows you to change the selected language either globally or locally, and
+% at any point in the document. The \texttt{french} and \texttt{francais}
+% options are synonyms. The \texttt{german} and \texttt{ngerman} options are
+% currently equivalent.
+%
+% \DescribeOption{lang}
+% If you're manipulating language settings at the level of \fx itself (as
+% opposed to the \cs{documentclass} level), then the preferred way to specify
+% a language is to use the \texttt{lang} option, and give it the language name
+% as a value. For instance:
+% \begin{verbatim}
+% \usepackage[lang=french]{fixme}
+% \end{verbatim}
+%
+% \subsubsection{Language tracking}
+% \DescribeOption{langtrack}
+% If the document you're working on has parts written in different languages,
+% it might be the case that \fx notes should follow the current language as
+% well (especially if you're in collaborative mode; see section
+% \sectionref{sec:manual:modes}). \fx provides a boolean option named
+% \texttt{langtrack}. When specified, \fx assumes that you're using
+% \texttt{babel} and automatically switches to the current language (as
+% specified by \texttt{babel}'s \cs{languagename} command), without requiring
+% an explicit language option.
+%
+% \DescribeOption{defaultlang}
+% In the case where tracking falls on a language unsupported by \fx, a
+% warning will be issued and \fx will switch to the language specified by
+% the \texttt{defaultlang} option (\texttt{english} by default). If you happen
+% to get one of these warnings, please consider sending me a patch with
+% support for this new language (see section \sectionref{sec:code:i18n}).
+%
+% Finally, note that specifying a language explicitely (by means of a language
+% option) in the annotation commands and environments always takes
+% precedence over the language tracking behavior.
+%
+% \subsubsection{Indexing in different languages}
+% If your document contains \fx notes written in different languages, and
+% you have requested the \texttt{index} layout, \fx will not only classify
+% the notes by their level of importance, but also by language. For example,
+% if you have \fx warnings in both English and French, you will find two
+% different subcategories for warnings in the index: one called ``Warnings''
+% and one called ``Avertissements''.
+%
+% \subsection{Standalone or collaborative mode\label{sec:manual:modes}}
+% \fx supports collaborative annotations as well as ``standalone'',
+% single-author documents.
+%
+% \subsubsection{Standalone mode}
+% By default, \fx is in standalone mode, meaning that it assumes there is
+% only one person annotating the document. This has several implications on
+% the layout. If you've tried it already, you may have noticed the following
+% points.
+% \begin{itemize}
+% \item All the built-in annotation layouts (index excepted) put the \fx logo
+%   in front of every note. This is also true for the environments. The idea
+%   is to distinguish \fx contents from the rest of the document (for instance
+%   other marginal notes or footnotes).
+% \item All annotations are indexed under the main \fx category, and sorted by
+%   importance level, but the \fx logo is not repeated constantly (that would
+%   be useless).
+% \item Similarly, the list of fixmes does not clutter itself with the logo,
+%   because we already know that its contents is specific to \fx.
+% \end{itemize}
+% As a matter of fact, when you see the \fx logo appear somewhere, you're not
+% actually contemplating it, but rather the annotation's \emph{author}. It
+% just happens that by default (meaning in standalone mode), the only author
+% is \fx itself.
+%
+% \DescribeOption{author}
+% In standalone mode, you might be annoyed by this orgy of \fx logos. This
+% might happen if for instance you're using the \texttt{margin} layout and you
+% \emph{know} there is nothing but \fx annotations in there. In such a case,
+% you will most likely want to change the author to \emph{nothing}. This can
+% be acomplished by using the \texttt{author} option, which is understood by
+% the package itself, the \cs{fxsetup} command and all the annotation
+% commands or environments. Doing something like the following will get rid of
+% the damn logo for good:
+% \begin{verbatim}
+% \usepackage[author=]{fixme}
+% \end{verbatim}
+%
+% \subsubsection{Collaborative mode}
+% If, on the other hand, you're working in collaboration with other people,
+% every potential ``fixer'' might want to tag his or her own annotations. So
+% assuming that John Doe is another author, he would most likely do something
+% like this:
+% \begin{verbatim}
+% \fxfatal[author=JD]{rephrase this}
+% \end{verbatim}
+% And suddenly, John's fatal comment will be prefixed with his initials. This
+% is not a very satisfactory solution however, because it would require you to
+% explicitely provide the author's tag in every single note you create.
+% Fortunately, \fx offers an easier way to achieve this.
+%
+% \paragraph{Registering new authors}
+% \DescribeMacro{\FXRegisterAuthor}\marg{cmdprefix}\marg{envprefix}\marg{tag}\\
+% The command \cs{FXRegisterAuthor} registers a new author with \fx. It takes
+% three arguments: the last one (\meta{tag}) is just the same as the value you
+% would pass to the \texttt{author} option: it will serve as a prefix (or
+% signature) for John's annotations. In addition to that, a complete new set
+% of user-level commands (prefixed with \meta{cmdprefix}) and environments
+% (prefixed with \meta{envprefix}) will be created. To clarify, suppose that
+% we have registered John like this:
+% \begin{verbatim}
+% \FXRegisterAuthor{jd}{ajd}{JD}
+% \end{verbatim}
+% Now, John can use the commands \cs{jdnote}, \cs{jdwarning} \etc, along with
+% their starred versions, and he can also use the environments
+% \texttt{ajdnote}, \texttt{ajdwarning} \etc, along with their starred
+% versions as well. If you really want to know the whole story, it turns out
+% that the main \fx interface described in section
+% \sectionref{sec:manual:insertion} is created with this single line of code:
+% \begin{verbatim}
+% \FXRegisterAuthor{fx}{anfx}{fixme}
+% \end{verbatim}
+%
+% \paragraph{Fun with the \texttt{author} option}
+% Some precisions about the author option are in order here. When a new
+% author is registered with \fx, the generated commands and environments
+% work by \emph{presetting} the author option to the specified \meta{tag}.
+% This means that it is still possible to override it explicitely like this:
+% \begin{verbatim}
+% \jdfatal[author=Anonymous]{For $500.00, you got your Ph.D.}
+% \end{verbatim}
+% I don't see any good reason for doing it though, the above example
+% notwithstanding.^^A $ AUC-TeX hack to prevent math-mode
+%
+% The final remark is about the default \texttt{fx*} user interface: the
+% \texttt{fixme} default user is special in that it is the only registered
+% user to honor a global \texttt{author} option (provided in the call to
+% \cs{usepackage} or \cs{fxsetup}). The intended use of this is that the
+% \emph{main} author of the document uses the \texttt{fx*} interface
+% (preferably with a personal \texttt{author} setting, different from the \fx
+% logo), and all other authors are registered via \cs{FXRegisterAuthor}.
+%
+% \paragraph{Globally switching to collaborative mode}
+% We're getting close, but we're not quite there yet. Perhaps you would like
+% to see the tags from the different authors in the list of fixmes, or even in
+% the index? Remember that \fx is in standalone mode by default, so the
+% (only) tag does not appear in those places.
+%
+% \noindent
+% \DescribeOption{singleuser}
+% \DescribeOption{multiuser}
+% \DescribeOption{mode}
+% If you want this additional information, you've got to ask \fx to
+% globally switch to collaborative mode. This can be done with either one of
+% the three options \texttt{singleuser}, \texttt{mutliuser} or \texttt{mode}.
+% \texttt{singleuser} and \texttt{multiuser} are boolean options. The
+% \texttt{mode} option takes a value of either \texttt{singleuser} or
+% \texttt{multiuser}. This is the preferred way to switch the mode. These
+% options are understood globally by \cs{usepackage} or \cs{fxsetup}, and also
+% locally by the annotation commands or environments.
+%
+% When collaborative mode is active, \fx adjusts the list of fixmes layout to
+% display the authors tags as well. Additionally, \fx notes are indexed as
+% before, but additional index entries, sorted by author, are generated as
+% well.
+%
+% \subsection{Themes\label{sec:manual:themes}}
+% Themes are orthogonal to layouts: they provide a way to modify the overall
+% appearance of \fx by overriding the existing layouts and/or by providing new
+% ones. In fact, a theme can be any kind of customization that you would
+% otherwise put in your preamble.
+%
+% \subsubsection{Using themes}
+% \DescribeOption{theme}
+% The interface for using a theme is quite simple: use the \texttt{theme}
+% option and give it the name of the theme you want to use. Themes are always
+% external: there are none in the  core of \fx but instead they are provided
+% as independent files. As a consequence, the \texttt{theme} option has the
+% same usage restrictions as all the layout options we've encountered so far.
+% Moreover, it is not possible to ``maintain'' several themes and switch
+% between them in a single document. Themes can be loaded only in the
+% preamble.
+%
+% \noindent\DescribeMacro{\fxusetheme}\marg{name}\\
+% An alternative to the \texttt{theme} option is to use the \cs{fxusetheme}
+% command, which takes the theme's name as its only mandatory argument.
+%
+% \subsubsection{Available themes}
+% \fx comes with a number of predefined themes listed below.
+%
+% \paragraph{The \texttt{signature} theme}
+% \DescribeTheme{signature}
+% This theme uses the \texttt{signature} environment layout (see section
+% \sectionref{sec:manual:envlayoutslist}), and overrides the built-in ones to
+% display the author tags as a signature (\ie at the end of the annotations)
+% instead of as a prefix. All original layout faces are honored.
+%
+% \paragraph{The \texttt{color} theme}
+% \DescribeTheme{color}
+% This theme uses the \texttt{color} environment and target layouts (see
+% sections \sectionref{sec:manual:envlayoutslist} and
+% \sectionref{sec:manual:targetlayoutslist}), and overrides the built-in ones
+% to use different colors for the different annotation levels. As a
+% consequence, it also avoids printing the annotation names because this
+% information is already contained in the colors themselves. All original
+% layout faces are honored, but the \texttt{inline} one is reset to
+% \meta{nothing}. Remember that the \texttt{env} and \texttt{target} faces are
+% reset as well (this is actually done by the \texttt{color} environment and
+% target layouts).
+%
+% \paragraph{The \texttt{colorsig} theme}
+% \DescribeTheme{colorsig}
+% This theme combines the features of the \texttt{color} and
+% \texttt{signature} ones. All original layout faces are honored, but
+% the \texttt{inline} one is reset to \meta{nothing}.
+%
+% \section{Extending \fx}
+% Hear hear, this is where you start spending more time hacking \LaTeX{} than
+% actually writing your document\ldots
+%
+% \subsection{Modifying existing layouts}
+% \fx annotations, environment and target layouts are implemented as a (set
+% of) commands conforming to strict prototypes. If you're not happy with the
+% way they perform, you have the possibility to \cs{renewcommand} them (in
+% fact, you should use \cs{renewcommand*} for annotation and environment
+% layouts). In such a case, it is probably best to have a look at the code in
+% order to figure out how the original ones are written. However, a
+% description of their prototypes is given below.
+%
+% \subsubsection{Modifying existing annotation layouts}
+% \DescribeMacro[noindex]{\FXLayout\ldots}
+% \marg{type}\marg{annotation}\marg{author}\\
+% \DescribeMacro[noprint]{\FXLayoutInline}
+% \DescribeMacro[noprint]{\FXLayoutMargin}
+% \DescribeMacro[noprint]{\FXLayoutFootnote}
+% \DescribeMacro[noprint]{\FXLayoutIndex}
+% \DescribeMacro[noprint]{\FXLayoutMarginClue}
+% Each annotation layout is implemented as a macro taking three mandatory
+% arguments. By convention, this macro is named \cs{FXLayout}\meta{name}, for
+% instance \cs{FXLayoutInline}.\meta{type} is the note type. It can be one of
+% \texttt{note}, \texttt{warning}, \texttt{error} and \texttt{fatal}.
+% \meta{annotation} is the annotation itself, and \meta{author} is the
+% author's tag.
+%
+% \subsubsection{Modifying existing environment layouts}
+% \DescribeMacro[noindex]{\FXEnvLayout\ldots Begin}
+% \DescribeMacro[noindex]{\FXEnvLayout\ldots End}\marg{type}\marg{author}\\
+% \DescribeMacro[noprint]{\FXEnvLayoutPlainBegin}
+% \DescribeMacro[noprint]{\FXEnvLayoutPlainEnd}
+% \DescribeMacro[noprint]{\FXEnvLayoutSignatureBegin}
+% \DescribeMacro[noprint]{\FXEnvLayoutSignatureEnd}
+% \DescribeMacro[noprint]{\FXEnvLayoutColorBegin}
+% \DescribeMacro[noprint]{\FXEnvLayoutColorEnd}
+% \DescribeMacro[noprint]{\FXEnvLayoutColorSigBegin}
+% \DescribeMacro[noprint]{\FXEnvLayoutColorSigEnd}
+% \begin{sloppypar}\noindent
+%   Each environment layout is implemented as two macros taking two mandatory
+%   arguments. By convention, these macros are named
+%   \cs{FXEnvLayout}\meta{name}\texttt{Begin} and
+%   \cs{FXEnvLayout}\meta{name}\texttt{End}, for instance
+%   \cs{FXEnvLayoutPlainBegin} and \cs{FXEnvLayoutPlainEnd}.
+%   \meta{type} is the note type. It can be one of \texttt{note},
+%   \texttt{warning}, \texttt{error} and \texttt{fatal}. \meta{author} is the
+%   author's tag.
+% \end{sloppypar}
+%
+% \subsubsection{Modifying existing target layouts}
+% \DescribeMacro[noindex]{\FXTargetLayout\ldots}\marg{type}\marg{target}\\
+% \DescribeMacro[noprint]{\FXTargetLayoutPlain}
+% \DescribeMacro[noprint]{\FXTargetLayoutColor}
+% Each target layout is implemented as a macro taking two mandatory arguments.
+% By convention, this macro is named \cs{FXTargetLayout}\meta{name}, for
+% instance \cs{FXTargetLayoutPlain}. \meta{type} is the note type. It can be
+% one of \texttt{note}, \texttt{warning}, \texttt{error} and \texttt{fatal}.
+% \meta{target} is the textual target.
+%
+% \subsection{Creating new layouts}
+% Creating a new layout first requires that you write new layout macros as
+% described in the previous section. Once you've done that, the next step is
+% to make \fx aware of this addition. This is called ``registering'' a layout.
+%
+% \subsubsection{Registering a new annotation layout}
+% \paragraph{Early \vs late layouts} Normally, \fx typesets your annotations
+% at the current position in the text, using a sensible order for built-in
+% layouts. For instance, the \texttt{footnote} layout, if active, is performed
+% before the \texttt{inline} one, so that the footnote mark is sticked to the
+% preceding text and not to the annotation. When using targeted commands or
+% environments, the situation is a bit more complex: some layouts make more
+% sense at the beginning of the textual target, and some others at the end.
+% The former ones are called ``early layouts'' and the later ones are called
+% ``late layouts''. A typical example of an early layout is the
+% \texttt{margin} one: if you're highlighting a long portion of text, it is
+% more convenient to see the marginal note appear near the top of that text,
+% rather than near the end of it (a nice illustration of this is to combine
+% the \texttt{changebar} target layout and \texttt{margin} annotation layout).
+% As for built-in layouts, only the \texttt{margin} and \texttt{marginclue}
+% ones are early. All others are late. When you create a new layout, you need
+% to decide whether it is an early or a late one.
+%
+% \paragraph{Registering late layouts}
+% \begin{sloppypar}
+%   \DescribeMacro{\FXRegisterLayout}\oarg{boolfunc}\marg{name}\marg{macro}\\
+%   In order to register a late annotation layout with \fx, use the command
+%   \cs{FXRegisterLayout}. This macro has two mandatory arguments: the layout
+%   \meta{name} (at least 3 characters long) and the associated layout
+%   \meta{macro}. For instance, the \texttt{inline} layout is registered like
+%   this:
+% \end{sloppypar}
+% \begin{verbatim}
+% \FXRegisterLayout{inline}{\FXLayoutInline}
+% \end{verbatim}
+% The first (optional) argument may provide code that will be executed when
+% the layout is activated (it is used for instance to implement mutual
+% exclusion between the \texttt{margin} and \texttt{marginclue} layouts. Once
+% registered, the new layout gets a boolean option \meta{name} and is also
+% recognized by the \texttt{layout} and \texttt{morelayout} options, as well
+% as by the \cs{fxuselayouts} command as \meta{name}.
+%
+% \paragraph{Registering early layouts}
+% \DescribeMacro{\FXRegisterLayout*}\oarg{boolfunc}\marg{name}\marg{macro}\\
+% In order to register an early annotation layout with \fx, use the starred
+% form of \cs{FXRegisterLayout}. Everything else behaves the same.
+%
+% \paragraph{Providing a layout}
+% \DescribeMacro{\FXProvidesLayout}\marg{name}\oarg{release information}\\
+% If you want to save your layout externally, you need to store it in a file
+% named \texttt{fxlayout}\meta{name}\texttt{.sty} and advertise it by calling
+% \cs{FXProvidesLayout}. It will then be recognized by the \cs{fxloadlayouts}
+% command as \meta{name}.
+%
+% \subsubsection{Registering a new environment layout}
+% \begin{sloppypar}
+%   \DescribeMacro{\FXRegisterEnvLayout}\marg{name}\marg{begin}\marg{end}\\
+%   In order to register a new environment layout with \fx, use the command
+%   \cs{FXRegisterEnvLayout}. This macro has three mandatory arguments: the
+%   layout \meta{name} and the associated \meta{begin} and \meta{end} macros.
+%   For instance, the \texttt{color} layout is registered like this:
+% \end{sloppypar}
+% \begin{verbatim}
+% \FXRegisterEnvLayout{color}{\FXEnvLayoutColorBegin}{\FXEnvLayoutColorEnd}
+% \end{verbatim}
+% Once registered, the new layout is recognized by the \texttt{envlayout}
+% option and by the \cs{fxuseenvlayout} command as \meta{name}.
+%
+% \noindent
+% \DescribeMacro{\FXProvidesEnvLayout}\marg{name}\oarg{release information}\\
+% If you want to save your layout externally, you need to store it in a file
+% named \texttt{fxenvlayout}\meta{name}\texttt{.sty} and advertise it by
+% calling \cs{FXProvidesEnvLayout}. It will then be recognized by the
+% \cs{fxloadenvlayouts} commands as \meta{name}.
+%
+% \subsubsection{Registering a new target layout}
+% \begin{sloppypar}
+%   \DescribeMacro{\FXRegisterTargetLayout}\marg{name}\marg{macro}\\
+%   In order to register a new target layout with \fx, use the command
+%   \cs{FXRegisterTargetLayout}. This macro has two mandatory arguments: the
+%   layout \meta{name} and the associated \meta{macro}. For instance, the
+%   \texttt{color} layout is registered like this:
+% \end{sloppypar}
+% \begin{verbatim}
+% \FXRegisterTargetLayout{color}{\FXTargetLayoutColor}
+% \end{verbatim}
+% Once registered, the new layout is recognized by the \texttt{targetlayout}
+% option and by the \cs{fxusetargetlayout} as \meta{name}.
+%
+% \noindent
+% \DescribeMacro{\FXProvidesTargetLayout}\marg{name}\oarg{release
+%   information}\\
+% If you want to save your layout externally, you need to store it in a file
+% named \texttt{fxtargetlayout}\meta{name}\texttt{.sty} and advertise it by
+% calling \cs{FXProvidesTargetLayout}. It will then be recognized by the
+% \cs{fxloadtargetlayouts} commands as \meta{name}.
+%
+% \subsection{Creating a new theme}
+% Creating a new theme may involve anything from using (by way of
+% \cs{fxsetup}) or modifying existing layouts, to providing new ones. If your
+% new theme has specific layouts, you may consider writing them in seperate
+% files as described before, in order to make them more generally available.
+%
+% \noindent
+% \DescribeMacro{\FXRequireLayout}
+% \DescribeMacro{\FXRequireEnvLayout}
+% \DescribeMacro{\FXRequireTargetLayout}\marg{name}\\
+% In order to use an external layout in a theme, use the commands
+% \cs{FXRequire*Layout} and give them the layout's name as argument.
+%
+% \noindent
+% \DescribeMacro{\FXProvidesTheme}\marg{name}\oarg{release information}\\
+% A theme should be saved in a file named
+% \texttt{fxtheme}\meta{name}\texttt{.sty} and advertised by calling
+% \cs{FXProvidesTheme}. It will then be recognized by the \texttt{theme}
+% option and the \cs{fxusetheme} command.
 %
 % \subsection{Internationalization}
-% \DescribeEnv{english}
-% \DescribeEnv{french}
-% \DescribeEnv{francais}
-% \DescribeEnv{spanish}
-% \DescribeEnv{italian}
-% \DescribeEnv{german}
-% \DescribeEnv{ngerman}
-% \DescribeEnv{danish}
-% \DescribeEnv{croatian}
-% \fixme{} currently supports English, French, Spanish, Italian, German,
-% Danish and Croatian. You can select the language you want to use by passing
-% the corresponding option (these options are usually given directly to
-% |\documentclass{}| which in turn passes them to all packages). The
-% \texttt{french} and \texttt{francais} options are synonyms. The
-% \texttt{german} and \texttt{ngerman} options are currently equivalent.\par
-% If you want a finer grain on the language-dependent parts of \fixme{}, the
-% following macros are provided and can be redefined.\par
-% \DescribeMacro{\fixmenoteprefix}
-% \DescribeMacro{\fixmewarningprefix}
-% \DescribeMacro{\fixmeerrorprefix}
-% \DescribeMacro{\fixmefatalprefix}
-% \DescribeMacro{\fixmelogo}
-% The |\fixme*prefix| macros define the prefix for the four different note
-% levels. They make intensive use of the macro |\fixmelogo| ;-)\par
-% \DescribeMacro{\fixmeindexname}
-% \DescribeMacro{\fixmenoteindexname}
-% \DescribeMacro{\fixmewarningindexname}
-% \DescribeMacro{\fixmeerrorindexname}
-% \DescribeMacro{\fixmefatalindexname}
-% The macro |\fixmeindexname| defines the main \fixme{} index key. The other
-% ones define the different index subkeys for each note level. Please note that
-% an empty name for a subkey means that you don't actually want a subcategory
-% (that's the case by default for fatal errors). The corresponding notes will
-% then appear directly under the main \fixme{} key. For that reason, a non
-% empty subkey must end with an exclamation mark.\par
-% \DescribeMacro{\listfixmename}
-% |\listfixmename| defines the title for the ``list of fixmes'' section.
-%
-% ^^A\subsection{Counters}
-% ^^A \DescribeMacro{\thefixmecount}
-% ^^A \DescribeMacro{\thefixmenotecount}
-% ^^A \DescribeMacro{\thefixmewarningcount}
-% ^^A \DescribeMacro{\thefixmeerrorcount}
-% ^^A \DescribeMacro{\thefixmefatalcount}
-% ^^A As of \fixme{} version 2.0, four counters are provided. They count
-% ^^A respectively the total number of \fixme{} notes, and the number of
-% ^^A level-specific ones. At the end of processing, a \fixme{} usage summary is
-% ^^A displayed and logged.
-%
-%
-% \section{\auctex{} support}
-% \auctex{} is a powerful major mode for editing \TeX{} documents in
-% \textsf{Emacs} or \textsf{XEmacs}. In particular, it provides automatic
-% completion of macro names once they are known. \fixme{} supports \auctex{}
-% by providing a style file named \texttt{fixme.el} which contains \auctex{}
-% definitions for the relevant macros. This file should be installed in a
-% place where \auctex{} can find it (usually in a subdirectory of your
-% \LaTeX{} styles directory). Please refer to the \auctex{} documentation for
-% more information on this.
-%
-% \section{Changes}
+% \DescribeMacro[noindex]{\fx\ldots name}
+% \DescribeMacro[noindex]{\fx\ldots sname}
+% \DescribeMacro[noprint]{\fxenglishnotename}
+% \DescribeMacro[noprint]{\fxenglishnotesname}
+% \DescribeMacro[noprint]{\fxenglishwarningname}
+% \DescribeMacro[noprint]{\fxenglishwarningsname}
+% \DescribeMacro[noprint]{\fxenglisherrorname}
+% \DescribeMacro[noprint]{\fxenglisherrorsname}
+% \DescribeMacro[noprint]{\fxenglishfatalname}
+% \DescribeMacro[noprint]{\fxenglishfatalsname}
+% \DescribeMacro[noprint]{\fxfrenchnotename}
+% \DescribeMacro[noprint]{\fxfrenchnotesname}
+% \DescribeMacro[noprint]{\fxfrenchwarningname}
+% \DescribeMacro[noprint]{\fxfrenchwarningsname}
+% \DescribeMacro[noprint]{\fxfrencherrorname}
+% \DescribeMacro[noprint]{\fxfrencherrorsname}
+% \DescribeMacro[noprint]{\fxfrenchfatalname}
+% \DescribeMacro[noprint]{\fxfrenchfatalsname}
+% \DescribeMacro[noprint]{\fxspanishnotename}
+% \DescribeMacro[noprint]{\fxspanishnotesname}
+% \DescribeMacro[noprint]{\fxspanishwarningname}
+% \DescribeMacro[noprint]{\fxspanishwarningsname}
+% \DescribeMacro[noprint]{\fxspanisherrorname}
+% \DescribeMacro[noprint]{\fxspanisherrorsname}
+% \DescribeMacro[noprint]{\fxspanishfatalname}
+% \DescribeMacro[noprint]{\fxspanishfatalsname}
+% \DescribeMacro[noprint]{\fxitaliannotename}
+% \DescribeMacro[noprint]{\fxitaliannotesname}
+% \DescribeMacro[noprint]{\fxitalianwarningname}
+% \DescribeMacro[noprint]{\fxitalianwarningsname}
+% \DescribeMacro[noprint]{\fxitalianerrorname}
+% \DescribeMacro[noprint]{\fxitalianerrorsname}
+% \DescribeMacro[noprint]{\fxitalianfatalname}
+% \DescribeMacro[noprint]{\fxitalianfatalsname}
+% \DescribeMacro[noprint]{\fxgermannotename}
+% \DescribeMacro[noprint]{\fxgermannotesname}
+% \DescribeMacro[noprint]{\fxgermanwarningname}
+% \DescribeMacro[noprint]{\fxgermanwarningsname}
+% \DescribeMacro[noprint]{\fxgermanerrorname}
+% \DescribeMacro[noprint]{\fxgermanerrorsname}
+% \DescribeMacro[noprint]{\fxgermanfatalname}
+% \DescribeMacro[noprint]{\fxgermanfatalsname}
+% \DescribeMacro[noprint]{\fxdanishnotename}
+% \DescribeMacro[noprint]{\fxdanishnotesname}
+% \DescribeMacro[noprint]{\fxdanishwarningname}
+% \DescribeMacro[noprint]{\fxdanishwarningsname}
+% \DescribeMacro[noprint]{\fxdanisherrorname}
+% \DescribeMacro[noprint]{\fxdanisherrorsname}
+% \DescribeMacro[noprint]{\fxdanishfatalname}
+% \DescribeMacro[noprint]{\fxdanishfatalsname}
+% \DescribeMacro[noprint]{\fxcroatiannotename}
+% \DescribeMacro[noprint]{\fxcroatiannotesname}
+% \DescribeMacro[noprint]{\fxcroatianwarningname}
+% \DescribeMacro[noprint]{\fxcroatianwarningsname}
+% \DescribeMacro[noprint]{\fxcroatianerrorname}
+% \DescribeMacro[noprint]{\fxcroatianerrorsname}
+% \DescribeMacro[noprint]{\fxcroatianfatalname}
+% \DescribeMacro[noprint]{\fxcroatianfatalsname}
+% \fx's language control has been described in section
+% \sectionref{sec:manual:i18n}. For every supported language \meta{lang}, a
+% number of macros define the language-dependent part of \fx. The commands
+% \cs{fx}\meta{lang}\texttt{notename}, \cs{fx}\meta{lang}\texttt{notesname},
+% and their equivalent for the other note levels define the singular and
+% plural forms of the note names.\\
+% \DescribeMacro[noindex]{\...listfixmename}
+% \DescribeMacro[noprint]{\englishlistfixmename}
+% \DescribeMacro[noprint]{\frenchlistfixmename}
+% \DescribeMacro[noprint]{\spanishlistfixmename}
+% \DescribeMacro[noprint]{\italianlistfixmename}
+% \DescribeMacro[noprint]{\germanlistfixmename}
+% \DescribeMacro[noprint]{\danishlistfixmename}
+% \DescribeMacro[noprint]{\croatianlistfixmename}
+% The title for the list of fixmes is defined by the command
+% \cs{}\meta{lang}\texttt{listfixmename}.
+%
+% All of these commands may be renewed, and their values will be honored by
+% \fx in all situations, including potential language changes across the
+% document.
+%
+% \section{History\label{sec:manual:history}}
 % \begin{itemize}
-% \item[v3.4] |\fixme|, |\fxerror|, |\fxwarning| and |\fxnote| are now robust,
-%   thanks to Will Robertson.\\
-%   Fix incompatibility with KOMA-Script classes version of |\@starttoc| when
-%   the lox file is inexistent, reported by Philipp Stephani.
+% \item[v4.0] Support for collaborative annotations, suggested by Michael
+%   Kubovy.\\
+%   Support for ``targeted'' notes and environments (highlighting a portion of
+%   text), suggested by Mark Edgington.\\
+%   Support for ``floating notes'' (not specific to any portion of text),
+%   suggested by Rasmus Villemoes.\\
+%   Support for alternative layout autoswitch in \TeX's inner mode, suggested
+%   by Will Robertson.\\
+%   Support for automatic language tracking in multilingual documents.\\
+%   Support for themes.\\
+%   Extended support for user-provided layouts.\\
+%   Support for \texttt{key=value} argument syntax in the whole user
+%   interface.\\
+%   New command \cs{fxsetup}.\\
+%   Homogenize the log and console messages.\\
+%   Heavy internals refactoring.
+% \item[v3.4] \cs{fixme}, \cs{fxerror}, \cs{fxwarning} and \cs{fxnote} are now
+%   robust, thanks to Will Robertson.\\
+%   Fix incompatibility with \komascript classes version of \cs{@starttoc}
+%   when the lox file is inexistent, reported by Philipp Stephani.
 % \item[v3.3] Document incompatibility between marginal layout and the ACM
 %   SIG classes, reported by Jochen Wuttke.\\
 %   Honor \texttt{twoside} option in marginal layout, suggested by Jens
 %   Remus.\\
-%   Support for KOMA-Script classes version 2006/07/30 v2.95b,
-%   suggested by Jens Remus.\\
+%   Support for \komascript classes version 2006/07/30 v2.95b, suggested by
+%   Jens Remus.\\
 %   Documentation improvements suggested by Brian van den Broek.\\
 %   Fix incompatibility with \texttt{amsart} reported by Lars Madsen:
 %   \cs{@starttoc} takes two arguments.\\
-%   Fix bug reported by Stefan Mann: a typo in the |\fixme@footnotetrue| macro
-%   name.
+%   Fix bug reported by Stefan Mann: a typo in the \cs{fixme@footnotetrue}
+%   macro name.
 % \item[v3.2] Added the marginclue layout option which only signals a fixme in
 %   the margin, withtout the actual contents.\\
 %   Support for Croatian thanks to Marcel Maretic |<marcel@fsb.hr>|.\\
@@ -397,182 +1446,316 @@
 %   contents of lox file.
 % \item[v3.1] Fix bug reported by Arnold Beckmann: the environments were
 %   visible in final mode.
-% \item[v3.0] Added environments corresponding to the note insertion
+% \item[v3.0] Added environments corresponding to the annotation
 %   commands.\\
-%   Added an optional first argument to the note insertion commands
+%   Added an optional first argument to the annotation commands
 %   to change the layout locally.\\
 %   Fix bug reported by Akim Demaille: marginal notes could mess up the
 %   document's layout by flushing it right.
 % \item[v2.2] New option \texttt{silent} to suppress notes logging.\\
 %   Support for Danish thanks to Kim Rud Bille |<krbi01@control.auc.dk>|.
-% \item[v2.1] Use |\nobreakspace| instead of the tilda character. This avoids
+% \item[v2.1] Use \cs{nobreakspace} instead of the tilda character. This avoids
 %   conflicts with Babel in Spanish environments.\\
 %   Fix bug reported by Knut Lickert: index entries were unconditionally built.
 % \item[v2.0] New feature: note levels.\\
-%   New feature: \fixme{} note counters and usage summary.\\
+%   New feature: \fx note counters and usage summary.\\
 %   Suggestions from Kasper B. Graversen |<kbg@dkik.dk>|.\\
 %   Support for Spanish thanks to Agust\'in Mart\'in |<agusmba@terra.es>|
 % \item[v1.5] New appearance option: \texttt{inline}.
-% \item[v1.4] Support for the koma-script classes.\\
-%   Fix bug reported by Ulf Jaenicke-Roessler: the |\listoffixmes| command
-%   didn't work when called before the first \fixme{} note.
+% \item[v1.4] Support for the \komascript classes.\\
+%   Fix bug reported by Ulf Jaenicke-Roessler: the \cs{listoffixmes} command
+%   didn't work when called before the first \fx note.
 % \item[v1.3] Support for Italian thanks to Riccardo Murri
 %   |<murri@phc.unipi.it>|.
 % \item[v1.2] Support for German thanks to Harald Harders
 %   |<h.harders@tu-bs.de>|.
 % \end{itemize}
 %
-% \StopEventually{\par Well, I think that's it. Enjoy using \fixme{}!
-%   \vfill\hfill\small \packagecopyright{}.}
+% \StopEventually{\vfill\hfill\small \packagecopyright{}.}
 %
-% \section{The Code}
-% \begin{macro}{\fixmelogo}
-%   Here's the preamble:
-% \end{macro}
+% \section{Implementation}
+% \subsection{Preamble}
 %    \begin{macrocode}
-\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{fixme}[2009/07/16 v3.4
-			Insert fixme notes in your documents]
+%<fixme>\NeedsTeXFormat{LaTeX2e}
+%<*header>
+\ProvidesPackage{fixme}[2009/09/21 v4.0 Insert fixme notes in your documents]
 
+%</header>
+%    \end{macrocode}
+% Some required packages:
+%    \begin{macrocode}
+%<*fixme>
 \RequirePackage{ifthen}
 \RequirePackage{verbatim}
+\RequirePackage{xkeyval}[2006/11/18]
 
-\newcommand*\fixmelogo{\textsf{FiXme}}
+%</fixme>
+%    \end{macrocode}
+% \begin{macro}{\fixmelogo}
+%   The \fx logo:
+%    \begin{macrocode}
+%<*header>
+\newcommand\fixmelogo{\textsf{FiXme}}
 
+%</header>
 %    \end{macrocode}
-% \subsection{List macros}
-% \begin{macro}{\listoffixmes}
-%   \begin{macro}{\listoffixmes@final}
-%     \begin{macro}{\listoffixmes@draft}
-%       |\listoffixmes| is empty by default. The |final| or |draft| options
-%       will provide the proper definition. Lists are output in a document
-%       class dependant fashion. Classes currently recognized are article,
-%       report, book and their koma-script replacements.
-%
-%       In order to prevent the List of Fixme's heading from being generated
-%       when there are no fixmes, a test on the existence of the lox file is
-%       performed. There's a slight bug left however: after removing the last
-%       fixme, one ends up with an empty lox file, so the heading still
-%       appear. Previously, this was done by checking if some fixmes were
-%       given, but that was buggy: the list of fixme's could not appear before
-%       the first fixme note\ldots I should try to detect whether the file is
-%       empty.
-%     \end{macro}
-%   \end{macro}
 % \end{macro}
+%
+% \subsection{Utilities}
+% \subsubsection{Miscellaneous}
+% \begin{macro}{\@fxpkginfo}
+% \begin{macro}{\@fxpkgwarning}
+%   \marg{msg}\\
+%   Issue a \fx package info or warning:
 %    \begin{macrocode}
-\let\l@fixme\l@figure
-\newcommand\listoffixmes{}
-\def\listoffixmes@final{}
-\def\listoffixmes@draft{%
-  \IfFileExists{\jobname .lox}{%
-    \@listoffixmes@pretoc%
-    \@starttoc{lox}%
-    \@listoffixmes@posttoc}{%
-    \@starttoc{lox}}}
+%<*fixme>
+\newcommand\@fxpkginfo{\PackageInfo{FiXme}}
+\newcommand\@fxpkgwarning{\PackageWarning{FiXme}}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\@fxpkgerror}
+%   \marg{shortmsg}\marg{longmsg}\\
+%   Issue a \fx package error:
+%    \begin{macrocode}
+\newcommand\@fxpkgerror{\PackageError{FiXme}}
+
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{\texttt{xkeyval} related}
+% \begin{macro}{\@fxkeyifundefined}
+%   \marg{families}\marg{keys}\marg{then}\marg{else}
+%    \begin{macrocode}
+\newcommand\@fxkeyifundefined{\key@ifundefined[fx]}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxdefinekey}
+%   \marg{family}\marg{key}\oarg{default}\marg{function}
+%    \begin{macrocode}
+\newcommand\@fxdefinekey{\define@key[fx]}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxvoidkeyerror}
+%   \marg{key}\marg{value}\\
+%   Issue a \fx error about a void key misuse (see below):
+%    \begin{macrocode}
+\newcommand*\@fxvoidkeyerror[2]{%
+  \@fxpkgerror{misuse of key '#1'}{%
+    You have given the key '#1' the argument '#2' but it takes
+    none.\MessageBreak
+    Type X to quit, fix that key and re-run LaTeX.\MessageBreak}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxdefinevoidkey}
+%   \marg{family}\marg{name}\marg{func}\\
+%   A \fx ``void key'' is an \texttt{xkeyval} key that doesn't expect any
+%   argument.
+%    \begin{macrocode}
+\newcommand*\@fxdefinevoidkey[3]{%
+  \define@key[fx]{#1}{#2}[]{%
+    \ifthenelse{\equal{##1}{}}{%
+      #3}{%
+      \@fxvoidkeyerror{#2}{##1}}}}
+
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxdefineboolkey}
+%   \oarg{func}\marg{family}\marg{name}\\
+%   A \fx ``boolean key'' is like an \texttt{xkeyval} one, with the
+%   addition that for every such \texttt{key}, there is a \texttt{nokey} void
+%   key counterpart.
+%    \begin{macrocode}
+\newcommand*\@fxdefineboolkey[3][]{%
+  \define@boolkey[fx]{#2}{#3}[true]{#1}
+  \@fxdefinevoidkey{#2}{no#3}{\@nameuse{fx@#2@#3}{false}}}
 
 %    \end{macrocode}
-% The \texttt{amsbook} and \texttt{amsart} classes have the very ugly idea of
-% redefining the \cs{@starttoc} command to take two arguments. Therefore, I
-% need to provide a specific version of the \cs{listoffixmes} macro:
+% \end{macro}
+% \begin{macro}{\@fxdefinecmdkey}
+%   \marg{family}\oarg{mp}\marg{key}\oarg{default}\marg{function}
 %    \begin{macrocode}
-\def\listoffixmes@draft@ams{\@starttoc{lox}\listfixmename}
+\newcommand\@fxdefinecmdkey{\define@cmdkey[fx]}
 
 %    \end{macrocode}
-% \begin{macro}{\listfixmename}
-%   In order to redefine the list title, users have to call |\renewcommand|.
-%   I don't like this much: it would be cleaner to provide a real command
-%   that redefines the title internally. However, I'll stick with the
-%   current scheme because it is consistent with the rest of \LaTeXe's lists.
 % \end{macro}
+% \begin{macro}{\@fxdefinechoicekey}
+%   \marg{family}\marg{key}\oarg{bin}\marg{alternatives}\ignorespaces
+%   \oarg{default}\marg{function}
 %    \begin{macrocode}
-\newcommand*\listfixmename{}
+\newcommand\@fxdefinechoicekey{\define@choicekey[fx]}
 
 %    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxsetkeys}
+%   \marg{families}\oarg{na}\marg{keys}
+%    \begin{macrocode}
+\newcommand\@fxsetkeys{\setkeys[fx]}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxpresetkeys}
+%   \marg{families}\marg{head keys}\marg{tail keys}
+%    \begin{macrocode}
+%%      Note: currently unused
+%%      \newcommand\@fxpresetkeys{\presetkeys[fx]}
+%    \end{macrocode}
+% \end{macro}
 %
-% \subsubsection{Standard classes}
-% \begin{macro}{\listoffixmes@pretoc@article}
-%   \begin{macro}{\listoffixmes@posttoc@article}
-%     Let's start with the article version:
-%   \end{macro}
+% \subsection{List macros}
+% \subsubsection{Contents lines\label{sec:code:contentsline}}
+% \begin{macro}{\l@fixme}
+%   We use the same layout as for the list of figures.
+%    \begin{macrocode}
+\let\l@fixme\l@figure
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxdottedtocline}
+%   \marg{tocdepth}\marg{indent}\marg{numwidth}\marg{contents}\marg{target}\\
+%   This macro is copied almost verbatim from \LaTeX's core. The intent is to
+%   do a similar layout, but replacing the last argument, normally a page
+%   number, by arbitrary text (in our case, a note's target). The original
+%   macro defines a restricted width to typeset the page number which is much
+%   too short for us, so we just let the \meta{target} text take all the space
+%   it needs.
+%    \begin{macrocode}
+\newcommand*\@fxdottedtocline[5]{%
+  \ifnum #1>\c@tocdepth \else
+    \vskip \z@ \@plus.2\p@
+    {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
+     \parindent #2\relax\@afterindenttrue
+     \interlinepenalty\@M
+     \leavevmode
+     \@tempdima #3\relax
+     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
+     {#4}\nobreak
+     \leaders\hbox{$\m@th
+	\mkern \@dotsep mu\hbox{.}\mkern \@dotsep
+	mu$}\hfill
+     \nobreak
+     #5\par}%
+  \fi}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\fxcontentsline}
+%   \marg{contents}\marg{target}\\
+%   Similar to \LaTeX's \cs{contentsline} macro, but temporarily bind
+%   \cs{@dottedtocline} to our own version. The nice thing about this
+%   implementation is that we can still use \cs{l@fixme} (remember that it is
+%   bound to \cs{l@figure}) without exactly knowing what its definition is.
+%   This macro is at the user level because \cs{contentsline} is, but it is
+%   not currently documented in the user manual.
+%    \begin{macrocode}
+\newcommand*\fxcontentsline[2]{%
+  \begingroup%
+  \let\@dottedtocline\@fxdottedtocline%
+  \l@fixme{#1}{#2}%
+  \endgroup}
+
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\fxaddcontentsline}
+%   \marg{contents}\\
+%   Wrapper around \LaTeX's \cs{addcontentsline} macro to handle the
+%   \texttt{target} option. If a specific target is provided, we can't use the
+%   normal \cs{addcontentsline} macro for reasons explained above, so we use
+%   our own version of \cs{contentsline} instead. This macro is at the user
+%   level because \cs{addcontentsline} is, but it is not currently documented
+%   in the user manual.
+%    \begin{macrocode}
+\newcommand*\fxaddcontentsline[1]{%
+  \ifthenelse{\equal{\cmdfx@note@target}{thepage}}{%
+    \addcontentsline{lox}{fixme}{#1}}{%
+    \addtocontents{lox}{\protect\fxcontentsline{#1}{\cmdfx@note@target}}}}
+
+%    \end{macrocode}
 % \end{macro}
+%
+% \subsubsection{List headers}
+% Lists are output in a document class dependant fashion. Classes currently
+% recognized are \texttt{article}, \texttt{report}, \texttt{book} and their
+% \komascript replacements.
+%
+% \paragraph{\texttt{article} version}
+% \begin{macro}{\@lox@prtc@article}
+% \begin{macro}{\@lox@psttc@article}
+%   \mbox{}
 %    \begin{macrocode}
-\def\@listoffixmes@pretoc@article{%
-  \section*{\listfixmename%
-    \@mkboth{\MakeUppercase\listfixmename}{\MakeUppercase\listfixmename}}%
-  }
-\def\@listoffixmes@posttoc@article{}
+\newcommand\@lox@prtc@article{%
+  \section*{\@fxlistfixmename%
+    \@mkboth{\MakeUppercase\@fxlistfixmename}{\MakeUppercase\@fxlistfixmename}}}
+\let\@lox@psttc@article\relax
 
 %    \end{macrocode}
-% \begin{macro}{\listoffixmes@pretoc@report}
-%   \begin{macro}{\listoffixmes@posttoc@report}
-%     Here's the report version:
-%   \end{macro}
 % \end{macro}
+% \end{macro}
+% \paragraph{\texttt{report} version}
+% \begin{macro}{\@lox@prtc@report}
+% \begin{macro}{\@lox@psttc@report}
+%   \mbox{}
 %    \begin{macrocode}
-\def\@listoffixmes@pretoc@report{%
+\newcommand\@lox@prtc@report{%
   \if@twocolumn
     \@restonecoltrue\onecolumn
   \else
     \@restonecolfalse
   \fi
-  \chapter*{\listfixmename%
-    \@mkboth{\MakeUppercase\listfixmename}{\MakeUppercase\listfixmename}}%
-  }
-\def\@listoffixmes@posttoc@report{\if@restonecol\twocolumn\fi}
+  \chapter*{\@fxlistfixmename%
+    \@mkboth{\MakeUppercase\@fxlistfixmename}{\MakeUppercase\@fxlistfixmename}}}
+\newcommand\@lox@psttc@report{\if@restonecol\twocolumn\fi}
 
 %    \end{macrocode}
-% \begin{macro}{\listoffixmes@pretoc@book}
-%   \begin{macro}{\listoffixmes@posttoc@book}
-%     And here's the book version:
-%   \end{macro}
 % \end{macro}
+% \end{macro}
+% \paragraph{\texttt{book} version}
+% \begin{macro}{\@lox@prtc@book}
+% \begin{macro}{\@lox@psttc@book}
+%   \mbox{}
 %    \begin{macrocode}
-\def\@listoffixmes@pretoc@book{%
+\newcommand\@lox@prtc@book{%
   \if@twocolumn
     \@restonecoltrue\onecolumn
   \else
     \@restonecolfalse
   \fi
-  \chapter*{\listfixmename%
-    \@mkboth{\MakeUppercase\listfixmename}{\MakeUppercase\listfixmename}}%
-  }
-\def\@listoffixmes@posttoc@book{\if@restonecol\twocolumn\fi}
+  \chapter*{\@fxlistfixmename%
+    \@mkboth{\MakeUppercase\@fxlistfixmename}{\MakeUppercase\@fxlistfixmename}}}
+\newcommand\@lox@psttc@book{\if@restonecol\twocolumn\fi}
 
 %    \end{macrocode}
+% \end{macro}
+% \end{macro}
 %
-% \subsubsection{koma-script classes}
-% The code below (version 3.3) mimics KOMA-Script version 2006/07/30 v2.95b.
+% The code below (version 3.3) mimics \komascript version 2006/07/30 v2.95b.
 % Older versions (using chapter*) are no longer supported because it is
 % simpler that way, but if some people complain, I'll  have to conditionalize
-% on the KOMA-Script version, which would be a PITA.
+% on the \komascript version, which would be a \textsc{pita}.
+% \begin{macro}{\lox@heading}
+%   \mbox{}
 %    \begin{macrocode}
-\newcommand*\lox@heading{\float@listhead{\listfixmename}}
+\newcommand\lox@heading{\float@listhead{\@fxlistfixmename}}
 
 %    \end{macrocode}
-% \begin{macro}{\listoffixmes@pretoc@scrartcl}
-%   \begin{macro}{\listoffixmes@posttoc@scrartcl}
-%     Let's start with the scrartcl version:
-%   \end{macro}
 % \end{macro}
+% \paragraph{\texttt{scrartcl} version}
+% \begin{macro}{\@lox@prtc@scrartcl}
+% \begin{macro}{\@lox@psttc@scrartcl}
+%   \mbox{}
 %    \begin{macrocode}
-\def\@listoffixmes@pretoc@scrartcl{%
+\newcommand\@lox@prtc@scrartcl{%
   \begingroup%
     \lox@heading%
-    \setparsizes{0}{0}{\z@\@plus 1fil}\par@updaterelative
-  }
-\def\@listoffixmes@posttoc@scrartcl{%
-  \endgroup
-  }
+    \setparsizes{0}{0}{\z@\@plus 1fil}\par@updaterelative}
+\let\@lox@psttc@scrartcl\endgroup
 
 %    \end{macrocode}
-% \begin{macro}{\listoffixmes@pretoc@scrreprt}
-%   \begin{macro}{\listoffixmes@posttoc@scrreprt}
-%     Here's the scrreprt version:
-%   \end{macro}
 % \end{macro}
+% \end{macro}
+% \paragraph{\texttt{scrreprt} version}
+% \begin{macro}{\@lox@prtc@scrreprt}
+% \begin{macro}{\@lox@psttc@scrreprt}
+%   \mbox{}
 %    \begin{macrocode}
-\def\@listoffixmes@pretoc@scrreprt{%
+\newcommand\@lox@prtc@scrreprt{%
   \begingroup%
     \if@twocolumn
       \@restonecoltrue\onecolumn
@@ -580,21 +1763,20 @@
       \@restonecolfalse
     \fi
     \lox@heading%
-    \setparsizes{0}{0}{\z@\@plus 1fil}\par@updaterelative
-  }
-\def\@listoffixmes@posttoc@scrreprt{%
+    \setparsizes{0}{0}{\z@\@plus 1fil}\par@updaterelative}
+\newcommand\@lox@psttc@scrreprt{%
     \if@restonecol\twocolumn\fi
-  \endgroup
-  }
+  \endgroup}
 
 %    \end{macrocode}
-% \begin{macro}{\listoffixmes@pretoc@scrbook}
-%   \begin{macro}{\listoffixmes@posttoc@scrbook}
-%     And here's the scrbook version:
-%   \end{macro}
 % \end{macro}
+% \end{macro}
+% \paragraph{\texttt{scrbook} version}
+% \begin{macro}{\@lox@prtc@scrbook}
+% \begin{macro}{\@lox@psttc@scrbook}
+%   \mbox{}
 %    \begin{macrocode}
-\def\@listoffixmes@pretoc@scrbook{%
+\newcommand\@lox@prtc@scrbook{%
   \begingroup%
     \if@twocolumn
       \@restonecoltrue\onecolumn
@@ -602,577 +1784,2136 @@
       \@restonecolfalse
     \fi
     \lox@heading%
-    \setparsizes{0}{0}{\z@\@plus 1fil}\par@updaterelative
-}
-\def\@listoffixmes@posttoc@scrbook{%
+    \setparsizes{0}{0}{\z@\@plus 1fil}\par@updaterelative}
+\newcommand\@lox@psttc@scrbook{%
     \if@restonecol\twocolumn\fi
-  \endgroup
-}
+  \endgroup}
 
 %    \end{macrocode}
+% \end{macro}
+% \end{macro}
 %
-% \subsection{Layout macros}
-% \begin{macro}{\FXInline}
-%   \begin{macro}{\FXMargin}
-%     \begin{macro}{\FXMarginCLue}
-%       \begin{macro}{\FXFootnote}
-%         The macros to implement different layouts for the fixme notes:
-%       \end{macro}
-%     \end{macro}
-%   \end{macro}
+% \subsubsection{Status/class-dependent implementation}
+% \begin{macro}{\lox@final}
+% \begin{macro}{\lox@draft}
+%   In order to prevent the List of Fixme's heading from being generated when
+%   there are no \fx notes, a test on the existence of the \texttt{lox} file
+%   is performed. There's a slight bug left however: after removing the last
+%   fixme note, one ends up with an empty \texttt{lox} file, so the heading
+%   still appears. Previously, this was done by checking if some \fx notes
+%   were given, but that was buggy: the List of Fixme's could not appear
+%   before the first fixme note\ldots I should try to detect whether the file
+%   is empty.
+%    \begin{macrocode}
+\let\lox@final\relax
+\newcommand\lox@draft{%
+  \IfFileExists{\jobname .lox}{%
+    \@lox@prtc%
+    \@starttoc{lox}%
+    \@lox@psttc}{%
+    \@starttoc{lox}}}
+%    \end{macrocode}
 % \end{macro}
+% \end{macro}
+% \begin{macro}{\lox@draft@ams}
+%   The \texttt{amsbook} and \texttt{amsart} classes have the very ugly idea
+%   of redefining the \cs{@starttoc} macro to take two arguments. Therefore, I
+%   need to provide a specific version of the \cs{listoffixmes} macro:
 %    \begin{macrocode}
-\newcommand\FXInline[2]{%
-  \textbf{#1}: \emph{#2}}
-\newcommand\FXMargin[2]{%
-  \marginpar[\footnotesize\raggedleft\textbf{#1}: \emph{#2}]{%
-    \footnotesize\raggedright\textbf{#1}: \emph{#2}}}
-\newcommand\FXMarginClue[1]{%
-  \marginpar[\footnotesize\raggedleft\textbf{#1}~!]{%
-    \footnotesize\raggedright\textbf{#1}~!}}
-\newcommand\FXFootnote[2]{%
-  \footnote{\textbf{#1}: \emph{#2}}}
+\newcommand\lox@draft@ams{\@starttoc{lox}\@fxlistfixmename}
 
 %    \end{macrocode}
-% \begin{macro}{\fixmeindexname}
-%   \begin{macro}{\FXIndex}
-%     The macros for index generation:
-%   \end{macro}
-% \end{macro}
-%    \begin{macrocode}
-\newcommand*\fixmeindexname{}
-\newcommand\FXIndex[1]{%
-  \index{***@\fixmeindexname:!#1}}
-
-%    \end{macrocode}
-% \begin{macro}{\fixmefatalprefix}
-% \begin{macro}{\FiXmeInline}
-%   \begin{macro}{\FiXmeMargin}
-%     \begin{macro}{\FiXmeFootnote}
-%       \begin{macro}{\FiXmeUser}
-%         \begin{macro}{\FiXmeIndex}
-%           \begin{macro}{\FiXmeInfo}
-%             \begin{macro}{\FiXmeWarning}
-%               Apart from |\fixmefatalprefix|, the following macros are kept
-%               only to preserve backward compatibility. They are used only by
-%               critical notes and are made to call the new versions by
-%               default:
-%             \end{macro}
-%           \end{macro}
-%         \end{macro}
-%       \end{macro}
-%     \end{macro}
-%   \end{macro}
-% \end{macro}
-% \end{macro}
-%    \begin{macrocode}
-\newcommand*\fixmefatalprefix{}
-\newcommand\FiXmeInline[1]{\FXInline{\fixmefatalprefix}{#1}}
-\newcommand\FiXmeMargin[1]{\FXMargin{\fixmefatalprefix}{#1}}
-\newcommand\FiXmeFootnote[1]{\FXFootnote{\fixmefatalprefix}{#1}}
-\newcommand\FiXmeUser[1]{}
-\let\FiXmeUser\empty
-
-\newcommand\FiXmeIndex[1]{\FXIndex{#1}}
-\newcommand\FiXmeInfo[1]{}
-\newcommand\FiXmeWarning[1]{}
-
-%    \end{macrocode}
-% Booleans that control which layouts are selected:
-%    \begin{macrocode}
-\newif\iffixme@inline
-\newif\iffixme@margin
-\newif\iffixme@marginclue
-\newif\iffixme@footnote
-\newif\iffixme@user
-\newif\iffixme@index
-
-%    \end{macrocode}
-% Setters for these booleans (some might required special treatment):
-%    \begin{macrocode}
-\let\fixme@setinline\fixme@inlinetrue
-\def\fixme@setmargin{%
-  \iffixme@marginclue%
-    \PackageWarning{FiXme}{%
-      Marginal notes requested; turning marginal clues off}%
-    \fixme@margincluefalse%
-  \fi%
-  \fixme@margintrue}
-\def\fixme@setmarginclue{%
-  \iffixme@margin%
-    \PackageWarning{FiXme}{%
-      Marginal clues requested; turning marginal notes off}%
-    \fixme@marginfalse%
-  \fi%
-  \fixme@margincluetrue}
-\let\fixme@setfootnote\fixme@footnotetrue
-\let\fixme@setuser\fixme@usertrue
-\let\fixme@setindex\fixme@indextrue
-
-%    \end{macrocode}
-% \begin{macro}{\fixme@text}
-%   This macro implements the common (textual) part of all notes:
-% \end{macro}
-%    \begin{macrocode}
-\def\fixme@text#1#2{%
-  \iffixme@inline\FXInline{#1}{#2}\fi%
-  \iffixme@margin\FXMargin{#1}{#2}\fi%
-  \iffixme@marginclue\FXMarginClue{#1}\fi%
-  \iffixme@footnote\FXFootnote{#1}{#2}\fi%
-  \iffixme@user\FXUser{#1}{#2}\fi}
-
-%    \end{macrocode}
-% Options that control which layouts are selected:
-%    \begin{macrocode}
-\DeclareOption{inline}{\fixme@setinline}
-\DeclareOption{noinline}{\fixme@inlinefalse}
-\DeclareOption{margin}{\fixme@setmargin}
-\DeclareOption{nomargin}{\fixme@marginfalse}
-\DeclareOption{marginclue}{\fixme@setmarginclue}
-\DeclareOption{nomarginclue}{\fixme@margincluefalse}
-\DeclareOption{footnote}{\fixme@footnotetrue}
-\DeclareOption{nofootnote}{\fixme@footnotefalse}
-\DeclareOption{user}{\fixme@usertrue}
-\DeclareOption{nouser}{\fixme@userfalse}
-\DeclareOption{index}{\fixme@indextrue}
-\DeclareOption{noindex}{\fixme@indexfalse}
-
-%    \end{macrocode}
-% The following options are here for backward compatibility, but are not used
-% anymore:
-%    \begin{macrocode}
-\DeclareOption{info}{}
-\DeclareOption{noinfo}{}
-\DeclareOption{warning}{}
-\DeclareOption{nowarning}{}
-
-%    \end{macrocode}
-%
-% \subsection{Logging macros}
-% \begin{macro}{\FXNote}
-%   \begin{macro}{\FXWarning}
-%     \begin{macro}{\FXerror}
-%       \begin{macro}{\FXFatal}
-%         The macros forcontrolling logging (log file and terminal output):
-%       \end{macro}
-%     \end{macro}
-%   \end{macro}
 % \end{macro}
+%
+% \subsection{Faces}
+% \begin{macro}{\fxsetface}
+%   \marg{name}\marg{value}
 %    \begin{macrocode}
-\newcommand\FXNote[1]{%
-  \GenericInfo{%
-    (FiXme)\@spaces\@spaces\@spaces\@spaces}{%
-    Package FiXme Note: `#1'}}
-\newcommand\FXWarning[1]{%
-  \PackageWarning{FiXme}{`#1'}}
-\newcommand\FXError[1]{%
-  \GenericWarning{%
-    (FiXme)\@spaces\@spaces\@spaces\@spaces}{%
-    Package FiXme Error: `#1'}}
-\newcommand\FXFatal[1]{%
-  \GenericWarning{%
-    (FiXme)\@spaces\@spaces\@spaces\@spaces}{%
-    Package FiXme: `#1'}}
-
+\newcommand*\fxsetface[2]{\@fxsetkeys{face}{#1face=#2}}
 %    \end{macrocode}
-% Boolean that control wether to stay silent or not:
+% \end{macro}
+% \begin{macro}{\@fxnewface}
+%   \oarg{default}\marg{name}\\
+%   A face is just a command key:
 %    \begin{macrocode}
-\newif\iffixme@silent
-
+\newcommand*\@fxnewface[2][]{%
+  \@fxdefinecmdkey{face}{#2face}{}%
+  \fxsetface{#2}{#1}}
 %    \end{macrocode}
-%% Options that control whether to be silent or not:
+% \end{macro}
+% \begin{macro}{\@fxuseface}
+%   \marg{name}
 %    \begin{macrocode}
-\DeclareOption{silent}{\fixme@silenttrue}
-\DeclareOption{nosilent}{\fixme@silentfalse}
+\newcommand*\@fxuseface[1]{\@nameuse{cmdfx@face@#1face}}
 
 %    \end{macrocode}
+% \end{macro}
 %
-% \subsection{\fixme{} notes}
-% Here are the counters:
-% \DescribeMacro{\thefixmecount}
-% \DescribeMacro{\thefixmenotecount}
-% \DescribeMacro{\thefixmewarningcount}
-% \DescribeMacro{\thefixmeerrorcount}
-% \DescribeMacro{\thefixmefatalcount}
+% \subsection{Annotation layouts}
+% \begin{option}{multiuser}
+% \begin{option}{singleuser}
+% \begin{option}{mode}
+%   These options specify whether \fx should function in standalone or
+%   collaborative mode, allowing the different layouts to tweak their output.
 %    \begin{macrocode}
-\newcounter{fixmecount}
-\newcounter{fixmenotecount}
-\newcounter{fixmewarningcount}
-\newcounter{fixmeerrorcount}
-\newcounter{fixmefatalcount}
-
-%    \end{macrocode}
-% \begin{macro}{\fixmenoteprefix}
-%   \begin{macro}{\fixmenoteindexname}
-%     \begin{macro}{\fixme@note@draft}
-%       \begin{macro}{\fixme@note@final}
-%         The different flavors of fixme notes. Proper definitions will be
-%         selected by the |draft| or |final| options. Let's start with the
-%         note notes:
-%       \end{macro}
-%     \end{macro}
-%   \end{macro}
-% \end{macro}
-%    \begin{macrocode}
-\newcommand*\fixmenoteprefix{}
-\newcommand*\fixmenoteindexname{}
-\def\fixme@note@draft#1{%
-  \fixme@text{\fixmenoteprefix}{#1}%
-  \iffixme@index\FXIndex{\fixmenoteindexname\thefixmenotecount: #1}\fi%
-  \iffixme@silent\else\FXNote{#1}\fi%
-  \addcontentsline{lox}{fixme}{\protect\fixmenoteprefix: #1}}
-\def\fixme@note@final#1{%
-  \iffixme@silent\else\FXNote{#1}\fi%
-  \addcontentsline{lox}{fixme}{\protect\fixmenoteprefix: #1}}
-
-%    \end{macrocode}
-% \begin{macro}{\fixmewarningprefix}
-%   \begin{macro}{\fixmewarningindexname}
-%     \begin{macro}{\fixme@warning@draft}
-%       \begin{macro}{\fixme@warning@final}
-%         Here are the warnings notes:
-%       \end{macro}
-%     \end{macro}
-%   \end{macro}
-% \end{macro}
-%    \begin{macrocode}
-\newcommand*\fixmewarningprefix{}
-\newcommand*\fixmewarningindexname{}
-\def\fixme@warning@draft#1{%
-  \fixme@text{\fixmewarningprefix}{#1}%
-  \iffixme@index\FXIndex{\fixmewarningindexname\thefixmewarningcount: #1}\fi%
-  \iffixme@silent\else\FXWarning{#1}\fi%
-  \addcontentsline{lox}{fixme}{\protect\fixmewarningprefix: #1}}
-\def\fixme@warning@final#1{%
-  \iffixme@silent\else\FXWarning{#1}\fi%
-  \addcontentsline{lox}{fixme}{\protect\fixmewarningprefix: #1}}
-
-%    \end{macrocode}
-% \begin{macro}{\fixmeerrorprefix}
-%   \begin{macro}{\fixmeerrorindexname}
-%     \begin{macro}{\fixme@error@draft}
-%       \begin{macro}{\fixme@error@final}
-%         Here are the errors notes:
-%       \end{macro}
-%     \end{macro}
-%   \end{macro}
-% \end{macro}
-%    \begin{macrocode}
-\newcommand*\fixmeerrorprefix{}
-\newcommand*\fixmeerrorindexname{}
-\def\fixme@error@draft#1{%
-  \fixme@text{\fixmeerrorprefix}{#1}%
-  \iffixme@index\FXIndex{\fixmeerrorindexname\thefixmeerrorcount: #1}\fi%
-  \iffixme@silent\else\FXError{#1}\fi%
-  \addcontentsline{lox}{fixme}{\protect\fixmeerrorprefix: #1}}
-\def\fixme@error@final#1{%
-  \iffixme@silent\else\FXError{#1}\fi%
-  \addcontentsline{lox}{fixme}{\protect\fixmeerrorprefix: #1}}
-
-%    \end{macrocode}
-% \begin{macro}{\fixmefatalindexname}
-%   \begin{macro}{\fixme@fatal@draft}
-%     \begin{macro}{\fixme@fatal@final}
-%       And here are the fatal ones:
-%     \end{macro}
-%   \end{macro}
-% \end{macro}
-%    \begin{macrocode}
-\newcommand*\fixmefatalindexname{}
-\def\fixme@fatal@draft#1{%
-  \iffixme@inline\FiXmeInline{#1}\fi%
-  \iffixme@margin\FiXmeMargin{#1}\fi%
-  \iffixme@marginclue\FXMarginClue{\fixmefatalprefix}\fi%
-  \iffixme@footnote\FiXmeFootnote{#1}\fi%
-  \iffixme@user\FiXmeUser{#1}\fi%
-  \iffixme@index\FiXmeIndex{%
-    \fixmefatalindexname\thefixmefatalcount: #1}\fi%
-  \iffixme@silent\else\FXFatal{#1}\fi%
-  \addcontentsline{lox}{fixme}{\protect\fixmefatalprefix: #1}}
-\def\fixme@fatal@final#1{%
-  \PackageError{FiXme}{`#1' fixme left in final version}{%
-    You are processing your document in final mode,\MessageBreak
-    but you still have some critical FiXme's left behind.\MessageBreak
-    Type X to quit, fix your document, and rerun LaTeX.}}
-
-%    \end{macrocode}
-% \begin{macro}{\@fixme}
-%   \begin{macro}{\fxnote}
-%     \begin{macro}{\fxwarning}
-%       \begin{macro}{\fxerror}
-%         \begin{macro}{\fixme}
-%           Here are the notes insertion macros. The different versions are
-%           |\let| to the draft of final flavors defined above by the
-%           \texttt{draft} or \texttt{final} options.
-%         \end{macro}
-%       \end{macro}
-%     \end{macro}
-%   \end{macro}
-% \end{macro}
-%    \begin{macrocode}
-\def\@@fixme#1#2{%
-  \stepcounter{fixmecount}%
-  \stepcounter{fixme#1count}%
-  \csname fixme@#1\endcsname{#2}}
-\def\@fixme#1[#2]#3{%
-  \bgroup%
-  \fixme@inlinefalse%
-  \fixme@marginfalse%
-  \fixme@margincluefalse%
-  \fixme@footnotefalse%
-  \fixme@userfalse%
-  \fixme@indexfalse%
-  \@for\fixme@option:=#2\do{%
-    \expandafter\ifx\csname fixme@\fixme@option true\endcsname\relax
-      \PackageError{FiXme}{Unknown layout option `\fixme@option'}{%
-	You have given an invalid option to \string\fixme, or an \string\fx %
-	command.\MessageBreak
-	Valid options are `inline', `margin', `marginclue', `footnote', %
-	`user',\MessageBreak
-	and `index'.\MessageBreak
-	Type X to quit, fix your document, and rerun LaTeX.}%
-      \else%
-      \csname fixme@set\fixme@option\endcsname%
-    \fi}%
-  \@@fixme{#1}{#3}%
-  \egroup}
-\DeclareRobustCommand\fxnote{\@ifnextchar[%]
-  {\@fixme{note}}{\@@fixme{note}}}
-\DeclareRobustCommand\fxwarning{\@ifnextchar[%]
-  {\@fixme{warning}}{\@@fixme{warning}}}
-\DeclareRobustCommand\fxerror{\@ifnextchar[%]
-  {\@fixme{error}}{\@@fixme{error}}}
-\DeclareRobustCommand\fixme{\@ifnextchar[%]
-  {\@fixme{fatal}}{\@@fixme{fatal}}}
-
-%    \end{macrocode}
-%
-% \subsection{\fixme{} environments}
-% The \fixme{} environments use the corresponding macro version to handle
-% inline (and possibly index) layout, and to perform logging. In final mode,
-% verbatim's \texttt{comment} environment is used to suppress output.
-%    \begin{macrocode}
-\newcommand\FXEnvBegin{\begin{quotation}}
-\newcommand\FXEnvEnd{\end{quotation}}
-
-\def\@fxenvbegin@draft#1#2{%
-  \FXEnvBegin
-  \edef\fixme@args{inline%
-    \iffixme@index,index\fi%
-    \iffixme@marginclue,marginclue\fi}%
-  \csname#1\endcsname[\fixme@args]{#2}}
-\def\@fxenvbegin@final#1#2{
-  \edef\fixme@args{inline%
-    \iffixme@index,index\fi%
-    \iffixme@marginclue,marginclue\fi}%
-  \csname#1\endcsname[\fixme@args]{#2}
-  \comment
-}
-
-\def\@fxenvend@draft{\FXEnvEnd}
-\def\@fxenvend@final{\endcomment}
-
-\newenvironment{anfxnote}[1][]{%
-  \@fxenvbegin{fxnote}{#1}}{%
-  \@fxenvend}
-\newenvironment{anfxwarning}[1][]{%
-  \@fxenvbegin{fxwarning}{#1}}{%
-  \@fxenvend}
-\newenvironment{anfxerror}[1][]{%
-  \@fxenvbegin{fxerror}{#1}}{%
-  \@fxenvend}
-\newenvironment{afixme}[1][]{%
-  \@fxenvbegin{fixme}{#1}}{%
-  \@fxenvend}
-
-%    \end{macrocode}
-%
-% \subsection{Language processing}
-% Options that control which language is selected:
-%    \begin{macrocode}
-\DeclareOption{english}{%
-  \renewcommand*\fixmenoteprefix{\fixmelogo\nobreakspace Note}
-  \renewcommand*\fixmewarningprefix{\fixmelogo\nobreakspace Warning}
-  \renewcommand*\fixmeerrorprefix{\fixmelogo\nobreakspace Error}
-  \renewcommand*\fixmefatalprefix{\fixmelogo}
-  \renewcommand*\fixmeindexname{\fixmelogo}
-  \renewcommand*\fixmenoteindexname{**a@Notes:!}
-  \renewcommand*\fixmewarningindexname{**b@Warnings:!}
-  \renewcommand*\fixmeerrorindexname{**c@Errors:!}
-  \renewcommand*\fixmefatalindexname{}
-  \renewcommand*{\listfixmename}{List of Corrections}}
-\DeclareOption{french}{%
-  \renewcommand*\fixmenoteprefix{\fixmelogo\nobreakspace Note}
-  \renewcommand*\fixmewarningprefix{\fixmelogo\nobreakspace Attention}
-  \renewcommand*\fixmeerrorprefix{\fixmelogo\nobreakspace Erreur}
-  \renewcommand*\fixmefatalprefix{\fixmelogo}
-  \renewcommand*\fixmeindexname{\fixmelogo}
-  \renewcommand*\fixmenoteindexname{**a@Notes:!}
-  \renewcommand*\fixmewarningindexname{**b@Avertissements:!}
-  \renewcommand*\fixmeerrorindexname{**c@Erreurs:!}
-  \renewcommand*\fixmefatalindexname{}
-  \renewcommand*{\listfixmename}{Liste des Corrections}}
-\DeclareOption{francais}{\ExecuteOptions{french}}
-\DeclareOption{spanish}{%
-  \renewcommand*\fixmenoteprefix{\fixmelogo\nobreakspace Nota}
-  \renewcommand*\fixmewarningprefix{\fixmelogo\nobreakspace Aviso}
-  \renewcommand*\fixmeerrorprefix{\fixmelogo\nobreakspace Error}
-  \renewcommand*\fixmefatalprefix{\fixmelogo}
-  \renewcommand*\fixmeindexname{\fixmelogo}
-  \renewcommand*\fixmenoteindexname{**a@Notas:!}
-  \renewcommand*\fixmewarningindexname{**b@Avisos:!}
-  \renewcommand*\fixmeerrorindexname{**c@Errores:!}
-  \renewcommand*\fixmefatalindexname{}
-  \renewcommand*{\listfixmename}{Lista de Correcciones}}
-\DeclareOption{italian}{%
-  \renewcommand*\fixmenoteprefix{\fixmelogo\nobreakspace Nota}
-  \renewcommand*\fixmewarningprefix{\fixmelogo\nobreakspace Avviso}
-  \renewcommand*\fixmeerrorprefix{\fixmelogo\nobreakspace Errore}
-  \renewcommand*\fixmefatalprefix{\fixmelogo}
-  \renewcommand*\fixmeindexname{\fixmelogo}
-  \renewcommand*\fixmenoteindexname{**a@Note:!}
-  \renewcommand*\fixmewarningindexname{**b@Avvisi:!}
-  \renewcommand*\fixmeerrorindexname{**c@Errori:!}
-  \renewcommand*\fixmefatalindexname{}
-  \renewcommand*{\listfixmename}{Corrigenda}}
-\DeclareOption{german}{%
-  \renewcommand*\fixmenoteprefix{\fixmelogo\nobreakspace Anm}
-  \renewcommand*\fixmewarningprefix{\fixmelogo\nobreakspace Warnung}
-  \renewcommand*\fixmeerrorprefix{\fixmelogo\nobreakspace Fehler}
-  \renewcommand*\fixmefatalprefix{\fixmelogo}
-  \renewcommand*\fixmeindexname{\fixmelogo}
-  \renewcommand*\fixmenoteindexname{**a@Anmerkungen:!}
-  \renewcommand*\fixmewarningindexname{**b@Warnungen:!}
-  \renewcommand*\fixmeerrorindexname{**c@Fehler:!}
-  \renewcommand*\fixmefatalindexname{}
-  \renewcommand*{\listfixmename}{Verzeichnis der Korrekturen}}
-\DeclareOption{ngerman}{%
-  \ExecuteOptions{german}}
-\DeclareOption{danish}{%
-  \renewcommand*\fixmenoteprefix{\fixmelogo\nobreakspace Note}
-  \renewcommand*\fixmewarningprefix{\fixmelogo\nobreakspace Advarsel}
-  \renewcommand*\fixmeerrorprefix{\fixmelogo\nobreakspace Fejl}
-  \renewcommand*\fixmefatalprefix{\fixmelogo}
-  \renewcommand*\fixmeindexname{\fixmelogo}
-  \renewcommand*\fixmenoteindexname{**a@Noter:!}
-  \renewcommand*\fixmewarningindexname{**b@Advarsler:!}
-  \renewcommand*\fixmeerrorindexname{**c@Fejl:!}
-  \renewcommand*\fixmefatalindexname{}
-  \renewcommand*{\listfixmename}{Rettelser}}
-\DeclareOption{croatian}{%
-  \renewcommand*\fixmenoteprefix{\fixmelogo\nobreakspace Poruka}
-  \renewcommand*\fixmewarningprefix{\fixmelogo\nobreakspace Upozorenje}
-  \renewcommand*\fixmeerrorprefix{\fixmelogo\nobreakspace Gre\v ska}
-  \renewcommand*\fixmefatalprefix{\fixmelogo}
-  \renewcommand*\fixmeindexname{\fixmelogo}
-  \renewcommand*\fixmenoteindexname{**a@Poruke:!}
-  \renewcommand*\fixmewarningindexname{**b@Upozorenja:!}
-  \renewcommand*\fixmeerrorindexname{**c@Greske:!}
-  \renewcommand*\fixmefatalindexname{}
-  \renewcommand*{\listfixmename}{Popis korekcija}}
+\@fxdefineboolkey[%
+  \ifthenelse{\equal{#1}{true}}{%
+    \fx@mode@singleuserfalse}{%
+    \fx@mode@singleusertrue}]{%
+    mode}{multiuser}
+\@fxdefineboolkey[%
+  \ifthenelse{\equal{#1}{true}}{%
+    \fx@mode@multiuserfalse}{%
+    \fx@mode@multiusertrue}]{%
+    mode}{singleuser}
+\@fxdefinechoicekey{mode}{mode}{multiuser,singleuser}{\@fxsetkeys{mode}{#1}}
 
 %    \end{macrocode}
+% \end{option}
+% \end{option}
+% \end{option}
 %
-% \subsection{Document status processing}
-% \begin{macro}{\fixme@note}
-%   \begin{macro}{\fixme@warning}
-%     \begin{macro}{\fixme@error}
-%       Here's where the draft or final version of the internal macros are
-%       selected.
-%     \end{macro}
-%   \end{macro}
-% \end{macro}
-%    \begin{macrocode}
-\DeclareOption{final}{
-  \let\fixme@note\fixme@note@final
-  \let\fixme@warning\fixme@warning@final
-  \let\fixme@error\fixme@error@final
-  \let\fixme@fatal\fixme@fatal@final
-  \let\@fxenvbegin\@fxenvbegin@final
-  \let\@fxenvend\@fxenvend@final
-  \let\listoffixmes\listoffixmes@final
-  }
-
-\DeclareOption{draft}{
-  \@ifclassloaded{article}{
-    \let\@listoffixmes@pretoc\@listoffixmes@pretoc@article
-    \let\@listoffixmes@posttoc\@listoffixmes@posttoc@article}{
-    \@ifclassloaded{report}{
-      \let\@listoffixmes@pretoc\@listoffixmes@pretoc@report
-      \let\@listoffixmes@posttoc\@listoffixmes@posttoc@report}{
-      \@ifclassloaded{book}{
-	\let\@listoffixmes@pretoc\@listoffixmes@pretoc@book
-	\let\@listoffixmes@posttoc\@listoffixmes@posttoc@book}{
-	\@ifclassloaded{scrartcl}{
-	  \let\@listoffixmes@pretoc\@listoffixmes@pretoc@scrartcl
-	  \let\@listoffixmes@posttoc\@listoffixmes@posttoc@scrartcl}{
-	  \@ifclassloaded{scrreprt}{
-	    \let\@listoffixmes@pretoc\@listoffixmes@pretoc@scrreprt
-	    \let\@listoffixmes@posttoc\@listoffixmes@posttoc@scrreprt}{
-	    \@ifclassloaded{scrbook}{
-	      \let\@listoffixmes@pretoc\@listoffixmes@pretoc@scrbook
-	      \let\@listoffixmes@posttoc\@listoffixmes@posttoc@scrbook}{
-	      \@ifclassloaded{amsbook}{
-		\let\listoffixmes@draft\listoffixmes@draft@ams}{
-		\@ifclassloaded{amsart}{
-		  \let\listoffixmes@draft\listoffixmes@draft@ams}{
-		  %% Use the article layout by default.
-		  \let\@listoffixmes@pretoc\@listoffixmes@pretoc@article
-		  \let\@listoffixmes@posttoc\@listoffixmes@posttoc@article}
-	      }
-	    }
-	  }
-	}
-      }
-    }
-  }
-  \let\fixme@note\fixme@note@draft
-  \let\fixme@warning\fixme@warning@draft
-  \let\fixme@error\fixme@error@draft
-  \let\fixme@fatal\fixme@fatal@draft
-  \let\@fxenvbegin\@fxenvbegin@draft
-  \let\@fxenvend\@fxenvend@draft
-  \let\listoffixmes\listoffixmes@draft
-}
-
-%    \end{macrocode}
-% Put us in \texttt{english} and \texttt{final} mode, and enable the marginal
-% notes. Note that as documented, marginal notes are incompatible with the ACM
-% SIG classes. Initially, I thought I would detect these classes and issue
-% an error if marginal layout (or clue) is active. However, I changed my mind,
-% because nothing prevents somebody to write a new class on top of these ones
-% and authorize |\marginpar| back again. Normally these classes issue an error
-% if |\marginpar| is used. However, the 2.3 / June 2007 versions are buggy and
-% the error actually triggers a stack overflow in \LaTeX\ldots Patch on its
-% way. Oh boy, these classes are a mess.
-%    \begin{macrocode}
-\ExecuteOptions{english,final,margin,nosilent}
-\ProcessOptions*
-
-%    \end{macrocode}
-% Finally, ensure backward compatibility for |\fixme| with |\FiXmeUser|, and
-% output a summary giving the number of fixme notes at the end of the
-% compilation:
+% \subsubsection{Layout creation}
+% Separating between ``early'' and ``late'' layouts is needed in starred
+% context, that is, when we are using targeted commands or environments.
+% \begin{macro}{\@fxearlylayouts}
+% \begin{macro}{\@fxlatelayouts}
+%   Comma-separated lists of available early and late layouts.
 %    \begin{macrocode}
-\AtBeginDocument{%
-  \ifx\FiXmeUser\empty
-    \renewcommand\FiXmeUser[1]{\FXUser{\fixmefatalprefix}{#1}}
-  \fi}
+\let\@fxearlylayouts\empty
+\let\@fxlatelayouts\empty
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\FXProvidesLayout}
+%   \marg{name}\oarg{release information}
+%    \begin{macrocode}
+\newcommand*\FXProvidesLayout[1]{\ProvidesPackage{fxlayout#1}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@FXRegisterLayout}
+%   \marg{when}\oarg{boolfunc}\marg{name}\marg{funcname}\\
+%   Register a new layout with \fx. This currently involves creating the
+%   boolean layout option with an optional function argument, constructing the
+%   translation macro to call the actual layout macro, and updating the
+%   appropriate layout list (early or late). The translation macro can't be
+%   \cs{let} to the real one, because themes might want to redefine latter.
+%    \begin{macrocode}
+\def\@FXRegisterLayout#1[#2]#3#4{%
+  \@fxkeyifundefined{layout}{#3}{%
+    \@fxdefineboolkey[#2]{layout}{#3}%
+    \expandafter\def\csname @fxlayout@#3\endcsname{#4}%
+    \expandafter\ifx\csname @fx#1layouts\endcsname\empty%
+      \expandafter\g@addto@macro\csname @fx#1layouts\endcsname{#3}%
+    \else%
+      \expandafter\g@addto@macro\csname @fx#1layouts\endcsname{,#3}%
+    \fi}{%
+    \@fxpkgerror{layout '#3' already registered}{%
+      You have called \string\FXRegisterLayout\space with a name already
+      in use.\MessageBreak
+      If you want to modify an existing layout, renew its
+      command.\MessageBreak
+      Otherwise, you must choose a different name.}}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\FXRegisterLayout}
+% \begin{macro}{\FXRegisterLayout*}
+%   \meta{\texttt{*}}\oarg{boolfunc}\marg{name}\marg{funcname}\\
+%   And the use-level interface:
+%    \begin{macrocode}
+\newcommand\FXRegisterLayout{%
+  \@ifstar{%
+    \@ifnextchar[%]
+    {\@FXRegisterLayout{early}}{\@FXRegisterLayout{early}[]}}{%
+    \@ifnextchar[%]
+    {\@FXRegisterLayout{late}}{\@FXRegisterLayout{late}[]}}}
 
-\AtEndDocument{%
-  \GenericWarning{%
-    (FiXme)\@spaces\@spaces\@spaces\@spaces
-  }{%
-    Package FiXme Summary: Number of notes: \thefixmenotecount,\MessageBreak%
-    Number of warnings: \thefixmewarningcount,\MessageBreak%
-    Number of errors: \thefixmeerrorcount,\MessageBreak%
-    Number of fatal errors: \thefixmefatalcount,\MessageBreak%
-    Total: \thefixmecount\@gobble%
-  }}
 %    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsubsection{Built-in layouts}
+% Let's deal start with the early layouts, and continue with the late ones.
+% \paragraph{Margin}
+% \begin{layout}[noprint]{margin}
+% \begin{face}{margin}
+%   \mbox{}
+%    \begin{macrocode}
+\@fxnewface{margin}
+%    \end{macrocode}
+% \end{face}
+% \begin{macro}{\FXLayoutMargin}
+%   \marg{type}\marg{note}\marg{author}
+%    \begin{macrocode}
+\newcommand*\FXLayoutMargin[3]{%
+  \marginpar[%
+  \raggedleft\@fxuseface{margin}\ignorespaces#3 \fxnotename{#1}: #2]{%
+    \raggedright\@fxuseface{margin}\ignorespaces#3 \fxnotename{#1}: #2}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxlayout@margin}
+%   \begin{booleanoption}{margin}
+%     \mbox{}
+%    \begin{macrocode}
+\FXRegisterLayout*[%
+  \ifthenelse{\boolean{fx@layout@margin}\and\boolean{fx@layout@marginclue}}{%
+    \@fxpkgwarning{%
+      marginal notes requested;\MessageBreak
+      turning marginal clues off}%
+    \fx@layout@marginclue{false}}]{%
+    margin}{\FXLayoutMargin}
+%    \end{macrocode}
+% \end{booleanoption}
+% \end{macro}
+% \end{layout}
+%
+% \paragraph{Margin clue}
+% \begin{layout}[noprint]{marginclue}
+% \begin{macro}{\FXLayoutMarginCLue}
+%   \marg{type}\marg{note}\marg{author}
+%    \begin{macrocode}
+\newcommand*\FXLayoutMarginClue[3]{%
+  \marginpar[%
+  \raggedleft\@fxuseface{margin}\ignorespaces#3 \fxnotename{#1}!]{%
+    \raggedright\@fxuseface{margin}\ignorespaces#3 \fxnotename{#1}!}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxlayout@marginclue}
+%   \begin{booleanoption}{marginclue}
+%     \mbox{}
+%    \begin{macrocode}
+\FXRegisterLayout*[%
+  \ifthenelse{\boolean{fx@layout@marginclue}\and\boolean{fx@layout@margin}}{%
+    \@fxpkgwarning{%
+      marginal clues requested;\MessageBreak
+      turning marginal notes off}%
+    \fx@layout@margin{false}}]{%
+    marginclue}{\FXLayoutMarginClue}
+%    \end{macrocode}
+% \end{booleanoption}
+% \end{macro}
+% \end{layout}
+%
+% \paragraph{Footnote}
+% \begin{layout}[noprint]{footnote}
+% \begin{macro}{\FXLayoutFootnote}
+%   \marg{type}\marg{note}\marg{author}
+%    \begin{macrocode}
+\newcommand*\FXLayoutFootnote[3]{%
+  \footnote{\ignorespaces#3 \fxnotename{#1}: #2}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxlayout@footnote}
+%   \begin{booleanoption}{footnote}
+%     \mbox{}
+%    \begin{macrocode}
+\FXRegisterLayout{footnote}{\FXLayoutFootnote}
+%    \end{macrocode}
+% \end{booleanoption}
+% \end{macro}
+% \end{layout}
+%
+% \paragraph{Inline}
+% \begin{layout}[noprint]{inline}
+% \begin{face}{inline}
+%   \mbox{}
+%    \begin{macrocode}
+\@fxnewface{inline}
+%    \end{macrocode}
+% \end{face}
+% \begin{macro}{\FXLayoutInline}
+%   \marg{type}\marg{note}\marg{author}
+%    \begin{macrocode}
+\newcommand*\FXLayoutInline[3]{%
+  {\@fxuseface{inline}\ignorespaces#3 \fxnotename{#1}: #2}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxlayout@inline}
+%   \begin{booleanoption}{inline}
+%     \mbox{}
+%    \begin{macrocode}
+\FXRegisterLayout{inline}{\FXLayoutInline}
+%    \end{macrocode}
+% \end{booleanoption}
+% \end{macro}
+% \end{layout}
+%
+% \paragraph{Index}
+% \begin{layout}[noprint]{index}
+% \begin{macro}{\fixmeindexname}
+%   \mbox{}
+%    \begin{macrocode}
+\newcommand\fixmeindexname{\fixmelogo}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@wrindex}
+%   \marg{contents}\\
+%   A replacement for \LaTeX's standard \cs{@wrindex} macro to deal with the
+%   \texttt{target} option. When given, it is supposed to replace the page
+%   number, just as in the list of fixmes.
+%    \begin{macrocode}
+\def\@wrindex#1{%
+  \ifthenelse{\equal{\cmdfx@note@target}{thepage}}{%
+    \protected@write\@indexfile{}{\string\indexentry{#1}{\thepage}}}{%
+    \protected@write\@indexfile{}{\string\indexentry{#1}{\cmdfx@note@target}}}
+  \endgroup
+  \@esphack}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxnotekey}
+% \begin{macro}{\@fxwarningkey}
+% \begin{macro}{\@fxerrorkey}
+% \begin{macro}{\@fxfatalkey}
+%   The keys used to sort indexed \fx notes by importance level:
+%    \begin{macrocode}
+\newcommand\@fxnotekey{***a}
+\newcommand\@fxwarningkey{***b}
+\newcommand\@fxerrorkey{***c}
+\newcommand\@fxfatalkey{***d}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\FXLayoutIndex}
+%   \marg{type}\marg{note}\marg{author}
+%    \begin{macrocode}
+\newcommand*\FXLayoutIndex[3]{%
+  \iffx@mode@multiuser%
+    \index{***@\fixmeindexname:%
+      !\@nameuse{@fx#1key}@\fxnotesname{#1}:%
+      !\@nameuse{thefx#1count}: #3: #2}%
+    \index{***#3@\fixmeindexname{} (#3):%
+      !\@nameuse{@fx#1key}@\fxnotesname{#1}:%
+      !\@nameuse{thefx#1count}: #2}%
+  \else%
+    \index{***@\fixmeindexname:%
+      !\@nameuse{@fx#1key}@\fxnotesname{#1}:%
+      !\@nameuse{thefx#1count}: #2}%
+  \fi}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxlayout@index}
+%   \begin{booleanoption}{index}
+%     \mbox{}
+%    \begin{macrocode}
+\FXRegisterLayout{index}{\FXLayoutIndex}
+%    \end{macrocode}
+% \end{booleanoption}
+% \end{macro}
+% \end{layout}
+%
+% \paragraph{Contents line\label{sec:code:contentslinelayout}}
+% \begin{macro}{\FXLayoutContentsLine}
+%   \marg{type}\marg{note}\marg{author}\\
+%   This one is not registered like the others because it is always active and
+%   used explicitely by the \texttt{lox} code.
+%    \begin{macrocode}
+\newcommand*\FXLayoutContentsLine[3]{%
+  \iffx@mode@multiuser%
+    \fxaddcontentsline{\ignorespaces#3 \fxnotename{#1}: #2}%
+  \else%
+    \fxaddcontentsline{\fxnotename{#1}: #2}%
+  \fi}
+
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Layout loading}
+% \begin{macro}{\fxloadlayouts}
+%   \marg{name,\ldots}
+%    \begin{macrocode}
+\newcommand*\fxloadlayouts[1]{%
+  \edef\@fxlts{\zap@space#1 \@empty}%
+  \@for\@fxlt:=\@fxlts\do{\usepackage{fxlayout#1}}}
+
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Layout control}
+% \begin{macro}{\@fxparselayout}
+%   Utility macro to detect the \texttt{no}\meta{name} form of layout options.
+%   The drawback of this technique is that layout options must be at least 3
+%   characters long. No big deal though\ldots
+%    \begin{macrocode}
+\def\@fxparselayout#1#2#3\relax{\def\@fxltprefix{#1#2}\def\@fxltrest{#3}}
+% \begin{macro}{\fxuselayouts}
+%   \marg{[no]names}\\
+%   First, ensure that those layouts are available, then activate them.
+%   \cs{\FXRequireLayouts} is a better style for theme programming.
+%    \begin{macrocode}
+\newcommand*\fxuselayouts[1]{%
+  \edef\@fxlts{\zap@space#1 \@empty}%
+  \@for\@fxlt:=\@fxlts\do{%
+    \expandafter\@fxparselayout\@fxlt\relax%
+    \ifthenelse{\equal{\@fxltprefix}{no}}{%
+      \let\@fxltname\@fxltrest}{%
+      \let\@fxltname\@fxlt}%
+    \@fxkeyifundefined{layout}{\@fxltname}{\fxloadlayouts{\@fxltname}}{}}%
+  \@fxsetkeys{layout}{#1}}
+\let\FXRequireLayouts\fxuselayouts
+
+%    \end{macrocode}
+% \end{macro}
+% \begin{option}{innerlayout}
+%   The alternative inner mode layout:
+%    \begin{macrocode}
+\@fxdefinecmdkey{layout}{innerlayout}{}
+%    \end{macrocode}
+% \end{option}
+% \begin{option}{morelayout}
+%   The \texttt{morelayout} option adds to the existing layout configuration.
+%   The implementation is trivial, as it simply boils down to calling
+%   \cs{setkeys} on its argument. There are several advantages in doing this.
+%   \begin{enumerate}
+%   \item It is possible to disable a layout by using the
+%     \texttt{no}\meta{layout} form. For example,
+%     |morelayout={inline,nomargin}| will work.
+%   \item A wrong layout name (for instance, misspelled) will trigger an
+%     \texttt{xkeyval} error.
+%   \end{enumerate}
+%    \begin{macrocode}
+\@fxdefinekey{layout}{morelayout}{\fxuselayouts{#1}}
+%    \end{macrocode}
+% \end{option}
+% \begin{option}{layout}
+%   The \texttt{layout} option lets the user specify exactly which ones she
+%   wants to use. Not very difficult to implement either: it works by first
+%   deactivating all layouts, and then activating the provided ones as before.
+%   Note that the use of the \texttt{no}\meta{layout} form is valid but has no
+%   effect.
+%    \begin{macrocode}
+\@fxdefinekey{layout}{layout}{%
+  \edef\@fxlayouts{\@fxearlylayouts,\@fxlatelayouts}%
+  \@for\@fxlt:=\@fxlayouts\do{%
+    \@nameuse{fx@layout@\@fxlt}{false}}%
+  \fxuselayouts{#1}}
+
+%    \end{macrocode}
+% \end{option}
+%
+% \subsection{Environment Layouts}
+% \subsubsection{Layout creation}
+% \begin{macro}{\FXProvidesEnvLayout}
+%   \marg{name}\oarg{release information}
+%    \begin{macrocode}
+\newcommand*\FXProvidesEnvLayout[1]{\ProvidesPackage{fxenvlayout#1}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\FXRegisterEnvLayout}
+%   \marg{name}\marg{beginfuncname}\marg{endfuncname}\\
+%   Register a new environment layout with \fx. This currently only involves
+%   constructing the translation macros. The translation macros in question
+%   can't be \cs{let} to the real ones, because themes or users might want to
+%   redefine the latter.
+%    \begin{macrocode}
+\newcommand*\FXRegisterEnvLayout[3]{%
+  \@ifundefined{@fxenvlayout@#1@begin}{%
+    \expandafter\def\csname @fxenvlayout@#1@begin\endcsname{#2}%
+    \expandafter\def\csname @fxenvlayout@#1@end\endcsname{#3}}{%
+    \@fxpkgerror{environment layout '#2' already registered}{%
+      You have called \string\FXRegisterEnvLayout\space with a name already in
+      use.\MessageBreak
+      If you want to modify an existing environment layout, renew its
+      commands.\MessageBreak
+      Otherwise, you must choose a different name.}}}
+
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Built-in layouts}
+% \paragraph{Plain}
+% \begin{envlayout}[noprint]{plain}
+% \begin{face}{env}
+%   \mbox{}
+%    \begin{macrocode}
+\@fxnewface{env}
+%    \end{macrocode}
+% \end{face}
+% \begin{macro}{\FXEnvLayoutPlainBegin}
+% \begin{macro}{\FXEnvLayoutPlainEnd}
+%   \marg{type}\marg{author}
+%    \begin{macrocode}
+\newcommand*\FXEnvLayoutPlainBegin[2]{%
+  \@fxuseface{env}\ignorespaces#2 \fxnotename{#1}: \ignorespaces}
+\newcommand*\FXEnvLayoutPlainEnd[2]{}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\@fxenvlayout@plain@begin}
+% \begin{macro}{\@fxenvlayout@plain@end}
+%    \begin{macrocode}
+\FXRegisterEnvLayout{plain}{\FXEnvLayoutPlainBegin}{\FXEnvLayoutPlainEnd}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{envlayout}
+%
+% \paragraph{Signature}
+% \begin{envlayout}{signature}
+% \begin{face}{signature}
+%   \mbox{}
+%    \begin{macrocode}
+\@fxnewface[\itshape]{signature}
+%    \end{macrocode}
+% \end{face}
+% \begin{macro}{\@fxdosig}
+%   \marg{author}
+% \begin{macro}{\@fxsignature}
+%   Use a signature of the form ``-- sig'', unless author is empty.
+%    \begin{macrocode}
+\newcommand*\@fxdosig[1]{%
+  \ifthenelse{\equal{#1}{}}{\def\@fxsignature{}}{%
+    \def\@fxsignature{ -- {\@fxuseface{signature}#1}}}}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\FXEnvLayoutSignatureBegin}
+% \begin{macro}{\FXEnvLayoutSignatureEnd}
+%   \marg{type}\marg{author}
+%    \begin{macrocode}
+\newcommand*\FXEnvLayoutSignatureBegin[2]{%
+  \@fxuseface{env}\fxnotename{#1}: \ignorespaces}
+\newcommand*\FXEnvLayoutSignatureEnd[2]{\@fxdosig{#2}\@fxsignature}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\@fxenvlayout@signature@begin}
+% \begin{macro}{\@fxenvlayout@signature@end}
+%   \mbox{}
+%    \begin{macrocode}
+\FXRegisterEnvLayout{signature}{%
+  \FXEnvLayoutSignatureBegin}{\FXEnvLayoutSignatureEnd}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{envlayout}
+%
+% \subsubsection{Layout selection}
+% \begin{macro}{\@fxselectenvlayout}
+%   \marg{name}
+% \begin{macro}{\@fxenvlayout@begin}
+% \begin{macro}{\@fxenvlayout@end}
+%   \marg{type}\marg{author}\\
+%   This is much simpler than standard layout management because only one
+%   environment layout at a time is possible. Using a specific environment
+%   layout boils down to possibly loading it, and binding the beginning and
+%   ending macros to the proper translation ones.
+%    \begin{macrocode}
+\newcommand*\@fxselectenvlayout[1]{%
+  \expandafter\let\expandafter\@fxenvlayout@begin%
+    \csname @fxenvlayout@#1@begin\endcsname%
+  \expandafter\let\expandafter\@fxenvlayout@end%
+    \csname @fxenvlayout@#1@end\endcsname}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsubsection{Layout loading}
+% \begin{macro}{\fxloadenvlayouts}
+%   \marg{name,\ldots}
+%    \begin{macrocode}
+\newcommand*\fxloadenvlayouts[1]{%
+  \edef\@fxlts{\zap@space#1 \@empty}%
+  \@for\@fxlt:=\@fxlts\do{\usepackage{fxenvlayout#1}}}
+
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Layout control}
+% \begin{macro}{\fxuseenvlayout}
+% \begin{macro}{\FXRequireEnvLayout}
+%   \marg{name}\\
+%   \cs{FXRequireEnvLayout} is a better style for theme programming.
+%    \begin{macrocode}
+\newcommand*\fxuseenvlayout[1]{%
+  \@ifundefined{@fxenvlayout@#1@begin}{\fxloadenvlayouts{#1}}{}%
+  \@fxselectenvlayout{#1}}
+\let\FXRequireEnvLayout\fxuseenvlayout
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{option}{envlayout}
+%   \mbox{}
+%    \begin{macrocode}
+\@fxdefinekey{envlayout}{envlayout}{\fxuseenvlayout{#1}}
+
+%    \end{macrocode}
+% \end{option}
+%
+% \subsection{Target Layouts}
+% \subsubsection{Layout creation}
+% \begin{macro}{\FXProvidesTargetLayout}
+%   \marg{name}\oarg{release information}
+%    \begin{macrocode}
+\newcommand*\FXProvidesTargetLayout[1]{\ProvidesPackage{fxtargetlayout#1}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\FXRegisterTargetLayout}
+%   \marg{name}\marg{funcname}\\
+%   Register a new target layout with \fx. This currently only involves
+%   constructing the translation macro. The translation macro in question
+%   can't be \cs{let} to the real one, because themes or user might want to
+%   redefine the latter.
+%    \begin{macrocode}
+\newcommand*\FXRegisterTargetLayout[2]{%
+  \@ifundefined{@fxtargetlayout@#1}{%
+    \expandafter\def\csname @fxtargetlayout@#1\endcsname{#2}}{%
+    \@fxpkgerror{target layout '#1' already registered}{%
+      You have called \string\FXRegisterTargetLayout\space with a name
+      already in use.\MessageBreak
+      If you want to modify an existing target layout, renew its
+      command.\MessageBreak
+      Otherwise, you must choose another name.}}}
+
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Built-in layouts}
+% \paragraph{Plain}
+% \begin{targetlayout}[noprint]{plain}
+% \begin{face}{target}
+%   \mbox{}
+%    \begin{macrocode}
+\@fxnewface{target}
+%    \end{macrocode}
+% \end{face}
+% \begin{macro}{\FXTargetLayoutPlain}
+%   \marg{target}
+%    \begin{macrocode}
+\newcommand\FXTargetLayoutPlain[2]{\@fxuseface{target}#2}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxtargetlayout@plain}
+%    \begin{macrocode}
+\FXRegisterTargetLayout{plain}{\FXTargetLayoutPlain}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{targetlayout}
+%
+% \subsubsection{Layout selection}
+% \begin{macro}{\@fxselecttargetlayout}
+%   \marg{name}
+% \begin{macro}{\@@fxtargetlayout}
+%   \marg{target}\\
+%   This is much simpler than standard layout management because only one
+%   target layout at a time is possible. Using a specific target layout boils
+%   down to possibly loading it, and binding the layout macro to the proper
+%   translation one.
+%    \begin{macrocode}
+\newcommand*\@fxselecttargetlayout[1]{%
+  \expandafter\let\expandafter\@@fxtargetlayout%
+    \csname @fxtargetlayout@#1\endcsname}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsubsection{Target layout loading}
+% \begin{macro}{\fxloadtargetlayouts}
+%   \marg{name,\ldots}
+%    \begin{macrocode}
+\newcommand*\fxloadtargetlayouts[1]{%
+  \edef\@fxlts{\zap@space#1 \@empty}%
+  \@for\@fxlt:=\@fxlts\do{\usepackage{fxtargetlayout#1}}}
+
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Target layout control}
+% \begin{macro}{\fxusetargetlayout}
+% \begin{macro}{\FXRequireTargetLayout}
+%   \marg{name}\\
+%   \cs{FXRequireTargetLayout} is a better style for theme programming.
+%    \begin{macrocode}
+\newcommand*\fxusetargetlayout[1]{%
+  \@ifundefined{@fxtargetlayout@#1}{\fxloadtargetlayouts{#1}}{}%
+  \@fxselecttargetlayout{#1}}
+\let\FXRequireTargetLayout\fxusetargetlayout
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{option}{targetlayout}
+%   \mbox{}
+%    \begin{macrocode}
+\@fxdefinekey{targetlayout}{targetlayout}{\fxusetargetlayout{#1}}
+
+%    \end{macrocode}
+% \end{option}
+%
+% \subsubsection{Status-dependant versions}
+% \begin{macro}{\@fxtargetlayout@final}
+% \begin{macro}{\@fxtargetlayout@draft}
+%   \marg{target}\\
+%   In \texttt{final} mode, the target is typeset as-is. In \texttt{draft}
+%   mode, we use the selected layout.
+%    \begin{macrocode}
+\newcommand\@fxtargetlayout@final[2]{#2}
+\newcommand\@fxtargetlayout@draft[2]{%
+  \begingroup\@@fxtargetlayout{#1}{#2}\endgroup}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Logging}
+% \subsubsection{Logging macros}
+% \begin{macro}{\FXLogNote}
+% \begin{macro}{\FXLogWarning}
+% \begin{macro}{\FXLogerror}
+% \begin{macro}{\FXLogFatal}
+%   \marg{msg}
+%    \begin{macrocode}
+\newcommand*\FXLogNote[1]{%
+  \GenericInfo{%
+    (FiXme)\@spaces\@spaces\@spaces\@spaces}{%
+    FiXme Note: '#1'}}
+\newcommand*\FXLogWarning[1]{%
+  \GenericWarning{%
+    (FiXme)\@spaces\@spaces\@spaces\@spaces}{%
+    FiXme Warning: '#1'}}
+\newcommand*\FXLogError[1]{%
+  \GenericWarning{%
+    (FiXme)\@spaces\@spaces\@spaces\@spaces}{%
+    FiXme Error: '#1'}}
+\newcommand*\FXLogFatal[1]{%
+  \GenericWarning{%
+    (FiXme)\@spaces\@spaces\@spaces\@spaces}{%
+    FiXme Fatal Error: '#1'}}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\@fxlog@note}
+% \begin{macro}{\@fxlog@warning}
+% \begin{macro}{\@fxlog@error}
+% \begin{macro}{\@fxlog@fatal}
+%   In order for the generic note dispatcher to be able to call the logging
+%   macros (see section \sectionref{sec:code:lowlevelcmd}), we need an easier
+%   translation mechanism from the note type to the actual macro name. The
+%   translation macros in question can't be \cs{let} to the real one, because
+%   users might want to redefine the actual log macros later.
+%    \begin{macrocode}
+\def\@fxlog@note{\FXLogNote}
+\def\@fxlog@warning{\FXLogWarning}
+\def\@fxlog@error{\FXLogError}
+\def\@fxlog@fatal{\FXLogFatal}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsubsection{Logging control}
+% \begin{booleanoption}{silent}
+%   Whether to log \fx notes:
+%    \begin{macrocode}
+\@fxdefineboolkey{log}{silent}
+
+%    \end{macrocode}
+% \end{booleanoption}
+%
+% \subsection{\fx notes}
+% \subsubsection{Note parameters}
+% \begin{counter}{fixmecount}
+% \begin{counter}{fxnotecount}
+% \begin{counter}{fxwarningcount}
+% \begin{counter}{fxerrorcount}
+% \begin{counter}{fxfatalcount}
+%   \texttt{fixmecount} maintains the total of all notes, regardless
+%   of their level. Each note type also gets its own counter:
+%    \begin{macrocode}
+\newcounter{fixmecount}
+\newcounter{fxnotecount}
+\newcounter{fxwarningcount}
+\newcounter{fxerrorcount}
+\newcounter{fxfatalcount}
+
+%    \end{macrocode}
+% \end{counter}
+% \end{counter}
+% \end{counter}
+% \end{counter}
+% \end{counter}
+% \begin{option}{author}
+%   A \fx note's ``author'' allows to distinguish notes from different persons
+%   in collaborative mode.
+%    \begin{macrocode}
+\@fxdefinecmdkey{note}{author}{}
+%    \end{macrocode}
+% \end{option}
+% \begin{option}{target}
+%   A \fx note's ``target'' may replace the page number in the list of
+%   fixmes or in the index (see also section
+%   \sectionref{sec:code:contentslinelayout}).
+%    \begin{macrocode}
+\@fxdefinecmdkey{note}{target}{}
+%    \end{macrocode}
+% \end{option}
+%
+% \subsubsection{Layout dispatch\label{sec:code:layoutdispatch}}
+% \begin{macro}{\@fxhandleinnermode}
+%   Handle the case where \TeX{} is in inner mode. We use the alternative
+%   layout provided by the \texttt{innerlayout} option, and we make sure to
+%   disable both the \texttt{margin} and \texttt{marginclue} layout forms.
+%   This is done by appending \texttt{nomargin} and \texttt{nomarginclue} to
+%   the inner layout value (this also renders nasty user settings harmless).
+%   Before that, we provide some informative message if risky layout forms
+%   were active.
+%    \begin{macrocode}
+\newcommand\@fxhandleinnermode{%
+  \ifinner%
+    \ifthenelse{\boolean{fx@layout@margin}}{%
+      \@fxpkginfo{%
+	inner mode detected;\MessageBreak
+	turning margin layout form off}}{%
+      \ifthenelse{\boolean{fx@layout@marginclue}}{%
+	\@fxpkginfo{%
+	  inner mode detected;\MessageBreak
+	  turning marginclue layout form off}}{}}%
+    \expandafter\fxuselayouts\expandafter{%
+      \cmdfx@layout@innerlayout,nomargin,nomarginclue}%
+  \fi}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxissueearlydraftlayouts}
+% \begin{macro}{\@fxissuelatedraftlayouts}
+%   \marg{type}\marg{note}\\
+%   Dispatch all active draft mode layouts. \cs{@fxissueearlydraftlayouts}
+%   takes care of dispatching early layouts, but before that, handles the
+%   inner mode case. \cs{@fxissuelatedraftlayouts} just dispatches late
+%   layouts.
+%    \begin{macrocode}
+\newcommand*\@fxissueearlydraftlayouts[2]{%
+  \@fxhandleinnermode%
+  \@for\@fxlt:=\@fxearlylayouts\do{%
+    \@nameuse{iffx@layout@\@fxlt}%
+      \@nameuse{@fxlayout@\@fxlt}{#1}{#2}{\cmdfx@note@author}%
+    \fi}}
+\newcommand*\@fxissuelatedraftlayouts[2]{%
+  \@for\@fxlt:=\@fxlatelayouts\do{%
+    \@nameuse{iffx@layout@\@fxlt}%
+      \@nameuse{@fxlayout@\@fxlt}{#1}{#2}{\cmdfx@note@author}%
+    \fi}}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\@fxissuecommonlayouts}
+%   \marg{type}\marg{note}\\
+%   Dispatch all mode-independent layouts (actually, ``layout'' is to be taken
+%   in a slightly broader sense here). This macro executes all operations that
+%   need to be performed regardless of the document status. This includes
+%   updating the \texttt{lox} file and logging the annotation. Note that even
+%   in \texttt{final} mode, the \texttt{lox} file is updated. This is to
+%   maintain a coherent state if the user goes from \texttt{final} to
+%   \texttt{draft} or the other way around. In \texttt{final} mode, the list
+%   of fixmes does not appears because \cs{listoffixmes} is \cs{let} to
+%   \cs{relax}.
+%    \begin{macrocode}
+\newcommand*\@fxissuecommonlayouts[2]{%
+  \FXLayoutContentsLine{#1}{#2}{\cmdfx@note@author}%
+  \iffx@log@silent\else\@nameuse{@fxlog@#1}{#2}\fi}
+
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Status-dependent implementation\label{sec:code:lowlevelcmd}}
+% \begin{macro}{\@@@fxnote@early@final}
+% \begin{macro}{\@@@fxnote@late@final}
+% \begin{macro}{\@@@fxnote@early@draft}
+% \begin{macro}{\@@@fxnote@late@draft}
+%   \marg{type}\marg{note}\\
+%   The lower-level macros that perform the real job. In \texttt{final} mode,
+%   early work is only to check for remaining fatal annotations and late work
+%   is to dispatch common layouts.
+%    \begin{macrocode}
+\newcommand*\@@@fxnote@early@final[2]{%
+  \ifthenelse{\equal{#1}{fatal}}{%
+    \@fxpkgerror{'#2' fatal error left in final version}{%
+      You are currently processing in final mode,\MessageBreak
+      but you still have some FiXme fatal errors left behind.\MessageBreak
+      Type X to quit, fix your document (or switch back to draft
+      mode),\MessageBreak
+      and rerun LaTeX.}}{}}
+\newcommand*\@@@fxnote@late@final[2]{\@fxissuecommonlayouts{#1}{#2}}
+%    \end{macrocode}
+% In \texttt{draft} mode, early work is to dispatch early layouts, while late
+% work is to dispatch both late \emph{and} common layouts.
+%    \begin{macrocode}
+\newcommand*\@@@fxnote@early@draft[2]{%
+  \@fxissueearlydraftlayouts{#1}{#2}}
+\newcommand*\@@@fxnote@late@draft[2]{%
+  \@fxissuelatedraftlayouts{#1}{#2}%
+  \@fxissuecommonlayouts{#1}{#2}}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsubsection{Standard version}
+% \begin{macro}{\@fxpostconfigure}
+%   This macro is used in \cs{@@fxnote@early} below, after processing user
+%   options (even when there is none), to postconfigure some aspects of the
+%   notes. Currently, this involves two things: setting the author to
+%   \cs{fixmelogo} if it still is \texttt{fixme}, and automatically tracking
+%   the current language if required (note that all other language options
+%   turn tracking off, meaning that one can override language tracking locally
+%   by providing a language explicitely). Since environments need the
+%   post-configuration done sooner, they perform it themselves and rebind this
+%   macro to \cs{relax}.
+%    \begin{macrocode}
+\newcommand*\@fxpostconfigure{%
+  \ifthenelse{\equal{\cmdfx@note@author}{fixme}}{%
+    \@fxsetkeys{note}{author=\fixmelogo}}{}%
+  \iffx@lang@langtrack%
+    \@fxkeyifundefined{lang}{\languagename}{%
+      \@fxpkgwarning{unknown language '\languagename';\MessageBreak
+        falling back to \@fxdefaultlang}%
+      \@fxsetkeys{lang}{\@fxdefaultlang}}{%
+      \@fxsetkeys{lang}{\languagename}}
+  \fi}
+
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxendgroup}
+%   This macro is used in \cs{@@fxnote@late} below to close the group opened
+%   at the user level. Since environments need the group opened for a longer
+%   time, they rebind it to \cs{relax} and close the group themselves later
+%   on.
+%    \begin{macrocode}
+\let\@fxendgroup\endgroup
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@@fxnote@early}
+%   \marg{type}\marg{note}\\
+%   Counters need to be updated regardless of the mode.
+%    \begin{macrocode}
+\def\@@fxnote@early#1#2{%
+    \@fxpostconfigure%
+    \stepcounter{fixmecount}%
+    \stepcounter{fx#1count}%
+    \@@@fxnote@early{#1}{#2}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@@fxnote@late}
+%    \begin{macrocode}
+\def\@@fxnote@late#1#2{%
+    \@@@fxnote@late{#1}{#2}%
+  \@fxendgroup}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@@fxnote}
+%   \marg{type}\marg{note}\\
+%   This macro is used everywhere outside a starred context, because in that
+%   case, we do early and late work in a row.
+%    \begin{macrocode}
+\def\@@fxnote#1#2{%
+  \@@fxnote@early{#1}{#2}%
+  \@@fxnote@late{#1}{#2}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxnote}
+%   \marg{type}\oarg{options}\marg{note}
+%    \begin{macrocode}
+\def\@fxnote#1[#2]#3{%
+  \@fxsetkeys{mode,status,lang,log,note,face,layout}{#2}%
+  \@@fxnote{#1}{#3}}
+
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Starred version}
+% \begin{macro}{\@@fxsnote}
+%   \marg{type}\marg{note}\marg{text}\\
+%   Post-configuration is done here because it's the code path confluent for
+%   all starred commands. Relaxing post-configuration afterwards is to prevent
+%   \cs{@@fxnote@early} from doing it again. Note that this is the only place
+%   where we actually do early and late work not in a row.
+%    \begin{macrocode}
+\long\def\@@fxsnote#1#2#3{%
+  \@fxpostconfigure\let\@fxpostconfigure\relax%
+  \@@fxnote@early{#1}{#2}\@fxtargetlayout{#1}{#3}\@@fxnote@late{#1}{#2}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxsnote}
+%   \marg{type}\oarg{options}\marg{note}\marg{text}\\
+%   Note the \texttt{targetlayout} family here.
+%    \begin{macrocode}
+\long\def\@fxsnote#1[#2]#3#4{%
+  \@fxsetkeys{mode,status,lang,log,note,face,layout,targetlayout}{#2}%
+  \@@fxsnote{#1}{#3}{#4}}
+
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{User-level interface generation}
+% \begin{macro}{\@fxpreconfigure}
+%   \marg{author}\\
+%   This macro is used at the beginning of every user-level entry point (here
+%   for notes, and also in the environments section), to preconfigure some
+%   aspects of the notes, before possibly processing options. Currently, this
+%   only involves presetting the note's author to the one specified in the
+%   call to \cs{FXRegisterAuthor}. This however is not done for the built-in
+%   \texttt{fixme} author, because this one should honor a global setting.
+%    \begin{macrocode}
+\newcommand*\@fxpreconfigure[1]{%
+  \ifthenelse{\equal{#1}{fixme}}{}{\@fxsetkeys{note}{author=#1}}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxnewnotemacro}
+%   \marg{prefix}\marg{type}\marg{author}\\
+%   This macro defines the user-level interface:
+%    \begin{macrocode}
+\newcommand*\@fxnewnotemacro[3]{%
+  \expandafter\DeclareRobustCommand\csname #1#2\endcsname{%
+    \begingroup%
+      \@fxpreconfigure{#3}%
+      \@ifstar{%
+        \@ifnextchar[%]
+        {\@fxsnote{#2}}{\@@fxsnote{#2}}}{%
+        \@ifnextchar[%]
+        {\@fxnote{#2}}{\@@fxnote{#2}}}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsection{\fx environments}
+% A \fx environment's summary is laid out by the corresponding macro, but
+% the \texttt{inline} layout is disabled. This is as easy as appending
+% \texttt{noinline} to the end of the options list.
+% \subsubsection{Status-dependent implementation}
+% \begin{macro}{\@@@@fxbeginenv@final}
+% \begin{macro}{\@@@@fxbeginenv@draft}
+% \begin{macro}{\@fxendenv@final}
+% \begin{macro}{\@fxendenv@draft}
+%   \marg{type}\\
+%   In final mode, \texttt{verbatim}'s \texttt{comment} environment is used to
+%   suppress output.
+%    \begin{macrocode}
+\def\@@@@fxbeginenv@final#1{\comment}
+\def\@@@@fxbeginenv@draft#1{\@fxenvlayout@begin{#1}{\cmdfx@note@author}}
+\def\@fxendenv@final#1{\endcomment}
+\def\@fxendenv@draft#1{\@fxenvlayout@end{#1}{\cmdfx@note@author}}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsubsection{Standard versions}
+% \begin{macro}{\@@@fxbeginenv}
+% \begin{macro}{\@@fxbeginenv}
+%   \marg{type}\marg{summary}\\
+%   Post-configuration is done here (it's the code path confluent for all
+%   non-starred environments). Relaxing post-configuration afterwards is to
+%   prevent \cs{@@fxnote} from doing it again.
+%    \begin{macrocode}
+\def\@@@fxbeginenv#1#2{%
+  \@fxpostconfigure\let\@fxpostconfigure\relax%
+  \@@fxnote{#1}{#2}%
+  \@@@@fxbeginenv{#1}}
+\def\@@fxbeginenv#1#2{%
+  \@fxsetkeys{layout}{noinline}%
+  \@@@fxbeginenv{#1}{#2}}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\@fxbeginenv}
+%   \marg{type}\oarg{options}\marg{summary}
+%    \begin{macrocode}
+\def\@fxbeginenv#1[#2]#3{%
+  \@fxsetkeys{mode,status,lang,log,note,face,layout,envlayout}{#2,noinline}%
+  \@@@fxbeginenv{#1}{#3}}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsubsection{Starred versions}
+% \begin{macro}{\@@@fxbeginsenv}
+% \begin{macro}{\@@fxbeginsenv}
+%   \marg{type}\marg{summary}\marg{text}\\
+%   Post-configuration is done here (it's the code path confluent for all
+%   starred environments). Relaxing post-configuration afterwards is to
+%   prevent \cs{@@fxsnote} from doing it again.
+%    \begin{macrocode}
+\long\def\@@@fxbeginsenv#1#2#3{%
+  \@fxpostconfigure\let\@fxpostconfigure\relax%
+  \@@fxsnote{#1}{#2}{#3}%
+  \@@@@fxbeginenv{#1}}
+\long\def\@@fxbeginsenv#1#2#3{%
+  \@fxsetkeys{layout}{noinline}%
+  \@@@fxbeginsenv{#1}{#2}{#3}}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\@fxbeginenv}
+%   \marg{type}\oarg{options}\marg{summary}\marg{text}\\
+%   Note the \texttt{targetlayout} family here.
+%    \begin{macrocode}
+\long\def\@fxbeginsenv#1[#2]#3#4{%
+  \@fxsetkeys{mode,status,lang,log,note,face,layout,envlayout,targetlayout}{%
+    #2,noinline}%
+  \@@@fxbeginsenv{#1}{#3}{#4}}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsubsection{User-level interface generation}
+% \begin{macro}{\@fxnewnoteenvs}
+%   \marg{prefix}\marg{type}\marg{author}\\
+%   This macro defines the user-level interface. The ending macros are
+%   identical. Also, the environments close their own group, so we prevent
+%   \cs{@@fxnote} from doing so by temporarily rebinding \cs{@fxendgroup} to
+%   \cs{relax}.
+%    \begin{macrocode}
+\newcommand*\@fxnewnoteenvs[3]{%
+  \expandafter\def\csname #1#2\endcsname{%
+    \begingroup%
+      \let\@fxendgroup\relax%
+      \@fxpreconfigure{#3}%
+      \@ifnextchar[%]
+        {\@fxbeginenv{#2}}{\@@fxbeginenv{#2}}}
+  \expandafter\def\csname end#1#2\endcsname{%
+      \@fxendenv{#2}%
+    \endgroup}%
+  \expandafter\long\expandafter\def\csname #1#2*\endcsname{%
+    \begingroup%
+      \let\@fxendgroup\relax%
+      \@fxpreconfigure{#3}%
+      \@ifnextchar[%]
+        {\@fxbeginsenv{#2}}{\@@fxbeginsenv{#2}}}
+  \expandafter\def\csname end#1#2*\endcsname{%
+      \@fxendenv{#2}%
+    \endgroup}}
+
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsection{\fx authors}
+% \begin{macro}{\FXRegisterAuthor}
+%   \marg{cmdprefix}\marg{envprefix}\marg{name}\\
+%   This macro creates the whole user-level interface for a particular author:
+%    \begin{macrocode}
+\newcommand*\FXRegisterAuthor[3]{%
+  \@ifundefined{#1note}{}{%
+    \@fxpkgerror{command prefix '#1' already in use}{%
+      You have called \string\FXRegisterAuthor\space with a command prefix
+      already in use.\MessageBreak
+      Please choose another one.}}%
+  \@ifundefined{#2note}{}{%
+    \@fxpkgerror{environment prefix '#2' already in use}{%
+      You have called \string\FXRegisterAuthor\space with an environment
+      prefix already in use.\MessageBreak
+      Please choose another one.}}%
+  \@fxnewnotemacro{#1}{note}{#3}%
+  \@fxnewnotemacro{#1}{warning}{#3}%
+  \@fxnewnotemacro{#1}{error}{#3}%
+  \@fxnewnotemacro{#1}{fatal}{#3}%
+  \@fxnewnoteenvs{#2}{note}{#3}%
+  \@fxnewnoteenvs{#2}{warning}{#3}%
+  \@fxnewnoteenvs{#2}{error}{#3}%
+  \@fxnewnoteenvs{#2}{fatal}{#3}}
+
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}[noindex]{\fx...[*]}
+% \begin{environment}[noindex]{anfx...[*]}
+% \begin{macro}[noprint]{\fxnote}
+% \begin{macro}[noprint]{\fxwarning}
+% \begin{macro}[noprint]{\fxerror}
+% \begin{macro}[noprint]{\fxfatal}
+% \begin{macro}[noprint]{\fxnote*}
+% \begin{macro}[noprint]{\fxwarning*}
+% \begin{macro}[noprint]{\fxerror*}
+% \begin{macro}[noprint]{\fxfatal*}
+% \begin{environment}[noprint]{anfxnote}
+% \begin{environment}[noprint]{anfxwarning}
+% \begin{environment}[noprint]{anfxerror}
+% \begin{environment}[noprint]{anfxfatal}
+% \begin{environment}[noprint]{anfxnote*}
+% \begin{environment}[noprint]{anfxwarning*}
+% \begin{environment}[noprint]{anfxerror*}
+% \begin{environment}[noprint]{anfxfatal*}
+%   And we use it to create the \fx default user:
+%    \begin{macrocode}
+\FXRegisterAuthor{fx}{anfx}{fixme}
+%    \end{macrocode}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{environment}
+% \end{macro}
+% \begin{macro}{\fixme}
+%   \oarg{options}\marg{note}\\
+%   Deprecate \cs{fixme}:
+%    \begin{macrocode}
+\DeclareRobustCommand\fixme{%
+  \@fxpkgwarning{\string\fixme\space is deprecated;\MessageBreak
+    please use \string\fxfatal\space instead}%
+  \fxfatal}
+%    \end{macrocode}
+% \end{macro}
+% \begin{environment}{afixme}
+%   Deprecate the \texttt{afixme} environment:
+%    \begin{macrocode}
+\def\afixme{%
+  \@fxpkgwarning{The 'afixme' environment is deprecated;\MessageBreak
+    please use 'anfxfatal' instead}%
+  \anfxfatal}
+\let\endafixme\endanfxfatal
+%    \end{macrocode}
+% \end{environment}
+%
+% \subsection{Internationalization\label{sec:code:i18n}}
+% \begin{macro}{\@fxlanguages}
+%   This macro lists all the supported languages, including aliases:
+%    \begin{macrocode}
+\newcommand*\@fxlanguages{%
+  english,french,francais,spanish,italian,german,ngerman,danish,croatian}
+
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Language definitions}
+% \paragraph{English}
+% \begin{lang}{english}
+% \begin{macro}[noindex]{\fxenglish...[s]name}
+% \begin{macro}[noprint]{\fxenglishnotename}
+% \begin{macro}[noprint]{\fxenglishnotesname}
+% \begin{macro}[noprint]{\fxenglishwarningname}
+% \begin{macro}[noprint]{\fxenglishwarningsname}
+% \begin{macro}[noprint]{\fxenglisherrorname}
+% \begin{macro}[noprint]{\fxenglisherrorsname}
+% \begin{macro}[noprint]{\fxenglishfatalname}
+% \begin{macro}[noprint]{\fxenglishfatalsname}
+% \begin{macro}{\englishlistfixmename}
+%   \mbox{}
+%    \begin{macrocode}
+\newcommand\fxenglishnotename{Note}
+\newcommand\fxenglishnotesname{Notes}
+\newcommand\fxenglishwarningname{Warning}
+\newcommand\fxenglishwarningsname{Warnings}
+\newcommand\fxenglisherrorname{Error}
+\newcommand\fxenglisherrorsname{Errors}
+\newcommand\fxenglishfatalname{Fatal}
+\newcommand\fxenglishfatalsname{Fatal errors}
+\newcommand\englishlistfixmename{List of Corrections}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{lang}
+%
+% \paragraph{French}
+% \begin{lang}{french}
+% \begin{lang}{francais}
+% \begin{macro}[noindex]{\fxfrench...[s]name}
+% \begin{macro}[noprint]{\fxfrenchnotename}
+% \begin{macro}[noprint]{\fxfrenchnotesname}
+% \begin{macro}[noprint]{\fxfrenchwarningname}
+% \begin{macro}[noprint]{\fxfrenchwarningsname}
+% \begin{macro}[noprint]{\fxfrencherrorname}
+% \begin{macro}[noprint]{\fxfrencherrorsname}
+% \begin{macro}[noprint]{\fxfrenchfatalname}
+% \begin{macro}[noprint]{\fxfrenchfatalsname}
+% \begin{macro}{\frenchlistfixmename}
+%   \mbox{}
+%    \begin{macrocode}
+\newcommand\fxfrenchnotename{Note}
+\newcommand\fxfrenchnotesname{Notes}
+\newcommand\fxfrenchwarningname{Attention}
+\newcommand\fxfrenchwarningsname{Avertissements}
+\newcommand\fxfrencherrorname{Erreur}
+\newcommand\fxfrencherrorsname{Erreurs}
+\newcommand\fxfrenchfatalname{Fatal}
+\newcommand\fxfrenchfatalsname{Erreurs fatales}
+\newcommand\frenchlistfixmename{Liste des Corrections}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{lang}
+% \end{lang}
+%
+% \paragraph{Spanish}
+% \begin{lang}{spanish}
+% \begin{macro}[noindex]{\fxspanish...[s]name}
+% \begin{macro}[noprint]{\fxspanishnotename}
+% \begin{macro}[noprint]{\fxspanishnotesname}
+% \begin{macro}[noprint]{\fxspanishwarningname}
+% \begin{macro}[noprint]{\fxspanishwarningsname}
+% \begin{macro}[noprint]{\fxspanisherrorname}
+% \begin{macro}[noprint]{\fxspanisherrorsname}
+% \begin{macro}[noprint]{\fxspanishfatalname}
+% \begin{macro}[noprint]{\fxspanishfatalsname}
+% \begin{macro}{\spanishlistfixmename}
+%   \mbox{}
+%    \begin{macrocode}
+\newcommand\fxspanishnotename{Nota}
+\newcommand\fxspanishnotesname{Notas}
+\newcommand\fxspanishwarningname{Aviso}
+\newcommand\fxspanishwarningsname{Avisos}
+\newcommand\fxspanisherrorname{Error}
+\newcommand\fxspanisherrorsname{Errores}
+\newcommand\fxspanishfatalname{Fatal}
+\newcommand\fxspanishfatalsname{Errores fatales}
+\newcommand\spanishlistfixmename{Lista de Correcciones}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{lang}
+%
+% \paragraph{Italian}
+% \begin{lang}{italian}
+% \begin{macro}[noindex]{\fxitalian...[s]name}
+% \begin{macro}[noprint]{\fxitaliannotename}
+% \begin{macro}[noprint]{\fxitaliannotesname}
+% \begin{macro}[noprint]{\fxitalianwarningname}
+% \begin{macro}[noprint]{\fxitalianwarningsname}
+% \begin{macro}[noprint]{\fxitalianerrorname}
+% \begin{macro}[noprint]{\fxitalianerrorsname}
+% \begin{macro}[noprint]{\fxitalianfatalname}
+% \begin{macro}[noprint]{\fxitalianfatalsname}
+% \begin{macro}{\italianlistfixmename}
+%   \mbox{}
+%    \begin{macrocode}
+\newcommand\fxitaliannotename{Nota}
+\newcommand\fxitaliannotesname{Note}
+\newcommand\fxitalianwarningname{Avviso}
+\newcommand\fxitalianwarningsname{Avvisi}
+\newcommand\fxitalianerrorname{Errore}
+\newcommand\fxitalianerrorsname{Errori}
+\newcommand\fxitalianfatalname{Fatale}
+\newcommand\fxitalianfatalsname{Errori fatali}
+\newcommand\italianlistfixmename{Corrigenda}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{lang}
+%
+% \paragraph{German}
+% \begin{lang}{german}
+% \begin{lang}{ngerman}
+% \begin{macro}[noindex]{\fxgerman...[s]name}
+% \begin{macro}[noprint]{\fxgermannotename}
+% \begin{macro}[noprint]{\fxgermannotesname}
+% \begin{macro}[noprint]{\fxgermanwarningname}
+% \begin{macro}[noprint]{\fxgermanwarningsname}
+% \begin{macro}[noprint]{\fxgermanerrorname}
+% \begin{macro}[noprint]{\fxgermanerrorsname}
+% \begin{macro}[noprint]{\fxgermanfatalname}
+% \begin{macro}[noprint]{\fxgermanfatalsname}
+% \begin{macro}{\germanlistfixmename}
+%   \mbox{}
+%    \begin{macrocode}
+\newcommand\fxgermannotename{Anm}
+\newcommand\fxgermannotesname{Anmerkungen}
+\newcommand\fxgermanwarningname{Warnung}
+\newcommand\fxgermanwarningsname{Warnungen}
+\newcommand\fxgermanerrorname{Fehler}
+\newcommand\fxgermanerrorsname{Fehler}
+\newcommand\fxgermanfatalname{Verh\"angnisvoll}
+\newcommand\fxgermanfatalsname{Verh\"angnisvolle fehler}
+\newcommand\germanlistfixmename{Verzeichnis der Korrekturen}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{lang}
+% \end{lang}
+%
+% \paragraph{Danish}
+% \begin{lang}{danish}
+% \begin{macro}[noindex]{\fxdanish...[s]name}
+% \begin{macro}[noprint]{\fxdanishnotename}
+% \begin{macro}[noprint]{\fxdanishnotesname}
+% \begin{macro}[noprint]{\fxdanishwarningname}
+% \begin{macro}[noprint]{\fxdanishwarningsname}
+% \begin{macro}[noprint]{\fxdanisherrorname}
+% \begin{macro}[noprint]{\fxdanisherrorsname}
+% \begin{macro}[noprint]{\fxdanishfatalname}
+% \begin{macro}[noprint]{\fxdanishfatalsname}
+% \begin{macro}{\danishlistfixmename}
+%   \mbox{}
+%    \begin{macrocode}
+\newcommand\fxdanishnotename{Note}
+\newcommand\fxdanishnotesname{Noter}
+\newcommand\fxdanishwarningname{Advarsel}
+\newcommand\fxdanishwarningsname{Advarsler}
+\newcommand\fxdanisherrorname{Fejl}
+\newcommand\fxdanisherrorsname{Fejl}
+\newcommand\fxdanishfatalname{D\o delige}
+\newcommand\fxdanishfatalsname{Sk\ae bnesvangre fejl}
+\newcommand\danishlistfixmename{Rettelser}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{lang}
+%
+% \paragraph{Croatian}
+% \begin{lang}{croatian}
+% \begin{macro}[noindex]{\fxcroatian...[s]name}
+% \begin{macro}[noprint]{\fxcroatiannotename}
+% \begin{macro}[noprint]{\fxcroatiannotesname}
+% \begin{macro}[noprint]{\fxcroatianwarningname}
+% \begin{macro}[noprint]{\fxcroatianwarningsname}
+% \begin{macro}[noprint]{\fxcroatianerrorname}
+% \begin{macro}[noprint]{\fxcroatianerrorsname}
+% \begin{macro}[noprint]{\fxcroatianfatalname}
+% \begin{macro}[noprint]{\fxcroatianfatalsname}
+% \begin{macro}{\croatianlistfixmename}
+%   \mbox{}
+%    \begin{macrocode}
+\newcommand\fxcroatiannotename{Poruka}
+\newcommand\fxcroatiannotesname{Poruke}
+\newcommand\fxcroatianwarningname{Upozorenja}
+\newcommand\fxcroatianwarningsname{Upozorenje}
+\newcommand\fxcroatianerrorname{Gre\v ska}
+\newcommand\fxcroatianerrorsname{Greske}
+\newcommand\fxcroatianfatalname{Fatalan}
+\newcommand\fxcroatianfatalsname{Kobne gre\v ske}
+\newcommand\croatianlistfixmename{Popis korekcija}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{lang}
+%
+% \subsubsection{Language tracking}
+% \begin{option}{langtrack}
+%   Whether to track the value of \cs{languagename} automatically:
+%    \begin{macrocode}
+\@fxdefineboolkey{lang}{langtrack}
+%    \end{macrocode}
+% \end{option}
+% \begin{option}{defaultlang}
+%   Which language to use when tracking leads to an unsuported language:
+%    \begin{macrocode}
+\def\@fxexpr{\@fxdefinechoicekey{lang}{defaultlang}[\@fxdefaultlang]}
+\expandafter\@fxexpr\expandafter{\@fxlanguages}{}
+
+%    \end{macrocode}
+% \end{option}
+%
+% \subsubsection{Language options}
+% \begin{option}{lang}
+% \begin{macro}{\@fxlang}
+%   Store the current language in \cs{@fxlang} after having handled language
+%   aliases, and disable language tracking:
+%    \begin{macrocode}
+\def\@fxexpr{\@fxdefinechoicekey{lang}{lang}[\@fxlang]}
+\expandafter\@fxexpr\expandafter{\@fxlanguages}{%
+  \ifthenelse{\equal{#1}{francais}}{\def\@fxlang{french}}{%
+    \ifthenelse{\equal{#1}{ngerman}}{\def\@fxlang{german}}{}}%
+  \@fxsetkeys{lang}{langtrack=false}}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{option}
+% \begin{option}{english}
+% \begin{option}{french}
+% \begin{option}{francais}
+% \begin{option}{spanish}
+% \begin{option}{italian}
+% \begin{option}{german}
+% \begin{option}{ngerman}
+% \begin{option}{danish}
+% \begin{option}{croatian}
+%   Create individual language options:
+%    \begin{macrocode}
+\@for\@fxlg:=\@fxlanguages\do{
+  \def\@fxexprone{\@fxdefinevoidkey{lang}}
+  \edef\@fxexprtwo{{\@fxlg}{\noexpand\@fxsetkeys{lang}{lang=\@fxlg}}}
+  \expandafter\@fxexprone\@fxexprtwo}
+
+%    \end{macrocode}
+% \end{option}
+% \end{option}
+% \end{option}
+% \end{option}
+% \end{option}
+% \end{option}
+% \end{option}
+% \end{option}
+% \end{option}
+%
+% \subsubsection{Language abstraction layer}
+% \begin{macro}{\@fxlistfixmename}
+%   Construct the ``list of fixmes'' title in a language dependent fashion:
+%    \begin{macrocode}
+\newcommand*\@fxlistfixmename{\@nameuse{\@fxlang listfixmename}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\fxnotename}
+% \begin{macro}{\fxnotesname}
+%   \marg{type}\\
+%   Construct the notes names in a language dependent fashion:
+%    \begin{macrocode}
+\newcommand*\fxnotename[1]{\@nameuse{fx\@fxlang#1name}}
+\newcommand*\fxnotesname[1]{\@nameuse{fx\@fxlang#1sname}}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Document status processing}
+% \begin{macro}{\@@@fxnote@early}
+% \begin{macro}{\@@@fxnote@late}
+% \begin{macro}{\@@@@fxbeginenv}
+% \begin{macro}{\@fxendenv}
+% \begin{macro}{\@fxtargetlayout}
+% \begin{macro}{\listoffixmes}
+% \begin{option}{final}
+% \begin{option}{draft}
+% \begin{option}{status}
+%   Select draft or final versions of internal macros (some of
+%   them also depending on the document class):
+%    \begin{macrocode}
+\@fxdefinevoidkey{status}{final}{%
+  \let\@@@fxnote@early\@@@fxnote@early@final%
+  \let\@@@fxnote@late\@@@fxnote@late@final%
+  \let\@@@@fxbeginenv\@@@@fxbeginenv@final
+  \let\@fxendenv\@fxendenv@final%
+  \let\@fxtargetlayout\@fxtargetlayout@final%
+  \let\listoffixmes\lox@final}
+\@fxdefinevoidkey{status}{draft}{%
+  \let\@@@fxnote@early\@@@fxnote@early@draft%
+  \let\@@@fxnote@late\@@@fxnote@late@draft%
+  \let\@@@@fxbeginenv\@@@@fxbeginenv@draft
+  \let\@fxendenv\@fxendenv@draft%
+  \let\@fxtargetlayout\@fxtargetlayout@draft%
+  \let\listoffixmes\lox@draft}
+\@fxdefinechoicekey{status}{status}{final,draft}{\@fxsetkeys{status}{#1}}
+
+%    \end{macrocode}
+% \end{option}
+% \end{option}
+% \end{option}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Theme support}
+% \begin{macro}{\FXProvidesTheme}
+%   \marg{name}\oarg{release information}
+%    \begin{macrocode}
+\newcommand*\FXProvidesTheme[1]{\ProvidesPackage{fxtheme#1}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\fxusetheme}
+%   \marg{name}
+%    \begin{macrocode}
+\newcommand*\fxusetheme[1]{\usepackage{fxtheme#1}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{option}{theme}
+%   \mbox{}
+%    \begin{macrocode}
+\@fxdefinekey{theme}{theme}{\fxusetheme{#1}}
+%    \end{macrocode}
+% \end{option}
+%
+% \subsection{Finale}
+% \subsubsection{Class-dependent settings}
+% Currently, our class dependencies only matter in draft mode, so one could
+% argue that it is not optimal to handle this here. However, it would be
+% incorrect to do it in the \texttt{draft} option code because this option can
+% be switched at any point in the document (remember that it is understood
+% even by the annotation macros and environments) and the stuff below
+% should only be executed once. Besides, \cs{@ifclassloaded} is an
+% \cs{@onlypreamble} macro\ldots
+%
+% As documented, marginal notes are incompatible with the ACM SIG classes.
+% Initially, I thought I would detect these classes and issue an error if
+% marginal layout (or clue) is active. However, I changed my mind, because
+% nothing prevents somebody to write a new class on top of these ones and
+% authorize \cs{marginpar} back again. Normally these classes issue an error
+% if \cs{marginpar} is used. However, the 2.3 / June 2007 versions are buggy
+% and the error actually triggers a stack overflow in \LaTeX\ldots (patch
+% submitted). Oh boy, these classes are a mess.
+% \begin{macro}{\@lox@prtc}
+% \begin{macro}{\@lox@psttc}
+% \begin{macro}{\@lox@draft}
+%    \begin{macrocode}
+\@ifclassloaded{article}{%
+  \let\@lox@prtc\@lox@prtc@article%
+  \let\@lox@psttc\@lox@psttc@article}{%
+  \@ifclassloaded{report}{%
+    \let\@lox@prtc\@lox@prtc@report%
+    \let\@lox@psttc\@lox@psttc@report}{%
+    \@ifclassloaded{book}{%
+      \let\@lox@prtc\@lox@prtc@book%
+      \let\@lox@psttc\@lox@psttc@book}{%
+      \@ifclassloaded{scrartcl}{%
+	\let\@lox@prtc\@lox@prtc@scrartcl%
+	\let\@lox@psttc\@lox@psttc@scrartcl}{%
+	\@ifclassloaded{scrreprt}{%
+	  \let\@lox@prtc\@lox@prtc@scrreprt%
+	  \let\@lox@psttc\@lox@psttc@scrreprt}{%
+	  \@ifclassloaded{scrbook}{%
+	    \let\@lox@prtc\@lox@prtc@scrbook%
+	    \let\@lox@psttc\@lox@psttc@scrbook}{%
+	    \@ifclassloaded{amsbook}{%
+	      \let\lox@draft\lox@draft@ams}{%
+	      \@ifclassloaded{amsart}{%
+		\let\lox@draft\lox@draft@ams}{%
+		%% Use the article layout by default.
+		\let\@lox@prtc\@lox@prtc@article%
+		\let\@lox@psttc\@lox@psttc@article}}}}}}}}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsubsection{Options Processing}
+% First, we execute some options to initialize \fx to something sensible,
+% and then we process the user ones. Note the abscence of the \texttt{theme}
+% family here.
+%    \begin{macrocode}
+\ExecuteOptionsX[fx]<%
+  mode,status,lang,log,note,face,layout,envlayout,targetlayout>{%
+  mode=singleuser,%
+  status=final,%
+  lang=english,%
+  langtrack=false,%
+  defaultlang=english,%
+  nosilent,%
+  author=fixme,%
+  target=thepage,%
+  layout=margin,%
+  innerlayout={layout=inline},%
+  envlayout=plain,%
+  targetlayout=plain,%
+  inlineface=\bfseries,%
+  marginface=\footnotesize,%
+  envface=\bfseries,%
+  targetface=\itshape}
+\ProcessOptionsX*[fx]<%
+  mode,status,lang,log,note,face,layout,envlayout,targetlayout>
+
+%    \end{macrocode}
+%
+% \subsubsection{The \cs{fxsetup} macro}
+% \begin{macro}{\fxsetup}
+%   \marg{options}\\
+%   The inevitable setup macro, extremely impressive yet as trivial as can be
+%   with the \texttt{xkeyval} package\ldots \cs{fxsetup} is the only place
+%   where the \texttt{theme} family is processed.
+%    \begin{macrocode}
+\newcommand*\fxsetup[1]{%
+  \@fxsetkeys{%
+    mode,status,lang,log,note,face,layout,envlayout,targetlayout,theme}{%
+    #1}}
+
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{\fx summary}
+% Finally, output a summary giving the number of fixme notes at the end of the
+% compilation:
+%    \begin{macrocode}
+\AtEndDocument{%
+  \iffx@log@silent\else
+    \GenericWarning{%
+      (FiXme)\@spaces\@spaces}{%
+      FiXme Summary: Number of notes: \thefxnotecount,\MessageBreak%
+      Number of warnings: \thefxwarningcount,\MessageBreak%
+      Number of errors: \thefxerrorcount,\MessageBreak%
+      Number of fatal errors: \thefxfatalcount,\MessageBreak%
+      Total: \thefixmecount\@gobble}%
+  \fi}
+%</fixme>
+%    \end{macrocode}
+%
+% \appendix
+% \section{External Layouts}
+% \subsection{Environment layouts}
+% \subsubsection{The \texttt{color} layout}
+% \begin{envlayout}{color}
+%   \mbox{}
+%    \begin{macrocode}
+%<*fxenvlayoutcolor>
+\NeedsTeXFormat{LaTeX2e}
+\FXProvidesEnvLayout{color}
+
+\RequirePackage{color}
+
+%    \end{macrocode}
+% \begin{macro}{\@fxdocolon}
+%   \marg{author}\\
+%   Add a colon after the author tag, unless empty.
+%    \begin{macrocode}
+\providecommand*\@fxdocolon[1]{%
+  \ifthenelse{\equal{#1}{}}{\def\@fxcolon{}}{\def\@fxcolon{: }}}
+
+%    \end{macrocode}
+% \end{macro}
+% \begin{color}{fxnote}
+% \begin{color}{fxwarning}
+% \begin{color}{fxerror}
+% \begin{color}{fxfatal}
+%   Environments use the same colors as the notes themselves because
+%   their contents really is a longer note.
+%    \begin{macrocode}
+\definecolor{fxnote}{rgb}{0.0000,0.6000,0.0000}
+\definecolor{fxwarning}{rgb}{1.0000,0.5490,0.0000}
+\definecolor{fxerror}{rgb}{1.0000,0.2706,0.0000}
+\definecolor{fxfatal}{rgb}{1.0000,0.0000,0.0000}
+
+\fxsetface{env}{}
+
+%    \end{macrocode}
+% \end{color}
+% \end{color}
+% \end{color}
+% \end{color}
+% \begin{macro}{\FXEnvLayoutColorBegin}
+% \begin{macro}{\FXEnvLayoutColorEnd}
+%   \marg{type}\marg{author}
+%    \begin{macrocode}
+\newcommand*\FXEnvLayoutColorBegin[2]{%
+  \@fxdocolon{#2}%
+  \@fxuseface{env}\color{fx#1}\ignorespaces#2\@fxcolon\ignorespaces}
+\newcommand*\FXEnvLayoutColorEnd[2]{}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\@fxenvlayout@color@begin}
+% \begin{macro}{\@fxenvlayout@color@end}
+%    \begin{macrocode}
+\FXRegisterEnvLayout{color}{\FXEnvLayoutColorBegin}{\FXEnvLayoutColorEnd}
+%</fxenvlayoutcolor>
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{envlayout}
+%
+% \subsubsection{The \texttt{colorsig} layout}
+% \begin{envlayout}{colorsig}
+%   \mbox{}
+%    \begin{macrocode}
+%<*fxenvlayoutcolorsig>
+\NeedsTeXFormat{LaTeX2e}
+\FXProvidesEnvLayout{colorsig}
+
+\RequirePackage{color}
+
+%    \end{macrocode}
+% \begin{face}{signature}
+%   \mbox{}
+%    \begin{macrocode}
+\@fxnewface[\itshape]{signature}
+%    \end{macrocode}
+% \end{face}
+% \begin{macro}{\@fxdosig}
+%   \marg{author}
+% \begin{macro}{\@fxsignature}
+%   Use a signature of the form ``-- sig'', unless author is empty.
+%    \begin{macrocode}
+\providecommand*\@fxdosig[1]{%
+  \ifthenelse{\equal{#1}{}}{\def\@fxsignature{}}{%
+    \def\@fxsignature{ -- {\@fxuseface{signature}#1}}}}
+
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{color}{fxnote}
+% \begin{color}{fxwarning}
+% \begin{color}{fxerror}
+% \begin{color}{fxfatal}
+%   Environments use the same colors as the notes themselves because
+%   their contents really is a longer note.
+%    \begin{macrocode}
+\definecolor{fxnote}{rgb}{0.0000,0.6000,0.0000}
+\definecolor{fxwarning}{rgb}{1.0000,0.5490,0.0000}
+\definecolor{fxerror}{rgb}{1.0000,0.2706,0.0000}
+\definecolor{fxfatal}{rgb}{1.0000,0.0000,0.0000}
+
+\fxsetface{env}{}
+
+%    \end{macrocode}
+% \end{color}
+% \end{color}
+% \end{color}
+% \end{color}
+% \begin{macro}{\FXEnvLayoutColorSigBegin}
+% \begin{macro}{\FXEnvLayoutColorSigEnd}
+%   \marg{type}\marg{author}
+%    \begin{macrocode}
+\newcommand*\FXEnvLayoutColorSigBegin[2]{\@fxuseface{env}\color{fx#1}}
+\newcommand*\FXEnvLayoutColorSigEnd[2]{\@fxdosig{#2}\@fxsignature}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\@fxenvlayout@colorsig@begin}
+% \begin{macro}{\@fxenvlayout@colorsig@end}
+%    \begin{macrocode}
+\FXRegisterEnvLayout{colorsig}{%
+  \FXEnvLayoutColorSigBegin}{\FXEnvLayoutColorSigEnd}
+%</fxenvlayoutcolorsig>
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{envlayout}
+%
+% \subsection{Target Layouts}
+% Since target layouts don't include author information, they're orthogonal to
+% (and hence usable in) prefix/signature display.
+%
+% \subsubsection{The \texttt{changebar} layout}
+% \begin{targetlayout}{changebar}
+%   \mbox{}
+%    \begin{macrocode}
+%<*fxtargetlayoutchangebar>
+\NeedsTeXFormat{LaTeX2e}
+\FXProvidesTargetLayout{changebar}
+
+\RequirePackage{changebar}
+\setlength{\changebarsep}{5pt}
+
+\fxsetface{target}{}
+%    \end{macrocode}
+% \begin{macro}{\FXTargetLayoutChangeBar}
+%   \marg{target}
+%    \begin{macrocode}
+\newcommand\FXTargetLayoutChangeBar[2]{\cbstart\@fxuseface{target}#2\cbend}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxtargetlayout@changebar}
+%    \begin{macrocode}
+\FXRegisterTargetLayout{changebar}{\FXTargetLayoutChangeBar}
+%</fxtargetlayoutchangebar>
+%    \end{macrocode}
+% \end{macro}
+% \end{targetlayout}
+%
+% \subsubsection{The \texttt{color} layout}
+% \begin{targetlayout}{color}
+%   \mbox{}
+%    \begin{macrocode}
+%<*fxtargetlayoutcolor>
+\NeedsTeXFormat{LaTeX2e}
+\FXProvidesTargetLayout{color}
+
+\RequirePackage{color}
+\definecolor{fxnote}{rgb}{0.0000,0.6000,0.0000}
+\definecolor{fxwarning}{rgb}{1.0000,0.5490,0.0000}
+\definecolor{fxerror}{rgb}{1.0000,0.2706,0.0000}
+\definecolor{fxfatal}{rgb}{1.0000,0.0000,0.0000}
+
+%    \end{macrocode}
+% \begin{color}{fxtarget}
+%   \mbox{}
+%    \begin{macrocode}
+\definecolor{fxtarget}{rgb}{0.3725,0.6196,0.6275}
+
+\fxsetface{target}{}
+
+%    \end{macrocode}
+% \end{color}
+% \begin{macro}{\FXTargetLayoutColor}
+%   \marg{target}
+%    \begin{macrocode}
+\newcommand\FXTargetLayoutColor[2]{\@fxuseface{target}\color{fxtarget}#2}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxtargetlayout@color}
+%    \begin{macrocode}
+\FXRegisterTargetLayout{color}{\FXTargetLayoutColor}
+%</fxtargetlayoutcolor>
+%    \end{macrocode}
+% \end{macro}
+% \end{targetlayout}
+%
+% \subsubsection{The \texttt{colorcb} layout}
+% \begin{targetlayout}{colorcb}
+%   \mbox{}
+%    \begin{macrocode}
+%<*fxtargetlayoutcolorcb>
+\NeedsTeXFormat{LaTeX2e}
+\FXProvidesTargetLayout{colorcb}
+
+\RequirePackage{color}
+
+\RequirePackage[color]{changebar}
+\setlength{\changebarsep}{5pt}
+
+\fxsetface{target}{}
+%    \end{macrocode}
+% \begin{macro}{\FXTargetLayoutColorCB}
+%   \marg{target}
+%    \begin{macrocode}
+\newcommand\FXTargetLayoutColorCB[2]{%
+  \cbstart\cbcolor{fx#1}\@fxuseface{target}#2\cbend}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@fxtargetlayout@colorcb}
+%    \begin{macrocode}
+\FXRegisterTargetLayout{colorcb}{\FXTargetLayoutColorCB}
+%</fxtargetlayoutcolorcb>
+%    \end{macrocode}
+% \end{macro}
+% \end{targetlayout}
+%
+% \section{Themes}
+% \subsection{The \texttt{signature} theme}
+% \begin{theme}{signature}
+%   \mbox{}
+%    \begin{macrocode}
+%<*fxthemesignature>
+\NeedsTeXFormat{LaTeX2e}
+\FXProvidesTheme{signature}
+
+%    \end{macrocode}
+% \cs{@fxdosig} and \cs{@fxsignature} are provided by the \texttt{signature}
+% environment layout.
+%    \begin{macrocode}
+\fxuseenvlayout{signature}
+
+\renewcommand*\FXLayoutFootnote[3]{%
+  \@fxdosig{#3}%
+  \footnote{\fxnotename{#1}: #2\@fxsignature}}
+\renewcommand*\FXLayoutMargin[3]{%
+  \@fxdosig{#3}%
+  \marginpar[%
+  \raggedleft\@fxuseface{margin}\fxnotename{#1}: #2\@fxsignature]{%
+    \raggedright\@fxuseface{margin}\fxnotename{#1}: #2\@fxsignature}}
+\renewcommand*\FXLayoutMarginClue[3]{%
+  \@fxdosig{#3}%
+  \marginpar[\raggedleft\@fxuseface{margin}\fxnotename{#1}!\@fxsignature]{%
+    \raggedright\@fxuseface{margin}\fxnotename{#1}!\@fxsignature}}
+\renewcommand*\FXLayoutInline[3]{%
+  \@fxdosig{#3}%
+  {\@fxuseface{inline}\fxnotename{#1}: #2\@fxsignature}}
+\renewcommand*\FXLayoutIndex[3]{%
+  \@fxdosig{#3}%
+  \iffx@mode@multiuser%
+    \index{***@\fixmeindexname:%
+      !\@nameuse{@fx#1key}@\fxnotesname{#1}:%
+      !\@nameuse{thefx#1count}: #2\@fxsignature}%
+    \index{***#3@\fixmeindexname{} (#3):%
+      !\@nameuse{@fx#1key}@\fxnotesname{#1}:%
+      !\@nameuse{thefx#1count}: #2}%
+  \else%
+    \index{***@\fixmeindexname:%
+      !\@nameuse{@fx#1key}@\fxnotesname{#1}:%
+      !\@nameuse{thefx#1count}: #2}%
+  \fi}
+\renewcommand*\FXLayoutContentsLine[3]{%
+  \iffx@mode@multiuser%
+    \@fxdosig{#3}%
+    \fxaddcontentsline{\fxnotename{#1}: #2\@fxsignature}%
+  \else%
+    \fxaddcontentsline{\fxnotename{#1}: #2}%
+  \fi}
+%</fxthemesignature>
+%    \end{macrocode}
+% \end{theme}
+%
+% \subsection{The \texttt{color} theme}
+% \begin{theme}{color}
+%   \mbox{}
+%    \begin{macrocode}
+%<*fxthemecolor>
+\NeedsTeXFormat{LaTeX2e}
+\FXProvidesTheme{color}
+
+\RequirePackage{color}
+
+\FXRequireEnvLayout{color}
+\FXRequireTargetLayout{color}
+
+\fxsetface{inline}{}
+
+\renewcommand*\FXLayoutFootnote[3]{%
+  \@fxdocolon{#3}%
+  \footnote{\color{fx#1}\ignorespaces#3\@fxcolon #2}}
+\renewcommand*\FXLayoutMargin[3]{%
+  \@fxdocolon{#3}%
+  \marginpar[%
+  \raggedleft\@fxuseface{margin}\color{fx#1}\ignorespaces#3\@fxcolon#2]{%
+    \raggedright\@fxuseface{margin}\color{fx#1}\ignorespaces#3\@fxcolon#2}}
+\renewcommand*\FXLayoutMarginClue[3]{%
+  \marginpar[\raggedleft\@fxuseface{margin}\color{fx#1}\ignorespaces#3!]{%
+    \raggedright\@fxuseface{margin}\color{fx#1}\ignorespaces#3!}}
+\renewcommand*\FXLayoutInline[3]{%
+  \@fxdocolon{#3}%
+  {\@fxuseface{inline}\color{fx#1}\ignorespaces#3\@fxcolon#2}}
+\renewcommand*\FXLayoutIndex[3]{%
+  \iffx@mode@multiuser%
+    \index{***@\fixmeindexname:%
+      !\@nameuse{@fx#1key}@\fxnotesname{#1}:%
+      !{\color{fx#1}\@nameuse{thefx#1count}: #3: #2}}%
+    \index{***#3@\fixmeindexname{} (#3):%
+      !\@nameuse{@fx#1key}@\fxnotesname{#1}:%
+      !{\color{fx#1}\@nameuse{thefx#1count}: #2}}%
+  \else%
+    \index{***@\fixmeindexname:%
+      !\@nameuse{@fx#1key}@\fxnotesname{#1}:%
+      !{\color{fx#1}\@nameuse{thefx#1count}: #2}}%
+  \fi}
+
+\renewcommand*\FXLayoutContentsLine[3]{%
+  \@fxdocolon{#3}%
+  \iffx@mode@multiuser%
+    \fxaddcontentsline{\color{fx#1}\ignorespaces#3\@fxcolon#2}%
+  \else%
+    \fxaddcontentsline{\color{fx#1}#2}%
+  \fi}
+%</fxthemecolor>
+%    \end{macrocode}
+% \end{theme}
+%
+% \subsection{The \texttt{colorsig} theme}
+% \begin{theme}{colorsig}
+%   The \texttt{colorsig} environment layout provides \cs{@fxdosig}, so there
+%   is no need to provide it here.
+%    \begin{macrocode}
+%<*fxthemecolorsig>
+\NeedsTeXFormat{LaTeX2e}
+\FXProvidesTheme{colorsig}
+
+\RequirePackage{color}
+
+\FXRequireEnvLayout{colorsig}
+\FXRequireTargetLayout{color}
+
+\fxsetface{inline}{}
+
+\renewcommand*\FXLayoutFootnote[3]{%
+  \@fxdosig{#3}%
+  \footnote{\color{fx#1}#2\@fxsignature}}
+\renewcommand*\FXLayoutMargin[3]{%
+  \@fxdosig{#3}%
+  \marginpar[%
+  \raggedleft\@fxuseface{margin}\color{fx#1}#2\@fxsignature]{%
+    \raggedright\@fxuseface{margin}\color{fx#1}#2\@fxsignature}}
+\renewcommand*\FXLayoutMarginClue[3]{%
+  \@fxdosig{#3}%
+  \marginpar[\raggedleft\@fxuseface{margin}\color{fx#1}!\@fxsignature]{%
+    \raggedright\@fxuseface{margin}\color{fx#1}!\@fxsignature}}
+\renewcommand*\FXLayoutInline[3]{%
+  \@fxdosig{#3}%
+  {\@fxuseface{inline}\color{fx#1}#2\@fxsignature}}
+\renewcommand*\FXLayoutIndex[3]{%
+  \@fxdosig{#3}%
+  \iffx@mode@multiuser%
+    \index{***@\fixmeindexname:%
+      !\@nameuse{@fx#1key}@\fxnotesname{#1}:%
+      !{\color{fx#1}\@nameuse{thefx#1count}: #2\@fxsignature}}%
+    \index{***#3@\fixmeindexname{} (#3):%
+      !\@nameuse{@fx#1key}@\fxnotesname{#1}:%
+      !{\color{fx#1}\@nameuse{thefx#1count}: #2}}%
+  \else%
+    \index{***@\fixmeindexname:%
+      !\@nameuse{@fx#1key}@\fxnotesname{#1}:%
+      !{\color{fx#1}\@nameuse{thefx#1count}: #2}}%
+  \fi}
+\renewcommand*\FXLayoutContentsLine[3]{%
+  \iffx@mode@multiuser%
+    \@fxdosig{#3}%
+    \fxaddcontentsline{\color{fx#1}#2\@fxsignature}%
+  \else%
+    \fxaddcontentsline{\color{fx#1}#2}%
+  \fi}
+%</fxthemecolorsig>
+%    \end{macrocode}
+% \end{theme}
 %
 % ^^A \PrintChanges
-% ^^A \PrintIndex
+% ^^A Nobody messes up with the marks in this document, but \index@prologue.
+% ^^A That sucks.
+% \makeatletter{\let\markboth\@gobbletwo\PrintIndex}\makeatother
 % \Finale
 %
+% ^^A Local variables:
+% ^^A eval: (doxitems "option" "counter" "lang" "face" "color")
+% ^^A eval: (doxitem "\\(env\\|target\\)?layout")
+% ^^A End:
 % ^^A fixme.dtx ends here.
-- 
cgit v1.2.3

