From e3a6580980db6fb87922a58f4b56206d2eb4ba18 Mon Sep 17 00:00:00 2001 From: Manuel Pégourié-Gonnard Date: Wed, 10 Sep 2008 20:11:47 +0000 Subject: notes2bib v 1.5a 2008/09/09 git-svn-id: svn://tug.org/texlive/trunk@10546 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/notes2bib/notes2bib.sty | 2 +- .../texmf-dist/tex/latex/notes2bib/xnotes2bib.sty | 193 +++++++++++---------- 2 files changed, 101 insertions(+), 94 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty b/Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty index 99e10380db2..62a94d290cb 100644 --- a/Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty +++ b/Master/texmf-dist/tex/latex/notes2bib/notes2bib.sty @@ -15,7 +15,7 @@ %% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{notes2bib} - [2008/09/08 v1.5 Integrating notes into the bibliography] + [2008/09/09 v1.5a Integrating notes into the bibliography] \RequirePackage{xkeyval}[2005/05/07] \newcommand*{\niib@tempa}{} \newcommand*{\niib@tempb}{} diff --git a/Master/texmf-dist/tex/latex/notes2bib/xnotes2bib.sty b/Master/texmf-dist/tex/latex/notes2bib/xnotes2bib.sty index af6f5b0eb25..78cb7a6f487 100644 --- a/Master/texmf-dist/tex/latex/notes2bib/xnotes2bib.sty +++ b/Master/texmf-dist/tex/latex/notes2bib/xnotes2bib.sty @@ -26,7 +26,7 @@ } \RequirePackage{l3names} \ProvidesExplPackage - {xnotes2bib}{2008/09/08}{0.0} + {xnotes2bib}{2008/09/09}{0.0} {Integrating notes into the bibliography (expl3 version)} \RequirePackage{expl3,xparse} \DeclareOption*{ @@ -37,8 +37,8 @@ } \ProcessOptions\scan_stop: \int_new:N \g_niib_note_int -\def_new:NNn \niib_thenote: 0 { - \niib_notename: +\def_new:Npn \niib_thenote: { + \l_niib_notename_tlp \num_compare:nNnT {\g_niib_totalnotes_int} > {\c_nine}{ \num_compare:nNnF {\g_niib_note_int} > {\c_nine}{ 0 @@ -49,7 +49,7 @@ \RequirePackage{keyval} \clist_new:N\g_niib_KV_bool_clist \clist_put_left:Nn\g_niib_KV_bool_clist{true,false} -\def_new:NNn\niib_KV_bool:nT 2 { +\def_new:Npn\niib_KV_bool:nT #1#2 { \define@key{niib}{#1}[true]{ \clist_if_in:cnTF{g_niib_KV_bool_clist}{##1}{ #2 @@ -63,7 +63,7 @@ } } } -\def_new:NNn\niib_KV_choice:nnT 3 { +\def_new:Npn\niib_KV_choice:nnT #1#2#3 { \cs_if_free:cTF{g_niib_KV_#1_clist}{ \clist_new:c{g_niib_KV_#1_clist} }{ @@ -83,27 +83,28 @@ } } } -\def_new:NNn\niib_KV_cs_n:n 1 { +\def_new:Npn\niib_KV_cs_n:n #1 { \define@key{niib}{#1}{ \def:cNn{niib_#1:n} 0 {##1} } } -\def_new:NNn\niib_KV_string:n 1 { +\def_new:Npn\niib_KV_tlp:n #1 { + \tlp_new:c {l_niib_#1_tlp} \define@key{niib}{#1}{ - \def:cNn{niib_#1:} 0 {##1} + \tlp_set:cn {l_niib_#1_tlp}{##1} } } \niib_KV_cs_n:n{cite} -\niib_KV_string:n{field} -\niib_KV_string:n{key~after} -\niib_KV_string:n{key~before} -\niib_KV_string:n{key~mixed} -\niib_KV_string:n{notename} -\niib_KV_string:n{prefix} -\niib_KV_string:n{presort~after} -\niib_KV_string:n{presort~before} -\niib_KV_string:n{presort~mixed} -\niib_KV_string:n{record} +\niib_KV_tlp:n{field} +\niib_KV_tlp:n{key~after} +\niib_KV_tlp:n{key~before} +\niib_KV_tlp:n{key~mixed} +\niib_KV_tlp:n{notename} +\niib_KV_tlp:n{prefix} +\niib_KV_tlp:n{presort~after} +\niib_KV_tlp:n{presort~before} +\niib_KV_tlp:n{presort~mixed} +\niib_KV_tlp:n{record} \let_new:NN\niib_convert_endnotes:\scan_stop: \let_new:NN\niib_convert_footnotes:\scan_stop: \niib_KV_bool:nT{convert~endnotes}{ @@ -115,17 +116,17 @@ \niib_KV_bool:nT{debug}{ \let:Nc\niib_debug:n{niib_debug_#1:n} } -\def_new:NNn\niib_debug_true:n 1 { +\def_new:Npn\niib_debug_true:n #1 { \PackageInfo{xnotes2bib}{#1} } \let_new:NN\niib_debug_false:n\use_none:n -\bool_new:N\l_niib_after_bool -\bool_new:N\l_niib_before_bool +\bool_new:N\l_niib_after_cite_bool +\bool_new:N\l_niib_before_cite_bool \niib_KV_choice:nnT{placement}{after,before,mixed}{ - \bool_set_false:N\l_niib_before_bool - \bool_set_false:N\l_niib_after_bool - \cs_if_really_exist:cT{l_niib_#1_bool}{ - \bool_set_true:c{l_niib_#1_bool} + \bool_set_false:N\l_niib_before_cite_bool + \bool_set_false:N\l_niib_after_cite_bool + \cs_if_really_exist:cT{l_niib_#1_cite_bool}{ + \bool_set_true:c{l_niib_#1_cite_bool} } } \setkeys{niib}{ @@ -165,7 +166,7 @@ \cs_if_free:NT \g_niib_out_stream { \iow_new:N \g_niib_out_stream \iow_open:Nn \g_niib_out_stream - {\niib_prefix:\c_job_name_tlp.bib} + {\l_niib_prefix_tlp\c_job_name_tlp.bib} \iow_expanded:Nn \g_niib_out_stream {This~is~an~auxiliary~file~used~by~the~`xnotes2bib'~ package.^^J This~file~may~safely~be~deleted.^^J It~ @@ -176,12 +177,12 @@ for~note~`#1' } \iow_expanded:Nn \g_niib_out_stream { - @\niib_record:{ + @\l_niib_record_tlp{ #1,^^J - \space\space \niib_field:\space + \space\space \l_niib_field_tlp\space =~{\exp_not:n{#2}},^^J - \space\space \niib_keyname:\space - =~{#1} ,^^J + \space\space \l_niib_keyname_tlp\space + =~{\niib_key:#1},^^J \space\space presort~ =~{\niib_presort:},^^J }^^J @@ -189,152 +190,157 @@ \fi } \NewDocumentCommand{\flushnotestack}{}{ - \clist_if_empty:NF\g_niib_beforecite_clist{ + \clist_if_empty:NF\g_niib_before_cite_clist{ \if@filesw \iow_expanded:Nn\@auxout{ \token_to_string:N\niibbeforecite{ - \g_niib_beforecite_clist + \g_niib_before_cite_clist } } \fi } - \clist_if_empty:NF\g_niib_aftercite_clist{ - \nocite{\g_niib_aftercite_clist} + \clist_if_empty:NF\g_niib_after_cite_clist{ + \nocite{\g_niib_after_cite_clist} \if@filesw \iow_expanded:Nn\@auxout{ - \token_to_string:N\niibaftercite{\g_niib_aftercite_clist} + \token_to_string:N\niibaftercite{\g_niib_after_cite_clist} } \fi } - \clist_gclear:N\g_niib_aftercite_clist + \clist_gclear:N\g_niib_after_cite_clist } \NewDocumentCommand{\niibsetup}{m}{\setkeys{niib}{#1}} -\clist_new:N\g_niib_oldbeforecite_clist -\clist_new:N\g_niib_oldaftercite_clist +\clist_new:N\g_niib_before_cite_old_clist +\clist_new:N\g_niib_after_cite_old_clist \tlp_new:N\g_niib_document_tlp \tlp_put_right:Nn\document{\g_niib_document_tlp} \NewDocumentCommand{\niibbeforecite}{m}{ - \clist_gput_right:Nn\g_niib_oldbeforecite_clist{#1} + \clist_gput_right:Nn\g_niib_before_cite_old_clist{#1} \tlp_gput_right:Nn\g_niib_document_tlp{\nocite{#1}} } \NewDocumentCommand{\niibaftercite}{m}{ - \clist_gput_right:Nn\g_niib_oldaftercite_clist{#1} + \clist_gput_right:Nn\g_niib_after_cite_old_clist{#1} } \int_new:N \g_niib_totalnotes_int \NewDocumentCommand{\niibtotalnotes}{m}{ \int_gset:Nn \g_niib_totalnotes_int {#1} } -\def_new:NNn \niib_notemark:n 1 { +\def_new:Npn \niib_notemark:n #1 { \niib_debug:n{Creating~citation~for~note~`#1'} - \bool_if:NT\l_niib_before_bool{ + \bool_if:NT\l_niib_before_cite_bool{ \niib_debug:n{Note~`#1'~before~real~citations} - \clist_put_right:Nx\g_niib_beforecite_clist{#1} + \clist_gput_right:Nx\g_niib_before_cite_clist{#1} } - \bool_if:NTF\l_niib_after_bool{ + \bool_if:NTF\l_niib_after_cite_bool{ \niib_debug:n{Note~`#1'~after~real~citations} - \clist_put_right:Nx\g_niib_aftercite_clist{#1} - \niib_aftercite:n{#1} + \clist_gput_right:Nx\g_niib_after_cite_clist{#1} + \niib_after_cite:n{#1} }{ \niib_cite:n{#1} } } -\clist_new:N\g_niib_beforecite_clist -\clist_new:N\g_niib_aftercite_clist -\def_new:NNn\niib_key: 0 { - \bool_if:NTF\l_niib_before_bool{ - \cs_use:c{niib_key~before:} +\clist_new:N\g_niib_before_cite_clist +\clist_new:N\g_niib_after_cite_clist +\def_new:Npn\niib_key: { + \bool_if:NTF\l_niib_before_cite_bool{ + \tlp_use:c{l_niib_key~before_tlp} }{ - \bool_if:NTF\l_niib_after_bool{ - \cs_use:c{niib_key~after:} + \bool_if:NTF\l_niib_after_cite_bool{ + \tlp_use:c{l_niib_key~after_tlp} }{ - \cs_use:c{niib_within~key:} + \tlp_use:c{l_niib_key~mixed_tlp} } } } -\def_new:NNn\niib_presort: 0 { - \bool_if:NTF\l_niib_before_bool{ - \cs_use:c{niib_presort~before:} +\def_new:Npn\niib_presort: { + \bool_if:NTF\l_niib_before_cite_bool{ + \tlp_use:c{l_niib_presort~before_tlp} }{ - \bool_if:NTF\l_niib_after_bool{ - \cs_use:c{niib_presort~after:} + \bool_if:NTF\l_niib_after_cite_bool{ + \tlp_use:c{l_niib_presort~after_tlp} }{ - \cs_use:c{niib_within~presort:} + \tlp_use:c{l_niib_presort~mixed_tlp} } } } -\def_new:NNn\niib_convert_endnotes_false: 0 { +\def_new:Npn\niib_convert_endnotes_false: { \niib_debug:n{Restoring~normal~endnotes} \let:NN\endnote\niib_saved_endnote: \let:NN\endnotemark\niib_saved_endnotemark: \let:NN\endnotetext\niib_saved_endnotetext: } -\def_new:NNn\niib_convert_endnotes_true: 0 { +\def_new:Npn\niib_convert_endnotes_true: { \niib_debug:n{Converting~endnotes~to~bibnotes} \let:NN\endnote\bibnote \let:NN\endnotemark\bibnotemark \let:NN\endnotetext\bibnotetext } -\def_new:NNn\niib_convert_footnotes_false: 0 { +\def_new:Npn\niib_convert_footnotes_false: { \niib_debug:n{Restoring~normal~footnotes} \let:NN\footnote\niib_saved_footnote: \let:NN\footnotemark\niib_saved_footnotemark: \let:NN\footnotetext\niib_saved_footnotetext: } -\def_new:NNn\niib_convert_footnotes_true: 0 { +\def_new:Npn\niib_convert_footnotes_true: { \niib_debug:n{Converting~footnotes~to~bibnotes} \let:NN\footnote\bibnote \let:NN\footnotemark\bibnotemark \let:NN\footnotetext\bibnotetext } -\def:NNn\thanks 1 { +\def:Npn\thanks #1 { \niib_saved_footnotemark: \protected@xdef\@thanks{\@thanks \protect\niib_saved_footnotetext:[\the\c@footnote]{#1}} } +\tlp_new:N \l_niib_keyname_tlp \AtBeginDocument{ \PackageInfo{xnotes2bib}{ Beginning~\token_to_string:N\AtBeginDocument\space tasks } \@ifpackageloaded{biblatex}{ - \def_new:NNn \niib_keyname: 0 {keysort} + \tlp_set:Nn \l_niib_keyname_tlp {keysort} \gappto\blx@bibfiles{,\niib_prefix\c_job_name_tlp} \let_new:NN\printbibnotes\printbibliography - \def_new:NNn\niib_aftercite:n 1 { + \def_new:Npn\niib_after_cite:n #1 { \AtNextCite{\@fileswfalse} \niib_cite:n{#1} } }{ - \def_new:NNn \niib_keyname: 0 {key} + \tlp_gset:Nn \l_niib_keyname_tlp {key} \let_new:NN\niib_biliography:n\bibliography - \def:NNn\bibliography 1 { + \def:Npn\bibliography #1 { \int_compare:nNnTF{\g_niib_note_int}={\c_zero}{ \niib_biliography:n{#1} }{ - \niib_biliography:n{#1,\niib_prefix:\c_job_name_tlp} + \niib_biliography:n{ + #1,\l_niib_prefix_tlp\c_job_name_tlp + } } } \NewDocumentCommand{\printbibnotes}{}{ - \niib_biliography:n{\niib_prefix:\c_job_name_tlp} + \niib_biliography:n{\l_niib_prefix_tlp\c_job_name_tlp} } \newif\ifniib@filesw \@ifpackageloaded{cite}{ - \def_new:NNn\niib_aftercite:n 1 { - \let:NN\ifniib@filesw\if@filesw + \def_new:Npn\niib_after_cite:n #1 { + \let:NN \ifniib@filesw \if@filesw \@fileswfalse - \def:NNn{\niib_auxhandle:} 0 { - \let:NN\if@filesw\ifniib@filesw - \let:NN\niib_auxhandle:\scan_stop: + \def:Npn \niib_auxhandle: { + \let:NN \if@filesw \ifniib@filesw + \let:NN \niib_auxhandle: \scan_stop: } \niib_cite:n{#1} } - \cs_if_exist:NTF\@restore@auxhandle{ - \tlp_put_right:Nn\@restore@auxhandle{\niib_auxhandle:} - }{ - \def_new:NNn\@restore@auxhandle 0 {\niib_auxhandle:} + \tlp_gput_right:Nn \g_niib_document_tlp { + \cs_if_exist:NTF\@restore@auxhandle{ + \tlp_put_right:Nn\@restore@auxhandle{\niib_auxhandle:} + }{ + \def_new:Npn\@restore@auxhandle {\niib_auxhandle:} + } } \let_new:NN\niib_auxhandle:\scan_stop: }{ - \def_new:NNn\niib_aftercite:n 1 { + \def_new:Npn\niib_after_cite:n #1 { \let\ifniib@filesw\if@filesw \@fileswfalse \niib_cite:n{#1} @@ -351,26 +357,26 @@ \niib_convert_endnotes: \niib_convert_footnotes: \niib_KV_bool:nT{convert~endnotes}{ - \cs_use:c{niib_convert_endnotes_#1:} + \use:c{niib_convert_endnotes_#1:} } \niib_KV_bool:nT{convert~footnotes}{ - \cs_use:c{niib_convert_footnotes_#1:} + \use:c{niib_convert_footnotes_#1:} } \PackageInfo{xnotes2bib}{ Finished~\token_to_string:N\AtBeginDocument\space tasks } } -\def_new:NNn\niib_rerun_check:n 1 { +\def_new:Npn\niib_rerun_check:n #1 { \clist_if_empty:cTF {g_niib_old#1cite_clist}{ \clist_if_empty:cF {g_niib_#1cite_clist}{ - \niib_rerun_log:n {#1} + \niib_rerun_log: } }{ \clist_if_empty:cTF {g_niib_#1cite_clist}{ - \niib_rerun_log:n {#1} + \niib_rerun_log: }{ \bool_set_false:N\l_tmpa_bool - \def:NNn\niib_rerun_test:n 1 { + \def:Npn\niib_rerun_test:n ##1 { \clist_if_in:cnTF{g_niib_old#1cite_clist}{##1}{ \bool_set_true:N\l_tmpa_bool \clist_map_break:w @@ -379,7 +385,7 @@ } \clist_map_function:cN{g_niib_#1cite_clist} \niib_rerun_test:n - \def:NNn\niib_rerun_test:n 1 { + \def:Npn\niib_rerun_test:n ##1 { \clist_if_in:cnTF{g_niib_#1cite_clist}{##1}{ \bool_set_true:N\l_tmpa_bool \clist_map_break:w @@ -389,15 +395,15 @@ \clist_map_function:cN{g_niib_old#1cite_clist} \niib_rerun_test:n \bool_if:NF\l_tmpa_bool{ - \niib_rerun_log:n {#1} + \niib_rerun_log: } } } } -\def:NNn\niib_rerun_test:n 0 {} -\def_new:NNn\niib_rerun_log:n 1 { +\let_new:NN \niib_rerun_test:n \use_none_i:n +\def_new:Npn\niib_rerun_log: { \PackageInfo{xnotes2bib}{ - To~get~`#1'~notes~in~the~correct~order,~please\MessageBreak + To~get~notes~in~the~correct~order,~please\MessageBreak rerun~LaTeX,~(re)run~BibTeX~on~the~file~\c_job_name_tlp.aux \MessageBreak and~rerun~LaTeX~again~afterwards } @@ -406,6 +412,7 @@ REQ:2:bibtex:REQ\iow_newline: REQ:1:latex:REQ\iow_newline: } + \let\niib_rerun_log:\scan_stop: } \AtEndDocument{ \niib_rerun_check:n{before} @@ -417,7 +424,7 @@ } } \num_compare:nNnF{\g_niib_totalnotes_int}={\g_niib_note_int}{ - \niib_rerun_log:n + \niib_rerun_log: } \cs_if_free:NF \g_niib_out_stream{ \iow_close:N \g_niib_out_stream -- cgit v1.2.3