summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/notes2bib/notes2bib.dtx201
1 files changed, 144 insertions, 57 deletions
diff --git a/Master/texmf-dist/source/latex/notes2bib/notes2bib.dtx b/Master/texmf-dist/source/latex/notes2bib/notes2bib.dtx
index a4c207cf6ff..ac21b157c1d 100644
--- a/Master/texmf-dist/source/latex/notes2bib/notes2bib.dtx
+++ b/Master/texmf-dist/source/latex/notes2bib/notes2bib.dtx
@@ -274,8 +274,8 @@ This work consists of the file notes2bib.dtx
% The package requires LaTeX3 support as provided in the
% \pkg{expl3} and \pkg{xpackages} bundles. Both of these are available
% on \href{http://www.ctan.org}{\textsc{ctan}} as ready-to-install
-% zip files. Suitable versions are available in MiKTeX 2.8 and
-% TeX Live 2009 (updating the relevant packages online may be
+% zip files. Suitable versions are available in MiKTeX 2.9 and
+% TeX Live 2010 (updating the relevant packages online may be
% necessary). LaTeX3, and so \pkg{notes2bib}, requires the e-TeX
% extensions: these are available on all modern \TeX\ systems.
%
@@ -404,6 +404,18 @@ This work consists of the file notes2bib.dtx
% part of the label is always generated automatically, and is the
% number of the note. The standard setting for \opt{note-name} is
% \opt{Note}.
+%
+%\DescribeOption {refsection-name}
+%\DescribeOption {refsection-separator}
+% When using \pkg{biblatex}'s \texttt{refsection} system, additional
+% information is added to all labels from the second \texttt{refsection}
+% onward (\emph{i.e.}~to all except \texttt{refsection} 0). This
+% additional text is added before the note name, and always includes the
+% \texttt{refsection} number. The settings \opt{refsection-name} and
+% \opt{refsection-separator} determine the exact text added:
+% \opt{refsection-name} comes before the \texttt{refsection} number and
+% has default \opt{Refsection}, while \opt{refsection-separator} comes
+% after it and has default value \opt{-}.
%
%\subsection{Underlying citation system}
%
@@ -430,9 +442,10 @@ This work consists of the file notes2bib.dtx
%\DescribeOption {record-type}
% Each note is written to the database as a standard \BibTeX\ record.
% The type of record created is set using the \opt{record-type}
-% option. Usually, this will be set to \opt{misc}, but some \BibTeX\
-% styles have dedicated support for notes and so recognise the record
-% type \opt{note} (or indeed some other value).
+% option. Usually, this will be set to \opt{misc}; \pkg{biblatex} v1.1a
+% upwards provides the \opt{bibnote} record type, and this is used if
+% available. Some \BibTeX\ styles have dedicated support for notes: if
+% so, the appropriate value should be set for this option.
%
%\DescribeOption {note-field}
% The database field used to store the text of the note is available
@@ -904,7 +917,7 @@ This work consists of the file notes2bib.dtx
% Version data to start with.
% \begin{macrocode}
\ProvidesExplPackage
- {notes2bib} {2011/01/06} {2.0d}
+ {notes2bib} {2011/01/08} {2.0d}
{Integrating notes into the bibliography}
\RequirePackage{l3keys2e}
% \end{macrocode}
@@ -1036,6 +1049,9 @@ This work consists of the file notes2bib.dtx
%\begin{macro}{\l_niib_presort_before_tl}
%\begin{macro}{\l_niib_presort_mixed_tl}
%\begin{macro}{\l_niib_record_type_tl}
+%\begin{macro}{\l_niib_refsection_name_tl}
+%\begin{macro}{\l_niib_refsection_sep_tl}
+%\begin{macro}{\l_niib_record_type_tl}
%\begin{macro}{\l_niib_sortkey_after_tl}
%\begin{macro}{\l_niib_sortkey_before_tl}
%\begin{macro}{\l_niib_sortkey_mixed_tl}
@@ -1045,47 +1061,56 @@ This work consists of the file notes2bib.dtx
\keys_define:nn { notes2bib } {
cite-function .code:n =
{ \AtBeginDocument { \cs_set_eq:NN \niib_cite:w #1 } } ,
- file-name .tl_gset_x:N = \g_niib_filename_tl ,
- convert-endnotes .choice: ,
- convert-endnotes / false .code:n =
+ file-name .tl_gset_x:N = \g_niib_filename_tl ,
+ convert-endnotes .choice: ,
+ convert-endnotes
+ / false .code:n =
{ \AtBeginDocument { \niib_from_bibnote:n { endnote } } } ,
- convert-endnotes / true .code:n =
+ convert-endnotes
+ / true .code:n =
{ \AtBeginDocument { \niib_to_bibnote:n { endnote } } } ,
- convert-footnotes .choice: ,
- convert-footnotes / false .code:n =
+ convert-footnotes .choice: ,
+ convert-footnotes
+ / false .code:n =
{ \AtBeginDocument { \niib_from_bibnote:n { footnote } } } ,
- convert-footnotes / true .code:n =
+ convert-footnotes
+ / true .code:n =
{ \AtBeginDocument { \niib_to_bibnote:n { footnote } } } ,
- keyword-entry .tl_set:N = \l_niib_keyword_tl ,
- note-field .tl_set:N = \l_niib_note_field_tl ,
- note-name .tl_set:N = \l_niib_note_name_tl ,
- placement .choice: ,
- placement / after .code:n =
+ keyword-entry .tl_set:N = \l_niib_keyword_tl ,
+ note-field .tl_set:N = \l_niib_note_field_tl ,
+ note-name .tl_set:N = \l_niib_note_name_tl ,
+ placement .choice: ,
+ placement
+ / after .code:n =
{
\cs_set_eq:NN \niib_mark_note:n \niib_mark_note_after:n
\tl_set_eq:NN \l_niib_presort_tl \l_niib_presort_after_tl
\tl_set_eq:NN \l_niib_sortkey_tl \l_niib_sortkey_after_tl
},
- placement / before .code:n =
+ placement
+ / before .code:n =
{
\cs_set_eq:NN \niib_mark_note:n \niib_mark_note_before:n
\tl_set_eq:NN \l_niib_presort_tl \l_niib_presort_before_tl
\tl_set_eq:NN \l_niib_sortkey_tl \l_niib_sortkey_before_tl
},
- placement / mixed .code:n =
+ placement
+ / mixed .code:n =
{
\cs_set_eq:NN \niib_mark_note:n \niib_mark_note_mixed:n
\tl_set_eq:NN \l_niib_presort_tl \l_niib_presort_mixed_tl
\tl_set_eq:NN \l_niib_sortkey_tl \l_niib_sortkey_mixed_tl
},
- presort-after .tl_set:N = \l_niib_presort_after_tl ,
- presort-before .tl_set:N = \l_niib_presort_before_tl ,
- presort-mixed .tl_set:N = \l_niib_presort_mixed_tl ,
- record-type .tl_set:N = \l_niib_record_type_tl ,
- sort-key-after .tl_set:N = \l_niib_sortkey_before_tl ,
- sort-key-before .tl_set:N = \l_niib_sortkey_after_tl ,
- sort-key-mixed .tl_set:N = \l_niib_sortkey_mixed_tl ,
- use-sort-key .bool_set:N = \l_niib_write_sortkey_bool ,
+ presort-after .tl_set:N = \l_niib_presort_after_tl ,
+ presort-before .tl_set:N = \l_niib_presort_before_tl ,
+ presort-mixed .tl_set:N = \l_niib_presort_mixed_tl ,
+ record-type .tl_set:N = \l_niib_record_type_tl ,
+ refsection-name .tl_set:N = \l_niib_refsection_name_tl ,
+ refsection-separator .tl_set:N = \l_niib_refsection_sep_tl ,
+ sort-key-after .tl_set:N = \l_niib_sortkey_before_tl ,
+ sort-key-before .tl_set:N = \l_niib_sortkey_after_tl ,
+ sort-key-mixed .tl_set:N = \l_niib_sortkey_mixed_tl ,
+ use-sort-key .bool_set:N = \l_niib_write_sortkey_bool ,
}
% \end{macrocode}
%\end{macro}
@@ -1100,30 +1125,52 @@ This work consists of the file notes2bib.dtx
%\end{macro}
%\end{macro}
%\end{macro}
+%\end{macro}
+%\end{macro}
%
% Default values for the keys are set up. Many of these probably never
% change, but done in this way the package is much more flexible.
% \begin{macrocode}
\keys_set:nn { notes2bib } {
- cite-function = \cite ,
- file-name = notes2bib-\jobname ,
- keyword-entry = note ,
- note-field = note ,
- note-name = Note ,
- presort-after = mn ,
- presort-before = ml ,
- presort-mixed = mm ,
- record-type = misc ,
- sort-key-after = zzz ,
- sort-key-before = aaa ,
- use-sort-key = true
+ cite-function = \cite ,
+ file-name = notes2bib-\jobname ,
+ keyword-entry = note ,
+ note-field = note ,
+ note-name = Note ,
+ presort-after = mn ,
+ presort-before = ml ,
+ presort-mixed = mm ,
+ record-type = misc ,
+ refsection-name = Refsection ,
+ refsection-separator = - ,
+ sort-key-after = zzz ,
+ sort-key-before = aaa ,
+ use-sort-key = true
}
% \end{macrocode}
%
+%\changes{v2.0d}{2011/01/08}{Use new \cs{bibnote} record type with
+% \pkg{biblatex} v1.1a or later}
% A few options need to be altered or deactivated at the start of
% the document.
% \begin{macrocode}
\AtBeginDocument {
+ \@ifpackageloaded { biblatex }
+ {
+ \@ifpackagelater { biblatex } { 2011/01/08 }
+ {
+ \keys_set:nn { notes2bib }
+ { record-type = bibnote }
+ \DeclareBibliographyDriver { bibnote }
+ {
+ \usebibmacro { begentry }
+ \printfield { note }
+ \usebibmacro { finentry }
+ }
+ }
+ { }
+ }
+ { }
\keys_define:nn { notes2bib }
{
cite-function .code:n =
@@ -1141,8 +1188,35 @@ This work consists of the file notes2bib.dtx
}
}
\msg_new:nnn { notes2bib } { preamble-only }
- {The option `#1' can only be used in the preamble.}
+ { The~option~'#1'~can~only~be~used~in~the~preamble. }
+% \end{macrocode}
+%
+%\subsection{Support for \pkg{biblatex} \texttt{refsection} system}
+%
+%\begin{macro}{\niib_insert_refsection:}
+%\changes{v2.0d}{2011/01/08}{Added support for refsections}
+% When using \pkg{biblatex}, it's possible that \texttt{refsection}s are
+% in use. If so, to ensure that labels are always unique the
+% \texttt{refsection} number is added to the label.
+% \begin{macrocode}
+\cs_new_nopar:Npn \niib_insert_refsection: { }
+\AtBeginDocument {
+ \@ifpackageloaded { biblatex }
+ {
+ \cs_set_nopar:Npn \niib_insert_refsection:
+ {
+ \int_compare:nNnT { \value { refsection } } > { 0 }
+ {
+ \tl_use:N \l_niib_refsection_name_tl
+ \arabic { refsection }
+ \tl_use:N \l_niib_refsection_sep_tl
+ }
+ }
+ }
+ { }
+}
% \end{macrocode}
+%\end{macro}
%
%\subsection{Options from version one}
%
@@ -1188,6 +1262,7 @@ This work consists of the file notes2bib.dtx
% available at the end of the LaTeX run.
% \begin{macrocode}
\cs_new_nopar:Npn \niib_note_name: {
+ \niib_insert_refsection:
\tl_use:N \l_niib_note_name_tl
\intexpr_compare:nT { \g_niib_previous_notes_int > \c_nine }
{ \intexpr_compare:nT { \g_niib_note_int < \c_ten } { 0 } }
@@ -1440,11 +1515,11 @@ This work consists of the file notes2bib.dtx
%\end{macro}
%\end{macro}
%
-%\changes{v2.0d}{2011/01/06}{Tweak \cs{bibliography} code to reduce
-% complexity}
+%\begin{macro}{\niib_attach_bibliography:}
+%\changes{v2.0d}{2011/01/08}{Use new \cs{bibliography*} function with
+% \pkg{biblatex} v1.1a or later}
%\begin{macro}{\bibliography}
%\begin{macro}{\niib_bibliography:n}
-%\begin{macro}{\niib_attach_bibliography:}
% Getting the database created here to be scanned by \BibTeX\ is
% dependant on whether \pkg{biblatex} is being used. If it is, and it is
% already loaded, then the data can be added now. On the other hand, if
@@ -1452,21 +1527,25 @@ This work consists of the file notes2bib.dtx
% The \cs{bibliography} function has to be patched if \pkg{biblatex} is
% not in use.
% \begin{macrocode}
-\AtBeginDocument {
+\cs_new_nopar:Npn \niib_attach_bibliography: {
\@ifpackageloaded { biblatex }
- { \exp_args:NV \bibliography \g_niib_filename_tl }
+ {
+ \@ifpackagelater { biblatex } { 2011/01/08 }
+ { \exp_args:NNV \bibliography * \g_niib_filename_tl }
+ { \exp_args:NV \bibliography \g_niib_filename_tl }
+ }
{
\cs_new_eq:NN \niib_bibliography:n \bibliography
\RenewDocumentCommand \bibliography { m }
{
\intexpr_compare:nTF { \g_niib_total_notes_int = \c_zero }
- { \niib_bibliography:n {#1} }
+ { \niib_bibliography:n {##1} }
{
- \cs_new_nopar:Npx \niib_attach_bibliography:
+ \cs_set_nopar:Npx \niib_attach_bibliography:
{
\exp_not:N \niib_bibliography:n
{
- \exp_not:n {#1} , \exp_not:V \g_niib_filename_tl
+ \exp_not:n {##1} , \exp_not:V \g_niib_filename_tl
}
}
\niib_attach_bibliography:
@@ -1474,6 +1553,14 @@ This work consists of the file notes2bib.dtx
}
}
}
+\@ifpackageloaded { biblatex }
+ {
+ \@ifpackagelater { biblatex } { 2011/01/08 }
+ { \exp_args:NNV \bibliography * \g_niib_filename_tl }
+ { \exp_args:NV \bibliography \g_niib_filename_tl }
+ \cs_gundefine:N \niib_attach_bibliography:
+ }
+ { \AtBeginDocument { \niib_attach_bibliography: } }
% \end{macrocode}
%\end{macro}
%\end{macro}
@@ -1567,7 +1654,7 @@ This work consists of the file notes2bib.dtx
\int_gincr:N \g_niib_note_int
\niib_bibnote:xn { \niib_note_name: } {#2}
}
- { \niib_bibnote:nn {#1} {#2} }
+ { \niib_bibnote:xn { \niib_insert_refsection: #1 } {#2} }
}
\cs_new_protected:Npn \niib_bibnote:nn #1#2 {
\niib_write_note:nn {#1} {#2}
@@ -1589,7 +1676,7 @@ This work consists of the file notes2bib.dtx
\int_gincr:N \g_niib_note_int
\niib_mark_note:x { \niib_note_name: }
}
- { \niib_mark_note:n {#1} }
+ { \niib_mark_note:x { \niib_insert_refsection: #1 } }
}
% \end{macrocode}
%\end{macro}
@@ -1603,7 +1690,7 @@ This work consists of the file notes2bib.dtx
\NewDocumentCommand \bibnotetext { o +m } {
\IfNoValueTF {#1}
{ \niib_write_note:xn { \niib_note_name: } {#2} }
- { \niib_write_note:nn {#1} {#2} }
+ { \niib_write_note:xn { \niib_insert_refsection: #1 } {#2} }
}
% \end{macrocode}
%\end{macro}
@@ -1734,11 +1821,11 @@ This work consists of the file notes2bib.dtx
}
{ \msg_info:nn { notes2bib } { rerun } }
}
-\msg_new:nnn { notes2bib } { rerun } {%
- To get notes in the correct order, please run:\\%
- 1) LaTeX \\%
- 2) BibTeX \\%
- 3) LaTeX
+\msg_new:nnn { notes2bib } { rerun } {
+ To~get~notes~in~the~correct~order,~please~run: \\%
+ \c_space_tl 1)~LaTeX \\
+ \c_space_tl 2)~BibTeX \\
+ \c_space_tl 3)~LaTeX
}
% \end{macrocode}
%