diff options
author | Karl Berry <karl@freefriends.org> | 2023-07-04 19:51:32 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-07-04 19:51:32 +0000 |
commit | c0c3efe9ccc6a70b02e71a9e088dd81644c4c9df (patch) | |
tree | 7a4bca6e2815838b9062a93d37cc9dbf744bafac /Master/texmf-dist/tex | |
parent | 498132a6f510f7940812eb9df6b341b38f6e3132 (diff) |
citation-style-language (4jul23)
git-svn-id: svn://tug.org/texlive/trunk@67541 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
7 files changed, 109 insertions, 43 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 5c4b229bffd..9ac52d7df0f 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 @@ -249,7 +249,9 @@ \prop_new:N \l__csl_back_ref_section_pop % Provide empty \@currentHref when hyperref is not loaded. -\cs_new:Npn \@currentHref {} +% LaTeX2e 2023-06-01 defines `\@currentHref` in the kernel. +\cs_if_exist:NF \@currentHref + { \cs_new:Npn \@currentHref {} } % TODO: write backref info to .brf file or .aux file \cs_new:Npn \__csl_add_back_ref_info: @@ -440,11 +442,18 @@ \cs_new:Npn \__csl_print_undefined_citation:n #1 % #1: keys { - \G@refundefinedtrue - \msg_warning:nnn { citation-style-language } { citation / undefined } {#1} \tl_if_blank:nTF {#1} - { \tl_set:Nn \l__csl_citation_tl { [ \textbf { ? } ] } } - { \tl_set:Nn \l__csl_citation_tl { [ \textbf {#1} ] } } + { + \__csl_warn_citation_undefined:n { } + \__csl_set_undefined_cite:n { ? } + } + { + \clist_map_inline:nn {#1} { \__csl_warn_citation_undefined:n {##1} } + % Underscores in citation keys like `zankl_kunstliche_2019` may cause a missing $ error. + % Thus We convert them to str. + \tl_set:Nx \l_tmpa_str { \tl_to_str:n {#1} } + \exp_args:NV \__csl_set_undefined_cite:n \l_tmpa_str + } \bool_if:NT \l__csl_regression_test_bool { \tl_show:N \l__csl_citation_tl } \group_begin: @@ -452,8 +461,20 @@ \group_end: } -\msg_new:nnn { citation-style-language } { citation / undefined } - { Citation~ `#1'~ on~ page~ \thepage \space undefined~ \msg_line_context: . } +\cs_new:Npn \__csl_set_undefined_cite:n #1 + { + \tl_set:Nn \l__csl_citation_tl { [ \textbf {#1} ] } + } + +% \msg_new:nnn { citation-style-language } { citation / undefined } +% { Citation~ `#1'~ on~ page~ \thepage \space undefined~ \msg_line_context: . } + +\cs_new:Npn \__csl_warn_citation_undefined:n #1 + { + \G@refundefinedtrue + % The warning message is read by latexmk. + \@latex@warning {Citation~ `#1'~ on~ page~ \thepage \space undefined} + } \DeclareDocumentCommand \nocite { m } 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 53aea6d4f5e..ff35eed14e8 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 @@ -62,13 +62,21 @@ \cs_new:Npn \__csl_initialize_lua_module: { - \lua_now:e + \tl_if_blank:VTF \l__csl_style_tl + { \msg_warning:nn { citation-style-language } { empty-style-name } } { - csl.init( - "\l__csl_style_tl", - "\l__csl_bib_resources_clist", - "\l__csl_locale_tl" - ) + \clist_if_empty:NTF \l__csl_bib_resources_clist + { \msg_warning:nn { citation-style-language } { empty-bib-resources } } + { + \lua_now:e + { + csl.init( + "\l__csl_style_tl", + "\l__csl_bib_resources_clist", + "\l__csl_locale_tl" + ) + } + } } \str_if_eq:eeT { \lua_now:n { tex.print(csl.initialized) } } { true } { \bool_set_true:N \l__csl_engine_initialized_bool } @@ -78,6 +86,12 @@ { } } +\msg_new:nnn { citation-style-language } { empty-style-name } + { Style~ name~ not~ specified. } + +\msg_new:nnn { citation-style-language } { empty-bib-resources } + { Empty~ bibliographic~ resources. Use~ \token_to_str:N \addbibresource. } + % \str_new:N \l__csl_style_class_str % In-text (including numeric or author-date) or note style 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 0e97c76dd5d..974b918c8de 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} {2023-04-12} {v0.4.1} +\ProvidesExplPackage {citation-style-language} {2023-07-04} {0.4.2} {Citation Style Language for LaTeX} \RequirePackage { l3keys2e } @@ -91,6 +91,13 @@ bib-entry-page-break .bool_set:N = \l__csl_bib_entry_page_break_bool , bib-item-sep .tl_set:N = \l__csl_bib_item_sep_tl , bib-hang .tl_set:N = \l__csl_bib_hang_tl , + % The following keys are for easier interaction between LaTeX and + % citeproc-lua engine and they are not designed for end-users. + undefined-cites .code:n = + { + \clist_map_inline:nn {#1} + { \__csl_warn_citation_undefined:n {##1} } + } , } \cs_new:Npn \__csl_set_back_ref:n #1 @@ -133,6 +140,13 @@ { \tl_gset:Nn \g__csl_aux_bibstyle_tl {#1} } +% Write to an empty `.ccf` file for use with latexmk +\iow_new:N \l__csl_ccf_iow +\iow_open:Nn \l__csl_ccf_iow { \c_sys_jobname_str .ccf } +\iow_now:Nx \l__csl_ccf_iow { } +\iow_close:N \l__csl_ccf_iow + + % Load other modules \input{citation-style-language-init.sty} \input{citation-style-language-data.sty} diff --git a/Master/texmf-dist/tex/latex/citation-style-language/styles/apa.csl b/Master/texmf-dist/tex/latex/citation-style-language/styles/apa.csl index f371046fe36..a71a9926895 100644 --- a/Master/texmf-dist/tex/latex/citation-style-language/styles/apa.csl +++ b/Master/texmf-dist/tex/latex/citation-style-language/styles/apa.csl @@ -14,7 +14,7 @@ <category citation-format="author-date"/> <category field="psychology"/> <category field="generic-base"/> - <updated>2022-10-02T16:08:41-04:00</updated> + <updated>2023-05-13T12:14:52-04:00</updated> <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights> </info> <locale xml:lang="en"> @@ -502,9 +502,6 @@ </else> </choose> </macro> - <macro name="date-sort-date"> - <date variable="issued" form="numeric"/> - </macro> <macro name="date-intext"> <choose> <if variable="issued"> @@ -1599,7 +1596,7 @@ </if> <else> <group delimiter=" "> - <text value="Original work published"/> + <text term="original-work-published" text-case="capitalize-first"/> <choose> <if is-uncertain-date="original-date"> <text term="circa" form="short"/> @@ -1865,7 +1862,7 @@ <sort> <key macro="author-bib" names-min="3" names-use-first="1"/> <key macro="date-sort-group"/> - <key macro="date-sort-date" sort="ascending"/> + <key macro="date-bib" sort="ascending"/> <key variable="status"/> </sort> <layout prefix="(" suffix=")" delimiter="; "> @@ -1880,7 +1877,7 @@ <sort> <key macro="author-bib"/> <key macro="date-sort-group"/> - <key macro="date-sort-date" sort="ascending"/> + <key macro="date-bib" sort="ascending"/> <key variable="status"/> <key macro="title"/> </sort> diff --git a/Master/texmf-dist/tex/latex/citation-style-language/styles/chicago-author-date.csl b/Master/texmf-dist/tex/latex/citation-style-language/styles/chicago-author-date.csl index 9baa4a8cf7d..267185cacf7 100644 --- a/Master/texmf-dist/tex/latex/citation-style-language/styles/chicago-author-date.csl +++ b/Master/texmf-dist/tex/latex/citation-style-language/styles/chicago-author-date.csl @@ -33,7 +33,7 @@ <category citation-format="author-date"/> <category field="generic-base"/> <summary>The author-date variant of the Chicago style</summary> - <updated>2022-12-11T23:02:09-05:00</updated> + <updated>2023-06-25T17:05:17-04:00</updated> <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights> </info> <locale xml:lang="en"> @@ -217,7 +217,7 @@ <choose> <if variable="title" match="none"> <choose> - <if type="personal_communication" match="none"> + <if type="personal_communication speech thesis" match="none"> <text variable="genre" text-case="capitalize-first"/> </if> </choose> diff --git a/Master/texmf-dist/tex/latex/citation-style-language/styles/ieee.csl b/Master/texmf-dist/tex/latex/citation-style-language/styles/ieee.csl index cf5ae110eab..5a642d31131 100644 --- a/Master/texmf-dist/tex/latex/citation-style-language/styles/ieee.csl +++ b/Master/texmf-dist/tex/latex/citation-style-language/styles/ieee.csl @@ -45,7 +45,7 @@ <category field="engineering"/> <category field="generic-base"/> <summary>IEEE style as per the 2021 guidelines, V 01.29.2021.</summary> - <updated>2023-03-29T08:47:55-04:00</updated> + <updated>2023-04-22T23:05:51-04:00</updated> <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights> </info> <locale xml:lang="en"> @@ -174,25 +174,20 @@ </macro> <macro name="event"> <choose> + <!-- Published Conference Paper --> <if type="paper-conference speech" match="any"> <choose> - <!-- Published Conference Paper --> <if variable="container-title" match="any"> - <group delimiter=", "> - <group delimiter=" "> - <text term="in"/> - <text variable="container-title" font-style="italic"/> - </group> + <group delimiter=" "> + <text term="in"/> + <text variable="container-title" font-style="italic"/> </group> </if> <!-- Unpublished Conference Paper --> <else> - <group delimiter=", "> - <group delimiter=" "> - <text term="presented at"/> - <text variable="event"/> - </group> - <text variable="event-place"/> + <group delimiter=" "> + <text term="presented at"/> + <text variable="event"/> </group> </else> </choose> diff --git a/Master/texmf-dist/tex/latex/citation-style-language/styles/vancouver.csl b/Master/texmf-dist/tex/latex/citation-style-language/styles/vancouver.csl index c3a0332c87e..21c27b899c8 100644 --- a/Master/texmf-dist/tex/latex/citation-style-language/styles/vancouver.csl +++ b/Master/texmf-dist/tex/latex/citation-style-language/styles/vancouver.csl @@ -19,7 +19,7 @@ <category citation-format="numeric"/> <category field="medicine"/> <summary>Vancouver style as outlined by International Committee of Medical Journal Editors Uniform Requirements for Manuscripts Submitted to Biomedical Journals: Sample References</summary> - <updated>2022-09-28T07:33:04-04:00</updated> + <updated>2023-06-24T15:29:06-04:00</updated> <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights> </info> <locale xml:lang="en"> @@ -50,6 +50,7 @@ <name sort-separator=" " initialize-with="" name-as-sort-order="all" delimiter=", " delimiter-precedes-last="always"/> <label form="long" prefix=", "/> <substitute> + <text macro="webpage-title"/> <names variable="editor"/> </substitute> </names> @@ -67,6 +68,17 @@ </if> </choose> </macro> + <macro name="webpage-title"> + <!--If a webpage has a container, we're assuming the citation is "part of a website" as per ch. 25 Citing Medicine https://www.ncbi.nlm.nih.gov/books/NBK7274/?report=reader --> + <choose> + <if type="webpage" variable="container-title" match="all"> + <group delimiter=" "> + <text variable="container-title"/> + <text term="internet" prefix="[" suffix="]" text-case="capitalize-first"/> + </group> + </if> + </choose> + </macro> <macro name="publisher"> <choose> <!--discard publisher info for articles--> @@ -164,16 +176,21 @@ </choose> </macro> <macro name="title"> - <text variable="title"/> <choose> - <if type="article-journal article-magazine chapter paper-conference article-newspaper review review-book entry-dictionary entry-encyclopedia" match="none"> + <if type="webpage" variable="container-title" match="all"/> + <else> + <text variable="title"/> <choose> - <if variable="URL"> - <text term="internet" prefix=" [" suffix="]" text-case="capitalize-first"/> + <if type="article-journal article-magazine chapter paper-conference article-newspaper review review-book entry-dictionary entry-encyclopedia" match="none"> + <choose> + <if variable="URL"> + <text term="internet" prefix=" [" suffix="]" text-case="capitalize-first"/> + </if> + </choose> + <text macro="edition" prefix=". "/> </if> </choose> - <text macro="edition" prefix=". "/> - </if> + </else> </choose> <choose> <if type="thesis"> @@ -283,6 +300,13 @@ </if> </choose> </macro> + <macro name="webpage-part"> + <choose> + <if type="webpage" variable="container-title" match="all"> + <text variable="title"/> + </if> + </choose> + </macro> <macro name="collection-details"> <choose> <if type="article-journal article-magazine article-newspaper review review-book" match="none"> @@ -342,6 +366,7 @@ <text macro="journal-location"/> <text macro="pages"/> </group> + <text macro="webpage-part"/> </group> <text macro="collection-details" suffix=". "/> <text macro="report-details" suffix=". "/> |