diff options
author | Karl Berry <karl@freefriends.org> | 2024-08-21 21:52:57 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-08-21 21:52:57 +0000 |
commit | 050f9c9bbb2bdb6e48cf31c895923a17c5298cd7 (patch) | |
tree | 1d1162d5115b294afdb08eec0cea923271ca31af /Master/texmf-dist/tex/latex/citation-style-language | |
parent | 20dabab318d46718959d1e49a4ec35532b9c8ada (diff) |
citation-style-language (21aug24)
git-svn-id: svn://tug.org/texlive/trunk@72078 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/citation-style-language')
4 files changed, 142 insertions, 109 deletions
diff --git a/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-cite.sty b/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-cite.sty index 709ef6191e4..d72cb1d1eb3 100644 --- a/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-cite.sty +++ b/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-cite.sty @@ -7,13 +7,33 @@ % ## Citation commands \DeclareDocumentCommand \cite { s o o m } - { \__csl_cite:nnnn {#1} {#2} {#3} {#4} } + { + \IfBooleanTF {#1} + { + \bool_if:NTF \l__csl_note_bool + { \__csl_cite_in_text:nnnn {#2} {#3} {#4} { } } + { \__csl_cite_in_text:nnnn {#2} {#3} {#4} { suppress-author } } + } + { + \bool_if:NTF \l__csl_note_bool + { \__csl_cite_note:nnnn {#2} {#3} {#4} { } } + { \__csl_cite_in_text:nnnn {#2} {#3} {#4} { } } + } + } \NewDocumentCommand \parencite { s o o m } - { \__csl_cite:nnnn {#1} {#2} {#3} {#4} } + { + \IfBooleanTF {#1} + { + \bool_if:NTF \l__csl_note_bool + { \__csl_cite_in_text:nnnn {#2} {#3} {#4} { } } + { \__csl_cite_in_text:nnnn {#2} {#3} {#4} { suppress-author } } + } + { \__csl_cite_parens:nnn {#2} {#3} {#4} } + } \NewDocumentCommand \citep { o o m } - { \__csl_cite:nnnn { \BooleanFalse } {#1} {#2} {#3} } + { \__csl_cite_parens:nnn {#1} {#2} {#3} } \NewDocumentCommand \textcite { o o m } { \__csl_text_cite:nnn {#1} {#2} {#3} } @@ -22,7 +42,7 @@ { \__csl_text_cite:nnn {#1} {#2} {#3} } \NewDocumentCommand \footcite { o o m } - { \__csl_cite:nnnn { \BooleanFalse } {#1} {#2} {#3} } + { \__csl_cite_note:nnnn {#1} {#2} {#3} { } } % \cites[⟨prenote⟩][⟨postnote⟩]{⟨key⟩}...[⟨prenote⟩][⟨postnote⟩]{⟨key⟩} @@ -30,23 +50,16 @@ { \__csl_cites: } \NewDocumentCommand \citeauthor { o o m } - { \__csl_cite_author:nnn {#1} {#2} {#3} } + { \__csl_cite_in_text:nnnn {#1} {#2} {#3} { author-only } } % TODO: \citeyear -% ATM the starred form is the same as non-star form. -\NewDocumentCommand \citeyearpar { s o o m } - { - \IfBooleanT {#1} - { - \bool_if:NTF \l__csl_note_bool - { \msg_error:nn { citation-style-language } { starred-cite-in-note-style } } - } - \__csl_cite_suppress_author:nnn {#2} {#3} {#4} - } +% Suppresses the author (from `natbib`). +\NewDocumentCommand \citeyearpar { o o m } + { \__csl_cite_in_text:nnnn {#1} {#2} {#3} { suppress-author } } \NewDocumentCommand \fullcite { o o m } - { \__csl_full_cite:nnn {#1} {#2} {#3} } + { \__csl_cite_in_text:nnnn {#1} {#2} {#3} { full-cite } } \seq_new:N \l__csl_cite_keys_seq @@ -54,36 +67,83 @@ \prop_new:N \l__csl_citation_properties_prop \prop_new:N \l__csl_citation_info_prop -% \__csl_cite:nnnn #1#2#3# -% #1: boolean of star form -% #2: prenote -% #3: postnote -% #4: cite keys -\cs_new:Npn \__csl_cite:nnnn #1#2#3#4 +% #1: prenote +% #2: postnote +% #3: cite keys +% #4: mode +\cs_new:Npn \__csl_cite_in_text:nnnn #1#2#3#4 { - \tl_if_blank:nTF {#4} - { \__csl_print_undefined_citation:n {#4} } + \tl_if_blank:nTF {#3} + { \__csl_print_undefined_citation:n {#3} } { \seq_clear:N \l__csl_cite_keys_seq \seq_clear:N \l__csl_citation_items_seq \prop_clear:N \l__csl_citation_properties_prop - \__csl_process_cite_input:nnn {#2} {#3} {#4} + \__csl_process_cite_input:nnn {#1} {#2} {#3} \__csl_process_citation_info:NN \l__csl_cite_keys_seq \l__csl_citation_items_seq - \IfBooleanT {#1} + \prop_put:Nnn \l__csl_citation_properties_prop { noteIndex } { 0 } + \tl_if_empty:nF {#4} { - \bool_if:NTF \l__csl_note_bool - { \msg_warning:nn { citation-style-language } { starred-cite-in-note-style } } + \prop_put:Nnn \l__csl_citation_properties_prop { mode } {#4} + } + \__csl_make_citation:N \l__csl_citation_info_prop + } + } + +% #1: prenote +% #2: postnote +% #3: cite keys +% #4: mode +\cs_new:Npn \__csl_cite_note:nnnn #1#2#3#4 + { + \bool_if:NTF \l__csl_in_note_bool + { + \tl_if_blank:nTF {#3} + { \__csl_print_undefined_citation:n {#3} } + { + \seq_clear:N \l__csl_cite_keys_seq + \seq_clear:N \l__csl_citation_items_seq + \prop_clear:N \l__csl_citation_properties_prop + \__csl_process_cite_input:nnn {#1} {#2} {#3} + \__csl_process_citation_info:NN \l__csl_cite_keys_seq \l__csl_citation_items_seq + \tl_if_empty:nF {#4} { - \prop_put:Nnn \l__csl_citation_properties_prop { noteIndex } { 0 } - \prop_put:Nnn \l__csl_citation_properties_prop { mode } { suppress-author } + \prop_put:Nnn \l__csl_citation_properties_prop { mode } {#4} + } + \__csl_make_citation:N \l__csl_citation_info_prop + } + } + { + \footnote + { + \tl_if_blank:nTF {#3} + { \__csl_print_undefined_citation:n {#3} } + { + \seq_clear:N \l__csl_cite_keys_seq + \seq_clear:N \l__csl_citation_items_seq + \prop_clear:N \l__csl_citation_properties_prop + \__csl_process_cite_input:nnn {#1} {#2} {#3} + \__csl_process_citation_info:NN \l__csl_cite_keys_seq \l__csl_citation_items_seq + \tl_if_empty:nF {#4} + { + \prop_put:Nnn \l__csl_citation_properties_prop { mode } {#4} + } + \__csl_make_citation:N \l__csl_citation_info_prop } } - \__csl_make_citation:N \l__csl_citation_info_prop } } -\msg_new:nnn { citation-style-language } { starred-cite-in-note-style } - { Starred~ variant~ of~ cite~ command~ does~ not~ work~ with~ note~ styles. } + +% #1: prenote +% #2: postnote +% #3: cite keys +\cs_new:Npn \__csl_cite_parens:nnn #1#2#3 + { + \bool_if:NTF \l__csl_note_bool + { ( \__csl_cite_in_text:nnnn {#1} {#2} {#3} { } ) } + { \__csl_cite_in_text:nnnn {#1} {#2} {#3} { } } + } \cs_new:Npn \__csl_text_cite:nnn #1#2#3 @@ -91,21 +151,10 @@ \bool_if:NTF \l__csl_note_bool { % In note styles, the authors are printed in-text followed by a note. - \bool_set_false:N \l__csl_note_bool - \__csl_cite_author:nnn {#1} {#2} {#3} - \bool_set_true:N \l__csl_note_bool - \__csl_cite:nnnn { \BooleanFalse } {#1} {#2} {#3} - } - { - \seq_clear:N \l__csl_cite_keys_seq - \seq_clear:N \l__csl_citation_items_seq - \prop_clear:N \l__csl_citation_properties_prop - \__csl_process_cite_input:nnn {#1} {#2} {#3} - \__csl_process_citation_info:NN \l__csl_cite_keys_seq \l__csl_citation_items_seq - \prop_put:Nnn \l__csl_citation_properties_prop { noteIndex } { 0 } - \prop_put:Nnn \l__csl_citation_properties_prop { mode } { composite } - \__csl_make_citation:N \l__csl_citation_info_prop + \__csl_cite_in_text:nnnn {#1} {#2} {#3} { author-only } + \__csl_cite_note:nnnn {#1} {#2} {#3} { } } + { \__csl_cite_in_text:nnnn {#1} {#2} {#3} { composite } } } @@ -121,8 +170,18 @@ { \tl_if_novalue:nTF {#3} { - \__csl_process_citation_info:NN \l__csl_cite_keys_seq \l__csl_citation_items_seq - \__csl_make_citation:N \l__csl_citation_info_prop + \bool_if:NTF \l__csl_note_bool + { + \footnote + { + \__csl_process_citation_info:NN \l__csl_cite_keys_seq \l__csl_citation_items_seq + \__csl_make_citation:N \l__csl_citation_info_prop + } + } + { + \__csl_process_citation_info:NN \l__csl_cite_keys_seq \l__csl_citation_items_seq + \__csl_make_citation:N \l__csl_citation_info_prop + } } { \__csl_process_cite_input:nnn {#1} {#2} {#3} @@ -131,48 +190,6 @@ } -\cs_new:Npn \__csl_cite_author:nnn #1#2#3 - { - \seq_clear:N \l__csl_cite_keys_seq - \seq_clear:N \l__csl_citation_items_seq - \prop_clear:N \l__csl_citation_properties_prop - \__csl_process_cite_input:nnn {#1} {#2} {#3} - \__csl_process_citation_info:NN \l__csl_cite_keys_seq \l__csl_citation_items_seq - \prop_put:Nnn \l__csl_citation_properties_prop { noteIndex } { 0 } - \prop_put:Nnn \l__csl_citation_properties_prop { mode } { author-only } - \bool_set_false:N \l__csl_note_bool - \__csl_make_citation:N \l__csl_citation_info_prop - } - - -\cs_new:Npn \__csl_cite_suppress_author:nnn #1#2#3 - { - \seq_clear:N \l__csl_cite_keys_seq - \seq_clear:N \l__csl_citation_items_seq - \prop_clear:N \l__csl_citation_properties_prop - \__csl_process_cite_input:nnn {#1} {#2} {#3} - \__csl_process_citation_info:NN \l__csl_cite_keys_seq \l__csl_citation_items_seq - \prop_put:Nnn \l__csl_citation_properties_prop { noteIndex } { 0 } - \prop_put:Nnn \l__csl_citation_properties_prop { mode } { suppress-author } - \bool_set_false:N \l__csl_note_bool - \__csl_make_citation:N \l__csl_citation_info_prop - } - - -\cs_new:Npn \__csl_full_cite:nnn #1#2#3 - { - \seq_clear:N \l__csl_cite_keys_seq - \seq_clear:N \l__csl_citation_items_seq - \prop_clear:N \l__csl_citation_properties_prop - \__csl_process_cite_input:nnn {#1} {#2} {#3} - \__csl_process_citation_info:NN \l__csl_cite_keys_seq \l__csl_citation_items_seq - \prop_put:Nnn \l__csl_citation_properties_prop { noteIndex } { 0 } - \prop_put:Nnn \l__csl_citation_properties_prop { mode } { full-cite } - \bool_set_false:N \l__csl_note_bool - \__csl_make_citation:N \l__csl_citation_info_prop - } - - % Appends the cite key into \l__csl_cite_keys_seq and cite-items into % \l__csl_citation_items_seq % #1, #2: prenote/postnote @@ -316,9 +333,19 @@ \__csl_process_citation_id:NN \l__csl_citation_id_tl #1 \__csl_get_note_index:N \l__csl_note_index_tl \prop_put:NnV \l__csl_citation_properties_prop { noteIndex } \l__csl_note_index_tl + \__csl_make_chapter_property: \__csl_add_back_ref_info: } +\cs_new:Npn \__csl_make_chapter_property: + { + \int_if_exist:NT \c@chapter + { + \prop_put:Nnx \l__csl_citation_properties_prop { chapterIndex } + { \int_use:N \c@chapter } + } + } + \tl_new:N \l__csl_back_ref_tl \prop_new:N \g__csl_back_ref_info_prop @@ -476,11 +503,7 @@ % #1: \l__csl_note_index_tl { \bool_if:NTF \l__csl_note_bool - { - \int_set_eq:Nc \l_tmpa_int { c@ \@mpfn } - \int_incr:N \l_tmpa_int - \tl_set:Nx #1 { \int_use:N \l_tmpa_int } - } + { \tl_set:Nx #1 { \int_use:c { c@ \@mpfn } } } { \tl_if_empty:NTF \l__csl_class_tl { @@ -490,7 +513,7 @@ \int_add:Nn \l_tmpa_int { \g__csl_pseudo_note_index_int } \tl_set:Nx #1 { \int_use:N \l_tmpa_int } } - { \tl_set:Nx #1 { 0 } } + { \tl_set:Nn #1 { 0 } } } } @@ -519,13 +542,7 @@ { \bool_if:NT \l__csl_regression_test_bool { \tl_show:N #1 } - \bool_if:NTF \l__csl_note_bool - { - \bool_if:NTF \l__csl_in_note_bool - {#1} - { \footnote {#1} } - } - {#1} + #1 } @@ -547,9 +564,7 @@ \bool_if:NT \l__csl_regression_test_bool { \tl_show:N \l__csl_citation_tl } \group_begin: - \bool_if:NTF \l__csl_note_bool - { \footnote { \reset@font \l__csl_citation_tl } } - { \reset@font \l__csl_citation_tl } + \reset@font \l__csl_citation_tl \group_end: } diff --git a/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-compatible.sty b/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-compatible.sty index 5289be43ee4..84da32c79b8 100644 --- a/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-compatible.sty +++ b/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-compatible.sty @@ -162,3 +162,21 @@ \cs_gset_eq:NN \cslcite \__csl_hyperref_cite_item:nn } } + + +% ### `perpage` + +\hook_gput_code:nnn { package / perpage / after } { . } + { + \hook_gput_code:nnn { begindocument } { . } + { + \cs_if_exist:cT { c@pchk@footnote } + { + \cs_set:Npn \__csl_make_chapter_property: + { + \prop_put:Nnx \l__csl_citation_properties_prop { chapterIndex } + { \int_use:N \c@page } + } + } + } + } diff --git a/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-init.sty b/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-init.sty index 65bc15d1162..de5b5bed4ce 100644 --- a/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-init.sty +++ b/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-init.sty @@ -248,7 +248,7 @@ turkmen = tk-TM, ukrainian = uk-UA, urdu = ur-IN, - UKenglish = en-UK, + UKenglish = en-GB, uppersorbian = hsb-DE, USenglish = en-US, usorbian = hsb-DE, diff --git a/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language.sty b/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language.sty index 484411beaed..f54f8d0e85e 100644 --- a/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language.sty +++ b/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language.sty @@ -9,7 +9,7 @@ \RequirePackage{expl3} \RequirePackage{xparse} -\ProvidesExplPackage {citation-style-language} {2024-08-15} {0.6.1} +\ProvidesExplPackage {citation-style-language} {2024-08-21} {0.6.2} {Citation Style Language for LaTeX} \RequirePackage { l3keys2e } |