% \iffalse
%
% fixme.dtx --- docTeX file for FiXme
%
% Copyright (C) 1998-2002, 2004-2007, 2009, 2013, 2017-2019 Didier Verna
%
% Author: Didier Verna <didier@didierverna.net>
%
% This file is part of FiXme.
%
% FiXme may be distributed and/or modified under the conditions of the LaTeX
% Project Public License, either version 1.3 of this license or (at your
% option) any later version. The latest version of this license is in
% http://www.latex-project.org/lppl.txt and version 1.3 or later is part of
% all distributions of LaTeX version 2005/12/01 or later.
%
% FiXme consists of the files listed in the file `README.md'.
%
%
% Commentary:
%
%
% Code:
%
%<*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[idxtype=cond.]{Cond}{cond}{conditionals}
\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
% \RecordChanges
\setcounter{secnumdepth}{4}
\begin{document}
\DocInput{fixme.dtx}
\end{document}
%</driver>
%
% \fi
%
% \CheckSum{1769}
% \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
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%
% \MakeShortVerb{\|}
%
% \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{Emacs}\xspace}
%
% \newcommand\fx{\fixmelogo\xspace}
% \newcommand\packagecopyright{%
%   Copyright \copyright{} 1998--2002, 2004--2007, 2009, 2013, 2017-2019 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@didierverna.net}\\
%   \texttt{http://www.lrde.epita.fr/\~{}didier/}}
% \maketitle
%
%
% \begin{abstract}
%   \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 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{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}
% \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 annotation. 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{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}
%
%
%
% \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}
% \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} and \texttt{book} classes and the AMS ones. If loaded, \fx
% will also use the \texttt{tocbasic} package which makes it compliant with
% the \komascript classes and any other document using it.  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}).
%
% \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 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.
%
% 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.
% \end{enumerate}
% \DescribeMacro{\fxloadlayouts}\marg{name,\ldots}
% \begin{enumerate}
% \item[3]
%   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}
%
% \subsubsection{Available layouts}
% \DescribeBooleanOption{inline}
% \DescribeBooleanOption{margin}
% \DescribeBooleanOption{footnote}
% \DescribeBooleanOption{index}
% \DescribeLayout[noprint]{inline}
% \DescribeLayout[noprint]{margin}
% \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. Most of
% these layouts should be self-explanatory, but some precisions are given
% below.
% \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\\
%     \texttt{marginnote} & \texttt{*} & Display non-floating note in the
%     margin\\
%     \texttt{pdfnote} & \texttt{*} & Display note as inline PDF comment\\
%     \texttt{pdfmargin} & \texttt{*} & Display note as marginal PDF
%     comment\\
%     \texttt{pdfsignote} & \texttt{*} & Display signed note ala
%     \texttt{pdfnote}\\
%     \texttt{pdfsigmargin} & \texttt{*} & Display signed note ala
%     \texttt{pdfmargin}\\
%     \texttt{pdfcnote} & \texttt{*} & Display colored note ala
%     \texttt{pdfnote}\\
%     \texttt{pdfcmargin} & \texttt{*} & Display colored note ala
%     \texttt{pdfmargin}\\
%     \texttt{pdfcsignote} & \texttt{*} & Display colored note ala
%     \texttt{pdfcsignote}\\
%     \texttt{pdfcsigmargin} & \texttt{*} & Display colored note ala
%     \texttt{pdfsigmargin}\\
%     \hline
%   \end{tabular}
%   \MakeShortVerb{\|}
%   \caption{Available annotation layouts}
%   \label{table:layouts}
% \end{table}
% \paragraph{\texttt{marginclue}}
% \DescribeBooleanOption{marginclue}
% \DescribeLayout[noprint]{marginclue}
% 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).
%
% \paragraph{\texttt{marginnote}}\label{sec:manual:marginnote}
% \DescribeBooleanOption{marginnote}
% \DescribeLayout[noprint]{marginnote}
% The \texttt{marginnote} layout is an alternate (external) way to display
% annotations in the margin, using the eponymous package. Contrary to \LaTeX's
% standard marginal paragraphs, the ones issued by \texttt{marginnote} are
% constructed in a non-floating way. This might be an advantage in some
% situations but \texttt{marginnote} also comes with some disadvantages of its
% own. For more information, please refer to \texttt{marginnote}'s
% documentation, and also read the next section. Also, note that it is not
% currently possible to pass options to the \cs{marginnote} command through
% this layout.
%
% For a reasonably robust marginal layout accross all annotations, including
% those issued in floats, consider using \texttt{marginnote} in conjunction
% with \texttt{innerlayout=noinline} (see
% section \sectionref{sec:manual:inner}).
%
% \paragraph{PDF comments}
% \DescribeBooleanOption{pdfnote}
% \DescribeLayout[noprint]{pdfnote}
% \DescribeBooleanOption{pdfmargin}
% \DescribeLayout[noprint]{pdfmargin}
% \DescribeBooleanOption{pdfsignote}
% \DescribeLayout[noprint]{pdfsignote}
% \DescribeBooleanOption{pdfsigmargin}
% \DescribeLayout[noprint]{pdfsigmargin}
% \DescribeBooleanOption{pdfcnote}
% \DescribeLayout[noprint]{pdfcnote}
% \DescribeBooleanOption{pdfcmargin}
% \DescribeLayout[noprint]{pdfcmargin}
% \DescribeBooleanOption{pdfcsignote}
% \DescribeLayout[noprint]{pdfcsignote}
% \DescribeBooleanOption{pdfcsigmargin}
% \DescribeLayout[noprint]{pdfcsigmargin}
% The PDF format comes with a concept of \emph{comment}, which \fx can use to
% display its own annotations. Support for PDF comments varies across PDF
% viewers. Acrobat Reader is usually considered a reference, and MacOS X's
% Preview supports them reasonably well. The \texttt{pdfnote} and
% \texttt{pdfmargin} layouts use the \texttt{pdfcomment} package to display
% annotations as PDF inline or marginal comments.
%
% The \texttt{sig} versions additionally display the author's tag (see
% \sectionref{sec:manual:modes}) as a signature instead of as a prefix.
%
% The versions with a \texttt{c} in their name (as in \textbf{c}olor) use one
% of four different colors named \texttt{fx}\meta{level} (according to the
% annotation's importance level). They also avoid printing the annotation's
% level since this information is already conveyed by the color.
%
% \subsubsection{Inner layout}\label{sec:manual:inner}
% 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. If you really want to use marginal paragraphs
% in inner mode, a good idea is then to set your inner layout to
% \texttt{marginnote} (see section \ref{sec:manual:marginnote}).
%
% 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}
%
% One final remark on the \texttt{innerlayout} option: this option is not
% processed immediately when you specify it, but instead, its value is stored
% and used only when needed. As a result, if you plan to use an external
% layout in inner mode (typically, \texttt{marginnote})~, you need to load it
% explicitely in the preamble first. Use \cs{fxloadlayouts} for that.
%
% \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{Annotations in captions being counted twice} You are most
% likely using \cs{listofsomething} (figure, table, or any other kind of
% float). Note that a caption will be used twice here: once in the float
% itself, and once in the list of floats. Any \fx annotation in the caption
% will consequently be generated twice as well. The solution to this problem
% is to use the optional argument to \cs{caption}, for example:
% \begin{verbatim}
% \caption[caption text]{caption text\fxnote{yuck!}}
% \end{verbatim}
%
% \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 annotation
% 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 the annotations 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 annotations 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}
%
% \textbf{Warning!} \meta{cmdprefix} and \meta{envprefix} need to be
% different, or you will get very strange errors. The technical reason is that
% in \LaTeX, an environment named \texttt{foo} is defined in terms of two
% commands: \cs{foo} and \cs{endfoo} (yes, this is silly; the first one should
% really be \cs{beginfoo}). As a consequence, if you use the same prefix, you
% will get a name clash between the annotation commands and environments.
%
% \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 $ AUCTeX 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, the annotations 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\meta{name}}
% \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 annotation 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\meta{name}Begin}
% \DescribeMacro[noindex]{\FXEnvLayout\meta{name}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 annotation 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\meta{name}}\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 annotation 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{mutex}\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}
% 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}.
%
% The first (optional) argument \meta{mutex} is a comma-separated list of
% other layout names that should be in mutual exclusion with the layout we are
% registering (for example, the \texttt{margin} and \texttt{marginclue}
% layouts are in mutual exclusion). Note that mutual exclusion between two
% layouts need only be registered once. In other words, a previsouly
% registered layout will automatically be made aware of subsequent mutex
% declarations.
%
% \paragraph{Registering early layouts}
% \DescribeMacro{\FXRegisterLayout*}\oarg{mutex}\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{Adding new options}
% \begin{quotation}\itshape
%   \textbf{Note:} \fx uses the \texttt{xkeyval} package for its underlying
%   options management, so some knowledge of this package is required in order
%   to understand the remainder of this section.
% \end{quotation}
% Yet another way to customize \fx is to plug additional behavior in, by way
% of options. As of version 4.5, \fx provides a convenient interface for
% creating new options, and associate them with code to execute.
%
% First of all, new options must belong to a ``family'', which essentially
% defines exactly where they make sense. \fx currently provides three option
% families: \texttt{Layout}, \texttt{EnvLayout}, and
% \texttt{TargetLayout}. Obviously, these families allow you to define options
% that will affect the behavior of the corresponding three kinds of layouts.
%
% For each family, \fx provides five commands wrapping around \texttt{xkeyval}
% to define special kinds of options (\emph{keys} in the \texttt{xkeyval}
% jargon). They are explained below.
%
% \noindent\DescribeMacro[noindex]{\FXDefine\meta{family}Key}
% \marg{key}\oarg{default}\marg{function}\\
% \DescribeMacro[noprint]{\FXDefineLayoutKey}
% \DescribeMacro[noprint]{\FXDefineEnvLayoutKey}
% \DescribeMacro[noprint]{\FXDefineTargetLayoutKey}
% Define an \texttt{xkeyval} ordinary \meta{key} belonging to \meta{family}.
%
% \noindent\DescribeMacro[noindex]{\FXDefine\meta{family}CmdKey}
% \oarg{mp}\marg{key}\oarg{default}\marg{function}\\
% \DescribeMacro[noprint]{\FXDefineLayoutCmdKey}
% \DescribeMacro[noprint]{\FXDefineEnvLayoutCmdKey}
% \DescribeMacro[noprint]{\FXDefineTargetLayoutCmdKey}
% Define an \texttt{xkeyval} command \meta{key} belonging to \meta{family}.
%
% \noindent\DescribeMacro[noindex]{\FXDefine\meta{family}ChoiceKey}
% \marg{key}\oarg{bin}\marg{alternatives}\oarg{default}\marg{function}\\
% \DescribeMacro[noprint]{\FXDefineLayoutChoiceKey}
% \DescribeMacro[noprint]{\FXDefineEnvLayoutChoiceKey}
% \DescribeMacro[noprint]{\FXDefineTargetLayoutChoiceKey}
% Define an \texttt{xkeyval} choice \meta{key} belonging to \meta{family}.
%
% \noindent\DescribeMacro[noindex]{\FXDefine\meta{family}VoidKey}
% \marg{key}\marg{func}\\
% \DescribeMacro[noprint]{\FXDefineLayoutVoidKey}
% \DescribeMacro[noprint]{\FXDefineEnvLayoutVoidKey}
% \DescribeMacro[noprint]{\FXDefineTargetLayoutVoidKey}
% A ``void \meta{key}'' is an option that is not supposed to get an
% argument. This property is automatically checked everytime the option is
% used.
%
% \noindent\DescribeMacro[noindex]{\FXDefine\meta{family}BoolKey}
% \oarg{func}\marg{key}\\
% \DescribeMacro[noprint]{\FXDefineLayoutBoolKey}
% \DescribeMacro[noprint]{\FXDefineEnvLayoutBoolKey}
% \DescribeMacro[noprint]{\FXDefineTargetLayoutBoolKey}
% Finally, a ``boolean \meta{key}'' is like an \texttt{xkeyval} one, with the
% addition that for every such \texttt{key}, there is a  void \texttt{nokey}
% counterpart.
%
% Every new option you define is inserted into the global options management
% mechanism, which has some implications.
% \begin{itemize}
% \item First of all, new options are automatically available almost
%   everywhere, and in particular in the \cs{fxsetup} macro, in the
%   annotations commands and environments, \etc Note however that the
%   \texttt{EnvLayout} and \texttt{TargetLayout} family options are only
%   processed when it makes sense, that is, when environments or targeted
%   commands are involved.
% \item Because new options are treated globally, they may affect every layout
%   (existing, loaded in the future, \etc) and of course, also the built-in
%   ones. Suppose, for example, that you want the ability to adjust the
%   vertical position of the marginal notes layout. One solution is to create
%   a \texttt{vadj} option like this:
%   |\FXDefineLayoutKey{vadj}{\def\marginnotevadjust{#1}}|, which you can then
%   use like that: |\fxnote[vadj=.5ex]{...}|.
% \item Finally, and again, because options are treated globally, beware of
%   name clashes! Every option name must be unique within a family.
% \end{itemize}
%
% \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{\FXRequireLayouts}\marg{layout names}\\
% In order to use external layouts in a theme, use the command
% \cs{FXRequireLayouts}, passing it a list of \meta{layout names} as
% argument.\\
% \DescribeMacro{\FXRequireEnvLayout}
% \DescribeMacro{\FXRequireTargetLayout}\marg{name}\\
% In order to use and external environment or target 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}
% \DescribeMacro[noindex]{\fx\meta{lang}name}
% \DescribeMacro[noindex]{\fx\meta{lang}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 annotation levels define the singular and
% plural forms of the note names.\\
% \DescribeMacro[noindex]{\ \unskip\meta{lang}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[v4.5] Public interface for extending \fx with new key/value options.\\
%   Revamp the \auctex support, with help from Arash Esbati and
%   Ikumi Keita.\\
%   Fix PDF signature layouts not working anymore, reported by Soeren
%   Wolfers.\\
%   Fix spurious space at the end of environments contents, reported
%   by Frank Mittelbach.
% \item[v4.4] Handle existing yet empty lox file properly, meaning don't
%   actually typeset an empty list of corrections.\\
%   Don't update the \texttt{lox} file in final mode, avoiding potential
%   typesetting artifacts, reported by Lars Madsen.\\
%   Various internals and documentation improvements.
% \item[v4.3] Add a paragraph about the duplication of notes in captions, upon
%   exchange with Kreuvf.\\
%   Update support for the \komascript classes by using the
%   \texttt{tocbasic} interface when available, reported by Dirk Surmann.\\
%   Separate inline notes from the text they follow, suggested by Victor
%   Porton.\\
%   Fix potential inline layouts color leakage, reported by Victor Porton.\\
%   Fix several parsing problems when passing optional arguments containing
%   brackets, thanks to Joseph Wright and Lars Madsen.
% \item[v4.2] Improve Danish translation, thanks to Lars Madsen.\\
%   Fix buglet in \cs{@wrindex} redefinition, reported by Norman Gray.
% \item[v4.1] 8 new PDF-specific annotation layouts.\\
%   New annotation layout: \texttt{marginnote}, suggested by S\'ebastien
%   Mengin.\\
%   Better mechanism for handling layout mutual exclusion.\\
%   Fix bug in inner layout processing.
% \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 \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 \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.\\
%   Fix incompatibility with \texttt{amsbook} reported by Claude
%   Lacoursi\`ere: \cs{@starttoc} takes two arguments.\\
%   Fix incompatibility with Beamer reported by Akim Demaille: protect
%   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 annotation
%   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.
% \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: \fx note counters and usage summary.\\
%   Suggestions from Kasper B. Graversen.\\
%   Support for Spanish thanks to Agust\'in Mart\'in.
% \item[v1.5] New appearance option: \texttt{inline}.
% \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.
% \item[v1.2] Support for German thanks to Harald Harders.
% \end{itemize}
%
% \StopEventually{\vfill\hfill\small \packagecopyright{}.}
%
% \section{Implementation}
% \subsection{Preamble}
%    \begin{macrocode}
%<fixme>
\NeedsTeXFormat{LaTeX2e}
%<*header>
\ProvidesPackage{fixme}[2019/01/03 v4.5 Collaborative annotations for LaTeX2e]

%</header>
%    \end{macrocode}
% Some required packages:
%    \begin{macrocode}
%<*fixme>
\RequirePackage{ifthen}
\RequirePackage{verbatim}
\RequirePackage{xkeyval}[2006/11/18]

%</fixme>
%    \end{macrocode}
% \begin{macro}{\fixmelogo}
% The \fx logo:
%    \begin{macrocode}
%<*header>
\newcommand\fixmelogo{\textsf{FiXme}}

%</header>
%    \end{macrocode}
% \end{macro}
%
% \subsection{Utilities}
% \subsubsection{Miscellaneous}
% \begin{macro}{\@fxpkginfo}
% \begin{macro}{\@fxpkgwarning}
% \marg{msg}\\
% Issue a \fx package info or warning:
%    \begin{macrocode}
%<*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}
% \begin{macro}{\@fxaddtolist}
% \marg{list}\marg{elt}\\
% Add \meta{elt} at the end of \meta{list}. We should check for duplicates,
% but this is not currently done.
%    \begin{macrocode}
\newcommand*\@fxaddtolist[2]{%
  \expandafter\ifx\csname #1\endcsname\relax%
    \expandafter\def\csname #1\endcsname{#2}%
  \else%
    \expandafter\ifx\csname #1\endcsname\empty%
      \expandafter\g@addto@macro\csname #1\endcsname{#2}%
    \else%
      \expandafter\g@addto@macro\csname #1\endcsname{,#2}%
    \fi%
  \fi}

%    \end{macrocode}
% \end{macro}
% \subsubsection{Key-value management (\texttt{xkeyval})}
% \paragraph{Shortcuts}
% The following macros are simple shortcuts for using \texttt{xkeyval} with
% the \texttt{fx} prefix.
% \begin{macro}{\@fxkeyifundefined}
% \marg{families}\marg{key}\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}{\@fxdefinecmdkey}
% \marg{family}\oarg{mp}\marg{key}\oarg{default}\marg{function}
%    \begin{macrocode}
\newcommand\@fxdefinecmdkey{\define@cmdkey[fx]}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@fxdefinechoicekey}
% \marg{family}\marg{key}\oarg{bin}\marg{alternatives}\ignorespaces
% \oarg{default}\marg{function}
%    \begin{macrocode}
\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}
%
% \paragraph{Wrappers}
% \begin{macro}{\@fxvoidkeyerror}
% \marg{key}\marg{value}\\
% Issue a \fx error about a void \meta{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{key}\marg{func}\\
% A \fx ``void \meta{key}'' isn't supposed to get an 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{key}\\
% A \fx ``boolean \meta{key}'' is like an \texttt{xkeyval} one, with the
% addition that for every such \texttt{key}, there is a void \texttt{nokey}
% counterpart.
%    \begin{macrocode}
\newcommand*\@fxdefineboolkey[3][]{%
  \define@boolkey[fx]{#2}{#3}[true]{#1}
  \@fxdefinevoidkey{#2}{no#3}{\@nameuse{fx@#2@#3}{false}}}

%    \end{macrocode}
% \end{macro}
%
% \paragraph{Extension-level option creation interface}
% \begin{macro}{\@fxdefineoptioninterface}
% \marg{family}\marg{infix}
% \begin{macro}[noindex]{\FXDefine...Key}
% \begin{macro}[noindex]{\FXDefine...CmdKey}
% \begin{macro}[noindex]{\FXDefine...ChoiceKey}
% \begin{macro}[noindex]{\FXDefine...VoidKey}
% \begin{macro}[noindex]{\FXDefine...BoolKey}
% This macro defines the extension-level interface allowing users to define
% new \texttt{xkeyval} options for a certain \meta{family}. Note that the core
% of \fx could use those interfaces once defined, but it wouldn't bring much
% to the picture. Indeed, it basically boils down to using a \meta{family}
% within the names of the macros instead of as an argument (and avoiding the
% use of the ``at'' character).
%    \begin{macrocode}
\newcommand*\@fxdefineoptioninterface[2]{%
  \expandafter\newcommand\csname FXDefine#2Key\endcsname{%
    \@fxdefinekey{#1}}%
  \expandafter\newcommand\csname FXDefine#2CmdKey\endcsname{%
    \@fxdefinecmdkey{#1}}%
  \expandafter\newcommand\csname FXDefine#2ChoiceKey\endcsname{%
    \@fxdefinechoicekey{#1}}%
  \expandafter\newcommand\csname FXDefine#2VoidKey\endcsname{%
    \@fxdefinevoidkey{#1}}%
  \expandafter\newcommand\expandafter*\csname FXDefine#2BoolKey\endcsname[2][]{%
    \@fxdefineboolkey[##1]{#1}{##2}}}

%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \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}
% \fx recognizes the standard \texttt{article}, \texttt{report} and
% \texttt{book} classes, the AMS ones, and adapts the list header
% accordingly. It also detects when the package \texttt{basictoc} is loaded
% and uses it, which notably makes it compliant with the \komascript classes
% as well. Otherwise, the standard \texttt{article} layout is used.
%
% \paragraph{\texttt{article} version}
% \begin{macro}{\@lox@prtc@article}
% \begin{macro}{\@lox@psttc@article}
%   \mbox{}
%    \begin{macrocode}
\newcommand\@lox@prtc@article{%
  \section*{\@fxlistfixmename%
    \@mkboth{\MakeUppercase\@fxlistfixmename}{\MakeUppercase\@fxlistfixmename}}}
\let\@lox@psttc@article\relax

%    \end{macrocode}
% \end{macro}
% \end{macro}
% \paragraph{\texttt{report} version}
% \begin{macro}{\@lox@prtc@report}
% \begin{macro}{\@lox@psttc@report}
%   \mbox{}
%    \begin{macrocode}
\newcommand\@lox@prtc@report{%
  \if@twocolumn
    \@restonecoltrue\onecolumn
  \else
    \@restonecolfalse
  \fi
  \chapter*{\@fxlistfixmename%
    \@mkboth{\MakeUppercase\@fxlistfixmename}{\MakeUppercase\@fxlistfixmename}}}
\newcommand\@lox@psttc@report{\if@restonecol\twocolumn\fi}

%    \end{macrocode}
% \end{macro}
% \end{macro}
% \paragraph{\texttt{book} version}
% \begin{macro}{\@lox@prtc@book}
% \begin{macro}{\@lox@psttc@book}
%   \mbox{}
%    \begin{macrocode}
\newcommand\@lox@prtc@book{%
  \if@twocolumn
    \@restonecoltrue\onecolumn
  \else
    \@restonecolfalse
  \fi
  \chapter*{\@fxlistfixmename%
    \@mkboth{\MakeUppercase\@fxlistfixmename}{\MakeUppercase\@fxlistfixmename}}}
\newcommand\@lox@psttc@book{\if@restonecol\twocolumn\fi}

%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsubsection{Status/class-dependent implementation}
% \begin{macro}{\lox@final}
% \begin{macro}{\lox@draft}
%   In the new implementation of the \texttt{draft} mode below, we not only
%   check that the \texttt{lox} file exists, but also that it is not empty
%   before actually typesetting anything.
%    \begin{macrocode}
\let\lox@final\relax

\newread\lox@file
\newif\iflox@typeset
\def\lox@eol{\par}
\newcommand\lox@draft{%
  \lox@typesetfalse%
  \openin\lox@file\jobname.lox\relax
  \ifeof\lox@file\else
    \read\lox@file to \lox@maybeeol
    \ifeof\lox@file
      \ifx\lox@maybeeol\lox@eol\else\lox@typesettrue\fi
    \else
      \lox@typesettrue
    \fi
  \fi
  \closein\lox@file
  \iflox@typeset\@lox@prtc\@starttoc{lox}\@lox@psttc\else\@starttoc{lox}\fi}
%    \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\lox@draft@ams{\@starttoc{lox}\@fxlistfixmename}

%    \end{macrocode}
% \end{macro}
%
% \subsection{Faces}
% \begin{macro}{\fxsetface}
%   \marg{name}\marg{value}
%    \begin{macrocode}
\newcommand*\fxsetface[2]{\@fxsetkeys{face}{#1face=#2}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@fxnewface}
%   \oarg{default}\marg{name}\\
%   A face is just a command key:
%    \begin{macrocode}
\newcommand*\@fxnewface[2][]{%
  \@fxdefinecmdkey{face}{#2face}{}%
  \fxsetface{#2}{#1}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@fxuseface}
%   \marg{name}
%    \begin{macrocode}
\newcommand*\@fxuseface[1]{\@nameuse{cmdfx@face@#1face}}

%    \end{macrocode}
% \end{macro}
%
% \subsection{Annotation layouts}
% \subsubsection{Layout modes}
% \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}
\@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}
%
% \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}
\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}{\@fxrecordlayoutmutex}
%   \marg{layout}\marg{layouts}\\
%   Record mutual exclusion between \meta{layout} and the comma-separated list
%   of \meta{layouts}. For each \meta{layout}, the mutual exclusion list is
%   stored in \cs{@fxlayout@}\meta{layout}\texttt{@mutex}.
%    \begin{macrocode}
\newcommand*\@fxrecordlayoutmutex[2]{%
  \edef\@fxlts{\zap@space#2 \@empty}%
  \def\@fxexpr{\@fxaddtolist{@fxlayout@#1@mutex}}%
  \expandafter\@fxexpr\expandafter{\@fxlts}%
  \@for\@fxlt:=\@fxlts\do{\@fxaddtolist{@fxlayout@\@fxlt @mutex}{#1}}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@fxhandlelayoutmutex}
%   \marg{layout}\\
%   Handle \meta{layout}'s mutual exclusion list.
%    \begin{macrocode}
\newcommand*\@fxhandlelayoutmutex[1]{%
  \ifthenelse{\boolean{fx@layout@#1}}{%
    \def\@fxexpr{\@for\@fxlt:=}%
    \expandafter\@fxexpr\csname @fxlayout@#1@mutex\endcsname\do{%
      \@ifundefined{iffx@layout@\@fxlt}{}{%
        \ifthenelse{\boolean{fx@layout@\@fxlt}}{%
          \@fxpkgwarning{%
            #1 layout requested;\MessageBreak
            turning \@fxlt\space layout off}%
          \@nameuse{fx@layout@\@fxlt}{false}}{}}}}{}}

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@FXRegisterLayout}
%   \marg{when}\oarg{mutex}\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. An
%   optional mutual exclusion list may also be given.
%    \begin{macrocode}
\def\@FXRegisterLayout#1[#2]#3#4{%
  \@fxkeyifundefined{layout}{#3}{%
    \@fxrecordlayoutmutex{#3}{#2}%
    \@fxdefineboolkey[\@fxhandlelayoutmutex{#3}]{layout}{#3}%
    \expandafter\def\csname @fxlayout@#3\endcsname{#4}%
    \@fxaddtolist{@fx#1layouts}{#3}}{%
    \@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{mutex}\marg{name}\marg{funcname}\\
%   And the use-level interface:
%    \begin{macrocode}
\newcommand\FXRegisterLayout{%
  \@ifstar{%
    \@ifnextchar[%]
    {\@FXRegisterLayout{early}}{\@FXRegisterLayout{early}[]}}{%
    \@ifnextchar[%]
    {\@FXRegisterLayout{late}}{\@FXRegisterLayout{late}[]}}}

%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}[noindex]{\FXDefineLayout...Key}
% \begin{macro}[noprint]{\FXDefineLayoutKey}
% \begin{macro}[noprint]{\FXDefineLayoutCmdKey}
% \begin{macro}[noprint]{\FXDefineLayoutChoiceKey}
% \begin{macro}[noprint]{\FXDefineLayoutVoidKey}
% \begin{macro}[noprint]{\FXDefineLayoutBoolKey}
% Finally, the extension-level option creation interface:
%    \begin{macrocode}
\@fxdefineoptioninterface{layout}{Layout}

%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsubsection{Standard textual dispositions}
% \begin{macro}{\@fxtextstd}
%   \marg{type}\marg{note}\marg{author}\\
%   The standard text disposition.
%    \begin{macrocode}
\newcommand*\@fxtextstd[3]{\ignorespaces#3 \fxnotename{#1}: #2}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@fxsignature}
%   \marg{author}\\
%   Typeset the signature part unless \meta{author} is empty. Note that
%   \cs{ifthenelse} is fragile, so we need to make the signature stuff robust.
%    \begin{macrocode}
\DeclareRobustCommand*\@fxsignature[1]{%
  \ifthenelse{\equal{#1}{}}{}{ -- {\@fxuseface{signature}#1}}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@fxsigstd}
%   \marg{type}\marg{note}\marg{author}\\
%   The standard signature disposition.
%    \begin{macrocode}
\newcommand*\@fxsigstd[3]{\fxnotename{#1}: #2\@fxsignature{#3}}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Built-in layouts}
% Let's 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}\@fxtextstd{#1}{#2}{#3}]{%
    \raggedright\@fxuseface{margin}\@fxtextstd{#1}{#2}{#3}}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@fxlayout@margin}
%   \begin{booleanoption}{margin}
%     \mbox{}
%    \begin{macrocode}
\FXRegisterLayout*{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*[margin]{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{\@fxtextstd{#1}{#2}{#3}}}
%    \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}\@fxtextstd{#1}{#2}{#3}}
%    \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 annotations 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}}
% The contents of the \texttt{lox} file is handled through this
% pseudo-layout. It follows the normal layout design, but is not registered
% the usual way because we don't want to give the user control over it. It is
% triggered explicitely by \cs{@@@fxnote@late@draft}.
% \begin{macro}{\FXLayoutContentsLine}
%   \marg{type}\marg{note}\marg{author}\\
%    \begin{macrocode}
\newcommand*\FXLayoutContentsLine[3]{%
  \iffx@mode@multiuser%
    \fxaddcontentsline{\@fxtextstd{#1}{#2}{#3}}%
  \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}{\@fxsetlayoutkeys}
%   \marg{keys}
%   This macro would probably be overkill if we didn't need to
%   \cs{expandafter} it at some point (See \cs{@fxhandleinnermode}).
%    \begin{macrocode}
\newcommand\@fxsetlayoutkeys{\@fxsetkeys{layout}}
%    \end{macrocode}
% \end{macro}
% \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}
% \begin{macro}[noindex]{\FXDefineEnvLayout...Key}
% \begin{macro}[noprint]{\FXDefineEnvLayoutKey}
% \begin{macro}[noprint]{\FXDefineEnvLayoutCmdKey}
% \begin{macro}[noprint]{\FXDefineEnvLayoutChoiceKey}
% \begin{macro}[noprint]{\FXDefineEnvLayoutVoidKey}
% \begin{macro}[noprint]{\FXDefineEnvLayoutBoolKey}
% The extension-level option creation interface:
%    \begin{macrocode}
\@fxdefineoptioninterface{envlayout}{EnvLayout}

%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \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}{\FXEnvLayoutSignatureBegin}
% \begin{macro}{\FXEnvLayoutSignatureEnd}
%   \marg{type}\marg{author}
%    \begin{macrocode}
\newcommand*\FXEnvLayoutSignatureBegin[2]{%
  \@fxuseface{env}\fxnotename{#1}: \ignorespaces}
\newcommand*\FXEnvLayoutSignatureEnd[2]{\@fxsignature{#2}}
%    \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}
% \begin{macro}[noindex]{\FXDefineTargetLayout...Key}
% \begin{macro}[noprint]{\FXDefineTargetLayoutKey}
% \begin{macro}[noprint]{\FXDefineTargetLayoutCmdKey}
% \begin{macro}[noprint]{\FXDefineTargetLayoutChoiceKey}
% \begin{macro}[noprint]{\FXDefineTargetLayoutVoidKey}
% \begin{macro}[noprint]{\FXDefineTargetLayoutBoolKey}
% The extension-level option creation interface:
%    \begin{macrocode}
\@fxdefineoptioninterface{targetlayout}{TargetLayout}

%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \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 annotation 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 the annotations:
%    \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 annotations, 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}
%   An annotation ``author'' allows to distinguish notes from different
%   persons in collaborative mode.
%    \begin{macrocode}
\@fxdefinecmdkey{note}{author}{}
%    \end{macrocode}
% \end{option}
% \begin{option}{target}
%   An annotation ``target'' may replace the page number in the list of
%   corrections 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\@fxsetlayoutkeys\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 currently
%   means logging the annotations. Previously, this code also updated the
%   \texttt{lox} file, but this could lead to typesetting artifacts even in
%   final mode (because of the whatsit introduced by \cs{write}), which is
%   highly undesirable, and besides, there's no point in keeping that
%   information up to date, since it won't be typeset. So from now on, the
%   contents lines are only generated in \texttt{draft} mode by
%   \cs{@@@fxnote@late@draft}.
%    \begin{macrocode}
\newcommand*\@fxissuecommonlayouts[2]{%
  \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, and update the
% \texttt{lox} file.
%    \begin{macrocode}
\newcommand*\@@@fxnote@early@draft[2]{%
  \@fxissueearlydraftlayouts{#1}{#2}}
\newcommand*\@@@fxnote@late@draft[2]{%
  \@fxissuelatedraftlayouts{#1}{#2}%
  \FXLayoutContentsLine{#1}{#2}{\cmdfx@note@author}%
  \@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
%   annotations. 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 annotations, 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{\unskip\@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{Fatal}
\newcommand\fxdanishfatalsname{Fatale 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{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}
% This overrides any previous class-based settings but makes the list of
% corrections compliant with the \komascript classes and any document using
% the \texttt{tocbasic} package.
%    \begin{macrocode}
\@ifpackageloaded{tocbasic}{%
  \addtotoclist[fixme]{lox}%
  \renewcommand\lox@draft{\listoftoc[\@fxlistfixmename]{lox}}}{}
%    \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{Annotation layouts}
% \subsubsection{The \texttt{marginnote} layout}
% \begin{layout}{marginnote}
%   \mbox{}
%    \begin{macrocode}
%<*fxlayoutmarginnote>
\NeedsTeXFormat{LaTeX2e}
\FXProvidesLayout{marginnote}

\RequirePackage{marginnote}

%    \end{macrocode}
% \begin{macro}{\FXLayoutMarginNote}
%   \marg{type}\marg{note}\marg{author}
%    \begin{macrocode}
\newcommand*\FXLayoutMarginNote[3]{%
  \marginnote[\raggedleft\@fxuseface{margin}\@fxtextstd{#1}{#2}{#3}]{%
    \raggedright\@fxuseface{margin}\@fxtextstd{#1}{#2}{#3}}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@fxlayout@marginnote}
%   \begin{booleanoption}{marginnote}
%    \begin{macrocode}
\FXRegisterLayout*[margin,marginclue]{marginnote}{\FXLayoutMarginNote}
%</fxlayoutmarginnote>
%    \end{macrocode}
% \end{booleanoption}
% \end{macro}
% \end{layout}
%
% \subsubsection{The \texttt{pdfnote} layout}
% \begin{layout}{pdfnote}
%   \mbox{}
%    \begin{macrocode}
%<*fxlayoutpdfnote>
\NeedsTeXFormat{LaTeX2e}
\FXProvidesLayout{pdfnote}

\RequirePackage{pdfcomment}

%    \end{macrocode}
% \begin{macro}{\FXLayoutPDFNote}
%   \marg{type}\marg{note}\marg{author}
%    \begin{macrocode}
\newcommand*\FXLayoutPDFNote[3]{%
  \pdfcomment[author={#3}]{\@fxtextstd{#1}{#2}{#3}}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@fxlayout@pdfnote}
%   \begin{booleanoption}{pdfnote}
%    \begin{macrocode}
\FXRegisterLayout{pdfnote}{\FXLayoutPDFNote}
%</fxlayoutpdfnote>
%    \end{macrocode}
% \end{booleanoption}
% \end{macro}
% \end{layout}
%
% \subsubsection{The \texttt{pdfmargin} layout}
% \begin{layout}{pdfmargin}
%   \mbox{}
%    \begin{macrocode}
%<*fxlayoutpdfmargin>
\NeedsTeXFormat{LaTeX2e}
\FXProvidesLayout{pdfmargin}

\RequirePackage{pdfcomment}

%    \end{macrocode}
% \begin{macro}{\FXLayoutPDFMargin}
%   \marg{type}\marg{note}\marg{author}
%    \begin{macrocode}
\newcommand*\FXLayoutPDFMargin[3]{%
  \pdfmargincomment[author={#3}]{\@fxtextstd{#1}{#2}{#3}}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@fxlayout@pdfmargin}
%   \begin{booleanoption}{pdfmargin}
%    \begin{macrocode}
\FXRegisterLayout*[margin,marginclue,marginnote]{pdfmargin}{%
  \FXLayoutPDFMargin}
%</fxlayoutpdfmargin>
%    \end{macrocode}
% \end{booleanoption}
% \end{macro}
% \end{layout}
%
% \subsubsection{The \texttt{pdfsignote} layout}
% \begin{layout}{pdfsignote}
%   \mbox{}
%    \begin{macrocode}
%<*fxlayoutpdfsignote>
\NeedsTeXFormat{LaTeX2e}
\FXProvidesLayout{pdfsignote}

\RequirePackage{pdfcomment}

%    \end{macrocode}
% \begin{macro}{\FXLayoutPDFSigNote}
% \marg{type}\marg{note}\marg{author}\\
% Warning: this layout cannot use \cs{@fxsignature} properly, because of the
% presence of an \cs{ifthenelse} inside, and that, eventough it was declared
% robust. This problem seems to affect PDF layouts only. The workaround I use
% below is to externalize the conditional and temporarily redefine
% \cs{@fxsignature} accordingly. This is a bit clumsy but it works\ldots
%    \begin{macrocode}
\newcommand*\FXLayoutPDFSigNote[3]{%
  \begingroup%
    \ifthenelse{\equal{#3}{}}{%
      \def\@fxsignature##1{}}{%
      \def\@fxsignature##1{ -- {\@fxuseface{signature}#1}}}%
    \pdfcomment[author={#3}]{\@fxsigstd{#1}{#2}{#3}}%
  \endgroup}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@fxlayout@pdfsignote}
%   \begin{booleanoption}{pdfsignote}
%    \begin{macrocode}
\FXRegisterLayout[pdfnote]{pdfsignote}{\FXLayoutPDFSigNote}
%</fxlayoutpdfsignote>
%    \end{macrocode}
% \end{booleanoption}
% \end{macro}
% \end{layout}
%
% \subsubsection{The \texttt{pdfsigmargin} layout}
% \begin{layout}{pdfsigmargin}
%   \mbox{}
%    \begin{macrocode}
%<*fxlayoutpdfsigmargin>
\NeedsTeXFormat{LaTeX2e}
\FXProvidesLayout{pdfsigmargin}

\RequirePackage{pdfcomment}

%    \end{macrocode}
% \begin{macro}{\FXLayoutPDFSigMargin}
%   \marg{type}\marg{note}\marg{author}\\
% Warning: this layout cannot use \cs{@fxsignature} properly, because of the
% presence of an \cs{ifthenelse} inside, and that, eventough it was declared
% robust. This problem seems to affect PDF layouts only. The workaround I use
% below is to externalize the conditional and temporarily redefine
% \cs{@fxsignature} accordingly. This is a bit clumsy but it works\ldots
%    \begin{macrocode}
\newcommand*\FXLayoutPDFSigMargin[3]{%
  \begingroup%
    \ifthenelse{\equal{#3}{}}{%
      \def\@fxsignature##1{}}{%
      \def\@fxsignature##1{ -- {\@fxuseface{signature}#1}}}%
    \pdfmargincomment[author={#3}]{\@fxsigstd{#1}{#2}{#3}}%
  \endgroup}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@fxlayout@pdfsigmargin}
%   \begin{booleanoption}{pdfsigmargin}
%    \begin{macrocode}
\FXRegisterLayout*[margin,marginclue,marginnote,pdfmargin]{pdfsigmargin}{%
  \FXLayoutPDFSigMargin}
%</fxlayoutpdfsigmargin>
%    \end{macrocode}
% \end{booleanoption}
% \end{macro}
% \end{layout}
%
% \subsubsection{The \texttt{pdfcnote} layout}
% \begin{layout}{pdfcnote}
%   \mbox{}
%    \begin{macrocode}
%<*fxlayoutpdfcnote>
\NeedsTeXFormat{LaTeX2e}
\FXProvidesLayout{pdfcnote}

\RequirePackage{pdfcomment}
\RequirePackage{xcolor}

%    \end{macrocode}
% \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}

%    \end{macrocode}
% \end{color}
% \end{color}
% \end{color}
% \end{color}
% \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{macro}{\FXLayoutPDFCNote}
%   \marg{type}\marg{note}\marg{author}
%    \begin{macrocode}
\newcommand*\FXLayoutPDFCNote[3]{%
  \@fxdocolon{#3}%
  \pdfcomment[author={#3},color={fx#1}]{\ignorespaces#3\@fxcolon#2}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@fxlayout@pdfcnote}
%   \begin{booleanoption}{pdfcnote}
%    \begin{macrocode}
\FXRegisterLayout[pdfnote]{pdfcnote}{\FXLayoutPDFCNote}
%</fxlayoutpdfcnote>
%    \end{macrocode}
% \end{booleanoption}
% \end{macro}
% \end{layout}
%
% \subsubsection{The \texttt{pdfcmargin} layout}
% \begin{layout}{pdfcmargin}
%   \mbox{}
%    \begin{macrocode}
%<*fxlayoutpdfcmargin>
\NeedsTeXFormat{LaTeX2e}
\FXProvidesLayout{pdfcmargin}

\RequirePackage{pdfcomment}
\RequirePackage{xcolor}

%    \end{macrocode}
% \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}

%    \end{macrocode}
% \end{color}
% \end{color}
% \end{color}
% \end{color}
% \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{macro}{\FXLayoutPDFCMargin}
%   \marg{type}\marg{note}\marg{author}
%    \begin{macrocode}
\newcommand*\FXLayoutPDFCMargin[3]{%
  \@fxdocolon{#3}%
  \pdfmargincomment[author={#3},color={fx#1}]{\ignorespaces#3\@fxcolon#2}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@fxlayout@pdfcmargin}
%   \begin{booleanoption}{pdfcmargin}
%    \begin{macrocode}
\FXRegisterLayout*[margin,marginclue,marginnote,pdfmargin]{pdfcmargin}{%
  \FXLayoutPDFCMargin}
%</fxlayoutpdfcmargin>
%    \end{macrocode}
% \end{booleanoption}
% \end{macro}
% \end{layout}
%
% \subsubsection{The \texttt{pdfcsignote} layout}
% \begin{layout}{pdfcsignote}
%   \mbox{}
%    \begin{macrocode}
%<*fxlayoutpdfcsignote>
\NeedsTeXFormat{LaTeX2e}
\FXProvidesLayout{pdfcsignote}

\RequirePackage{pdfcomment}
\RequirePackage{xcolor}

%    \end{macrocode}
% \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}

%    \end{macrocode}
% \end{color}
% \end{color}
% \end{color}
% \end{color}
% \begin{macro}{\FXLayoutPDFCSigNote}
%   \marg{type}\marg{note}\marg{author}
%    \begin{macrocode}
\newcommand*\FXLayoutPDFCSigNote[3]{%
  \pdfcomment[author={#3},color={fx#1}]{#2\@fxsignature{#3}}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@fxlayout@pdfcsignote}
%   \begin{booleanoption}{pdfcsignote}
%    \begin{macrocode}
\FXRegisterLayout[pdfnote,pdfcnote]{pdfcsignote}{\FXLayoutPDFCSigNote}
%</fxlayoutpdfcsignote>
%    \end{macrocode}
% \end{booleanoption}
% \end{macro}
% \end{layout}
%
% \subsubsection{The \texttt{pdfcsigmargin} layout}
% \begin{layout}{pdfcsigmargin}
%   \mbox{}
%    \begin{macrocode}
%<*fxlayoutpdfcsigmargin>
\NeedsTeXFormat{LaTeX2e}
\FXProvidesLayout{pdfcsigmargin}

\RequirePackage{pdfcomment}
\RequirePackage{xcolor}

%    \end{macrocode}
% \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}

%    \end{macrocode}
% \end{color}
% \end{color}
% \end{color}
% \end{color}
% \begin{macro}{\FXLayoutPDFCSigMargin}
%   \marg{type}\marg{note}\marg{author}
%    \begin{macrocode}
\newcommand*\FXLayoutPDFCSigMargin[3]{%
  \pdfmargincomment[author={#3},color={fx#1}]{#2\@fxsignature{#3}}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@fxlayout@pdfcsigmargin}
%   \begin{booleanoption}{pdfcsigmargin}
%    \begin{macrocode}
\FXRegisterLayout*[margin,marginclue,marginnote,pdfmargin,pdfsigmargin]{%
  pdfcsigmargin}{%
  \FXLayoutPDFCSigMargin}
%</fxlayoutpdfcsigmargin>
%    \end{macrocode}
% \end{booleanoption}
% \end{macro}
% \end{layout}
%
% \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{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]{\@fxsignature{#2}}
%    \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}

\fxuseenvlayout{signature}

\renewcommand*\FXLayoutFootnote[3]{\footnote{\@fxsigstd{#1}{#2}{#3}}}
\renewcommand*\FXLayoutMargin[3]{%
  \marginpar[{\raggedleft\@fxuseface{margin}\@fxsigstd{#1}{#2}{#3}}]{%
    \raggedright\@fxuseface{margin}\@fxsigstd{#1}{#2}{#3}}}
\renewcommand*\FXLayoutMarginClue[3]{%
  \marginpar[{\raggedleft\@fxuseface{margin}\fxnotename{#1}!\@fxsignature{#3}}]{%
    \raggedright\@fxuseface{margin}\fxnotename{#1}!\@fxsignature{#3}}}
\renewcommand*\FXLayoutInline[3]{{ \@fxuseface{inline}\@fxsigstd{#1}{#2}{#3}}}
\renewcommand*\FXLayoutIndex[3]{%
  \iffx@mode@multiuser%
    \index{***@\fixmeindexname:%
      !\@nameuse{@fx#1key}@\fxnotesname{#1}:%
      !\@nameuse{thefx#1count}: #2\@fxsignature{#3}}%
    \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%
    \fxaddcontentsline{\@fxsigstd{#1}{#2}{#3}}%
  \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}%
  { \textcolor{fx#1}{\@fxuseface{inline}\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}
%    \begin{macrocode}
%<*fxthemecolorsig>
\NeedsTeXFormat{LaTeX2e}
\FXProvidesTheme{colorsig}

\RequirePackage{color}

\FXRequireEnvLayout{colorsig}
\FXRequireTargetLayout{color}

\fxsetface{inline}{}

\renewcommand*\FXLayoutFootnote[3]{\footnote{\color{fx#1}#2\@fxsignature{#3}}}
\renewcommand*\FXLayoutMargin[3]{%
  \marginpar[{\raggedleft\@fxuseface{margin}\color{fx#1}#2\@fxsignature{#3}}]{%
    \raggedright\@fxuseface{margin}\color{fx#1}#2\@fxsignature{#3}}}
\renewcommand*\FXLayoutMarginClue[3]{%
  \marginpar[{\raggedleft\@fxuseface{margin}\color{fx#1}!\@fxsignature{#3}}]{%
    \raggedright\@fxuseface{margin}\color{fx#1}!\@fxsignature{#3}}}
\renewcommand*\FXLayoutInline[3]{%
  { \textcolor{fx#1}{\@fxuseface{inline}#2\@fxsignature{#3}}}}
\renewcommand*\FXLayoutIndex[3]{%
  \iffx@mode@multiuser%
    \index{***@\fixmeindexname:%
      !\@nameuse{@fx#1key}@\fxnotesname{#1}:%
      !{\color{fx#1}\@nameuse{thefx#1count}: #2\@fxsignature{#3}}}%
    \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%
    \fxaddcontentsline{\color{fx#1}#2\@fxsignature{#3}}%
  \else%
    \fxaddcontentsline{\color{fx#1}#2}%
  \fi}
%</fxthemecolorsig>
%    \end{macrocode}
% \end{theme}
%
% ^^A \PrintChanges
% ^^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 : (add-hook 'TeX-update-style-hook (lambda () (doxitems "option" "counter" "lang" "cond" "face" "color" "theme")) nil t)
% ^^A eval: (add-hook 'TeX-update-style-hook (lambda () (doxitem "\\(env\\|target\\)?layout")) nil t)
% ^^A End:
% ^^A fixme.dtx ends here.
