From 507fd2d5ca1378ad57eb17175dfe67a6ba794962 Mon Sep 17 00:00:00 2001 From: Manuel Pégourié-Gonnard Date: Sun, 22 Jun 2008 10:38:33 +0000 Subject: notes2bib v1.4 2008/06/21 git-svn-id: svn://tug.org/texlive/trunk@8923 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/notes2bib/README | 30 +- .../doc/latex/notes2bib/notes2bib-manual.pdf | Bin 0 -> 167656 bytes .../texmf-dist/doc/latex/notes2bib/notes2bib.pdf | Bin 242034 -> 239723 bytes .../source/latex/notes2bib/notes2bib.dtx | 802 +++++++++++---------- .../source/latex/notes2bib/notes2bib.ins | 83 ++- .../texmf-dist/tex/latex/notes2bib/notes2bib.sty | 216 +++--- 6 files changed, 630 insertions(+), 501 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/notes2bib/notes2bib-manual.pdf (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/notes2bib/README b/Master/texmf-dist/doc/latex/notes2bib/README index 6ca127e5ab6..1e58a0de853 100644 --- a/Master/texmf-dist/doc/latex/notes2bib/README +++ b/Master/texmf-dist/doc/latex/notes2bib/README @@ -1,15 +1,15 @@ ----------------------------------------------------------------- -The notes2bib package --- Integrating notes into the - bibliography -Maintained by Joseph Wright -E-mail: joseph.wright@morningstar2.co.uk -Released under the LaTeX Project Public License v1.3c or later -See http://www.latex-project.org/lppl.txt ----------------------------------------------------------------- - -The notes2bib package defines a new type of note, bibnote, -which will always be added to the bibliography. The package -allows footnotes and endnotes to be moved into the bibliography -in the same way. The package can be used with natbib and -biblatex as well as plain LaTeX citations. Both sorted and -unsorted bibliography styles are supported. +---------------------------------------------------------------- +The notes2bib package --- Integrating notes into the + bibliography +Maintained by Joseph Wright +E-mail: joseph.wright@morningstar2.co.uk +Released under the LaTeX Project Public License v1.3c or later +See http://www.latex-project.org/lppl.txt +---------------------------------------------------------------- + +The notes2bib package defines a new type of note, bibnote, +which will always be added to the bibliography. The package +allows footnotes and endnotes to be moved into the bibliography +in the same way. The package can be used with natbib and +biblatex as well as plain LaTeX citations. Both sorted and +unsorted bibliography styles are supported. diff --git a/Master/texmf-dist/doc/latex/notes2bib/notes2bib-manual.pdf b/Master/texmf-dist/doc/latex/notes2bib/notes2bib-manual.pdf new file mode 100644 index 00000000000..febda698e00 Binary files /dev/null and b/Master/texmf-dist/doc/latex/notes2bib/notes2bib-manual.pdf differ diff --git a/Master/texmf-dist/doc/latex/notes2bib/notes2bib.pdf b/Master/texmf-dist/doc/latex/notes2bib/notes2bib.pdf index 7297ddbadd1..26479e9b762 100644 Binary files a/Master/texmf-dist/doc/latex/notes2bib/notes2bib.pdf and b/Master/texmf-dist/doc/latex/notes2bib/notes2bib.pdf differ diff --git a/Master/texmf-dist/source/latex/notes2bib/notes2bib.dtx b/Master/texmf-dist/source/latex/notes2bib/notes2bib.dtx index d5bd184897b..2cbb0cafc5e 100644 --- a/Master/texmf-dist/source/latex/notes2bib/notes2bib.dtx +++ b/Master/texmf-dist/source/latex/notes2bib/notes2bib.dtx @@ -17,8 +17,20 @@ % % This work consists of the source file notes2bib.dtx % and the derived files notes2bb.ins, -% notes2bib.sty and -% notes2bib.pdf +% notes2bib.sty, +% notes2bib.pdf, +% jawltxdoc.sty and +% README +% +% TDS-ready files: +% The compressed file notes2bib.tds.zip contains an unpacked +% version of all of the files included here, and pre-compiled +% documentation in PDF format. Simply decompress +% notes2bib.tds.dtx in your local TeX directory, run your hash +% program (texhash, initexmf --update-fndb, etc.) and everything +% will be ready to go. The user documentation for the package is +% called notes2bib-manual.pdf; the file notes2bib.pdf includes the +% user manual and the fully-indexed source code. % % Unpacking: % (a) If notes2bib.ins is present: @@ -35,8 +47,6 @@ % 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 @@ -45,14 +55,15 @@ % 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, +% 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, initexmf --update-fndb, % etc.) % % Note: % The jawltxdoc.sty file is not needed for installation, -% only for building the documentation. It may be deleted. +% only for building the documentation; it may be deleted +% after producing the documentation (if necessary). % %<*ignore> % This is all taken verbatim from Heiko Oberdiek's packages @@ -79,28 +90,51 @@ \endpreamble \Msg{Generating notes2bib files:} -\usedir{tex/latex/contib/notes2bib} +\generate{\file{jawltxdoc.sty}{\from{\jobname.dtx}{jawltxdoc}} +} +\usedir{tex/latex/notes2bib} +\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}} +} +\usedir{source/latex/notes2bib} \generate{\file{\jobname.ins}{\from{\jobname.dtx}{install}} - \file{\jobname.sty}{\from{\jobname.dtx}{package}} - \file{jawltxdoc.sty}{\from{\jobname.dtx}{jawltxdoc}} +} +\nopreamble\nopostamble +\usedir{doc/latex/notes2bib} +\generate{\file{README.txt}{\from{\jobname.dtx}{readme}} } \endbatchfile % +%<*readme> +---------------------------------------------------------------- +The notes2bib package --- Integrating notes into the + bibliography +Maintained by Joseph Wright +E-mail: joseph.wright@morningstar2.co.uk +Released under the LaTeX Project Public License v1.3c or later +See http://www.latex-project.org/lppl.txt +---------------------------------------------------------------- + +The notes2bib package defines a new type of note, bibnote, +which will always be added to the bibliography. The package +allows footnotes and endnotes to be moved into the bibliography +in the same way. The package can be used with natbib and +biblatex as well as plain LaTeX citations. Both sorted and +unsorted bibliography styles are supported. +% %<*ignore> \fi % Will Robertson's trick +\immediate\write18{bibtex8 --wolfgang \jobname} \immediate\write18{makeindex -s gind.ist -o \jobname.ind \jobname.idx} \immediate\write18{makeindex -s gglo.ist -o \jobname.gls \jobname.glo} % %<*driver> \PassOptionsToClass{a4paper}{article} -\documentclass{ltxdoc} +\documentclass[german,english,UKenglish]{ltxdoc} \EnableCrossrefs \CodelineIndex \RecordChanges %\OnlyDescription -% The various formatting commands used in this file are collected -% together in |jawltxdoc|. \usepackage{jawltxdoc} \begin{document} \DocInput{\jobname.dtx} @@ -108,7 +142,7 @@ % %\fi % -%\CheckSum{781} +%\CheckSum{873} % %\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 @@ -142,6 +176,8 @@ %\changes{v1.3}{2008/01/08}{All options now work anywhere in input} %\changes{v1.3}{2008/01/08}{Fixed serious errors with \opt{head} % and \opt{tail} implementation} +%\changes{v1.4}{2008/06/21}{\eTeX\ made optional (again), with +% control option to turn off use even if available} % %\DoNotIndex{\@auxout,\@empty,\@fileswfalse,\@for,\@ifnextchar} %\DoNotIndex{\@ifpackagelater,\@ifpackageloaded,\@ifundefined} @@ -160,6 +196,10 @@ %\DoNotIndex{\the,\typeout,\unexpanded,\value,\write,\xdef,\z@} %\DoNotIndex{\protected@xdef,\protect} % +%\DoNotIndex{\@bsphack,\@esphack,\@makeother,\@onelevel@sanitize} +%\DoNotIndex{\@thanks,\AtEndOfPackage} +%\DoNotIndex{\c@footnote,\catcode,\define@key,\dospecials,\global} +% %\setkeys{lst}{language=[LaTeX]{TeX},moretexcs={bibnote,% % bibnotemark,bibnotetext,citenote}} % @@ -224,7 +264,7 @@ % \bibnote{Note for the first example}. %\end{LaTeXexample} % By default, each bibnote is given an automatically-generated label. -% However, \cs{bibnote} accepts an optional argument \meta{label}, +% However, \cs{bibnote} accepts an optional argument \meta{label}, % which can be used to over-ride this. This is particularly useful % when a note will be referenced several times (The use of the % \cs{citenote} command is covered in @@ -263,79 +303,77 @@ % \currpkg will note that the large number of control macros have all % been removed from v1.3.} % -% Almost all of the package options take literal text; those which do -% not are true/false switches. -%\begin{itemize} -% \item \opt{cite}: The csname of the macro used to cite bibnotes; -% by default ``cite''. -% \item \opt{endnotes}: Whether to convert endnotes into bibnotes; -% takes a Boolean value. -% \item \opt{field}: The \BibTeX\ database field name for notes. -% \item \opt{footnotes}: Whether to convert footnotes into bibnotes; -% takes a Boolean value, and does not affect the \cs{thanks} -% macro. -% \item \opt{keyhead}, \opt{keynone}, \opt{keytail}: Sorted \BibTeX\ -% styles can use the \texttt{key} field to sort citations; by -% setting a prefix to the bibnote name, extra control over sorting -% can be obtained. -% \item \opt{log}: The amount of detail to add to the log; expects a -% value from the list \opt{debug} (very detailed information), -% \opt{verbose} (the same as \opt{debug}), \opt{normal}, -% \opt{errors} (errors only), \opt{none}. -% \item \opt{name}: The name given to bibnote citations; by default, -% this is followed by an automatically-generated number. -% \item \opt{prefix}: The file-name prefix used for the \BibTeX\ -% database holding the notes. -% \item \opt{presorthead}, \opt{presortnone}, \opt{presorttail}: For -% \pkg{biblatex} users, the presort field can be used to control -% sorting of the bibliography; these keys control the value used -% depending on the setting of the \opt{sort} key. -% \item \opt{record}: The name of the \BibTeX\ record type used to -% store notes. -% \item \opt{sort}: Controls the placement of notes relative to real -% citations in the bibliography; expected a value \opt{none} (no -% control of sorting, intended for unsorted bibliographies and -% interspersed citations and notes), \opt{head} (notes appear -% before real citations) and \opt{tail} (notes appear after real -% citations). -%\end{itemize} -% The default options are: -%\begin{LaTeXexample}[\typesetcodeonly] -% \niibsetup{% -% cite=cite, -% endnotes=false, -% field=note, -% footnotes=false, -% keyhead=aaa, -% keynone={}, -% keytail=zzz, -% log=normal, -% name=Bibnote, -% prefix=niib-, -% presorthead=ml, -% presortnone=mm, -% presorttail=mn, -% record=Misc, -% sort=none} -%\end{LaTeXexample} +%\DescribeOption{footnote} +%\DescribeOption{endnotes} +% Some options control the general behaviour of \currpkg in the body +% of the \LaTeX\ source. The \opt{footnote} and \opt{endnotes} +% options control whether \cs{footnote} and \cs{endnote} macros are +% converted into bibnotes. Both are Boolean options, and are +% \defaultopt{false} by default. +%\DescribeOption{cite} +% The citation command used by \currpkg to insert bibnotes. It +% should be the name of a \LaTeX\ command (a ``csname''), and is set +% to \defaultopt{cite} on loading \currpkg; this means that \cs{cite} +% will be used as the citation command. +% +%\DescribeOption{field} +%\DescribeOption{name} +%\DescribeOption{record} +% A number of options control the data added to the \BibTeX\ +% database. The \opt{field} and \opt{record} options control the type +% of \BibTeX\ entry created by \currpkg. On loading, \opt{record} is +% set to \defaultopt{Misc} an \opt{field} is set as +% \defaultopt{note}. Depending on the \BibTeX\ style in use, better +% choices may exist for these settings. The \opt{name} option is used +% to automatically generate citation names. The option starts with +% the value \defaultopt{Bibnote}, which may need to change for +% author--year styles in particular. +%\DescribeOption{prefix} +% The name of the database itself is controlled by the \opt{prefix} +% option. This contains the ``marker'' used by \currpkg to attach to +% the job name when creating the storage database. The default is +% \defaultopt{niib-}. % -% The \opt{sort} option requires some comment. By default, \currpkg -% places notes where cited into the \ext{aux} file, which means that -% the order of citations and notes depends on the \ext{bst} file in -% use. With an unsorted style, citations and notes will be mixed in -% the order they appear in the \LaTeX\ source. The \opt{sort=head} -% option will cause \currpkg to place notes before real citations. -% This should work with sorted and unsorted \ext{bst} files, but -% requires two \LaTeX\ runs \emph{before} a \BibTeX\ run in order to -% work. The package warns if extra runs are needed. The -% \opt{sort=tail} option places notes after citations; here, only one -% \LaTeX\ run is needed. +%\DescribeOption{sort} +%\DescribeOption{head} +%\DescribeOption{tail} +% Bibnotes can be created so that thy will be sorted before or after +% normal citations. A list of values are recognised: +% \defaultopt{none} (no control of sorting), \opt{head} (notes appear +% before real citations) and \opt{tail} (notes appear after real +% citations). The shortcut options \opt{head} and \opt{tail} +% are also available. +%\DescribeOption{keyhead} +%\DescribeOption{keynone} +%\DescribeOption{keytail} +% A number of mechanisms are used to ensure correct sorting of +% bibnotes. For normal \BibTeX\ users, the options \opt{keyhead}, +% \opt{keynone} and \opt{keytail} are used to control sorting. These +% values are added to the start of the citation name in the +% \texttt{key} field, which controls sorting. The default values are +% \defaultopt{aaa}, nothing and \defaultopt{zzz}, respectively. +%\DescribeOption{presorthead} +%\DescribeOption{presortnone} +%\DescribeOption{presorttail} +% For \pkg{biblatex} users, control is made using the \opt{presort} +% system made available there. The \currpkg options +% \opt{presorthead}, \opt{presortnone} and \opt{presorttail} set up +% the appropriate values; default values are \defaultopt{ml}, +% \defaultopt{mm} and \defaultopt{ml}, respectively. % -% The options \opt{head} and \opt{tail} are provided as shortcuts for -% \opt{sort=head} and \opt{sort=tail}, respectively. The \opt{debug} -% option is a shortcut for \opt{log=debug}. As the \opt{endnotes} -% and \opt{footnotes} options take Boolean values, giving the option -% name alone is the same as giving \opt{\meta{option}=true}. +%\DescribeOption{log} +%\DescribeOption{debug} +% The amount of detail to add to the log; expects a value from the +% list \opt{debug} (very detailed information), \opt{verbose} (the +% same as \opt{debug}), \defaultopt{normal}, \opt{errors} (errors +% only), \opt{none} (what it says). As a shortcut, the \opt{debug} +% option is provided as an alias to \opt{log=debug}. +%\DescribeOption{etex} +% The package has a single load-time only option, \opt{etex}. This +% is a Boolean switch, and determines whether \eTeX\ extensions are +% used if available. This is \defaultopt{true} by default; the +% intension here is for testing when sending to publishers, \etc., +% where \eTeX\ may be an issue. % %\subsection{Output of notes} % Bibnotes are only printed when a bibliography is created. This @@ -397,7 +435,7 @@ % default \currpkg does not pad the automatically-created labels with % zeros. To get the correct sort order, \cs{thebibnote} should be % redefined. -%\begin{LaTeXexample}[\typesetcodeonly] +%\begin{LaTeXexample}[noexample] % \makeatletter % \renewcommand*{\thebibnote}{% % \niib@name% @@ -407,15 +445,8 @@ %\end{LaTeXexample} % %\section{Package requirements} -% \currpkg has certain requirements to run successfully; if these are -% not met the package will abort loading. -%\begin{itemize} -% \item \eTeX: The package uses the \eTeX\ \cs{unexpanded} -% primitive, and so the extensions must be available. -% \item \pkg{xkeyval}, v2.5 or later: Option handling uses -% \pkg{xkeyval}, and the features used here are only available -% from v2.5 of that package. -%\end{itemize} +% The package has only one requirement, \pkg{xkeyval} version 2.5 or +% later. \eTeX\ is used if available, but is not a requirement. % %\section{Known issues} % From v1.1, the method for writing notes to the \BibTeX\ database has @@ -439,7 +470,10 @@ % %\bibliographystyle{unsrt} %\renewcommand*{\refname}{Notes} -%\StopEventually{\printbibnotes} +%\StopEventually{% +% \printbibnotes +% \PrintChanges +% \PrintIndex} % %\section{The mechanism} % The mechanism for positioning notes in the bibliography is somewhat @@ -518,50 +552,22 @@ %\section{The package code} % %\subsection{Package setup code} -% The package starts with the usual identification code. +%\begin{macro}{\niib@id} %\changes{v1.1}{2007/09/29}{Removed use of \pkg{xspace}} +% The package starts with the usual identification code and support +% loading. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} +\def\niib@id$#1: #2.#3 #4 #5-#6-#7 #8 #9${% + #5/#6/#7\space v1.4\space} \ProvidesPackage{notes2bib} - [2008/02/26 v1.3c Integrating notes into the bibliography] -% \end{macrocode} -% The package requires \eTeX, so before going any further, this is -% tested. This code is taken more-or-less verbatim from -% \pkg{biblatex}. -%\changes{v1.1}{2007/09/29}{Require \eTeX\ extensions} -% \begin{macrocode} -\begingroup - \@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'} - \endgroup\endinput} - {\endgroup} -% \end{macrocode} -%\changes{v1.3a}{2008/01/09}{Require at least v2.5 of \pkg{xkeyval}} -%\changes{v1.3a}{2008/01/09}{Require at least v1.3 of \pkg{etoolbox}} -%\changes{v1.3c}{2008/02/26}{Dropped requirement for \pkg{etoolbox}} -% The necessary support packages are loaded. The method used in -% \pkg{biblatex} is used to check the date of the packages: \currpkg -% bails out if the support packages are too old. -% \begin{macrocode} -\RequirePackage{xkeyval} -\@ifpackagelater{xkeyval}{2005/05/07} - {} - {\PackageError{notes2bib} - {xkeyval >= 2.5 required} - {notes2bib requires the `xkeyval' package, version 2.5 or - later.\MessageBreak The version loaded is: - `\@nameuse{ver@etoolbox.sty}'.\MessageBreak - This is a fatal error; the package will abort.}% - \endinput} + [\niib@id$Id: notes2bib.dtx 11 2008-06-21 16:00:05Z joseph $ + Integrating notes into the bibliography] +\RequirePackage{xkeyval}[2005/05/07] % \end{macrocode} +%\end{macro} %\begin{macro}{\niib@tempa} -%\changes{v1.3}{2008/01/08}{New macro} %\begin{macro}{\niib@tempb} -%\changes{v1.3}{2008/01/08}{New macro} % Some private temporary macros are declared. % \begin{macrocode} \newcommand*{\niib@tempa}{} @@ -640,9 +646,9 @@ % \end{macrocode} %\end{macro} %\begin{macro}{\niib@opt@choicekey} -% A ``fill in the blanks'' choice key. In all -% cases, \cs{niib@tempa} is used to hold the value given to the key, -% so that \cs{ifx} testing can occur. +% A ``fill in the blanks'' choice key. In all cases, \cs{niib@tempa} +% is used to hold the value given to the key, so that \cs{ifx} +% testing can occur. % \begin{macrocode} \newcommand*{\niib@opt@choicekey}[5][]{% \define@choicekey*+[niib]{opt}{#2}[\niib@tempa]{#3}[#1] @@ -663,19 +669,14 @@ % provided. The run of strange tests are to prevent problems in % arrays and the like. % \begin{macrocode} -\newcommand*{\niibsetup}[1]{% - \iffalse{\fi\ifnum0=`}\fi - \setkeys[niib]{opt}{#1}% - \ifnum0=`{\fi\iffalse}\fi} +\newcommand*{\niibsetup}{\setkeys[niib]{opt}} % \end{macrocode} %\end{macro} -%\begin{macro}{\niib@opt@log} -%\begin{macro}{\niib@tempa} -%\begin{macro}{\niib@tempb} % The \pkg{xkeyval} package option for logging is declared. This is % then processed to set the switches correctly. % \begin{macrocode} -\niib@opt@choicekey[normal]{log}{debug,verbose,normal,errors,none} +\niib@opt@choicekey[normal]{log} + {debug,verbose,normal,errors,none} % \end{macrocode} % A series of comparisons are made to assign the logging mode. The % \opt{normal} option is not tested, as executing the option sets the @@ -706,17 +707,12 @@ % \begin{macrocode} {\niib@log@warn{Unrecognised value `#1' for option log}} % \end{macrocode} -%\end{macro} -%\end{macro} -%\end{macro} %\begin{macro}{\niib@opt@debug} % A quick method to set \opt{log=debug}. % \begin{macrocode} \niib@opt@boolkey{debug} % \end{macrocode} %\end{macro} -%\begin{macro}{\niib@opt@footnotes} -%\begin{macro}{\niib@opt@ndnotes} %\begin{macro}{\ifniib@footnotes} %\begin{macro}{\ifniib@endnotes} % The \opt{footnote} and \opt{endnote} options are declared here. @@ -726,8 +722,6 @@ % \end{macrocode} %\end{macro} %\end{macro} -%\end{macro} -%\end{macro} %\begin{macro}{\ifniib@head} %\begin{macro}{\ifniib@tail} % Switches are needed for placing notes before and after normal @@ -738,14 +732,10 @@ % \end{macrocode} %\end{macro} %\end{macro} -%\begin{macro}{\niib@opt@sort} -%\begin{macro}{\niib@tempa} -%\begin{macro}{\niib@tempb} % This option controls the position of notes \latin{versus} normal % citations. The \pkg{xkeyval} option replaces the earlier \opt{head} % and \opt{tail} options, which are retained for backward -% compatibility.\footnote{This may change in a future release; the -% options \opt{head} and \opt{tail} are ``depreciated.''} +% compatibility. % \begin{macrocode} \niib@opt@choicekey[none]{sort}{none,head,tail} {\niib@headfalse @@ -760,11 +750,6 @@ \fi} {\niib@log@warn{Unrecognised value `#1' for option sort}} % \end{macrocode} -%\end{macro} -%\end{macro} -%\end{macro} -%\begin{macro}{\niib@opt@head} -%\begin{macro}{\niib@opt@tail} % The back-compatibility code; unlike earlier versions, this will % take whatever the \opt{sort}-type key is given. % \begin{macrocode} @@ -785,29 +770,16 @@ \fi \fi]{tail} % \end{macrocode} -%\end{macro} -%\end{macro} -%\begin{macro}{\niib@opt@cite} %\begin{macro}{\niib@cite} -%\begin{macro}{\niib@opt@name} %\begin{macro}{\niib@name} -%\begin{macro}{\niib@opt@prefix} %\begin{macro}{\niib@prefix} -%\begin{macro}{\niib@opt@record} %\begin{macro}{\niib@record} -%\begin{macro}{\niib@opt@field} %\begin{macro}{\niib@field} -%\begin{macro}{\niib@opt@presorthead} %\begin{macro}{\niib@presorthead} -%\begin{macro}{\niib@opt@presortnone} %\begin{macro}{\niib@presortnone} -%\begin{macro}{\niib@opt@presorttail} %\begin{macro}{\niib@presorttail} -%\begin{macro}{\niib@opt@keyhead} %\begin{macro}{\niib@keyhead} -%\begin{macro}{\niib@opt@keynone} %\begin{macro}{\niib@keynone} -%\begin{macro}{\niib@opt@keytail} %\begin{macro}{\niib@keytail} % The various internal control values are set up as command keys. % \begin{macrocode} @@ -823,7 +795,7 @@ keyhead, keynone, keytail} -\niibsetup{% +\niibsetup{ cite=cite, name=Bibnote, prefix=niib-, @@ -847,16 +819,33 @@ %\end{macro} %\end{macro} %\end{macro} -%\end{macro} -%\end{macro} -%\end{macro} -%\end{macro} -%\end{macro} -%\end{macro} -%\end{macro} -%\end{macro} -%\end{macro} -%\end{macro} +%\begin{macro}{\ifniib@etex} +% The option to turn off \eTeX\ needs to ensure that the user does +% not ask for \eTeX\ if it is not there. On the other hand, the +% default is to use \eTeX\ if it is available. +% \begin{macrocode} +\niib@opt@boolkey{etex} +\begingroup + \@ifundefined{eTeXversion} + {} + {\global\niib@etextrue} +\endgroup +\ProcessOptionsX[niib] +\AtEndOfPackage{ + \define@key[niib]{opt}{etex} + {\niib@log@warn{Option `etex' only available + \MessageBreak when loading notes2bib}}} +\begingroup + \@ifundefined{eTeXversion} + {\ifniib@etex + \niib@log@warn{e-TeX unavailable}% + \global\niib@etexfalse + \fi} + {\ifniib@etex\else + \niib@log@inf{Use of e-TeX disabled}% + \fi} +\endgroup +% \end{macrocode} %\end{macro} % %\subsection{Footnote and endnote handling} @@ -883,7 +872,7 @@ % If \pkg{endnotes} is loaded, then \cs{endnote} and friends have to % be saved. % \begin{macrocode} -\AtBeginDocument{% +\AtBeginDocument{ \@ifpackageloaded{endnotes} {\let\niib@org@endnote\endnote \let\niib@org@endnotemark\endnotemark @@ -941,7 +930,7 @@ % definitions is set up. % \begin{macrocode} \newcommand*{\niib@swapend}{} -\AtBeginDocument{% +\AtBeginDocument{ \@ifpackageloaded{endnotes} {\renewcommand*{\niib@swapend}{% \ifniib@endnotes @@ -955,7 +944,8 @@ \let\endnotemark\niib@org@endnotemark \let\endnotetext\niib@org@endnotetext \let\theendnotes\niib@org@theendnotes - \niib@log@debug{Using endnotes package to handle endnotes}% + \niib@log@debug{Using endnotes package to handle + endnotes}% \fi} \niib@swapend} % \end{macrocode} @@ -1033,6 +1023,7 @@ % handling of optional arguments can be used. % \begin{macrocode} \DeclareRobustCommand*{\bibnotetext}[1][\thebibnote]{% + \let\niib@next\niib@gobble \niib@text{#1}} % \end{macrocode} %\end{macro} @@ -1044,7 +1035,7 @@ % command to print only notes is given. In the \pkg{biblatex} case, % the best that can be done is to issue \cs{printbibliography}. % \begin{macrocode} -\AtBeginDocument{% +\AtBeginDocument{ \@ifpackageloaded{biblatex} {\let\printbibnotes\printbibliography} {\DeclareRobustCommand*{\printbibnotes} @@ -1070,12 +1061,13 @@ \niib@checkrerun{tail}% \fi \ifx\@empty\niib@stack\@empty - \niib@log@debug{Citation stack empty: nothing for\MessageBreak - \noexpand\flushnotestack to do}% + \niib@log@debug{Citation stack empty: nothing for + \MessageBreak\noexpand\flushnotestack to do}% \else% \niib@log@debug{Flushing note citations to aux file}% \if@filesw - \immediate\write\@auxout{\string\niibtailcite{\niib@stack}}% + \immediate\write\@auxout{% + \string\niibtailcite{\niib@stack}}% \fi \expandafter\nocite\expandafter{\niib@stack}% \gdef\niib@stack{}% @@ -1086,9 +1078,9 @@ %\changes{v1.0a}{2007/09/03}{New macro} %\changes{v1.1}{2007/09/29}{Macro made robust} %\changes{v1.3}{2008/01/08}{Now a wrapper for \cs{niib@mark}} -% Problems arise with \cs{cite} and the \opt{sort=tail} option. Rather -% than overload \cs{cite} with all of the problems that can bring, a -% new command is provided that can be guaranteed to work. +% Problems arise with \cs{cite} and the \opt{sort=tail} option. +% Rather than overload \cs{cite} with all of the problems that can +% bring, a new command is provided that can be guaranteed to work. % \begin{macrocode} \DeclareRobustCommand*{\citenote}[1]{\niib@mark[#1]} % \end{macrocode} @@ -1101,12 +1093,12 @@ % should be called ``keysort,'' whereas otherwise it should be % ``key.'' % \begin{macrocode} -\AtBeginDocument{% +\AtBeginDocument{ \@ifpackageloaded{biblatex} {\niib@log@debug{Using field `keysort' for sorting key}% - \newcommand*\niib@keyname{keysort}} + \newcommand*{\niib@keyname}{keysort}} {\niib@log@debug{Using field `key' for sorting key}% - \newcommand*\niib@keyname{key}}} + \newcommand*{\niib@keyname}{key}}} % \end{macrocode} %\end{macro} %\begin{macro}{\niib@presort} @@ -1118,22 +1110,22 @@ % \begin{macrocode} \newcommand*{\niib@presort}{% \ifniib@head - \niib@presorthead% + \niib@presorthead \else \ifniib@tail - \niib@presorttail% + \niib@presorttail \else - \niib@presortnone% + \niib@presortnone \fi \fi} \newcommand*{\niib@key}{% \ifniib@head - \niib@keyhead% + \niib@keyhead \else \ifniib@tail - \niib@keytail% + \niib@keytail \else - \niib@keynone% + \niib@keynone \fi \fi} % \end{macrocode} @@ -1144,9 +1136,9 @@ % needs to carry suitable information on its source. % \begin{macrocode} \edef\niib@msg{% - This is an auxiliary file used by the `notes2bib' package.^^J% - This file may safely be deleted. It will be recreated as - required.^^J} + This is an auxiliary file used by the `notes2bib' + package.^^J This file may safely be deleted. It + will be recreated as required.^^J} % \end{macrocode} %\end{macro} %\begin{macro}{\niib@stack} @@ -1158,13 +1150,13 @@ %\end{macro} %\begin{macro}{\niib@addtostack} %\changes{v1.3}{2008/01/08}{Macro renamed from \cs{niib@stackup}} -%\begin{macro}{\niib@tempa} % The various optional argument tricks above all use the same core % code, which adds the mandatory argument of the citation to the % stack. The stack is global (see also \cs{flushnotestack}). % \begin{macrocode} \newcommand*{\niib@addtostack}[1]{% - \niib@log@debug{Adding citation #1\MessageBreak to `tail' stack}% + \niib@log@debug{Adding citation #1\MessageBreak to `tail' + stack}% \edef\niib@tempa{#1}% \ifx\@empty\niib@stack\@empty \xdef\niib@stack{\niib@tempa}% @@ -1173,7 +1165,6 @@ \fi} % \end{macrocode} %\end{macro} -%\end{macro} %\begin{macro}{\niib@bibnote} %\changes{v1.3}{2008/01/08}{Use \cs{niib@mark} for citation} % Two steps are needed here, writing the text of the note to file @@ -1181,8 +1172,8 @@ % \cs{niib@cite}). % \begin{macrocode} \long\def\niib@bibnote[#1]#2{% - \niib@text{#1}{#2}% - \niib@mark[#1]} + \let\niib@next\niib@mark + \niib@text{#1}{#2}} % \end{macrocode} %\end{macro} %\begin{macro}{\niib@headlist} @@ -1193,7 +1184,6 @@ % \end{macrocode} %\end{macro} %\begin{macro}{\niib@mark} -%\begin{macro}{\niib@tempa} % Adding a citation to the \LaTeX\ file is handled here. When using % the \opt{sort=head} option, the citation is written to the % \ext{aux} file for sorting control. The normal citation command is @@ -1213,7 +1203,6 @@ \fi \fi % \end{macrocode} -%\end{macro} % When the \opt{sort=tail} option is active, citation is handled by % another macro, so a switch is needed. % \begin{macrocode} @@ -1239,7 +1228,7 @@ % turning it off and setting up the restore system. %\end{macro} % \begin{macrocode} -\AtBeginDocument{% +\AtBeginDocument{ \@ifpackageloaded{biblatex} {\newcommand{\niib@tailcite}[1]{% \niib@addtostack{#1}% @@ -1280,54 +1269,118 @@ \newcommand*{\niib@normcite}{\@nameuse{\niib@cite}} % \end{macrocode} %\end{macro} -%\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. This is a -% \cs{long} macro, so no star is used for \cs{newcommand}. +%\begin{macro}{\niib@next} +%\begin{macro}{\niib@gobble} +% To allow correct detection of following punctuation by +% \cs{niib@mark}, it has to follow \cs{niib@text}. However, to +% prevent category code issues, \cs{niib@text} can only take +% \emph{one} argument. Hence, a ``follow-on'' macro is needed; this +% is provided here. The no-op here has to gobble a square-bracketed +% argument. % \begin{macrocode} -\newcommand{\niib@text}[2]{% +\newcommand*{\niib@next}{} +\def\niib@gobble[#1]{} +\let\niib@next\niib@gobble % \end{macrocode} +%\end{macro} +%\end{macro} +%\begin{macro}{\niib@text} %\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} - \@ifundefined{niib@out}{% - \if@filesw - \newwrite\niib@out% - \gdef\niib@stream{\niib@prefix\jobname.bib}% - \niib@log@debug{Creating BibTeX database file \MessageBreak - \niib@stream\space to contain bibnotes}% - \immediate\openout\niib@out\niib@stream\relax -% \end{macrocode} -% The new file starts with the message that it has been automatically -% generated by \currpkg. -% \begin{macrocode} - \immediate\write\niib@out{\niib@msg}% - \fi}{}% +% The \cs{niib@text} macro is the outer part of the writing system. +% It does not absorb the text of note, as without \eTeX\ this is bad +% news. +% \begin{macrocode} +\newcommand*{\niib@text}{% + \@bsphack + \@ifundefined{niib@out} + {\if@filesw + \newwrite\niib@out + \gdef\niib@stream{\niib@prefix\jobname.bib}% + \niib@log@debug{Creating BibTeX database file + \MessageBreak\niib@stream\space to contain bibnotes}% + \immediate\openout\niib@out\niib@stream\relax + \immediate\write\niib@out{\niib@msg}% + \fi} + {}% + \if@filesw + \expandafter\niib@write + \fi} % \end{macrocode} %\end{macro} %\end{macro} -% The new record is now written to file. The \cs{unexpanded} \eTeX\ -% 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. +%\end{macro} +%\begin{macro}{\niib@write} +% The \cs{niib@write} macro deals with writing data verbatim to the +% \BibTeX\ file. When \eTeX\ is available, this is easy; the macro +% absorbs the note text and uses \cs{unexpanded}. % \begin{macrocode} - \if@filesw +\ifniib@etex + \newcommand*{\niib@write}[2]{% \niib@log@debug{Writing bibnote #1 contents - \MessageBreak---\MessageBreak#2\MessageBreak---\MessageBreak - to BibTeX database}% + \MessageBreak---\MessageBreak#2\MessageBreak + ---\MessageBreak to BibTeX database}% \immediate\write\niib@out{% @\niib@record\string{#1,^^J% presort = \string{\niib@presort\string},^^J% \niib@keyname\space= \string{\niib@key#1\string},^^J% \niib@field\space= \string{\unexpanded{#2}\string}^^J% \string}^^J}% - \fi} + \@esphack + \niib@next[#1]} +% \end{macrocode} +% Life is more awkward when \eTeX\ is unavailable. The code here is +% based on a suggestion by Ulrich Diez, with alterations to the +% specifics needed here. +% \begin{macrocode} +\else + \newcommand*{\niib@write}[1]{% + \begingroup + \let\do\@makeother + \dospecials + \catcode`\{=1\relax + \catcode`\}=2\relax + \niib@write@{#1}} +\fi % \end{macrocode} %\end{macro} +%\begin{macro}{\niib@write@} +% Two support macros are needed if \eTeX\ is not available. +% \cs{niib@write@} works with the category codes altered as above, +% which means that text is written (essentially) verbatim to the +% \BibTeX\ file. +% \begin{macrocode} +\newcommand\niib@write@[1]{% + \long\def\niib@tempa##1{% + \def\niib@tempa{##1}% + \@onelevel@sanitize\niib@tempa\expandafter\endgroup + \expandafter\def\expandafter\niib@tempa\expandafter{% + \niib@tempa}% + \niib@write@@{#1}}% + \catcode`\^^M=10\relax + \niib@tempa} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\niib@write@@} +% Writing to the file is a very slightly altered version of the +% \eTeX\ version. In this case, the debugging data is given here, +% after category code changes. +% \begin{macrocode} +\newcommand*\niib@write@@[1]{% + \niib@log@debug{Writing bibnote #1 contents + \MessageBreak---\MessageBreak\niib@tempa\MessageBreak + ---\MessageBreak to BibTeX database}% + \immediate\write\niib@out{% + @\niib@record\string{#1,^^J% + presort = \string{\niib@presort\string},^^J% + \niib@keyname\space= \string{\niib@key#1\string},^^J% + \niib@field\space= \string{\niib@tempa\string}^^J% + \string}^^J}% + \@esphack + \niib@next[#1]} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\niib@headcitelist} % To inform the user that a re-run of \LaTeX\ is needed, tracking is % needed of any citations that have been moved to the start of the @@ -1342,7 +1395,6 @@ %\begin{macro}{\niib@dochook} %\begin{macro}{\niibheadcite} %\changes{v1.3}{2008/01/08}{New macro} -%\begin{macro}{\niib@tempa} % When using the \opt{sort=head} option, bibnotes need to appear in % the \ext{aux} file before other citations. Other approaches cause % all sorts of problems, so the suggestion of Michael Shell is @@ -1369,12 +1421,10 @@ %\end{macro} %\end{macro} %\end{macro} -%\end{macro} %\begin{macro}{\niib@tailcitelist} %\changes{v1.3b}{2008/01/16}{New macro} %\begin{macro}{\niibtailcite} %\changes{v1.3b}{2008/01/16}{New macro} -%\begin{macro}{\niib@tempa} % To enable proper logging of citations when \opt{sort=tail}, a % similar system to the above is employed without the \cs{nocite} % part. @@ -1390,7 +1440,6 @@ % \end{macrocode} %\end{macro} %\end{macro} -%\end{macro} %\begin{macro}{\niib@auxhook} %\changes{v1.3}{2008/01/08}{New macro} %\begin{macro}{\niib@dochook} @@ -1427,11 +1476,12 @@ % things very differently, but this actually makes it much easier to % patch for. % \begin{macrocode} -\AtBeginDocument{% - \@ifpackageloaded{biblatex}% - {\expandafter\gappto\expandafter\blx@bibfiles\expandafter% +\AtBeginDocument{ + \@ifpackageloaded{biblatex} + {\expandafter\gappto\expandafter\blx@bibfiles\expandafter {,\niib@prefix\jobname} - \niib@log@debug{Added bibnotes database to biblatex file list}}% + \niib@log@debug{Added bibnotes database to biblatex file + list}}% % \end{macrocode} %\end{macro} %\begin{macro}{\niib@org@bib} @@ -1472,24 +1522,24 @@ % \begin{macrocode} \newcommand*{\niib@checkrerun}[1]{% \niib@rerunfalse - \expandafter\ifx\expandafter\@empty\csname niib@#1list\endcsname% - \@empty - \expandafter\ifx\expandafter\@empty\csname niib@#1citelist% - \endcsname\@empty + \expandafter\ifx\expandafter\@empty + \csname niib@#1list\endcsname\@empty + \expandafter\ifx\expandafter\@empty + \csname niib@#1citelist\endcsname\@empty \niib@log@debug{No `#1' notes detected}% \else \niib@reruntrue \niib@log@debug{No `#1' notes found this run\MessageBreak - but .aux files contained the `#1' requests:\MessageBreak - \csname niib@#1citelist\endcsname}% + but .aux files contained the `#1' requests: + \MessageBreak\csname niib@#1citelist\endcsname}% \fi \else - \expandafter\ifx\expandafter\@empty\csname niib@#1citelist% - \endcsname\@empty + \expandafter\ifx\expandafter\@empty + \csname niib@#1citelist\endcsname\@empty \niib@reruntrue - \niib@log@debug{No `#1' requests in .aux file\MessageBreak - but `#1' notes in this run:\MessageBreak - \csname niib@#1list\endcsname}% + \niib@log@debug{No `#1' requests in .aux file + \MessageBreak but `#1' notes in this run: + \MessageBreak\csname niib@#1list\endcsname}% \else % \end{macrocode} % If the package gets here, then there are some notes and some @@ -1521,8 +1571,6 @@ %\begin{macro}{\niib@checklists} %\changes{v1.3b}{2008/01/16}{Added ability to check for both % \opt{sort=head} and \opt{sort=tail}} -%\begin{macro}{\niib@tempa} -%\begin{macro}{\niib@tempb} % The business end of comparing the two lists. Two sweeps are made, % to check that the lists match entirely. % \begin{macrocode} @@ -1536,9 +1584,9 @@ % \opt{sort=tail} citations, the expanded list is needed for the % \cs{@for} loops. % \begin{macrocode} - \expandafter\edef\expandafter\niib@list\expandafter% + \expandafter\edef\expandafter\niib@list\expandafter {\csname niib@#1list\endcsname}% - \expandafter\edef\expandafter\niib@citelist\expandafter% + \expandafter\edef\expandafter\niib@citelist\expandafter {\csname niib@#1citelist\endcsname}% % \end{macrocode} %\end{macro} @@ -1563,14 +1611,12 @@ \niib@rerunfalse \fi} \ifniib@rerun - \niib@log@debug{Note \niib@tempa\space is set to `#1' in - .aux\MessageBreak file but is not a `#1' note}% + \niib@log@debug{Note \niib@tempa\space is set to `#1' + in .aux\MessageBreak file but is not a `#1' note}% \fi} \fi} % \end{macrocode} %\end{macro} -%\end{macro} -%\end{macro} %\begin{macro}{\niib@taillist} %\changes{v1.3b}{2008/01/16}{New macro} % At the end of the document, any delayed citations are written to the @@ -1581,39 +1627,34 @@ \AtEndDocument{% \niib@rerunfalse \niib@checkrerun{head}% - \flushnotestack% + \flushnotestack \@ifundefined{niib@out}{} - {\immediate\closeout\niib@out% + {\immediate\closeout\niib@out \niib@log@debug{Closed BibTeX database file\MessageBreak \niib@stream}}} % \end{macrocode} %\end{macro} -% Options are processed at the end of the package, to avoid any odd -% issues arising with definition of macros. -% \begin{macrocode} -\ProcessOptionsX[niib] -% \end{macrocode} % %\iffalse % %\fi -% \PrintChanges -% \PrintIndex % \Finale %\iffalse %<*jawltxdoc> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{jawltxdoc} \usepackage[T1]{fontenc} -\usepackage[english,UKenglish]{babel} +\usepackage{lmodern} +\usepackage[final]{listings,graphicx,microtype} \usepackage[scaled=0.95]{helvet} \usepackage[version=3]{mhchem} -\usepackage[final]{microtype} \usepackage[osf]{mathpazo} -\usepackage{booktabs,array,url,graphicx,courier,xspace} -\usepackage{upgreek,ifpdf,listings,float,caption,longtable} +\usepackage{booktabs,array,url,courier,xspace,etoolbox,varioref} +\usepackage{upgreek,ifpdf,float,caption,longtable,babel} \floatstyle{plaintop} \restylefloat{table} +\labelformat{figure}{\figurename~#1} +\labelformat{table}{\tablename~#1} \ifpdf \usepackage{embedfile} \embedfile[% @@ -1625,115 +1666,148 @@ \IfFileExists{\jobname.sty} {\usepackage{\jobname}}{} \usepackage[numbered]{hypdoc} +\setcounter{IndexColumns}{2} \newlength\LaTeXwidth \newlength\LaTeXoutdent \newlength\LaTeXgap \setlength\LaTeXgap{1em} \setlength\LaTeXoutdent{-0.15\textwidth} -\newcommand*{\typesetexampleandcode}{% +\newbox\lst@samplebox +\edef\LaTeXexamplefile{\jobname.tmp} +\lst@RequireAspects{writefile} +\lstnewenvironment{LaTeXexample}[1][example]{% + \global\let\lst@intname\@empty + \ifcsname LaTeXcode#1\endcsname + \expandafter\let\expandafter\LaTeXcode + \csname LaTeXcode#1\endcsname + \expandafter\let\expandafter\LaTeXcodeend + \csname LaTeXcode#1end\endcsname + \else + \PackageError{jawltxdoc} + {Undefined example type `#1'} + \@ehd + \let\LaTeXcode\relax + \let\LaTeXcodeend\relax + \fi + \LaTeXcode} + {\lst@EndWriteFile + \LaTeXcodeend} +\newcommand*{\LaTeXcodeexample}{% + \setbox\lst@samplebox=\hbox\bgroup + \LaTeXcodefloat} +\let\LaTeXcoderesultonly\LaTeXcodeexample +\newcommand*{\LaTeXcodeexampleend}{% + \egroup + \setlength\LaTeXwidth{\wd\lst@samplebox}% \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} -} -\newcommand*{\typesetcodeandexample}{% - \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}% - \lst@sampleInput - \end{list} -} -\newcommand*{\typesetfloatexample}{% - \begin{list}{}{% - \setlength\itemindent{0pt} - \setlength\leftmargin{0pt} - \setlength\rightmargin{0pt} - } - \item - \lst@sampleInput - \begin{minipage}[c]{\LaTeXwidth}% - \hbox to\linewidth{\box\lst@samplebox\hss}% - \end{minipage}% - \end{list} -} -\newcommand*{\typesetcodeonly}{% + \setlength\rightmargin{0pt}}% + \item + \setlength\LaTeXoutdent{-0.15\textwidth} + \begin{minipage}[c]{% + \textwidth-\LaTeXwidth-\LaTeXoutdent-\LaTeXgap} + \LaTeXcodefloatend + \end{minipage}% + \hfill + \begin{minipage}[c]{\LaTeXwidth}% + \hbox to\linewidth{\box\lst@samplebox\hss}% + \end{minipage}% + \end{list}} +\let\LaTeXcodenoexample\LaTeXcodeexample +\newcommand*{\LaTeXcodenoexampleend}{% + \egroup + \setlength\LaTeXwidth{\wd\lst@samplebox}% \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} -} -\edef\LaTeXexamplefile{\jobname.tmp} -\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}{tabsize=4,gobble=3,breakindent=0pt,% - basicstyle=\small\ttfamily,basewidth=0.51em,% - keywordstyle=\color{blue}} - \lst@BeginAlsoWriteFile{\LaTeXexamplefile} -}{% - \lst@EndWriteFile\egroup - \setlength\LaTeXwidth{\wd\lst@samplebox} - \typesetexample% -} -\newcommand*{\lst@sampleInput}{% + \setlength\rightmargin{0pt}}% + \item + \begin{minipage}[c]{\LaTeXwidth} + \hbox to\linewidth{\box\lst@samplebox\hss}% + \end{minipage}% + \end{list}} +\newcommand*{\LaTeXcodefloat}{% + \setkeys{lst}{tabsize=4,gobble=3,breakindent=0pt, + basicstyle=\small\ttfamily,basewidth=0.51em, + keywordstyle=\color{blue}}% + \lst@BeginAlsoWriteFile{\LaTeXexamplefile}} +\newcommand*{\LaTeXcodefloatend}{% \MakePercentComment\catcode`\^^M=10\relax - \small% + \small {\setkeys{lst}{SelectCharTable=\lst@ReplaceInput{\^\^I}% {\lst@ProcessTabulator}}% \leavevmode \input{\LaTeXexamplefile}}% - \MakePercentIgnore% -} + \MakePercentIgnore} +\newcommand*{\LaTeXcoderesultonlyend}{\egroup\LaTeXcodefloatend} +\lstnewenvironment{BibTeXexample}{% + \global\let\lst@intname\@empty + \setbox\lst@samplebox=\hbox\bgroup + \setkeys{lst}{tabsize=4,gobble=3,breakindent=0pt, + basicstyle=\small\ttfamily,basewidth=0.51em, + keywordstyle=\color{black}} + \lst@BeginAlsoWriteFile{\LaTeXexamplefile}} + {\lst@EndWriteFile + \LaTeXcodeexampleend} +\newcommand*{\DescribeOption}{% + \leavevmode\@bsphack\begingroup\MakePrivateLetters + \Describe@Option} +\newcommand*{\Describe@Option}[1]{\endgroup + \marginpar{\raggedleft\PrintDescribeEnv{#1}}% + \SpecialOptionIndex{#1}\@esphack\ignorespaces} +\newcommand*{\SpecialOptionIndex}[1]{\@bsphack + \index{#1\actualchar{\protect\ttfamily#1} + (option)\encapchar usage}% + \index{options:\levelchar#1\actualchar{\protect\ttfamily#1}% + \encapchar usage}\@esphack} +\newcommand*{\indexopt}[1]{\DescribeOption{#1}\opt{#1}} +\newcommand*{\DescribeOptionInfo}[2]{% + \DescribeOption{#1}% + \opt{#1=\meta{#2}}\xspace} +\newcommand*{\ofixarg}[1]{% + {\ttfamily[}% + \ifmmode \expandafter \nfss@text \fi + {% + \meta@font@select + \edef\meta@hyphen@restore{% + \hyphenchar\the\font\the\hyphenchar\font}% + \hyphenchar\font\m@ne + \language\l@nohyphenation + #1\/% + \meta@hyphen@restore + }% + {\ttfamily]}} \newcommand*{\pkg}[1]{\textsf{#1}} \newcommand*{\currpkg}{\pkg{\jobname}\xspace} \newcommand*{\opt}[1]{\texttt{#1}} +\newcommand*{\defaultopt}[1]{\opt{\textbf{#1}}} \newcommand*{\file}[1]{\texttt{#1}} \newcommand*{\ext}[1]{\file{.#1}} \newcommand*{\latin}[1]{\emph{#1}} \newcommand*{\etc}{% \@ifnextchar. {\latin{etc}} - {\latin{etc.}} - \xspace} + {\latin{etc}.\xspace}} \newcommand*{\eg}{% \@ifnextchar. {\latin{e.g}} - {\latin{e.g.}} - \xspace} + {\latin{e.g}.\xspace}} \newcommand*{\ie}{% \@ifnextchar. {\latin{i.e}} - {\latin{i.e.}} - \xspace} + {\latin{i.e}.\xspace}} +\newcommand*{\etal}{% + \@ifnextchar. + {\latin{et~al.}} + {\latin{et~al}.\xspace}} \newcommand*{\AMS}{{\protect\usefont{OMS}{cmsy}{m}{n}% A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}} \providecommand*{\eTeX}{\ensuremath{\varepsilon}-\TeX} -\newcommand*{\XeTeX} +\DeclareRobustCommand*{\XeTeX} {X\kern-.125em\lower.5ex\hbox{\reflectbox{E}}\kern-.1667em\TeX} +\providecommand*{\CTAN}{\textsc{ctan}} +\patchcmd{\@addmarginpar} + {\@latex@warning@no@line {Marginpar on page \thepage\space moved}} + {\relax}{}{} % %\fi diff --git a/Master/texmf-dist/source/latex/notes2bib/notes2bib.ins b/Master/texmf-dist/source/latex/notes2bib/notes2bib.ins index 2eb1b04face..0c3f403213d 100644 --- a/Master/texmf-dist/source/latex/notes2bib/notes2bib.ins +++ b/Master/texmf-dist/source/latex/notes2bib/notes2bib.ins @@ -1,38 +1,45 @@ -%% -%% 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 -\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 -\endinput -%% -%% End of file `notes2bib.ins'. +%% +%% 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 +\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:} +\generate{\file{jawltxdoc.sty}{\from{\jobname.dtx}{jawltxdoc}} +} +\usedir{tex/latex/notes2bib} +\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}} +} +\usedir{source/latex/notes2bib} +\generate{\file{\jobname.ins}{\from{\jobname.dtx}{install}} +} +\nopreamble\nopostamble +\usedir{doc/latex/notes2bib} +\generate{\file{README.txt}{\from{\jobname.dtx}{readme}} +} +\endbatchfile +\endinput +%% +%% End of file `notes2bib.ins'. diff --git a/Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty b/Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty index 793d3bd29d4..c24a2950549 100644 --- a/Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty +++ b/Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty @@ -14,27 +14,12 @@ %% ---------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} +\def\niib@id$#1: #2.#3 #4 #5-#6-#7 #8 #9${% + #5/#6/#7\space v1.4\space} \ProvidesPackage{notes2bib} - [2008/02/26 v1.3c Integrating notes into the bibliography] -\begingroup - \@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'} - \endgroup\endinput} - {\endgroup} -\RequirePackage{xkeyval} -\@ifpackagelater{xkeyval}{2005/05/07} - {} - {\PackageError{notes2bib} - {xkeyval >= 2.5 required} - {notes2bib requires the `xkeyval' package, version 2.5 or - later.\MessageBreak The version loaded is: - `\@nameuse{ver@etoolbox.sty}'.\MessageBreak - This is a fatal error; the package will abort.}% - \endinput} + [\niib@id$Id: notes2bib.dtx 11 2008-06-21 16:00:05Z joseph $ + Integrating notes into the bibliography] +\RequirePackage{xkeyval}[2005/05/07] \newcommand*{\niib@tempa}{} \newcommand*{\niib@tempb}{} \newif\ifniib@debug @@ -75,11 +60,9 @@ {#5\niib@log@debug{Option #2 set to ##1}}} \newcommand*{\niib@opt@cmdkeys}[1]{% \define@cmdkeys[niib]{opt}[niib@]{#1}} -\newcommand*{\niibsetup}[1]{% - \iffalse{\fi\ifnum0=`}\fi - \setkeys[niib]{opt}{#1}% - \ifnum0=`{\fi\iffalse}\fi} -\niib@opt@choicekey[normal]{log}{debug,verbose,normal,errors,none} +\newcommand*{\niibsetup}{\setkeys[niib]{opt}} +\niib@opt@choicekey[normal]{log} + {debug,verbose,normal,errors,none} {\niib@debugfalse \niib@logminfalse \niib@lognonefalse @@ -145,7 +128,7 @@ keyhead, keynone, keytail} -\niibsetup{% +\niibsetup{ cite=cite, name=Bibnote, prefix=niib-, @@ -157,10 +140,31 @@ keyhead=aaa, keynone={}, keytail=zzz} +\niib@opt@boolkey{etex} +\begingroup + \@ifundefined{eTeXversion} + {} + {\global\niib@etextrue} +\endgroup +\ProcessOptionsX[niib] +\AtEndOfPackage{ + \define@key[niib]{opt}{etex} + {\niib@log@warn{Option `etex' only available + \MessageBreak when loading notes2bib}}} +\begingroup + \@ifundefined{eTeXversion} + {\ifniib@etex + \niib@log@warn{e-TeX unavailable}% + \global\niib@etexfalse + \fi} + {\ifniib@etex\else + \niib@log@inf{Use of e-TeX disabled}% + \fi} +\endgroup \let\niib@org@footnote\footnote \let\niib@org@footnotemark\footnotemark \let\niib@org@footnotetext\footnotetext -\AtBeginDocument{% +\AtBeginDocument{ \@ifpackageloaded{endnotes} {\let\niib@org@endnote\endnote \let\niib@org@endnotemark\endnotemark @@ -185,7 +189,7 @@ \fi} \AtBeginDocument{\niib@swapfoot} \newcommand*{\niib@swapend}{} -\AtBeginDocument{% +\AtBeginDocument{ \@ifpackageloaded{endnotes} {\renewcommand*{\niib@swapend}{% \ifniib@endnotes @@ -199,7 +203,8 @@ \let\endnotemark\niib@org@endnotemark \let\endnotetext\niib@org@endnotetext \let\theendnotes\niib@org@theendnotes - \niib@log@debug{Using endnotes package to handle endnotes}% + \niib@log@debug{Using endnotes package to handle + endnotes}% \fi} \niib@swapend} {\ifniib@endnotes @@ -233,8 +238,9 @@ {\niib@mark} {\niib@mark[\thebibnote]}} \DeclareRobustCommand*{\bibnotetext}[1][\thebibnote]{% + \let\niib@next\niib@gobble \niib@text{#1}} -\AtBeginDocument{% +\AtBeginDocument{ \@ifpackageloaded{biblatex} {\let\printbibnotes\printbibliography} {\DeclareRobustCommand*{\printbibnotes} @@ -245,50 +251,52 @@ \niib@checkrerun{tail}% \fi \ifx\@empty\niib@stack\@empty - \niib@log@debug{Citation stack empty: nothing for\MessageBreak - \noexpand\flushnotestack to do}% + \niib@log@debug{Citation stack empty: nothing for + \MessageBreak\noexpand\flushnotestack to do}% \else% \niib@log@debug{Flushing note citations to aux file}% \if@filesw - \immediate\write\@auxout{\string\niibtailcite{\niib@stack}}% + \immediate\write\@auxout{% + \string\niibtailcite{\niib@stack}}% \fi \expandafter\nocite\expandafter{\niib@stack}% \gdef\niib@stack{}% \fi} \DeclareRobustCommand*{\citenote}[1]{\niib@mark[#1]} -\AtBeginDocument{% +\AtBeginDocument{ \@ifpackageloaded{biblatex} {\niib@log@debug{Using field `keysort' for sorting key}% - \newcommand*\niib@keyname{keysort}} + \newcommand*{\niib@keyname}{keysort}} {\niib@log@debug{Using field `key' for sorting key}% - \newcommand*\niib@keyname{key}}} + \newcommand*{\niib@keyname}{key}}} \newcommand*{\niib@presort}{% \ifniib@head - \niib@presorthead% + \niib@presorthead \else \ifniib@tail - \niib@presorttail% + \niib@presorttail \else - \niib@presortnone% + \niib@presortnone \fi \fi} \newcommand*{\niib@key}{% \ifniib@head - \niib@keyhead% + \niib@keyhead \else \ifniib@tail - \niib@keytail% + \niib@keytail \else - \niib@keynone% + \niib@keynone \fi \fi} \edef\niib@msg{% - This is an auxiliary file used by the `notes2bib' package.^^J% - This file may safely be deleted. It will be recreated as - required.^^J} + This is an auxiliary file used by the `notes2bib' + package.^^J This file may safely be deleted. It + will be recreated as required.^^J} \newcommand*{\niib@stack}{} \newcommand*{\niib@addtostack}[1]{% - \niib@log@debug{Adding citation #1\MessageBreak to `tail' stack}% + \niib@log@debug{Adding citation #1\MessageBreak to `tail' + stack}% \edef\niib@tempa{#1}% \ifx\@empty\niib@stack\@empty \xdef\niib@stack{\niib@tempa}% @@ -296,8 +304,8 @@ \xdef\niib@stack{\niib@stack,\niib@tempa}% \fi} \long\def\niib@bibnote[#1]#2{% - \niib@text{#1}{#2}% - \niib@mark[#1]} + \let\niib@next\niib@mark + \niib@text{#1}{#2}} \newcommand*{\niib@headlist}{} \def\niib@mark[#1]{% \ifniib@head @@ -319,7 +327,7 @@ \fi {#1}} \newif\ifniib@filesw -\AtBeginDocument{% +\AtBeginDocument{ \@ifpackageloaded{biblatex} {\newcommand{\niib@tailcite}[1]{% \niib@addtostack{#1}% @@ -341,27 +349,67 @@ \niib@normcite{#1}% \niib@restorefilesw}}} \newcommand*{\niib@normcite}{\@nameuse{\niib@cite}} -\newcommand{\niib@text}[2]{% - \@ifundefined{niib@out}{% - \if@filesw - \newwrite\niib@out% - \gdef\niib@stream{\niib@prefix\jobname.bib}% - \niib@log@debug{Creating BibTeX database file \MessageBreak - \niib@stream\space to contain bibnotes}% - \immediate\openout\niib@out\niib@stream\relax - \immediate\write\niib@out{\niib@msg}% - \fi}{}% +\newcommand*{\niib@next}{} +\def\niib@gobble[#1]{} +\let\niib@next\niib@gobble +\newcommand*{\niib@text}{% + \@bsphack + \@ifundefined{niib@out} + {\if@filesw + \newwrite\niib@out + \gdef\niib@stream{\niib@prefix\jobname.bib}% + \niib@log@debug{Creating BibTeX database file + \MessageBreak\niib@stream\space to contain bibnotes}% + \immediate\openout\niib@out\niib@stream\relax + \immediate\write\niib@out{\niib@msg}% + \fi} + {}% \if@filesw + \expandafter\niib@write + \fi} +\ifniib@etex + \newcommand*{\niib@write}[2]{% \niib@log@debug{Writing bibnote #1 contents - \MessageBreak---\MessageBreak#2\MessageBreak---\MessageBreak - to BibTeX database}% + \MessageBreak---\MessageBreak#2\MessageBreak + ---\MessageBreak to BibTeX database}% \immediate\write\niib@out{% @\niib@record\string{#1,^^J% presort = \string{\niib@presort\string},^^J% \niib@keyname\space= \string{\niib@key#1\string},^^J% \niib@field\space= \string{\unexpanded{#2}\string}^^J% \string}^^J}% - \fi} + \@esphack + \niib@next[#1]} +\else + \newcommand*{\niib@write}[1]{% + \begingroup + \let\do\@makeother + \dospecials + \catcode`\{=1\relax + \catcode`\}=2\relax + \niib@write@{#1}} +\fi +\newcommand\niib@write@[1]{% + \long\def\niib@tempa##1{% + \def\niib@tempa{##1}% + \@onelevel@sanitize\niib@tempa\expandafter\endgroup + \expandafter\def\expandafter\niib@tempa\expandafter{% + \niib@tempa}% + \niib@write@@{#1}}% + \catcode`\^^M=10\relax + \niib@tempa} +\newcommand*\niib@write@@[1]{% + \niib@log@debug{Writing bibnote #1 contents + \MessageBreak---\MessageBreak\niib@tempa\MessageBreak + ---\MessageBreak to BibTeX database}% + \immediate\write\niib@out{% + @\niib@record\string{#1,^^J% + presort = \string{\niib@presort\string},^^J% + \niib@keyname\space= \string{\niib@key#1\string},^^J% + \niib@field\space= \string{\niib@tempa\string}^^J% + \string}^^J}% + \@esphack + \niib@next[#1]} \newcommand*{\niib@headcitelist}{} \g@addto@macro{\document}{\niib@dochook} \newcommand*{\niibheadcite}[1]{% @@ -393,11 +441,12 @@ \fi}} \newcommand*{\niib@auxhook}{} \let\niib@auxhook\relax -\AtBeginDocument{% - \@ifpackageloaded{biblatex}% - {\expandafter\gappto\expandafter\blx@bibfiles\expandafter% +\AtBeginDocument{ + \@ifpackageloaded{biblatex} + {\expandafter\gappto\expandafter\blx@bibfiles\expandafter {,\niib@prefix\jobname} - \niib@log@debug{Added bibnotes database to biblatex file list}}% + \niib@log@debug{Added bibnotes database to biblatex file + list}}% {\let\niib@org@bib\bibliography \renewcommand*{\bibliography}[1]{% \ifnum\the\value{bibnote} > \z@ @@ -410,24 +459,24 @@ \newif\ifniib@rerun \newcommand*{\niib@checkrerun}[1]{% \niib@rerunfalse - \expandafter\ifx\expandafter\@empty\csname niib@#1list\endcsname% - \@empty - \expandafter\ifx\expandafter\@empty\csname niib@#1citelist% - \endcsname\@empty + \expandafter\ifx\expandafter\@empty + \csname niib@#1list\endcsname\@empty + \expandafter\ifx\expandafter\@empty + \csname niib@#1citelist\endcsname\@empty \niib@log@debug{No `#1' notes detected}% \else \niib@reruntrue \niib@log@debug{No `#1' notes found this run\MessageBreak - but .aux files contained the `#1' requests:\MessageBreak - \csname niib@#1citelist\endcsname}% + but .aux files contained the `#1' requests: + \MessageBreak\csname niib@#1citelist\endcsname}% \fi \else - \expandafter\ifx\expandafter\@empty\csname niib@#1citelist% - \endcsname\@empty + \expandafter\ifx\expandafter\@empty + \csname niib@#1citelist\endcsname\@empty \niib@reruntrue - \niib@log@debug{No `#1' requests in .aux file\MessageBreak - but `#1' notes in this run:\MessageBreak - \csname niib@#1list\endcsname}% + \niib@log@debug{No `#1' requests in .aux file + \MessageBreak but `#1' notes in this run: + \MessageBreak\csname niib@#1list\endcsname}% \else \niib@checklists{#1}% \fi @@ -446,9 +495,9 @@ \fi \fi} \newcommand*{\niib@checklists}[1]{% - \expandafter\edef\expandafter\niib@list\expandafter% + \expandafter\edef\expandafter\niib@list\expandafter {\csname niib@#1list\endcsname}% - \expandafter\edef\expandafter\niib@citelist\expandafter% + \expandafter\edef\expandafter\niib@citelist\expandafter {\csname niib@#1citelist\endcsname}% \@for\niib@tempa:=\niib@list\do{% \niib@reruntrue @@ -468,19 +517,18 @@ \niib@rerunfalse \fi} \ifniib@rerun - \niib@log@debug{Note \niib@tempa\space is set to `#1' in - .aux\MessageBreak file but is not a `#1' note}% + \niib@log@debug{Note \niib@tempa\space is set to `#1' + in .aux\MessageBreak file but is not a `#1' note}% \fi} \fi} \AtEndDocument{% \niib@rerunfalse \niib@checkrerun{head}% - \flushnotestack% + \flushnotestack \@ifundefined{niib@out}{} - {\immediate\closeout\niib@out% + {\immediate\closeout\niib@out \niib@log@debug{Closed BibTeX database file\MessageBreak \niib@stream}}} -\ProcessOptionsX[niib] \endinput %% %% End of file `notes2bib.sty'. -- cgit v1.2.3