diff options
author | Karl Berry <karl@freefriends.org> | 2024-03-10 20:05:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-03-10 20:05:53 +0000 |
commit | 2a7a4bc5f7b280171baee6973331f681d20ac23f (patch) | |
tree | 292d238dd9d9f0da7cbea2c607bd655a1ab8fc85 /Master/texmf-dist/tex | |
parent | 474e0bd8ac78e218ef711aeca99837358f7e0f4b (diff) |
citation-style-language (10mar24)
git-svn-id: svn://tug.org/texlive/trunk@70555 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-cite.sty | 67 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/citation-style-language/citation-style-language.sty | 2 |
2 files changed, 56 insertions, 13 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 1482a343833..6ebb300536d 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 @@ -6,14 +6,14 @@ % ## Citation commands -\DeclareDocumentCommand \cite { o o m } - { \__csl_cite:nnn {#1} {#2} {#3} } +\DeclareDocumentCommand \cite { s o o m } + { \__csl_cite:nnnn {#1} {#2} {#3} {#4} } -\NewDocumentCommand \parencite { o o m } - { \__csl_cite:nnn {#1} {#2} {#3} } +\NewDocumentCommand \parencite { s o o m } + { \__csl_cite:nnnn {#1} {#2} {#3} {#4} } \NewDocumentCommand \citep { o o m } - { \__csl_cite:nnn {#1} {#2} {#3} } + { \__csl_cite:nnnn { \BooleanFalse } {#1} {#2} {#3} } \NewDocumentCommand \textcite { o o m } { \__csl_text_cite:nnn {#1} {#2} {#3} } @@ -22,7 +22,7 @@ { \__csl_text_cite:nnn {#1} {#2} {#3} } \NewDocumentCommand \footcite { o o m } - { \__csl_cite:nnn {#1} {#2} {#3} } + { \__csl_cite:nnnn { \BooleanFalse } {#1} {#2} {#3} } % \cites[⟨prenote⟩][⟨postnote⟩]{⟨key⟩}...[⟨prenote⟩][⟨postnote⟩]{⟨key⟩} @@ -32,27 +32,56 @@ \NewDocumentCommand \citeauthor { o o m } { \__csl_cite_author:nnn {#1} {#2} {#3} } +% 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} + } + \seq_new:N \l__csl_cite_keys_seq \seq_new:N \l__csl_citation_items_seq \prop_new:N \l__csl_citation_properties_prop \prop_new:N \l__csl_citation_info_prop -% \__csl_cite:nnn #1#2#3 -\cs_new:Npn \__csl_cite:nnn #1#2#3 +% \__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 { - \tl_if_blank:nTF {#3} - { \__csl_print_undefined_citation:n {#3} } + \tl_if_blank:nTF {#4} + { \__csl_print_undefined_citation:n {#4} } { \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_cite_input:nnn {#2} {#3} {#4} \__csl_process_citation_info:NN \l__csl_cite_keys_seq \l__csl_citation_items_seq + \IfBooleanT {#1} + { + \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 { noteIndex } { 0 } + \prop_put:Nnn \l__csl_citation_properties_prop { mode } { suppress-author } + } + } \__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. } + \cs_new:Npn \__csl_text_cite:nnn #1#2#3 { @@ -62,7 +91,7 @@ \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:nnn {#1} {#2} {#3} + \__csl_cite:nnnn { \BooleanFalse } {#1} {#2} {#3} } { \seq_clear:N \l__csl_cite_keys_seq @@ -113,6 +142,20 @@ } +\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 + } + + % Appends the cite key into \l__csl_cite_keys_seq and cite-items into % \l__csl_citation_items_seq % #1, #2: prenote/postnote 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 603312dcf8e..4dd3456b78a 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-02-20} {0.4.6} +\ProvidesExplPackage {citation-style-language} {2024-03-10} {0.4.7} {Citation Style Language for LaTeX} \RequirePackage { l3keys2e } |