summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-10-01 13:35:02 +0000
committerKarl Berry <karl@freefriends.org>2007-10-01 13:35:02 +0000
commit3b4de807bc36907fe0d045c16180c5503c88f373 (patch)
tree62c56c8bed31a411cc2b9c0a9fab8264f1a9a761 /Master
parent127cf2f1ba829680b88bbc568d6f2119f9f7cc34 (diff)
notes2bib 1.1 (29sep07)
git-svn-id: svn://tug.org/texlive/trunk@5077 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/notes2bib/notes2bib.pdfbin177706 -> 190666 bytes
-rw-r--r--Master/texmf-dist/source/latex/notes2bib/notes2bib.dtx994
-rw-r--r--Master/texmf-dist/source/latex/notes2bib/notes2bib.ins47
-rw-r--r--Master/texmf-dist/tex/latex/notes2bib/jawltxdoc.sty99
-rw-r--r--Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty298
5 files changed, 823 insertions, 615 deletions
diff --git a/Master/texmf-dist/doc/latex/notes2bib/notes2bib.pdf b/Master/texmf-dist/doc/latex/notes2bib/notes2bib.pdf
index 91b0cc1bdc4..47f80082be1 100644
--- a/Master/texmf-dist/doc/latex/notes2bib/notes2bib.pdf
+++ b/Master/texmf-dist/doc/latex/notes2bib/notes2bib.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/notes2bib/notes2bib.dtx b/Master/texmf-dist/source/latex/notes2bib/notes2bib.dtx
index b9fe28fdf96..c1d75557a1c 100644
--- a/Master/texmf-dist/source/latex/notes2bib/notes2bib.dtx
+++ b/Master/texmf-dist/source/latex/notes2bib/notes2bib.dtx
@@ -1,14 +1,97 @@
-%\iffalse meta-comment
+% \iffalse meta-comment
%
% Copyright (C) 2007 by
% Joseph Wright <joseph.wright@morningstar2.co.uk>
%
-% Released under the GNU General Public License v2
-% See http://www.gnu.org/licenses/gpl.txt
-%
-% This work consists of the main source file notes2bib.dtx
-% and the derived files notes2bib.sty and notes2bib.pdf
-%
+% This work 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 2003/12/01 or later.
+%
+% This work has the LPPL maintenance status ``maintained.''
+%
+% The current maintainer of this work is Joseph Wright.
+%
+% This work consists of the source file notes2bib.dtx
+% and the derived files notes2bb.ins,
+% notes2bib.sty and
+% notes2bib.pdf
+%
+% Unpacking:
+% (a) If notes2bib.ins is present:
+% tex notes2bib.ins
+% (b) Without notes2bib.ins:
+% tex notes2bib.dtx
+% (c) If you use LaTeX to generate files:
+% latex \let\install=y\input{notes2bib.dtx}
+%
+% Documentation:
+% (a) Without write18 enabled:
+% pdflatex notes2bib.dtx
+% bibtex8 --wolfgang notes2bib
+% makeindex -s gind.ist notes2bib.idx
+% makeindex -s gglo.ist -o notes2bib.gls notes2bib.glo
+% pdflatex notes2bib.dtx
+% makeindex -s gind.ist notes2bib.idx
+% makeindex -s gglo.ist -o notes2bib.gls notes2bib.glo
+% pdflatex notes2bib.dtx
+% (b) With write18 enabled:
+% pdflatex notes2bib.dtx
+% bibtex8 --wolfgang notes2bib
+% pdflatex notes2bib.dtx
+% pdflatex notes2bib.dtx
+%
+% Installation:
+% Copy notes2bib.sty to a location searched by TeX, and
+% if required by your TeX installation, run the appropriate
+% command to build a hash of files (texhash, mpm --update-db,
+% etc.)
+%
+% Note:
+% The jawltxdoc.sty file is not needed for installation,
+% only for building the documentation. It may be deleted.
+%
+%<*ignore>
+% This is all taken verbatim from Heiko Oberdiek's packages
+\begingroup
+ \def\x{LaTeX2e}%
+\expandafter\endgroup
+\ifcase 0\ifx\install y1\fi\expandafter
+ \ifx\csname processbatchFile\endcsname\relax\else1\fi
+ \ifx\fmtname\x\else 1\fi\relax
+\else\csname fi\endcsname
+%</ignore>
+%<*install>
+\input docstrip.tex
+\keepsilent
+\askforoverwritefalse
+\preamble
+ ----------------------------------------------------------------
+ note2bib --- Integrating notes into the bibliography
+ Maintained by Joseph Wright
+ E-mail: joseph.wright@morningstar2.co.uk
+ Released under the LaTeX Project Public License v1.3 or later
+ See http://www.latex-project.org/lppl.txt
+ ----------------------------------------------------------------
+
+\endpreamble
+\Msg{Generating notes2bib files:}
+\usedir{tex/latex/contib/notes2bib}
+\generate{\file{\jobname.ins}{\from{\jobname.dtx}{install}}
+ \file{\jobname.sty}{\from{\jobname.dtx}{package}}
+ \file{jawltxdoc.sty}{\from{\jobname.dtx}{jawltxdoc}}
+}
+\endbatchfile
+%</install>
+%<*ignore>
+\fi
+% Will Robertson's trick
+\immediate\write18{makeindex -s gind.ist -o \jobname.ind \jobname.idx}
+\immediate\write18{makeindex -s gglo.ist -o \jobname.gls \jobname.glo}
+%</ignore>
%<*driver>
\PassOptionsToClass{a4paper}{article}
\documentclass{ltxdoc}
@@ -16,29 +99,16 @@
\CodelineIndex
\RecordChanges
%\OnlyDescription
-\usepackage[T1]{fontenc}
-\usepackage[english,UKenglish]{babel}
-\usepackage{mathpazo,booktabs,array,url,graphicx,courier,unitsdef}
-\usepackage{upgreek}
-\usepackage[scaled=0.95]{helvet}
-\usepackage[version=3]{mhchem}
-\usepackage[final]{microtype}
-% Some tricks from Heiko Oberdiek
-\RequirePackage{embedfile}
-\embedfile[%
- stringmethod=escape,%
- mimetype=plain/text,%
- desc={LaTeX docstrip source archive for package `\jobname'}%
- ]{\jobname.dtx}
-\usepackage{\jobname}
-\usepackage[numbered]{hypdoc}
+% The various formatting commands used in this file are collected
+% together in |jawltxdoc|.
+\usepackage{jawltxdoc}
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
%</driver>
%\fi
%
-%\CheckSum{498}
+%\CheckSum{433}
%
%\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
@@ -59,25 +129,30 @@
%\GetFileInfo{\jobname.sty}
%
%\changes{v1.0}{2007/08/30}{Initial public release}
-%
-%\DoNotIndex{\@arabic,\@bsphack,\@esphack,\@fileswfalse}
-%\DoNotIndex{\@ifclassloaded,\@ifnextchar,\@ifpackageloaded}
-%\DoNotIndex{\@ifundefined,\@makeother,\@onelevel@sanitize}
-%\DoNotIndex{\@undefined,\AtBeginDocument,\AtEndDocument,\autocite}
-%\DoNotIndex{\begingroup,\bib@gadd,\blx@bibfiles,\catcode,\cite}
-%\DoNotIndex{\closeout,\csname,\DeclareOption,\def,\do,\dospecials}
-%\DoNotIndex{\edef,\else,\endcsname,\endgroup,\endnote,\endnotemark}
-%\DoNotIndex{\endnotetext,\ExecuteOptions,\expandafter,\fi}
-%\DoNotIndex{\footnot,\footnotemark,\footnotetext,\gdef,\global}
-%\DoNotIndex{\if@filesw,\ifdefined,\ifnum,\ifx,\ignorespaces}
+%\changes{v1.1}{2007/09/29}{License changed from GPL to LPPL}
+%\changes{v1.1}{2007/09/29}{\cs{Percent} macro removed}
+%\changes{v1.1}{2007/09/29}{Documentation improvements}
+%\changes{v1.1}{2007/09/29}{Several code sections re-factored}
+%\changes{v1.1}{2007/09/29}{Improvements to documentation and
+% \texttt{dtx} file}
+%
+%\DoNotIndex{\@fileswfalse,\@ifnextchar,\@ifpackageloaded}
+%\DoNotIndex{\@ifundefined,\@nameuse,\AtBeginDocument,\AtEndDocument}
+%\DoNotIndex{\begingroup,\bib@gadd,\bibliography,\blx@bibfiles,\cite}
+%\DoNotIndex{\closeout,\csname,\DeclareOption,\def,\edef,\else}
+%\DoNotIndex{\endcsname,\expandafter,\fi,\footnote,\footnotemark}
+%\DoNotIndex{\footnotetext,\gdef,\global,\if@filesw,\ifnum,\ifx}
%\DoNotIndex{\immediate,\jobname,\let,\long,\MessageBreak}
%\DoNotIndex{\NeedsTeXFormat,\newcommand,\newcounter,\newif}
-%\DoNotIndex{\newwrite,\nocite,\openout,\PackageInfo,\PackageWarning}
-%\DoNotIndex{\patchcmd,\printbibliography,\ProcessOptions,\protect}
+%\DoNotIndex{\newrobustcmd,\newwrite,\nocite,\openout,\PackageError}
+%\DoNotIndex{\PackageInfo,\PackageWarning,\patchcmd}
+%\DoNotIndex{\printbibliography,\ProcessOptions,\protect}
%\DoNotIndex{\ProvidesPackage,\relax,\renewcommand,\RequirePackage}
-%\DoNotIndex{\space,\stepcounter,\string,\supercite,\the}
-%\DoNotIndex{\theendnotes,\value,\write,\xdef,\xspace,\z@}
-%\DoNotIndex{\DeclareRobustCommand}
+%\DoNotIndex{\space,\stepcounter,\string,\thanks,\the,\theendnotes}
+%\DoNotIndex{\unexpanded,\value,\write,\xdef,\z@}
+%
+%
+%\DoNotIndex{\NeedsTeXFormat}
%
%\title{\texttt{notes2bib} --- Integrating notes into the
% bibliography%
@@ -122,7 +197,7 @@
% into the bibliography easy. Notes can be written as normal in the
% LaTeX source, and are automatically moved to the bibliography. The
% package is compatible with sorted and unsorted bibliography styles.
-% The package has been designed for use with numerical citations ,
+% The package has been designed for use with numerical citations,
% although it will work with other systems.
%
%\section{Basic use}
@@ -132,12 +207,24 @@
% existing \cmd{\footnote} type: \cmd{\bibnote}. This can be used in
% exactly the same way as a footnote, taking one mandatory argument
% \marg{text}. The \meta{text} will be made available as to the
-% bibliography as a note (henceforth referred to as a bibnote). By
-% default, each bibnote is given an automatically-generated label
+% bibliography as a note (henceforth referred to as a bibnote).
+%\begin{LaTeXexample}
+% A very simple example of a bibliography note
+% \bibnote{Note for the first example}.
+%\end{LaTeXexample}
+% By default, each bibnote is given an automatically-generated label
% (see Section \ref{custom} for details of modifying the automatic
% system). However, \cmd{\bibnote} accepts an optional argument
% \oarg{label}, which can be used to over-ride this. This is
-% particularly useful when a note will be referenced several times.
+% particularly useful when a note will be referenced several times
+% (The use of the \cmd{\citenote} command is covered in
+% Section~\ref{subsec:cross-ref}).
+%\begin{LaTeXexample}
+% An example of a named note
+% \bibnote[labelled-note]{Note for the second example}.
+% The text can then continue and reference the
+% note again later \citenote{labelled-note}.
+%\end{LaTeXexample}
%
%\DescribeMacro{\bibnotemark}
%\DescribeMacro{\bibnotetext}
@@ -150,13 +237,19 @@
% headings which also appear in the Table of Contents. In these
% contexts, use \cmd{\citenote} to reference the note, or use an
% optional argument to the \cmd{\section}, \emph{etc.}
+%\begin{LaTeXexample}
+% It is hard to write a good example for this \bibnotemark!
+% The text continues here \bibnotetext{Note for the
+% third example}.
+%\end{LaTeXexample}
%
%\subsection{Package options}
% The |notes2bib| package currently accepts a number of options. The
-% |footnotes| option turns standard LaTeX footnotes into bibnotes
-% \bibnote{The |\thanks| macro used in making titles uses the
-% footnote mechanism. This is unaffected by loading |notes2bib| even
-% with the |footnote| option.}. Thus footnotes then appear in the
+% |footnotes| option turns standard LaTeX footnotes into
+% bibnotes.\footnote{The \cs{thanks} macro used in making titles uses
+% the footnote mechanism. This is unaffected by loading
+% \texttt{notes2bib} even with the \texttt{footnote} option.}. Thus,
+% with the |footnotes| option enables, footnotes appear in the
% bibliography with no further user input. The \cmd{\footnotemark}
% and \cmd{\footnotetext} macros are supported, and are aliased to
% \cmd{\bibnotemark} and \cmd{\bibnotetext}, respectively.
@@ -172,43 +265,31 @@
% citations are written in the order they appear in the source. Thus,
% with an unsorted bibliography style, they will appear in the order
% given. The |tail| option will force all notes to appear after real
-% citations, whereas the |head| option causes notes to come first
-% \bibnote{The |head| option is provided primarily for consistency
-% with the |tail| option. The system used to give |head| notes is
-% something of a hack, and is \emph{not} a core part of the
-% package.}. This has been designed to work with both sorted and
-% unsorted bibliography styles.
-%
-% Finally, the package takes the |killpercent| option. This affects
-% the handling of percentage characters within notes. By default,
-% the percentage character is treated as a comment marker (as
-% normal). Thus the rest of the line is ignored. With the
-% |killpercent| option, the \% is completely skipped over,
-% \emph{e.g.}~writing \verb*=Some text % A comment= will place
-% \verb*=Some text A comment= in the notes database \bibnote{When
-% producing the documentation for the package, this was something of
-% a headache until the problem was solved.}.
+% citations, whereas the |head| option causes notes to come
+% first.\footnote{The \texttt{head} option is provided primarily for
+% consistency with the \texttt{tail} option. The system used to give
+% ``head'' notes is something of a hack, and is \emph{not} a core
+% part of the package.} This has been designed to work with both
+% sorted and unsorted bibliography styles.
%
%\subsection{Output of notes}
% Bibnotes are only printed when a bibliography is created. This
% means that at the very least a \cmd{\bibliographystyle} command
-% must appear in the source \bibnote{|biblatex| users will define a
-% style when loading |biblatex|, of course}. Under most
-% circumstances, the user will be citing literature, and so will also
-% include a \cmd{\bibliography} command in their source.
-% Bibliography notes are automatically added to the citations to be
-% printed.
+% must appear in the source. Under most circumstances, the user will
+% be citing literature, and so will also include a
+% \cmd{\bibliography} command in their source. Bibliography notes are
+% automatically added to the citations to be printed.
%
%\DescribeMacro{\printbibnotes}
% If bibnotes are being used without any other citations, then the
-% user cannot place \cmd{\bibliography} in the source
-% \bibnote[verbhack]{LaTeX will complain if the user puts
-% |\bibliography{}|}. The package therefore
-% provides the macro \cmd{\printbibnotes}, which will output only the
-% notes. If the |endnotes| package has been loaded, the
-% \cmd{\theendnotes} macro is redefined to achieve the same effect.
-%
-%\subsection{Cross-referencing notes}
+% user cannot place \cmd{\bibliography} in the source.\footnote{LaTeX
+% will complain if the user puts \cs{bibliography\{\}}.} The package
+% therefore provides the macro \cmd{\printbibnotes}, which will
+% output only the notes. If the |endnotes| package has been loaded,
+% the \cmd{\theendnotes} macro is redefined to achieve the same
+% effect.
+%
+%\subsection{Cross-referencing notes\label{subsec:cross-ref}}
%\DescribeMacro{\citenote}
% As explained above, each note is automatically assigned a label, or
% the user can provide one as an optional argument to the note. In
@@ -217,29 +298,33 @@
% However, this can cause problems when using the |tail| option. The
% \cmd{\citenote} command is therefore provided. This is aware of
% the options, and will act correctly in all circumstances.
-% \cmd{\citenote} uses the citation command currently defined in
-% \cmd{\niibcite}.
+%\begin{LaTeXexample}
+% Cross-references to the note labelled earlier
+% using \cite{labelled-note} and using
+% \citenote{labelled-note}.
+%\end{LaTeXexample}
%
%\subsection{Interaction with other packages}
% |notes2bib| is designed to work well with as many other packages as
% possible. It tries to avoid changing anything which other packages
-% may rely on. That said, it is best to load |notes2bib| after other
-% packages that affect citations, footnotes or endnotes. As usual,
-% the |notes2bib| package should be loaded before |hyperref|
-% \bibnote{It is usually the case that |hyperref| should be the very
-% last package loaded in the preamble.}.
+% may rely on. That said, it is best to load |notes2bib|
+% \emph{after} other packages that affect citations, footnotes or
+% endnotes. As usual, the |notes2bib| package should be loaded
+% before |hyperref|.\footnote{It is usually the case that
+% \texttt{hyperref} should be the very last package loaded in the
+% preamble.}
%
% The |notes2bib| package is compatible with the current release of
% |biblatex| (v0.6). As |biblatex| works very differently from other
-% citation systems, |notes2bib| must be loaded \emph{after}
-% |biblatex|. This allows the package to adjust correctly for some
-% important differences in operation of the bibliography environment.
+% citation systems, it must be loaded \emph{before} |notes2bib|.
+% This allows the package to adjust correctly for some important
+% differences in operation of the bibliography environment.
%
%\section{Customisation\label{custom}}
% The |notes2bib| package provides a number of possibilities for
% customisation. Some of these will be useful only in somewhat
% unusual circumstances. These more low-level macros all begin
-% \texttt{\textbackslash niib\dots}.
+% \cs{niib\dots}.
%
%\DescribeMacro{\bibnotename}
%\DescribeMacro{\thebibnote}
@@ -269,8 +354,8 @@
% \texttt{\niibfield} field. Both of these can be altered by
% redefining \cmd{\niibrecord} and \cmd{\niibfield}. This could be
% useful with a bibliography style that has an explicit ``Notes''
-% record type, for example \bibnote{The |rsc| and |achemso| packages
-% contain styles of this type.}.
+% record type, for example.\footnote{The \texttt{rsc} and
+% \texttt{achemso} packages contain styles of this type.}
%
% |notes2bib| attempts to maintain the correct ordering of notes with
% sorted bibliography styles. This is done by setting up suitable
@@ -304,18 +389,6 @@
%
%\section{Special effects}
%
-%\DescribeMacro{\Percent}
-% As explained in the description of the |killpercent| option, the
-% default behaviour of the package is to treat the \% sign as a
-% comment marker, as normal. However, no ``escape'' is available
-% while writing the note to file, and so |\%| will also start a
-% comment. The package therefore provides the \cmd{\Percent} macro
-% to produce the percentage sign in notes \bibnote{There is no
-% perfect way of getting unexpanded output from TeX. The
-% |\unexpanded| e-TeX primitive, for example, adds extra spaces to
-% control sequences. The package author thinks that having to type
-% |\Percent| to get \Percent is the least inconvenient solution.}.
-%
%\DescribeMacro{\flushcitestack}
% When using the |head| or |tail| options, citations are added to a
% stack as they are made. This stack is then flushed to the |.aux|
@@ -330,57 +403,67 @@
% the stack described above. This requires the modification of the
% citation commands. By default, |notes2bib| modifies the
% \cmd{\cite} command and most of the standard citation commands of
-% |natbib| and |biblatex| \bibnote{Notice that |\nocite| is not
-% modified}. However, if problems are encountered with citation
-% order, the user can use the \cmd{\delaycite} macro to patch any
-% arbitrary citation command. This macro takes a single argument
-% \marg{macro-name}, which is the name of the citation command to
-% modify \emph{minus} the leading backslash. For example, the
-% \cmd{\cite} command is patched using |\delaycite{cite}|. The
-% \cmd{\delaycite} macro checks that a citation command is not
-% already modified, and so may be used again on the same command with
-% no ill effects.
+% |natbib| and |biblatex|.\footnote{Notice that \bslash
+% \texttt{nocite} is not modified} However, if problems are
+% encountered with citation order, the user can use the
+% \cmd{\delaycite} macro to patch any arbitrary citation command.
+% This macro takes a single argument \marg{macro-name}, which is the
+% name of the citation command to modify \emph{minus} the leading
+% backslash. For example, the \cmd{\cite} command is patched using
+% |\delaycite{cite}|. The \cmd{\delaycite} macro checks that a
+% citation command is not already modified, and so may be used again
+% on the same command with no ill effects.
%
% If a sorted bibliography style is in use, and more than nine notes
% are created, the sort order will be incorrect. This is because by
% default |notes2bib| does not pad the automatically-created labels
% with zeros. To get the correct sort order, \cmd{\thebibnote}
% should be redefined:
-%\begin{verbatim}
-%\renewcommand*{\thebibnote}{%
-% \bibnotename%
-% \ifnum\value{bibnote} < 9 0\fi%
-% \the\value{bibnote}%
-%}
-%\end{verbatim}
+%\begin{LaTeXexample}[\typesetcodeonly]
+% \renewcommand*{\thebibnote}{%
+% \bibnotename%
+% \ifnum\value{bibnote} < 9 0\fi%
+% \the\value{bibnote}%
+% }
+%\end{LaTeXexample}
%
%\section{Known issues}
%
+% From v1.1, the method for writing notes to the BibTeX database has
+% been modified. This means that bibnotes cannot contain verbatim
+% text.\footnote{Actually, they can, but the spacing will go wrong.
+% LaTeX will only complain if a note ends with verbatim text.
+% However, verbatim text is not supported in bibnotes: don't do it!}
+% This is the same as for normal footnotes, and so the usual
+% work-arounds are applicable.
+%\begin{LaTeXexample}
+% The next note contains some awkward text
+% \bibnote{Some \texttt{\textbackslash verb}-like output}.
+%\end{LaTeXexample}
+%
% Currently, when using the |head| option citations can take only one
% optional argument. This is fine for normal citation styles, but
% means that |biblatex| users may have some issues. The package
% author will look again at this if it is a serious problem. A work
% around is to cite as follows (here assuming you wish to use the
-% ``\cmd{\mycite}'' command):
-%\begin{verbatim}
-%\makeatletter
-% \begingroup
-% \@fileswfalse
-% \niib@orig@mycite[argument-one][argument-two]{citation}
-% \endgroup
-% \edef\niib@stack{\niib@stack,citation}
-%\makeatother
-%\end{verbatim}
+% \cmd{\cite} command):
+%\begin{LaTeXexample}[\typesetcodeonly]
+% \makeatletter
+% \begingroup
+% \@fileswfalse
+% \niib@orig@cite[argument-one][argument-two]{citation}
+% \endgroup
+% \edef\niib@stack{\niib@stack,citation}
+% \makeatother
+%\end{LaTeXexample}
% Where ``argument-one,'' ``argument-two'' and ``citation'' should be
% altered to the desired information.
%
-% Users of |cite| will find that |notes2bib| does not move citations
-% for notes to after punctuation. The note will be cited where it
-% is given in the source.
-%
-% |biblatex| does not like notes that contain verbatim text. This is
-% due to the methods |biblatex| employs to work. Currently, there
-% does not seem to be a great deal |notes2bib| can do about this.
+% The |cite| and |biblatex| packages move superscript citations after
+% punctuation. When these packages are used with standard (not |head|
+% or |tail|) mode of |notes2bib|, the same will occur for bibnote
+% numbers. Unfortunately, the |head| and |tail| options prevent this
+% ``auto-magic'' operation on \emph{bibnote} numbers.
%
%\bibliographystyle{unsrt}
%\renewcommand*{\refname}{Notes}
@@ -395,7 +478,7 @@
% inspiration for this package.
%
%\subsection{The \texttt{endnotes} approach}
-% The |endnotes| package \bibnote{%
+% The |endnotes| package\footnote{%
% \url{http://tug.ctan.org/macros/latex/contrib/misc/endnotes.sty}}
% allows the user to generate endnotes in the same way as footnotes.
% In |endnotes|, the text of the note is written to a |.ent| file.
@@ -434,13 +517,10 @@
% |notes2bib| writes its output in the well-known BibTeX database
% format. All of the note text is written almost completely
% unexpanded to the file, the only requirement being that the braces
-% match within the argument \bibnote{Many thanks to Ulrich Diez for
-% the code to achieve the unexpanded writing.}. Notice that by
-% default the \% character still acts as a comment marker. Percentage
-% signs in the notes database would cause problems on reading the data
-% back in after running BibTeX.
+% match within the argument.\footnote{Writing to the file uses the
+% e-TeX \cs{unexpanded} primitive.}
%
-% Each note results in a citation being placed by |notes2bib| in the
+% Each note results in a citation being placed by |notes2bib| in the
% |.aux| file. The \cmd{\bibliography} command is also modified so
% that the new database will be used by BibTeX. After the BibTeX run,
% the note text will appear in the |.bbl| file, in the same way as
@@ -462,12 +542,33 @@
%\subsection{Package setup code}
%
% The package starts with the usual identification code.
+%\changes{v1.1}{2007/09/29}{Removed use of \texttt{xspace}}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{notes2bib}
- [2007/09/03 v1.0a Integrating notes into the bibliography]
-\RequirePackage{xspace}
+ [2007/09/29 v1.1 Integrating notes into the bibliography]
% \end{macrocode}
+% The package requires e-TeX, so before going any further, this is
+% tested. This code is taken more-or-less verbatim from |biblatex|.
+%\changes{v1.1}{2007/09/29}{Require e-TeX extensions}
+% \begin{macrocode}
+\@ifundefined{eTeXversion}
+ {\PackageError{notes2bib}
+ {Not running under e-TeX}
+ {This package requires e-TeX. Try compiling the document
+ with\MessageBreak `elatex' instead of `latex'. When using
+ pdfTeX, try `pdfelatex'\MessageBreak instead of `pdflatex'}%
+ \endinput}
+ {}
+% \end{macrocode}
+% With that check out of the way, Philip Lehmann's |elatex| package
+% is loaded to extend various LaTeX commands. Early versions of
+% |elatex| ues slightly different macro names, so a version check
+% is needed.
+% \begin{macrocode}
+\RequirePackage{elatex}[2007/07/13]
+% \end{macrocode}
+%
% Option processing takes place. Redefining \cmd{\footnote} or
% \cmd{\endnote} is delayed until the start of the document, to avoid
% the danger of other packages being loaded and overwriting this.
@@ -477,6 +578,8 @@
\niib@fntrue
\AtBeginDocument{%
\let\footnote\bibnote%
+ \PackageInfo{notes2bib}%
+ {Converting footnotes to bibnotes}%
}}
\DeclareOption{endnotes}{%
\AtBeginDocument{%
@@ -490,6 +593,8 @@
% \begin{macrocode}
\@ifpackageloaded{endnotes}%
{\let\theendnotes\printbibnotes}{}%
+ \PackageInfo{notes2bib}%
+ {Converting endnotes to bibnotes}%
}}
% \end{macrocode}
% Stephen Dalton suggested an option for all notes to come after
@@ -501,52 +606,24 @@
\DeclareOption{tail}{\niib@tailtrue}
\DeclareOption{head}{\niib@headtrue}
% \end{macrocode}
-%\begin{macro}{\niib@percent}
-% For handling percentage signs in notes, an option is needed
-% to alter handling.
-% \begin{macrocode}
-\def\niib@percent{\catcode`\%=14\relax}
-\DeclareOption{killpercent}{%
- \def\niib@percent{\catcode`\%=9\relax}
-}
-% \end{macrocode}
-% For |.dtx| files, the |killpercent| option is necessary.
-% \begin{macrocode}
-\@ifclassloaded{ltxdoc}{\ExecuteOptions{killpercent}}{}
-% \end{macrocode}
-%\end{macro}
% Finally, the options are put into effect.
% \begin{macrocode}
\ProcessOptions
% \end{macrocode}
%
-% If the |footnote| option is active, there is some work to do
-% because of the \cmd{\thanks} macro.
-% \begin{macrocode}
-\ifniib@fn
-% \end{macrocode}
-% The \cmd{\thanks} macro can only be patched if e-TeX extensions are
-% available. This is because |elatex| is used for the actual
-% patching.
-% \begin{macrocode}
- \@ifundefined{eTeXversion}{%
- \PackageWarning{notes2bib}{%
- e-TeX extensions unavailable\MessageBreak
- \protect\footnotemark and \protect\footnotetext%
- \MessageBreak unmodified}%
- }{%
-% \end{macrocode}
%\begin{macro}{\niib@fnmark}
%\begin{macro}{\niib@fntext}
%\begin{macro}{\niib@thanks}
-% With e-TeX available, the |elatex| package can be used to do the
-% patching needed. Firstly, it is necessary to back up the original
-% definitions for \cmd{\footnotetext} and \cmd{\footnotetext}. The
-% \cmd{\thanks} macro is also backed up.
+% If the |footnote| option is active, there is some work to do
+% because of the \cmd{\thanks} macro. This is all done using the
+% |elatex| package. Firstly, it is necessary to back up the original
+% definitions for \cmd{\footnotetext}, \cmd{\footnotetext} and
+% \cmd{\thanks}.
% \begin{macrocode}
- \let\niib@fnmark\footnotemark
- \let\niib@fntext\footnotetext
- \let\niib@thanks\thanks
+\ifniib@fn
+ \let\niib@fnmark\footnotemark
+ \let\niib@fntext\footnotetext
+ \let\niib@thanks\thanks
% \end{macrocode}
%\end{macro}
%\end{macro}
@@ -556,26 +633,28 @@
% definitions. The patching is nested so that everything has to go
% right before things are finalised.
% \begin{macrocode}
- \RequirePackage{elatex}
- \patchcmd{\thanks}{\footnotemark}{\niib@fnmark}{%
- \patchcmd{\thanks}{\footnotetext}{\niib@fntext}{%
- \AtBeginDocument{%
- \let\footnotemark\bibnotemark
- \let\footnotetext\bibnotetext
- }%
+ \patchcmd{\thanks}{\footnotemark}{\niib@fnmark}{%
+ \patchcmd{\thanks}{\footnotetext}{\niib@fntext}{%
+ \AtBeginDocument{%
+ \let\footnotemark\bibnotemark
+ \let\footnotetext\bibnotetext
}%
+ \PackageInfo{notes2bib}%
+ {Modifying \protect\thanks\space macro}%
+ }{%
% \end{macrocode}
-% Thinks have gone wrong if the following lines are reached. So everything
-% is put back to normal.
+% If the following is executed, then things have gone wrong in some
+% way. The \cmd{\patchcmd} macro shouldn't mess up the definition of
+% \cmd{\thanks}, but to be on the safe side the original version
+% is restored here.
% \begin{macrocode}
- {\let\thanks\niib@thanks%
- \PackageWarning{notes2bib}%
- {Could not patch \protect\thanks}}%
- }{%
\let\thanks\niib@thanks%
\PackageWarning{notes2bib}%
{Could not patch \protect\thanks}}%
- }%
+ }{%
+ \let\thanks\niib@thanks%
+ \PackageWarning{notes2bib}%
+ {Could not patch \protect\thanks}}%
\fi
% \end{macrocode}
%\end{macro}
@@ -588,10 +667,15 @@
\ifniib@tail
\PackageWarning{notes2bib}
{You've given both ``head'' and ``tail'' as
- options\MessageBreak
- I'm ignoring both!}
+ options\MessageBreak I'm ignoring both!}
\niib@headfalse\niib@tailfalse
+ \else
+ \PackageInfo{notes2bib}%
+ {bibnotes will ``head'' other citations}
\fi
+\else
+ \PackageInfo{notes2bib}%
+ {bibnotes will ``tail'' other citations}
\fi
% \end{macrocode}
% For the |head| option, the normal citation commands are modified to
@@ -600,9 +684,10 @@
\AtBeginDocument{%
\ifniib@head
% \end{macrocode}
-% The \cmd{\cite} command is always defined, so it can be redefined in all
-% cases.
+% The real \cmd{\delaycite} is activated. The \cmd{\cite} command is
+% always defined, so it can be redefined in all cases.
% \begin{macrocode}
+ \let\delaycite\niib@delaycite
\delaycite{cite}%
% \end{macrocode}
% If |natbib| is loaded, there a several citation commands that will
@@ -623,31 +708,26 @@
\delaycite{Citealt}%
\delaycite{Citealp}%
\delaycite{Citeauthor}%
- }{%
+ }{}%
% \end{macrocode}
% For |biblatex|, some citation commands are always defined.
% \begin{macrocode}
- \@ifpackageloaded{biblatex}{%
- \delaycite{Cite}%
- \delaycite{parencite}%
- \delaycite{Parencite}%
- \delaycite{footcite}%
- \delaycite{Footcite}%
- \delaycite{textcite}%
- \delaycite{Textcite}%
+ \@ifpackageloaded{biblatex}{%
+ \delaycite{Cite}%
+ \delaycite{parencite}%
+ \delaycite{Parencite}%
+ \delaycite{footcite}%
+ \delaycite{Footcite}%
+ \delaycite{textcite}%
+ \delaycite{Textcite}%
% \end{macrocode}
-% Now there are several citation commands that may be defined. As
-% |biblatex| requires e-TeX, the |\ifdefined| primitive can be
-% used.
+% Now there are some citation commands that may be defined or not.
% \begin{macrocode}
- \ifdefined\autocite%
- \delaycite{autocite}%
- \fi%
- \ifdefined\supercite%
- \delaycite{supercite}%
- \fi%
+ \@ifundefined{autocite}{}%
+ {\delaycite{autocite}}%
+ \@ifundefined{supercite}{}%
+ {\delaycite{supercite}}%
}{}%
- }%
\fi%
}
% \end{macrocode}
@@ -656,7 +736,7 @@
%
% The |notes2bib| package makes quite a number of configuration
% defaults available as macros. These are all set up here. Most of
-% these are of the form \texttt{\textbackslash niib\dots}, as in the
+% these are of the form \cs{niib\dots}, as in the
% main they are unlikely to be altered by most users.
%
%\begin{macro}{\bibnotename}
@@ -669,9 +749,9 @@
%\end{macro}
%\begin{macro}{\thebibnote}
% A counter is needed for the notes created. In analogy to other
-% counters in LaTeX, this is given a \texttt{\textbackslash
-% the\dots} name. The user should not really need to use this
-% macro, but convention dictate that it has a user-space name.
+% counters in LaTeX, this is given a \cs{the\dots} name. The user
+% should not really need to use this macro, but convention dictate
+% that it has a user-space name.
% \begin{macrocode}
\newcounter{bibnote}
\renewcommand*{\thebibnote}{\bibnotename\the\value{bibnote}}
@@ -680,7 +760,7 @@
%\begin{macro}{\niibprefix}
% The package works by creating a new BibTeX database file containing
% the notes. By default, this fix is called
-% \texttt{\niibprefix\textbackslash jobname.bib}, but the prefix may
+% \texttt{\niibprefix}\cs{jobname.bib}, but the prefix may
% be altered by redefining \cmd{\niibprefix}. The default follows
% the pattern used by the |biblatex| package (which uses |blx-|).
% \begin{macrocode}
@@ -744,11 +824,12 @@
%\subsection{User macros}
%
%\begin{macro}{\bibnote}
+%\changes{v1.1}{2007/09/29}{Macro made robust}
% Each new bibnote increments the note counter, then checks for an
% optional label, before handing off to the internal macro
% \cmd{\niib@bibnote}.
% \begin{macrocode}
-\DeclareRobustCommand\bibnote{%
+\newrobustcmd*{\bibnote}{%
\stepcounter{bibnote}%
\@ifnextchar[%
{\niib@bibnote}%
@@ -757,11 +838,12 @@
% \end{macrocode}
%\end{macro}
%\begin{macro}{\bibnotemark}
+%\changes{v1.1}{2007/09/29}{Macro made robust}
% The \cmd{\bibnotemark} macro works in the same way as
% \cmd{\bibnote}, but calls \cmd{\niib@mark} rather than
% \cmd{\niib@bibnote}.
% \begin{macrocode}
-\DeclareRobustCommand\bibnotemark{%
+\newrobustcmd*{\bibnotemark}{%
\stepcounter{bibnote}%
\@ifnextchar[%
{\niib@mark}%
@@ -770,17 +852,19 @@
% \end{macrocode}
%\end{macro}
%\begin{macro}{\bibnotetext}
+%\changes{v1.1}{2007/09/29}{Macro made robust}
+%\changes{v1.1}{2007/09/29}{Use \cs{newrobustcmd} rather than
+% \cs{@ifnextchar} for detecting optional argument}
% The text companion to the mark macro above, with no increment of
% the counter.
% \begin{macrocode}
-\DeclareRobustCommand\bibnotetext{%
- \@ifnextchar[%
- {\niib@text}%
- {\niib@text[\thebibnote]}%
+\newrobustcmd*{\bibnotetext}[1][\thebibnote]{%
+ \niib@text{#1}%
}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\printbibnotes}
+%\changes{v1.1}{2007/09/29}{Macro made robust}
% To allow for the possibility of there being no other notes, a
% command to print only notes is given. In the |biblatex| case, the
% best that can be done is to issue \cmd{\printbibliography}.
@@ -788,19 +872,20 @@
\@ifpackageloaded{biblatex}{%
\let\printbibnotes\printbibliography%
}{%
- \newcommand*{\printbibnotes}{\niib@bib%
+ \newrobustcmd*{\printbibnotes}{\niib@bib%
{\niibprefix\jobname}}%
}%
% \end{macrocode}
%\end{macro}
%\begin{macro}{\flushcitestack}
+%\changes{v1.1}{2007/09/29}{Macro made robust}
% In order to delay citations to the end of the bibliography (and
% thus force others to the start), a ``stack'' is created of
% citations which need to be written to the |.aux| file. This
% is done here, and the stack is cleared so collection can begin
% again.
% \begin{macrocode}
-\newcommand*\flushcitestack{%
+\newrobustcmd*{\flushcitestack}{%
\ifx\niib@stack\relax\else%
\expandafter\nocite\expandafter{\niib@stack}%
\global\let\niib@stack\relax%
@@ -810,88 +895,46 @@
%\end{macro}
%
%\begin{macro}{\delaycite}
-%\changes{v1.0a}{2007/09/03}{Fixed a flaw with checking for
-% existing redefinition}
-% Normal citations have to be stacked up in the stack when in
-% ``head'' mode. To do this, the citation command has to be modified
-% to do this, while leaving note citations alone. The trick used in
-% this is to set \cmd{\@filesw} to false while the citation takes
-% place.
-% \begin{macrocode}
-\newcommand*\delaycite[1]{%
- \@ifundefined{niib@orig@#1}{%
- \expandafter\expandafter\expandafter\let\expandafter%
- \csname niib@orig@#1\expandafter\endcsname\csname #1\endcsname%
- \expandafter\renewcommand\csname #1\endcsname[2][\relax]{%
-% \end{macrocode}
-% If a note is being cited, then there will be no optional argument,
-% and |##1| will expand to \cmd{\relax}.
-% \begin{macrocode}
- \ifniib@cn%
- \csname niib@orig@#1\endcsname{##2}%
- \else%
- \begingroup%
- \@fileswfalse%
-% \end{macrocode}
-% If an optional argument has been given, then |##1| will expand to
-% something other than \cmd{\relax}. So the original citation
-% command is called with the optional argument.
+%\changes{v1.1}{2007/09/29}{Initial definition prevents use in
+% preamble}
% \begin{macrocode}
- \ifx##1\relax%
- \csname niib@orig@#1\endcsname{##2}%
- \else%
- \csname niib@orig@#1\endcsname[##1]{##2}%
- \fi%
- \endgroup%
- \edef\niib@temp{##2}%
- \ifx\niib@stack\relax%
- \xdef\niib@stack{\niib@temp}%
- \else%
- \xdef\niib@stack{\niib@stack,\niib@temp}%
- \fi%
- \fi%
- }%
- }{%
- \PackageInfo{notes2bib}%
- {Citation type ``#1'' already delayed}%
- }
+\newrobustcmd*{\delaycite}[1]{%
+ \PackageWarning{notes2bib}{%
+ \@nameuse{delaycite}can only be used in the document
+ body\MessageBreak Not modifying citation macro \@nameuse{#1}}
}
% \end{macrocode}
%\end{macro}
%
%\begin{macro}{\citenote}
%\changes{v1.0a}{2007/09/03}{New macro}
+%\changes{v1.1}{2007/09/29}{Macro made robust}
% A ``mode aware'' command for referencing notes is needed (problems
% arise with \cmd{\cite} and the |tail| option. Rather than overload
% \cmd{\cite} with all of the problems that can bring, a new command
% is provided that can be guaranteed to work.
% \begin{macrocode}
\ifniib@tail
- \newcommand*\citenote[2][\relax]{%
+ \newrobustcmd*\citenote[2][\relax]{%
\begingroup%
\@fileswfalse%
% \end{macrocode}
% \cmd{\relax} is used as a marker for an empty first argument.
% \begin{macrocode}
- \ifx#1\relax
+ \ifx#1\relax%
\niibcite{#2}%
\else
- \niibcite[#1]{#2}
+ \niibcite[#1]{#2}%
\fi
\endgroup%
- }
-\else
- \newcommand*\citenote{\niibcite}
-\fi
+ }%
% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\Percent}
-% Finally, a way of producing a percentage sign in note is needed.
-% This is because inside the note, no method for escaping a comment
-% is available.
+% If |tail| is not active, then \cmd{\citenote} is simply an alias
+% for the citation command used by |notes2bib|.
% \begin{macrocode}
-\newcommand*{\Percent}{\%\xspace}
+\else
+ \newrobustcmd*\citenote{\niibcite}%
+\fi
% \end{macrocode}
%\end{macro}
%
@@ -955,22 +998,77 @@
%
%\subsection{Internal macros}
%
-%\begin{macro}{\niib@text}
-% Here the label and the text for the note are separated out before
-% writing to the bibliography file.
+%\begin{macro}{\niib@delaycite}
+%\changes{v1.0a}{2007/09/03}{Fixed a flaw with checking for
+% existing redefinition}
+%\changes{v1.1}{2007/09/29}{Improved logging of function}
+%\changes{v1.1}{2007/09/29}{Added a sanity check on argument}
+%\changes{v1.1}{2007/09/29}{Made internal to prevent execution
+% in preamble}
+%\changes{v1.1}{2007/09/29}{Macro made robust}
+% Normal citations have to be stacked up in the stack when in
+% ``head'' mode. To do this, the citation command has to be modified
+% to do this, while leaving note citations alone. The trick used in
+% this is to set \cmd{\@filesw} to false while the citation takes
+% place.
+% \begin{macrocode}
+\newrobustcmd*\niib@delaycite[1]{%
+ \@ifundefined{#1}{%
+ \PackageWarning{notes2bib}
+ {Citation macro \@nameuse{#1}undefined\MessageBreak
+ \protect\delaycite\space cannot operate on this macro}
+ }{%
+ \@ifundefined{niib@orig@#1}{%
+ \expandafter\expandafter\expandafter\let\expandafter%
+ \csname niib@orig@#1\expandafter\endcsname\csname #1\endcsname%
+ \expandafter\renewcommand\csname #1\endcsname[2][\relax]{%
+% \end{macrocode}
+% If a note is being cited, then there will be no optional argument,
+% and |##1| will expand to \cmd{\relax}.
% \begin{macrocode}
-\long\def\niib@text[#1]{%
- \niib@@text{#1}%
+ \ifniib@cn%
+ \csname niib@orig@#1\endcsname{##2}%
+ \else%
+ \begingroup%
+ \@fileswfalse%
+% \end{macrocode}
+% If an optional argument has been given, then |##1| will expand to
+% something other than \cmd{\relax}. So the original citation
+% command is called with the optional argument.
+% \begin{macrocode}
+ \ifx##1\relax%
+ \csname niib@orig@#1\endcsname{##2}%
+ \else%
+ \csname niib@orig@#1\endcsname[##1]{##2}%
+ \fi%
+ \endgroup%
+ \edef\niib@temp{##2}%
+ \ifx\niib@stack\relax%
+ \xdef\niib@stack{\niib@temp}%
+ \else%
+ \xdef\niib@stack{\niib@stack,\niib@temp}%
+ \fi%
+ \fi%
+ }%
+ \PackageInfo{notes2bib}%
+ {Modifying citation type \@nameuse{#1}}%
+ }{%
+ \PackageInfo{notes2bib}%
+ {Already delayed \@nameuse{#1}}%
+ }%
+ }
}
% \end{macrocode}
%\end{macro}
+%
%\begin{macro}{\niib@bibnote}
-% Very similar processing to \cmd{\niib@text} is carried out here,
-% but in this case a citation is also added to the file.
+% Two steps are needed here, writing the text of the note to file
+% (handled by \cmd{\niib@text}, and marking the citation (using
+% \cmd{\niib@cite}).
% \begin{macrocode}
-\long\def\niib@bibnote[#1]{%
- \niib@citenote{#1}%
- \niib@@text{#1}%
+\long\def\niib@bibnote[#1]#2{%
+ \niib@text{#1}{#2}%
+ \niib@cite{#1}%
}
% \end{macrocode}
%\end{macro}
@@ -979,175 +1077,98 @@
% citation. This cannot be done directly as the optional has to be
% processed correctly.
% \begin{macrocode}
-\def\niib@mark[#1]{\niib@citenote{#1}}
+\def\niib@mark[#1]{\niib@cite{#1}}
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\niib@citenote}
-% To allow the notes to ``tail'' the real citations, a special
-% version of the \cmd{\cite} command is needed that can allow
-% delaying writing the \cmd{\citation} command to the aux file.
-% \begin{macrocode}
-\def\niib@citenote#1{%
- \niib@cntrue%
-% \end{macrocode}
-%\begin{macro}{\niib@temp}
-% \cmd{\niib@temp} is needed to hold the expanded citation.
+%\begin{macro}{\niib@cite}
+%\changes{v1.1}{2007/09/29}{Name change from \cs{niib@citenote}}
+%\changes{v1.1}{2007/09/29}{Definition made option-specific}
+% The internal macro used to cite notes depends on the package
+% options in force. First, for |head| mode, the modified real
+% citation commands need to know that a note is being cited. So the
+% Boolean \cmd{\niib@cn} has to be set correctly before citation.
% \begin{macrocode}
- \edef\niib@temp{#1}%
+\ifniib@head%
+ \def\niib@cite#1{%
+ \niib@cntrue%
+ \niibcite{#1}%
+ \niib@cnfalse%
+ }%
% \end{macrocode}
-% If ``tail''-ing is needed, the \texttt{\textbackslash cite\dots}
-% command is told not to write to the |.aux| file using
-% \cmd{\@filesw}.
+% For |tail| mode, the citation has to be added to the stack for use
+% later. The citation is then made with writing to the |.aux| file
+% disabled.
% \begin{macrocode}
+\else%
\ifniib@tail%
- \begingroup%
+ \def\niib@cite#1{%
+ \ifx\niib@stack\relax%
+ \xdef\niib@stack{#1}%
+ \else%
+ \xdef\niib@stack{\niib@stack,#1}%
+ \fi%
+ \begingroup
\@fileswfalse%
\niibcite{#1}%
\endgroup%
+ }%
% \end{macrocode}
-% The citation is added to the stack for writing later.
-% \cmd{\niib@stack} will always expand to \cmd{\relax} if it is
-% empty.
+% Without the |head| or |tail| options, none of these tricks are
+% needed, and \cmd{\niib@cite} is simply an alias for
+% \cmd{\niibcite}. That in turn may well just be an alias for
+% \cmd{\cite}!
% \begin{macrocode}
- \ifx\niib@stack\relax%
- \xdef\niib@stack{\niib@temp}%
- \else%
- \xdef\niib@stack{\niib@stack,\niib@temp}%
- \fi%
\else%
-% \end{macrocode}
-% When tailing is not in operation, writing takes place as normal.
-% The run of \cmd{\expandafter}s is needed to close the |\if|
-% cleanly.
-% \begin{macrocode}
- \expandafter\niibcite\expandafter%
- {\expandafter\niib@temp\expandafter}%
+ \def\niib@cite#1{\niibcite{#1}}%
\fi%
- \niib@cnfalse%
-}%
+\fi%
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%
-% The next set of macros provides the direct writing of the
-% unexpanded note to file. The code is a modified from a usenet post
-% by Ulrich Diez at |comp.text.tex|, but with everything stripped
-% down to do just what is needed here. The package author takes
-% responsibility for the code eating your socks!
-%
-%\begin{macro}{\niib@verbtext}
-%\begin{macro}{\niib@@verbtext}
-%\begin{macro}{\niib@tempa}
-% The two macros here set up the necessary catcode changes and
-% grouping. Notice that they do not have the note text as an
-% argument. That is left to \cmd{\niib@tempa}
-% \begin{macrocode}
-\newcommand\niib@verbtext[2][\ignorespaces]{%
- \begingroup%
- \let\do\@makeother\dospecials%
- \catcode`\{=1\relax%
- \catcode`\}=2\relax%
- \niib@@verbtext{#1}{#2}%
-}%
-\newcommand\niib@@verbtext[2]{%
- \begingroup%
- \long\def\niib@tempa##1{%
- \def\niib@tempa{##1}%
- \@onelevel@sanitize\niib@tempa%
- \expandafter\endgroup%
- \expandafter\def%
- \expandafter#2%
- \expandafter{%
- \niib@tempa}%
- #1%
- }%
-% \end{macrocode}
-% New lines are set to be spaces.
-% \begin{macrocode}
- \catcode`\^^M=10\relax%
-% \end{macrocode}
-% Unlike the ``real'' unexpanded write, the catcode of \texttt{\%}
-% needs to be something that will be safe, so that comments do not
-% cause problems. There is no escape character, so an alternative
-% method for printing \% is given elsewhere in the package. For
-% |dtx| files and so on, this will not work. So an option is
-% needed to ignore percentage signs entirely.
-% \begin{macrocode}
- \niib@percent%
- \expandafter\endgroup%
- \niib@tempa%
-}%
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\begin{macro}{\niib@write}
-% This provides the access end of the unexpanded write. Once again,
-% the note is not an argument.
-% \begin{macrocode}
-\newcommand*\niib@write{%
- \@bsphack%
- \begingroup%
- \niib@verbtext[\niib@@write\ignorespaces]\niib@tempa%
-}%
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\niib@@write}
-% Writing actually takes place here. In order to get all of the code
-% needed into the |.bib| file, it is set out here. Thus this macro
-% is the specialised part of the mechanism.
-% \begin{macrocode}
-\newcommand*\niib@@write[1]{%
- \immediate\write\niib@out{%
- @\niibrecord\string{\niib@tempb,^^J%
- presort = \string{\niib@presort\string},^^J%
- \niib@keyname\space= \string{\niib@key\niib@tempb\string},^^J%
- \niibfield\space= \string{\niib@tempa\string}^^J%
- \string}^^J}%
- \endgroup%
- \@esphack%
-}%
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\niib@@text}
+%\begin{macro}{\niib@text}
+%\changes{v1.1}{2007/09/29}{Combined \cs{niib@text}
+% and \cs{niib@@text}}
+%\changes{v1.1}{2007/09/29}{Improved awareness of files switch}
% The ``business end'' of writing the notes to file.
% \begin{macrocode}
-\long\def\niib@@text#1{%
+\long\def\niib@text#1#2{%
% \end{macrocode}
%\begin{macro}{\niib@out}
%\begin{macro}{\niib@stream}
% If this is the first note, then a new output stream is needed,
% otherwise it will already be open.
% \begin{macrocode}
- \ifx\niib@out\@undefined%
- \newwrite\niib@out%
- \gdef\niib@stream{\niibprefix\jobname.bib}%
- \immediate\openout\niib@out\niib@stream\relax%
+ \@ifundefined{niib@out}{%
+ \if@filesw%
+ \newwrite\niib@out%
+ \gdef\niib@stream{\niibprefix\jobname.bib}%
+ \immediate\openout\niib@out\niib@stream\relax%
% \end{macrocode}
% The new file starts with the message that it has been automatically
% generated by |notes2bib|.
% \begin{macrocode}
- \immediate\write\niib@out{\niib@msg}%
- \fi%
+ \immediate\write\niib@out{\niib@msg}%
+ \fi}%
+ {}%
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\begin{macro}{\niib@tempb}
-% As long files are being written, \cmd{\niib@tempb} is used to
-% store the label, before calling the \cmd{\niib@write} macro to
-% output the note text. \cmd{\niib@write} will pick up the next
-% thing in the input, which should be the grouped note text.
+% The new record is now written to file. The \cmd{\unexpanded} e-TeX
+% primitive is used to avoid expansion of macros in the note text.
+% The only issue with this is the addition of spaces after command
+% names; this is the reason verbatim text cannot be used in bibnotes.
% \begin{macrocode}
\if@filesw%
- \edef\niib@tempb{#1}%
- \expandafter\niib@write%
+ \immediate\write\niib@out{%
+ @\niibrecord\string{#1,^^J%
+ presort = \string{\niib@presort\string},^^J%
+ \niib@keyname\space= \string{\niib@key#1\string},^^J%
+ \niibfield\space= \string{\unexpanded{#2}\string}^^J%
+ \string}^^J}%
\fi%
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
% The \cmd{\bibliography} macro is patached to ensure that when it is
% executed the note file is also processed. |biblatex| does things
@@ -1180,9 +1201,8 @@
% \begin{macrocode}
\AtEndDocument{%
\flushcitestack%
- \ifx\niib@out\@undefined\else%
- \immediate\closeout\niib@out%
- \fi%
+ \@ifundefined{niib@out}{}%
+ {\immediate\closeout\niib@out}%
}
% \end{macrocode}
%
@@ -1192,4 +1212,106 @@
% \PrintChanges
% \PrintIndex
% \Finale
+%\iffalse
+%<*jawltxdoc>
+% The following is convenient method for collecting together package
+% loading, formatting commands and new macros used to format |dtx|
+% files written by the current author. It is based on the similar
+% files provided by Will Robertson in his packages and Heiko Oberdiek
+% as a stand-alone package. Notice that it is not intended for other
+% users: there is no error checking! However, it is covered by the
+% LPPL in the same way as the rest of this package.
+%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{jawltxdoc}
+ [2007/09/28 v1.0]
+% First of all, a number of support packages are loaded.
+\usepackage[T1]{fontenc}
+\usepackage[english,UKenglish]{babel}
+\usepackage[scaled=0.95]{helvet}
+\usepackage[version=3]{mhchem}
+\usepackage[final]{microtype}
+\usepackage{mathpazo,booktabs,array,url,graphicx,courier,unitsdef}
+\usepackage{upgreek,ifpdf,listings}
+% If using pdfLaTeX, the source will be attached to the PDF. This
+% is basically the system used by Heiko Oberdiek, but with a check
+% that PDF mode is enabled.
+\ifpdf
+ \usepackage{embedfile}
+ \embedfile[%
+ stringmethod=escape,%
+ mimetype=plain/text,%
+ desc={LaTeX docstrip source archive for package `\jobname'}%
+ ]{\jobname.dtx}
+\fi
+\usepackage{\jobname}
+\usepackage[numbered]{hypdoc}
%
+% To typeset examples, a new environment is needed. The code below
+% is based on that in used by |listings|, but is modified to get
+% better formatting for this context. The formatting of the output
+% is basically that in Will Robertson's |dtx-style| file.
+\newlength\LaTeXwidth
+\newlength\LaTeXoutdent
+\newlength\LaTeXgap
+\setlength\LaTeXgap{1em}
+\setlength\LaTeXoutdent{-0.15\textwidth}
+\def\typesetexampleandcode{
+ \begin{list}{}{%
+ \setlength\itemindent{0pt}
+ \setlength\leftmargin\LaTeXoutdent
+ \setlength\rightmargin{0pt}
+ }
+ \item
+ \setlength\LaTeXoutdent{-0.15\textwidth}
+ \begin{minipage}[c]{\textwidth-\LaTeXwidth-\LaTeXoutdent-\LaTeXgap}
+ \lst@sampleInput
+ \end{minipage}%
+ \hfill%%
+ \begin{minipage}[c]{\LaTeXwidth}%
+ \hbox to\linewidth{\box\lst@samplebox\hss}%
+ \end{minipage}%
+ \end{list}
+}
+\def\typesetcodeonly{%
+ \begin{list}{}{%
+ \setlength\itemindent{0pt}
+ \setlength\leftmargin{0pt}
+ \setlength\rightmargin{0pt}
+ }
+ \item
+ \begin{minipage}[c]{\LaTeXwidth}%
+ \hbox to\linewidth{\box\lst@samplebox\hss}%
+ \end{minipage}%
+ \end{list}
+}
+\makeatletter
+\lst@RequireAspects{writefile}
+\newbox\lst@samplebox
+\lstnewenvironment{LaTeXexample}[1][\typesetexampleandcode]{%
+ \let\typesetexample#1
+ \global\let\lst@intname\@empty
+ \setbox\lst@samplebox=\hbox\bgroup
+ \setkeys{lst}{language=[LaTeX]{TeX},tabsize=4,gobble=2,%
+ breakindent=0pt,basicstyle=\small\ttfamily,basewidth=0.51em,%
+ keywordstyle=\color{blue},%
+% Notice that new keywords should be added here.
+ morekeywords={bibnote,citenote,bibnotetext,bibnotemark,%
+ thebibnote,bibnotename}}
+ \lst@BeginAlsoWriteFile{\jobname.tmp}
+}{%
+ \lst@EndWriteFile\egroup
+ \setlength\LaTeXwidth{\wd\lst@samplebox}
+ \typesetexample%
+}
+\def\lst@sampleInput{%
+ \MakePercentComment\catcode`\^^M=10\relax
+ \small%
+ {\setkeys{lst}{SelectCharTable=\lst@ReplaceInput{\^\^I}%
+ {\lst@ProcessTabulator}}%
+ \leavevmode \input{\jobname.tmp}}%
+ \MakePercentIgnore%
+}
+\makeatother
+%</jawltxdoc>
+%\fi
diff --git a/Master/texmf-dist/source/latex/notes2bib/notes2bib.ins b/Master/texmf-dist/source/latex/notes2bib/notes2bib.ins
index 27bf9c5683a..2eb1b04face 100644
--- a/Master/texmf-dist/source/latex/notes2bib/notes2bib.ins
+++ b/Master/texmf-dist/source/latex/notes2bib/notes2bib.ins
@@ -1,33 +1,38 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% notes2bib is free software; you can redistribute it and/or modify it
-% under the terms of the GNU General Public License as published by
-% the Free Software Foundation; either version 2, or (at your option)
-% any later version.
-%
-% notes2bib is distributed in the hope that it will be useful, but
-% WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-% GNU General Public License for more details.
-%
-% You should have received a copy of the GNU General Public License
-% along with this program. If not, see
-% <http://www.gnu.org/licenses/>.
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%
+%% This is file `notes2bib.ins',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% notes2bib.dtx (with options: `install')
+%% ----------------------------------------------------------------
+%% note2bib --- Integrating notes into the bibliography
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3 or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
\input docstrip.tex
-\askonceonly
+\keepsilent
+\askforoverwritefalse
\preamble
----------------------------------------------------------------
note2bib --- Integrating notes into the bibliography
Maintained by Joseph Wright
E-mail: joseph.wright@morningstar2.co.uk
- Released under the GNU General Public License
- See http://www.gnu.org/licenses/gpl.txt
+ Released under the LaTeX Project Public License v1.3 or later
+ See http://www.latex-project.org/lppl.txt
----------------------------------------------------------------
+
\endpreamble
\Msg{Generating notes2bib files:}
\usedir{tex/latex/contib/notes2bib}
-\generate{\file{notes2bib.sty}{\from{notes2bib.dtx}{package}}
+\generate{\file{\jobname.ins}{\from{\jobname.dtx}{install}}
+ \file{\jobname.sty}{\from{\jobname.dtx}{package}}
+ \file{jawltxdoc.sty}{\from{\jobname.dtx}{jawltxdoc}}
}
\endbatchfile
+\endinput
+%%
+%% End of file `notes2bib.ins'.
diff --git a/Master/texmf-dist/tex/latex/notes2bib/jawltxdoc.sty b/Master/texmf-dist/tex/latex/notes2bib/jawltxdoc.sty
new file mode 100644
index 00000000000..71327c89cb7
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/notes2bib/jawltxdoc.sty
@@ -0,0 +1,99 @@
+%%
+%% This is file `jawltxdoc.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% notes2bib.dtx (with options: `jawltxdoc')
+%% ----------------------------------------------------------------
+%% note2bib --- Integrating notes into the bibliography
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3 or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{jawltxdoc}
+ [2007/09/28 v1.0]
+\usepackage[T1]{fontenc}
+\usepackage[english,UKenglish]{babel}
+\usepackage[scaled=0.95]{helvet}
+\usepackage[version=3]{mhchem}
+\usepackage[final]{microtype}
+\usepackage{mathpazo,booktabs,array,url,graphicx,courier,unitsdef}
+\usepackage{upgreek,ifpdf,listings}
+\ifpdf
+ \usepackage{embedfile}
+ \embedfile[%
+ stringmethod=escape,%
+ mimetype=plain/text,%
+ desc={LaTeX docstrip source archive for package `\jobname'}%
+ ]{\jobname.dtx}
+\fi
+\usepackage{\jobname}
+\usepackage[numbered]{hypdoc}
+\newlength\LaTeXwidth
+\newlength\LaTeXoutdent
+\newlength\LaTeXgap
+\setlength\LaTeXgap{1em}
+\setlength\LaTeXoutdent{-0.15\textwidth}
+\def\typesetexampleandcode{
+ \begin{list}{}{%
+ \setlength\itemindent{0pt}
+ \setlength\leftmargin\LaTeXoutdent
+ \setlength\rightmargin{0pt}
+ }
+ \item
+ \setlength\LaTeXoutdent{-0.15\textwidth}
+ \begin{minipage}[c]{\textwidth-\LaTeXwidth-\LaTeXoutdent-\LaTeXgap}
+ \lst@sampleInput
+ \end{minipage}%
+ \hfill%%
+ \begin{minipage}[c]{\LaTeXwidth}%
+ \hbox to\linewidth{\box\lst@samplebox\hss}%
+ \end{minipage}%
+ \end{list}
+}
+\def\typesetcodeonly{%
+ \begin{list}{}{%
+ \setlength\itemindent{0pt}
+ \setlength\leftmargin{0pt}
+ \setlength\rightmargin{0pt}
+ }
+ \item
+ \begin{minipage}[c]{\LaTeXwidth}%
+ \hbox to\linewidth{\box\lst@samplebox\hss}%
+ \end{minipage}%
+ \end{list}
+}
+\makeatletter
+\lst@RequireAspects{writefile}
+\newbox\lst@samplebox
+\lstnewenvironment{LaTeXexample}[1][\typesetexampleandcode]{%
+ \let\typesetexample#1
+ \global\let\lst@intname\@empty
+ \setbox\lst@samplebox=\hbox\bgroup
+ \setkeys{lst}{language=[LaTeX]{TeX},tabsize=4,gobble=2,%
+ breakindent=0pt,basicstyle=\small\ttfamily,basewidth=0.51em,%
+ keywordstyle=\color{blue},%
+ morekeywords={bibnote,citenote,bibnotetext,bibnotemark,%
+ thebibnote,bibnotename}}
+ \lst@BeginAlsoWriteFile{\jobname.tmp}
+}{%
+ \lst@EndWriteFile\egroup
+ \setlength\LaTeXwidth{\wd\lst@samplebox}
+ \typesetexample%
+}
+\def\lst@sampleInput{%
+ \MakePercentComment\catcode`\^^M=10\relax
+ \small%
+ {\setkeys{lst}{SelectCharTable=\lst@ReplaceInput{\^\^I}%
+ {\lst@ProcessTabulator}}%
+ \leavevmode \input{\jobname.tmp}}%
+ \MakePercentIgnore%
+}
+\makeatother
+\endinput
+%%
+%% End of file `jawltxdoc.sty'.
diff --git a/Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty b/Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty
index 8e73720bd46..760db640055 100644
--- a/Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty
+++ b/Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty
@@ -9,18 +9,29 @@
%% note2bib --- Integrating notes into the bibliography
%% Maintained by Joseph Wright
%% E-mail: joseph.wright@morningstar2.co.uk
-%% Released under the GNU General Public License
-%% See http://www.gnu.org/licenses/gpl.txt
+%% Released under the LaTeX Project Public License v1.3 or later
+%% See http://www.latex-project.org/lppl.txt
%% ----------------------------------------------------------------
+%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{notes2bib}
- [2007/09/03 v1.0a Integrating notes into the bibliography]
-\RequirePackage{xspace}
+ [2007/09/29 v1.1 Integrating notes into the bibliography]
+\@ifundefined{eTeXversion}
+ {\PackageError{notes2bib}
+ {Not running under e-TeX}
+ {This package requires e-TeX. Try compiling the document
+ with\MessageBreak `elatex' instead of `latex'. When using
+ pdfTeX, try `pdfelatex'\MessageBreak instead of `pdflatex'}%
+ \endinput}
+ {}
+\RequirePackage{elatex}[2007/07/13]
\newif\ifniib@fn\niib@fnfalse
\DeclareOption{footnotes}{%
\niib@fntrue
\AtBeginDocument{%
\let\footnote\bibnote%
+ \PackageInfo{notes2bib}%
+ {Converting footnotes to bibnotes}%
}}
\DeclareOption{endnotes}{%
\AtBeginDocument{%
@@ -29,55 +40,52 @@
\let\endnotetext\bibnotetext%
\@ifpackageloaded{endnotes}%
{\let\theendnotes\printbibnotes}{}%
+ \PackageInfo{notes2bib}%
+ {Converting endnotes to bibnotes}%
}}
\newif\ifniib@tail\niib@tailfalse
\newif\ifniib@head\niib@headfalse
\DeclareOption{tail}{\niib@tailtrue}
\DeclareOption{head}{\niib@headtrue}
-\def\niib@percent{\catcode`\%=14\relax}
-\DeclareOption{killpercent}{%
- \def\niib@percent{\catcode`\%=9\relax}
-}
-\@ifclassloaded{ltxdoc}{\ExecuteOptions{killpercent}}{}
\ProcessOptions
\ifniib@fn
- \@ifundefined{eTeXversion}{%
- \PackageWarning{notes2bib}{%
- e-TeX extensions unavailable\MessageBreak
- \protect\footnotemark and \protect\footnotetext%
- \MessageBreak unmodified}%
- }{%
- \let\niib@fnmark\footnotemark
- \let\niib@fntext\footnotetext
- \let\niib@thanks\thanks
- \RequirePackage{elatex}
- \patchcmd{\thanks}{\footnotemark}{\niib@fnmark}{%
- \patchcmd{\thanks}{\footnotetext}{\niib@fntext}{%
- \AtBeginDocument{%
- \let\footnotemark\bibnotemark
- \let\footnotetext\bibnotetext
- }%
+ \let\niib@fnmark\footnotemark
+ \let\niib@fntext\footnotetext
+ \let\niib@thanks\thanks
+ \patchcmd{\thanks}{\footnotemark}{\niib@fnmark}{%
+ \patchcmd{\thanks}{\footnotetext}{\niib@fntext}{%
+ \AtBeginDocument{%
+ \let\footnotemark\bibnotemark
+ \let\footnotetext\bibnotetext
}%
- {\let\thanks\niib@thanks%
- \PackageWarning{notes2bib}%
- {Could not patch \protect\thanks}}%
+ \PackageInfo{notes2bib}%
+ {Modifying \protect\thanks\space macro}%
}{%
\let\thanks\niib@thanks%
\PackageWarning{notes2bib}%
{Could not patch \protect\thanks}}%
- }%
+ }{%
+ \let\thanks\niib@thanks%
+ \PackageWarning{notes2bib}%
+ {Could not patch \protect\thanks}}%
\fi
\ifniib@head
\ifniib@tail
\PackageWarning{notes2bib}
{You've given both ``head'' and ``tail'' as
- options\MessageBreak
- I'm ignoring both!}
+ options\MessageBreak I'm ignoring both!}
\niib@headfalse\niib@tailfalse
+ \else
+ \PackageInfo{notes2bib}%
+ {bibnotes will ``head'' other citations}
\fi
+\else
+ \PackageInfo{notes2bib}%
+ {bibnotes will ``tail'' other citations}
\fi
\AtBeginDocument{%
\ifniib@head
+ \let\delaycite\niib@delaycite
\delaycite{cite}%
\@ifpackageloaded{natbib}{%
\delaycite{citet}%
@@ -94,23 +102,20 @@
\delaycite{Citealt}%
\delaycite{Citealp}%
\delaycite{Citeauthor}%
- }{%
- \@ifpackageloaded{biblatex}{%
- \delaycite{Cite}%
- \delaycite{parencite}%
- \delaycite{Parencite}%
- \delaycite{footcite}%
- \delaycite{Footcite}%
- \delaycite{textcite}%
- \delaycite{Textcite}%
- \ifdefined\autocite%
- \delaycite{autocite}%
- \fi%
- \ifdefined\supercite%
- \delaycite{supercite}%
- \fi%
+ }{}%
+ \@ifpackageloaded{biblatex}{%
+ \delaycite{Cite}%
+ \delaycite{parencite}%
+ \delaycite{Parencite}%
+ \delaycite{footcite}%
+ \delaycite{Footcite}%
+ \delaycite{textcite}%
+ \delaycite{Textcite}%
+ \@ifundefined{autocite}{}%
+ {\delaycite{autocite}}%
+ \@ifundefined{supercite}{}%
+ {\delaycite{supercite}}%
}{}%
- }%
\fi%
}
\newcommand*\bibnotename{Bibnote}
@@ -126,79 +131,52 @@
\newcommand*\niibkeynone{}
\newcommand*\niibkeytail{zzz}
\newcommand*\niibcite{\cite}
-\DeclareRobustCommand\bibnote{%
+\newrobustcmd*{\bibnote}{%
\stepcounter{bibnote}%
\@ifnextchar[%
{\niib@bibnote}%
{\niib@bibnote[\thebibnote]}%
}
-\DeclareRobustCommand\bibnotemark{%
+\newrobustcmd*{\bibnotemark}{%
\stepcounter{bibnote}%
\@ifnextchar[%
{\niib@mark}%
{\niib@mark[\thebibnote]}%
}
-\DeclareRobustCommand\bibnotetext{%
- \@ifnextchar[%
- {\niib@text}%
- {\niib@text[\thebibnote]}%
+\newrobustcmd*{\bibnotetext}[1][\thebibnote]{%
+ \niib@text{#1}%
}
\@ifpackageloaded{biblatex}{%
\let\printbibnotes\printbibliography%
}{%
- \newcommand*{\printbibnotes}{\niib@bib%
+ \newrobustcmd*{\printbibnotes}{\niib@bib%
{\niibprefix\jobname}}%
}%
-\newcommand*\flushcitestack{%
+\newrobustcmd*{\flushcitestack}{%
\ifx\niib@stack\relax\else%
\expandafter\nocite\expandafter{\niib@stack}%
\global\let\niib@stack\relax%
\fi%
}
-\newcommand*\delaycite[1]{%
- \@ifundefined{niib@orig@#1}{%
- \expandafter\expandafter\expandafter\let\expandafter%
- \csname niib@orig@#1\expandafter\endcsname\csname #1\endcsname%
- \expandafter\renewcommand\csname #1\endcsname[2][\relax]{%
- \ifniib@cn%
- \csname niib@orig@#1\endcsname{##2}%
- \else%
- \begingroup%
- \@fileswfalse%
- \ifx##1\relax%
- \csname niib@orig@#1\endcsname{##2}%
- \else%
- \csname niib@orig@#1\endcsname[##1]{##2}%
- \fi%
- \endgroup%
- \edef\niib@temp{##2}%
- \ifx\niib@stack\relax%
- \xdef\niib@stack{\niib@temp}%
- \else%
- \xdef\niib@stack{\niib@stack,\niib@temp}%
- \fi%
- \fi%
- }%
- }{%
- \PackageInfo{notes2bib}%
- {Citation type ``#1'' already delayed}%
- }
+\newrobustcmd*{\delaycite}[1]{%
+ \PackageWarning{notes2bib}{%
+ \@nameuse{delaycite}can only be used in the document
+ body\MessageBreak Not modifying citation macro \@nameuse{#1}}
}
\ifniib@tail
- \newcommand*\citenote[2][\relax]{%
+ \newrobustcmd*\citenote[2][\relax]{%
\begingroup%
\@fileswfalse%
- \ifx#1\relax
+ \ifx#1\relax%
\niibcite{#2}%
\else
- \niibcite[#1]{#2}
+ \niibcite[#1]{#2}%
\fi
\endgroup%
- }
+ }%
\else
- \newcommand*\citenote{\niibcite}
+ \newrobustcmd*\citenote{\niibcite}%
\fi
-\newcommand*{\Percent}{\%\xspace}
\@ifpackageloaded{biblatex}
{\def\niib@keyname{keysort}}
{\def\niib@keyname{key}}
@@ -220,82 +198,87 @@
required.^^J}
\let\niib@stack\relax
\newif\ifniib@cn\niib@cnfalse
-\long\def\niib@text[#1]{%
- \niib@@text{#1}%
+\newrobustcmd*\niib@delaycite[1]{%
+ \@ifundefined{#1}{%
+ \PackageWarning{notes2bib}
+ {Citation macro \@nameuse{#1}undefined\MessageBreak
+ \protect\delaycite\space cannot operate on this macro}
+ }{%
+ \@ifundefined{niib@orig@#1}{%
+ \expandafter\expandafter\expandafter\let\expandafter%
+ \csname niib@orig@#1\expandafter\endcsname\csname #1\endcsname%
+ \expandafter\renewcommand\csname #1\endcsname[2][\relax]{%
+ \ifniib@cn%
+ \csname niib@orig@#1\endcsname{##2}%
+ \else%
+ \begingroup%
+ \@fileswfalse%
+ \ifx##1\relax%
+ \csname niib@orig@#1\endcsname{##2}%
+ \else%
+ \csname niib@orig@#1\endcsname[##1]{##2}%
+ \fi%
+ \endgroup%
+ \edef\niib@temp{##2}%
+ \ifx\niib@stack\relax%
+ \xdef\niib@stack{\niib@temp}%
+ \else%
+ \xdef\niib@stack{\niib@stack,\niib@temp}%
+ \fi%
+ \fi%
+ }%
+ \PackageInfo{notes2bib}%
+ {Modifying citation type \@nameuse{#1}}%
+ }{%
+ \PackageInfo{notes2bib}%
+ {Already delayed \@nameuse{#1}}%
+ }%
+ }
}
-\long\def\niib@bibnote[#1]{%
- \niib@citenote{#1}%
- \niib@@text{#1}%
+\long\def\niib@bibnote[#1]#2{%
+ \niib@text{#1}{#2}%
+ \niib@cite{#1}%
}
-\def\niib@mark[#1]{\niib@citenote{#1}}
-\def\niib@citenote#1{%
- \niib@cntrue%
- \edef\niib@temp{#1}%
+\def\niib@mark[#1]{\niib@cite{#1}}
+\ifniib@head%
+ \def\niib@cite#1{%
+ \niib@cntrue%
+ \niibcite{#1}%
+ \niib@cnfalse%
+ }%
+\else%
\ifniib@tail%
- \begingroup%
- \@fileswfalse%
- \niibcite{#1}%
- \endgroup%
+ \def\niib@cite#1{%
\ifx\niib@stack\relax%
- \xdef\niib@stack{\niib@temp}%
+ \xdef\niib@stack{#1}%
\else%
- \xdef\niib@stack{\niib@stack,\niib@temp}%
+ \xdef\niib@stack{\niib@stack,#1}%
\fi%
+ \begingroup
+ \@fileswfalse%
+ \niibcite{#1}%
+ \endgroup%
+ }%
\else%
- \expandafter\niibcite\expandafter%
- {\expandafter\niib@temp\expandafter}%
+ \def\niib@cite#1{\niibcite{#1}}%
\fi%
- \niib@cnfalse%
-}%
-\newcommand\niib@verbtext[2][\ignorespaces]{%
- \begingroup%
- \let\do\@makeother\dospecials%
- \catcode`\{=1\relax%
- \catcode`\}=2\relax%
- \niib@@verbtext{#1}{#2}%
-}%
-\newcommand\niib@@verbtext[2]{%
- \begingroup%
- \long\def\niib@tempa##1{%
- \def\niib@tempa{##1}%
- \@onelevel@sanitize\niib@tempa%
- \expandafter\endgroup%
- \expandafter\def%
- \expandafter#2%
- \expandafter{%
- \niib@tempa}%
- #1%
- }%
- \catcode`\^^M=10\relax%
- \niib@percent%
- \expandafter\endgroup%
- \niib@tempa%
-}%
-\newcommand*\niib@write{%
- \@bsphack%
- \begingroup%
- \niib@verbtext[\niib@@write\ignorespaces]\niib@tempa%
-}%
-\newcommand*\niib@@write[1]{%
- \immediate\write\niib@out{%
- @\niibrecord\string{\niib@tempb,^^J%
+\fi%
+\long\def\niib@text#1#2{%
+ \@ifundefined{niib@out}{%
+ \if@filesw%
+ \newwrite\niib@out%
+ \gdef\niib@stream{\niibprefix\jobname.bib}%
+ \immediate\openout\niib@out\niib@stream\relax%
+ \immediate\write\niib@out{\niib@msg}%
+ \fi}%
+ {}%
+ \if@filesw%
+ \immediate\write\niib@out{%
+ @\niibrecord\string{#1,^^J%
presort = \string{\niib@presort\string},^^J%
- \niib@keyname\space= \string{\niib@key\niib@tempb\string},^^J%
- \niibfield\space= \string{\niib@tempa\string}^^J%
+ \niib@keyname\space= \string{\niib@key#1\string},^^J%
+ \niibfield\space= \string{\unexpanded{#2}\string}^^J%
\string}^^J}%
- \endgroup%
- \@esphack%
-}%
-\long\def\niib@@text#1{%
- \ifx\niib@out\@undefined%
- \newwrite\niib@out%
- \gdef\niib@stream{\niibprefix\jobname.bib}%
- \immediate\openout\niib@out\niib@stream\relax%
- \immediate\write\niib@out{\niib@msg}%
- \fi%
- \if@filesw%
- \edef\niib@tempb{#1}%
- \expandafter\niib@write%
\fi%
}
\@ifpackageloaded{biblatex}{%
@@ -312,9 +295,8 @@
%%
\AtEndDocument{%
\flushcitestack%
- \ifx\niib@out\@undefined\else%
- \immediate\closeout\niib@out%
- \fi%
+ \@ifundefined{niib@out}{}%
+ {\immediate\closeout\niib@out}%
}
\endinput
%%