summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty')
-rw-r--r--Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty154
1 files changed, 105 insertions, 49 deletions
diff --git a/Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty b/Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty
index c041d732325..537be64913e 100644
--- a/Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty
+++ b/Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty
@@ -15,7 +15,7 @@
%%
\RequirePackage{xparse}
\ProvidesExplPackage
- {notes2bib} {2011/01/06} {2.0d}
+ {notes2bib} {2011/01/08} {2.0d}
{Integrating notes into the bibliography}
\RequirePackage{l3keys2e}
\tl_new:N \c_niib_file_message_tl
@@ -47,63 +47,90 @@
\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 ,
}
\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
}
\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 =
@@ -121,7 +148,23 @@
}
}
\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. }
+\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
+ }
+ }
+ }
+ { }
+}
\keys_define:nn { notes2bib } {
cite .meta:x = { cite-function = \exp_not:c {#1} } ,
debug .code:n = { } ,
@@ -149,6 +192,7 @@
writekey .meta:n = { use-sort-key = #1 }
}
\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 } }
@@ -263,21 +307,25 @@
}
}
\cs_new_nopar:Npn \niib_create_print_notes: { }
-\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:
@@ -285,6 +333,14 @@
}
}
}
+\@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: } }
\AtBeginDocument {
\@ifpackageloaded { biblatex }
{ \tl_set:Nn \l_niib_sortkey_field_tl { sortkey } }
@@ -339,7 +395,7 @@
\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}
@@ -352,12 +408,12 @@
\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 } }
}
\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} }
}
\NewDocumentCommand \recordnotes { } {
\niib_record_notes:
@@ -396,11 +452,11 @@
}
{ \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
}
\AtEndDocument {
\if@filesw