diff options
author | Karl Berry <karl@freefriends.org> | 2008-10-26 15:40:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-10-26 15:40:51 +0000 |
commit | 70da966888998bdc516ca75b91435d29746adb7d (patch) | |
tree | 303f086dbc391d25149652ad6b67d246e00d7fcc /Master/texmf-dist/source/latex/notes2bib | |
parent | d8e34c095c3416f709b61aeec497806cf99813e6 (diff) |
notes2bib 1.6 (22oct08)
git-svn-id: svn://tug.org/texlive/trunk@11061 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/notes2bib')
-rw-r--r-- | Master/texmf-dist/source/latex/notes2bib/notes2bib.dtx | 102 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/notes2bib/xnotes2bib.dtx | 81 |
2 files changed, 145 insertions, 38 deletions
diff --git a/Master/texmf-dist/source/latex/notes2bib/notes2bib.dtx b/Master/texmf-dist/source/latex/notes2bib/notes2bib.dtx index a22d12ce741..c5b2d6f5b9d 100644 --- a/Master/texmf-dist/source/latex/notes2bib/notes2bib.dtx +++ b/Master/texmf-dist/source/latex/notes2bib/notes2bib.dtx @@ -144,7 +144,7 @@ unsorted bibliography styles are supported. %</driver> %\fi % -%\CheckSum{868} +%\CheckSum{881} % %\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 @@ -182,6 +182,8 @@ unsorted bibliography styles are supported. % control option to turn off use even if available} %\changes{v1.5}{2008/09/08}{Bundle now includes experimental % \LaTeX3 support} +%\changes{v1.6}{2008/10/21}{Fixed issue with \cs{nofiles}} +%\changes{v1.6}{2008/10/21}{Advice extended on various issues} % %\DoNotIndex{\@auxout,\@empty,\@fileswfalse,\@for,\@ifnextchar} %\DoNotIndex{\@ifpackagelater,\@ifpackageloaded,\@ifundefined} @@ -205,7 +207,7 @@ unsorted bibliography styles are supported. %\DoNotIndex{\c@footnote,\catcode,\define@key,\dospecials,\global} % %\setkeys{lst}{language=[LaTeX]{TeX},moretexcs={bibnote,% -% bibnotemark,bibnotetext,citenote}} +% bibnotemark,bibnotetext,citenote,niibsetup,newif,printbibliography}} % %\title{\currpkg\ --- Integrating notes into the % bibliography^^A @@ -323,6 +325,8 @@ unsorted bibliography styles are supported. %\DescribeOption{field} %\DescribeOption{name} %\DescribeOption{record} +%\DescribeOption{keyword} +%\changes{v1.6}{2008/10/22}{New option \opt{keyword}} % 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 @@ -331,7 +335,9 @@ unsorted bibliography styles are supported. % 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. +% author--year styles in particular. For separating notes from other +% citations when using \pkg{biblatex}, the \opt{keyword} option is used +% for the name of the keyword used to control this. %\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 @@ -365,6 +371,13 @@ unsorted bibliography styles are supported. % the appropriate values; default values are \defaultopt{ml}, % \defaultopt{mm} and \defaultopt{ml}, respectively. % +%\DescribeOption{writekey} +% When using the package with \pkg{natbib}, it may be necessary to avoid +% writing the \texttt{key} field to the temporary database. This is +% seen with the style \texttt{unsrtnat}, for example. The Boolean +% option \opt{writekey} is available to turn off writing the +% \texttt{key} field under these circumstances. +% %\DescribeOption{log} %\DescribeOption{debug} % The amount of detail to add to the log; expects a value from the @@ -442,12 +455,58 @@ unsorted bibliography styles are supported. %\begin{LaTeXexample}[noexample] % \makeatletter % \renewcommand*{\thebibnote}{% -% \niib@name% -% \ifnum\value{bibnote} < 9 0\fi% +% \niib@name +% \ifnum\value{bibnote} < 9 0\fi % \the\value{bibnote}} % \makeatother %\end{LaTeXexample} % +% Using the package with \pkg{natbib} may require some work, for example +% when using the \texttt{unsrtnat} style. This requires a couple of +% setting changes to get the correct labelling.\footnote{This is due to +% the method used by \pkg{natbib} when creating labels.} +%\begin{LaTeXexample}[noexample] +% \niibsetup{writekey=false,name={}} +%\end{LaTeXexample} +% +% Notes can be separated from other citations easily using +% \pkg{biblatex}. Using the \opt{keyword} option, a key phrase can be +% used to mark notes. The optional argument to the +% \cs{printbibliography} can then be used to separate notes and +% other citations based on the keyword used. The following example +% also places note citations in the margin, and makes a switch available +% to control the appearance of notes. Note that the standard keyword is +% \opt{bibnote}. +%\begin{LaTeXexample}[noexample] +% \documentclass{article} +% \begin{filecontents}{demo.bib} +% @article{Test, +% title = {A test article}, +% author = {A. N. Other}, +% year = {2008}, +% pages = {1-10} +% } +% \end{filecontents} +% \usepackage{notes2bib,biblatex} +% \defbibheading{notes}{\section*{Notes}} +% \bibliography{demo} +% \newif\ifprintbibnotes\printbibnotesfalse +% \niibsetup{cite=mycite} +% \ifprintbibnotes +% \newcommand*{\mycite}[1]{\marginpar{\cite{#1}}} +% \else +% \newcommand*{\mycite}[1]{} +% \fi +% \begin{document} +% Some text\bibnote{A first note} and some more\bibnote{A second note}. +% A real citation \cite{Test}. +% \printbibliography[notkeyword=bibnote] +% \ifprintbibnotes +% \printbibliography[heading=notes,keyword=bibnote] +% \fi +% \end{document} +%\end{LaTeXexample} +% %\section{Package requirements} % The package has only one requirement, \pkg{xkeyval} version 2.5 or % later. \eTeX\ is used if available, but is not a requirement. @@ -562,7 +621,7 @@ unsorted bibliography styles are supported. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{notes2bib} - [2008/09/24 v1.5b Integrating notes into the bibliography] + [2008/10/22 v1.6 Integrating notes into the bibliography] \RequirePackage{xkeyval}[2005/05/07] % \end{macrocode} %\begin{macro}{\niib@tempa} @@ -769,6 +828,13 @@ unsorted bibliography styles are supported. \fi \fi]{tail} % \end{macrocode} +%\begin{macro}{\niib@writekey} +%\changes{v1.6}{2008/10/21}{Added \opt{writekey} option} +% Control of writing \texttt{key} to disk. +% \begin{macrocode} +\niib@opt@boolkey{writekey} +% \end{macrocode} +%\end{macro} %\begin{macro}{\niib@cite} %\begin{macro}{\niib@name} %\begin{macro}{\niib@prefix} @@ -780,6 +846,7 @@ unsorted bibliography styles are supported. %\begin{macro}{\niib@keyhead} %\begin{macro}{\niib@keynone} %\begin{macro}{\niib@keytail} +%\begin{macro}{\niib@keyword} % The various internal control values are set up as command keys. % \begin{macrocode} \niib@opt@cmdkeys{% @@ -793,7 +860,8 @@ unsorted bibliography styles are supported. presorttail, keyhead, keynone, - keytail} + keytail, + keyword} \niibsetup{ cite=cite, name=Bibnote, @@ -805,7 +873,9 @@ unsorted bibliography styles are supported. presorttail=mn, keyhead=aaa, keynone={}, - keytail=zzz} + keytail=zzz, + keyword=bibnote, + writekey=true} % \end{macrocode} %\end{macro} %\end{macro} @@ -818,6 +888,7 @@ unsorted bibliography styles are supported. %\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 @@ -1307,11 +1378,21 @@ unsorted bibliography styles are supported. {}% \if@filesw \expandafter\niib@write + \else + \expandafter\niib@tidy \fi} % \end{macrocode} %\end{macro} %\end{macro} %\end{macro} +%\begin{macro}{\niib@tidy} +% When not writing to file. +% \begin{macrocode} +\newcommand*{\niib@tidy}[2]{% + \@esphack + \niib@next[#1]} +% \end{macrocode} +%\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 @@ -1325,7 +1406,10 @@ unsorted bibliography styles are supported. \immediate\write\niib@out{% @\niib@record\string{#1,^^J% presort = \string{\niib@presort\string},^^J% - \niib@keyname\space= \string{\niib@key#1\string},^^J% + \ifniib@writekey + \niib@keyname\space= \string{\niib@key#1\string},^^J% + \fi + keywords = \string{\niib@keyword\string},^^J% \niib@field\space= \string{\unexpanded{#2}\string}^^J% \string}^^J}% \@esphack diff --git a/Master/texmf-dist/source/latex/notes2bib/xnotes2bib.dtx b/Master/texmf-dist/source/latex/notes2bib/xnotes2bib.dtx index 199e2137cea..6cd5acce8c2 100644 --- a/Master/texmf-dist/source/latex/notes2bib/xnotes2bib.dtx +++ b/Master/texmf-dist/source/latex/notes2bib/xnotes2bib.dtx @@ -95,7 +95,7 @@ This work consists of the file notes2bib.dtx %</internal>
%<*package>
\RequirePackage{l3names}
-\GetIdInfo$Id: xnotes2bib.dtx 4 2008-09-23 09:00:00Z joseph $
+\GetIdInfo$Id: xnotes2bib.dtx 5 2008-10-22 21:00:00Z joseph $
{Integrating notes into the bibliography (expl3 version)}
%</package>
%<*driver>
@@ -110,7 +110,7 @@ This work consists of the file notes2bib.dtx %</driver>
% \fi
%
-%\CheckSum{461}
+%\CheckSum{466}
%
%\GetFileInfo{\jobname.sty}
%
@@ -237,6 +237,13 @@ This work consists of the file notes2bib.dtx % with default values \opt{mn}, \opt{ml} and \opt{mm}, respectively.
% The \opt{presort} system is described in the \pkg{biblatex} manual.
%
+%\DescribeOption{write~key~field}
+% When using the package with \pkg{natbib}, it may be necessary to avoid
+% writing the \texttt{key} field to the temporary database. This is
+% seen with the style \texttt{unsrtnat}, for example. The Boolean
+% option \opt{write key field} is available to turn off writing the
+% \texttt{key} field under these circumstances.
+%
%\DescribeOption{cite}
% As \currpkg\ uses \BibTeX\ to create notes, it uses a citation
% command to mark the notes in the body of the text. The command used
@@ -244,7 +251,7 @@ This work consists of the file notes2bib.dtx % \cs{cite}.
%
%\DescribeOption{field}
-%\DescribeOption{notename}
+%\DescribeOption{name}
%\DescribeOption{prefix}
%\DescribeOption{record}
% Four control values are available to affect low-level aspects of the
@@ -253,7 +260,7 @@ This work consists of the file notes2bib.dtx % \opt{niib-} initially. The \opt{field} and \opt{record} options
% contain the name of the field used for the note, and the \BibTeX\
% record type used. The standard values are \opt{note} and \opt{Misc},
-% respectively. Finally, the \opt{notename} option sets the text used
+% respectively. Finally, the \opt{name} option sets the text used
% in addition to a number when automatically labelling notes. This is
% set to \opt{Bibnote}: there is no space between this text and the
% number as this will confuse \BibTeX.
@@ -381,7 +388,7 @@ This work consists of the file notes2bib.dtx % so that if there are more than ten notes then the number is padded.
% \begin{macrocode}
\def_new:Npn \niib_thenote: {
- \l_niib_notename_tlp
+ \l_niib_name_tlp
\num_compare:nNnT {\g_niib_totalnotes_int} > {\c_nine} {
\num_compare:nNnF {\g_niib_note_int} > {\c_nine} {
0
@@ -462,7 +469,9 @@ This work consists of the file notes2bib.dtx %\changes{v0.0}{2008/09/15}{Renamed from \cs{l_niib_key before_tlp}}
%\begin{macro}{\l_niib_key_mixed_tlp}
%\changes{v0.0}{2008/09/15}{Renamed from \cs{l_niib_key mixed_tlp}}
-%\begin{macro}{\l_niib_notename_tlp}
+%\begin{macro}{\l_niib_keyword_tlp}
+%\begin{macro}{\l_niib_name_tlp}
+%\changes{v0.0}{2008/09/15}{Renamed from \cs{l_niib_notename_tlp}}
% Some storage macros.
% \begin{macrocode}
/keys/current~module:n = niib,
@@ -470,13 +479,15 @@ This work consists of the file notes2bib.dtx key~after/.set:c = key_after,
key~before/.set:c = key_before,
key~mixed/.set:c = key_mixed,
- notename/.set:c = notename,
+ keyword/.set:c = keyword,
+ name/.set:c = name,
% \end{macrocode}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
+%\end{macro}
% Another choice for placement.
% \begin{macrocode}
placement/.choice: = \l_niib_placement_tlp,
@@ -506,35 +517,43 @@ This work consists of the file notes2bib.dtx %\changes{v0.0}{2008/09/09}{Renamed and recoded from
% \cs{niib_KV_string:n}}
% \begin{macrocode}
- prefix/.set:c = prefix_tlp,
+ /keys/current~module:n = niib,
+ prefix/.set:c = prefix,
presort~after/.set:c = presort_after,
presort~before/.set:c = presort_before,
presort~mixed/.set:c = presort_mixed,
- record/.set:c = record
-}
+ record/.set:c = record,
% \end{macrocode}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
+%\begin{macro}{\l_niib_write_key_bool}
+% One real Boolean key.
+% \begin{macrocode}
+ write~key~field/.boolean:c = write_key
+}
+% \end{macrocode}
+%\end{macro}
% All of the default values are set.
% \begin{macrocode}
\keys_manage_quick:n{
/niib/.cd:,
- cite = \cite,
- debug = false,
- field = note,
- key~after = zzz,
- key~before = aaa,
- key~mixed = {},
- notename = Bibnote,
- placement = mixed,
- prefix = niib-,
- presort~after = mn,
- presort~before = ml,
- presort~mixed = mm,
- record = Misc}
+ cite = \cite,
+ debug = false,
+ field = note,
+ key~after = zzz,
+ key~before = aaa,
+ key~mixed = {},
+ name = Bibnote,
+ placement = mixed,
+ prefix = niib-,
+ presort~after = mn,
+ presort~before = ml,
+ presort~mixed = mm,
+ record = Misc,
+ write~key~field = true}
% \end{macrocode}
%
%\subsection{User macros}
@@ -547,7 +566,7 @@ This work consists of the file notes2bib.dtx % \cs{niib_thenote:}. The note text must be sorted out before the mark
% is made, as otherwise packages such as \pkg{cite} do not work
% correctly with punctuation. As the package is designed for \LaTeX3,
-% it is assumed \eTeX\ is available and so \cs{scantokens} can be used
+% it is assumed \eTeX\ is available and so \cs{exp_not:n} can be used
% on the mandatory argument. Hence everything is absorbed here without
% worrying about category codes.
% \begin{macrocode}
@@ -618,8 +637,12 @@ This work consists of the file notes2bib.dtx #1,^^J
\text_put_sp: \text_put_sp: \l_niib_field_tlp \text_put_sp:
=~{\exp_not:n{#2}},^^J
- \text_put_sp: \text_put_sp: \l_niib_keyname_tlp \text_put_sp:
- =~{\niib_key:#1},^^J
+ \bool_if:NT \l_niib_write_key_bool {
+ \text_put_sp: \text_put_sp: \l_niib_keyname_tlp \text_put_sp:
+ =~{\niib_key:#1},^^J
+ }
+ \text_put_sp: \text_put_sp: keywords~
+ =~{\l_niib_keyword_tlp},^^J
\text_put_sp: \text_put_sp: presort~
=~{\niib_presort:},^^J
}^^J
@@ -785,12 +808,12 @@ This work consists of the file notes2bib.dtx }
\def_new:Npn \niib_presort: {
\bool_if:NTF \l_niib_before_cite_bool {
- \tlp_use:N \l_niib_presort~before_tlp
+ \tlp_use:N \l_niib_presort_before_tlp
}{
\bool_if:NTF \l_niib_after_cite_bool {
- \tlp_use:N \l_niib_presort~after_tlp
+ \tlp_use:N \l_niib_presort_after_tlp
}{
- \tlp_use:N \l_niib_presort~mixed_tlp
+ \tlp_use:N \l_niib_presort_mixed_tlp
}
}
}
|