diff options
Diffstat (limited to 'macros')
132 files changed, 8588 insertions, 4074 deletions
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/README b/macros/latex/contrib/biblatex-contrib/biblatex-apa/README index 0d6e552303..7a5602951d 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/README +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/README @@ -1,7 +1,7 @@ Permission is granted to copy, distribute and/or modify this software under the terms of the LaTeX Project Public License, version 1.3c (http://www.latex-project.org/lppl.txt). The current -maintainer is Philip Kime (© 2019). +maintainer is Philip Kime (© 2022). This package is a biblatex style for APA (American Psychological Association) style compliant documents typeset in LaTeX. It diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/american-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/american-apa.lbx index 4d9ee874c6..ad5493e264 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/american-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/american-apa.lbx @@ -1,6 +1,7 @@ -\ProvidesFile{american-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{american-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{american} +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -264,7 +265,8 @@ washington = {{Washington}{{W\adddot A\adddot}}}, westvirginia = {{West Virginia}{{W\adddot V\adddot}}}, wisconsin = {{Wisconsin}{{W\adddot I\adddot}}}, - wyoming = {{Wyoming}{{W\adddot Y\adddot}}} + wyoming = {{Wyoming}{{W\adddot Y\adddot}}}, + publication = {{Publication}{Publication}} } % @@ -276,68 +278,86 @@ \DeclareBibliographyExtras{% \def\urldatecomma{\addcomma\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY {}% - {\iffieldundef{#2}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + {\mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY {}% {\addspace}% - \stripzeros{\thefield{#3}}% - \iffieldundef{#1}% + \stripzeros{\thefield{#4}}% + \iffieldundef{#1}% YEAR {}% - {\ifthenelse{\iffieldundef{#3}}% - {\ifthenelse{\iffieldundef{#2}}% + {\iffieldundef{#4}% + {\iffieldundef{#3}% {}% {\addspace}}% {\addcomma\addspace}% diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx index 5523f83e17..ee19f6dd0a 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx @@ -12,7 +12,7 @@ %% %% The Current Maintainer of this work is Philip Kime. -\ProvidesFile{apa.bbx}[2021/12/24\space v9.15\space APA biblatex references style] +\ProvidesFile{apa.bbx}[2022/06/22\space v9.16\space APA biblatex references style] \RequireBiber[3] \RequireBibliographyStyle{standard} \urlstyle{same} % APA examples all have URLs in same font as text @@ -157,37 +157,41 @@ or test {\ifentrytype{legal}} or ( test {\ifentrytype{legadminmaterial}} and test {\ifkeyword{proposed}} ) } - {\printtext{% - \mkbibdateapalongmdy{#1year}{#1month}{#1day}% + {\printtext[#1date]{% + \mkbibdateapalongmdy{#1year}{#1yeardivision}{#1month}{#1day}% \iffieldundef{#1endyear}% {}% {\iffieldequalstr{#1endyear}{}% open-ended range? {\bibdatedash\bibstring{present}} - {\bibdatedash% - \iffieldsequal{#1year}{#1endyear}% - {\iffieldsequal{#1month}{#1endmonth}% - {\iffieldsequal{#1day}{#1endday}% - {}% - {\mkbibdateapalongmdy{}{}{#1endday}}}% - {\mkbibdateapalongmdy{}{#1endmonth}{#1endday}}}% - {\mkbibdateapalongmdy{#1endyear}{#1endmonth}{#1endday}}}}% + {\iffieldundef{#1endyeardivision} + {\bibdatedash% + \iffieldsequal{#1year}{#1endyear}% + {\iffieldsequal{#1month}{#1endmonth}% + {\iffieldsequal{#1day}{#1endday}% + {}% + {\mkbibdateapalongmdy{}{}{}{#1endday}}}% + {\mkbibdateapalongmdy{}{}{#1endmonth}{#1endday}}}% + {\mkbibdateapalongmdy{#1endyear}{#1endyeardivision}{#1endmonth}{#1endday}}}} + {\addslash\mkbibdateapalongmdy{}{#1endyeardivision}{}{}}}% \dateuncertainprint}} {\printtext{% - \mkbibdateapalong{#1year}{#1month}{#1day}% + \mkbibdateapalong{#1year}{#1yeardivision}{#1month}{#1day}% \dateeraprint{#1year}% \iffieldundef{#1endyear}% {}% {\iffieldequalstr{#1endyear}{}% open-ended range? {\bibdatedash\bibstring{present}} - {\bibdatedash% - \iffieldsequal{#1year}{#1endyear}% - {\iffieldsequal{#1month}{#1endmonth}% - {\iffieldsequal{#1day}{#1endday}% - {}% - {\mkbibdateapalong{}{}{#1endday}}}% - {\mkbibdateapalong{}{#1endmonth}{#1endday}}}% - {\mkbibdateapalong{#1endyear}{#1endmonth}{#1endday}% - \dateeraprint{#1endyear}}}% + {\iffieldundef{#1endyeardivision} + {\bibdatedash% + \iffieldsequal{#1year}{#1endyear}% + {\iffieldsequal{#1month}{#1endmonth}% + {\iffieldsequal{#1day}{#1endday}% + {}% + {\mkbibdateapalong{}{}{}{#1endday}}}% + {\mkbibdateapalong{}{}{#1endmonth}{#1endday}}}% + {\mkbibdateapalong{#1endyear}{#1endyeardivision}{#1endmonth}{#1endday}% + \dateeraprint{#1endyear}}} + {\addslash\mkbibdateapalongmdy{}{#1endyeardivision}{}{}}}% \enddateuncertainprint}}}}% \endgroup} @@ -196,24 +200,26 @@ \begingroup \blx@metadateinfo{#1}% \iffieldundef{#1year}{} - {\printtext{% + {\printtext[#1date]{% \datecircaprint - \mkbibdateapalongextra{#1year}{#1month}{#1day}% + \mkbibdateapalongextra{#1year}{#1yeardivision}{#1month}{#1day}% \dateeraprint{#1year}% \dateuncertainprint \iffieldundef{#1endyear}% {}% {\iffieldequalstr{#1endyear}{}% open-ended range? {\bibdatedash\bibstring{present}} - {\bibdatedash% - \iffieldsequal{#1year}{#1endyear}% - {\iffieldsequal{#1month}{#1endmonth}% - {\iffieldsequal{#1day}{#1endday}% - {}% - {\mkbibdateapalongextra{}{}{#1endday}}} - {\mkbibdateapalongextra{}{#1endmonth}{#1endday}}} - {\mkbibdateapalongextra{#1endyear}{#1endmonth}{#1endday}% - \dateeraprint{#1endyear}}}% + {\iffieldundef{#1endyeardivision} + {\bibdatedash% + \iffieldsequal{#1year}{#1endyear}% + {\iffieldsequal{#1month}{#1endmonth}% + {\iffieldsequal{#1day}{#1endday}% + {}% + {\mkbibdateapalongextra{}{}{}{#1endday}}} + {\mkbibdateapalongextra{}{}{#1endmonth}{#1endday}}} + {\mkbibdateapalongextra{#1endyear}{#1endyeardivision}{#1endmonth}{#1endday}% + \dateeraprint{#1endyear}}} + {\addslash\mkbibdateapalongmdy{}{#1endyeardivision}{}{}}}% \enddateuncertainprint}}}% \endgroup} @@ -226,8 +232,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % (APA 8.12) sort citations -% (APA 8.17) More than two authors is truncated to one but overriden for list ambiguity to -% point of no ambiguity +% (APA 8.17,8.18) More than two authors is truncated to one but overriden for list ambiguity to +% point of no ambiguity but only when same year. % (APA 8.20) Use initials to disambiguate shared surnames % (APA 8.19) Use year postfix to disambiguate multiple items in same year % (APA 9.44, 9.46, 9.47) Sorting is nyt but we need to account for PUBSTATE which comes @@ -236,6 +242,25 @@ % (APA Figure 9.2) Sorting ignores punctuation in names % (APA 9.47) Ignore "The", "An" and "A" when sorting titles +% Used for sorting citations with biblatex option "sortcites" as this needs to use +% the silly APA standards for name list visibility (8.17, 8.18) in cites which differs from the reference list. +\DeclareSortingNamekeyTemplate[apasortcite]{ + \visibility{cite} + \keypart{ + \namepart[use=true]{prefix} + \namepart{family} + } + \keypart{ + \namepart{given} + } + \keypart{ + \namepart{suffix} + } + \keypart{ + \namepart[use=false]{prefix} + } +} + \DeclareNosort{ \nosort{setnames}{\regexp{\p{General_Category=Punctuation}}} \nosort{settitles}{\regexp{\A(?:The|An|A)\s+}} @@ -322,6 +347,7 @@ maxitems=999,% origdate=apalong,% pagetracker=true,% + pluralothers=true,% sortcites=true,% sorting=apa,% uniquelist=minyear,% @@ -332,7 +358,35 @@ usetranslator=true,% usenarrator=true} + +% It's not completely obvious but it's implied that names identical apart from a suffix +% are to be treated as different name lists for extradate calculation so we add suffix +% to the default definition +\DeclareUniquenameTemplate{ + \namepart[use=true, base=true]{prefix} + \namepart[base=true]{family} + \namepart{given} + \namepart{suffix} +} + +% Force, in every refsection, the generation of refcontext data with a +% sorting name key template which works for citation sorting with sortcites. This +% would not be generated in the .bcf otherwise and therefore no sorted list +% with this sorting name key tenplate would generated in teh .bbl by biber because no +% \printbibliography would be executed in this context since it is only +% used for sorting of citations truncated to one name as per 8.17/8.18. % +% Two things needs to happen in general: +% 1. Generate the refcontext sorted data list in the .bbl (biber) which requires a datalist +% section in the .bcf. This latter is done by \printbibliography/\printbiblist or \GenRefcontextData +% when no \printbibliography/\printbiblist is done in the refcontext +% 2. Switch to the relevant refcontext at the right time in order to pull the date from the +% correct data list (\newrefcontext/\begin{refcontext}) +\AtBeginRefsection{\GenRefcontextData{sortingnamekeytemplatename=apasortcite}} +% Switch to the reference context using citation visibility setting for sorting of citations +\AtEveryCite{\localrefcontext[sortingnamekeytemplatename=apasortcite]} + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Enforce ignoring of PUBSTATE if there is a YEAR or DATE field @@ -367,6 +421,7 @@ \map{ \pertype{inproceedings} \step[notfield=editor, final] + \step[notfield=crossref, final]% A bit suspect but assuming that any crossref contains EDITOR \step[fieldsource=booktitle, fieldtarget=journaltitle] \step[typesource=inproceedings, typetarget=article] } @@ -427,7 +482,7 @@ \DeclareFieldFormat{maintitleaddon}{\mkbibbrackets{\bbx@colon@search\MakeSentenceCase*{#1}}} % NOTE -\DeclareFieldFormat[legmaterial,legadminmaterial]{note}{\mkbibparens{#1}} +\DeclareFieldFormat[legmaterial,legadminmaterial,report]{note}{\mkbibparens{#1}} % BOOKTITLEADDON \DeclareFieldFormat{booktitleaddon}{\mkbibbrackets{\bbx@colon@search\MakeSentenceCase*{#1}}} @@ -451,7 +506,6 @@ \DeclareFieldFormat{volumes}{\bibcpstring{volumes}~#1} % CHAPTER - \DeclareFieldFormat{chapter}{\bibcpstring{chapter}~\apanum{#1}} % NUMBER @@ -467,7 +521,8 @@ \ifthenelse{% \iffieldequalstr{type}{report}\OR% \iffieldequalstr{type}{execorder}}{\bibcpstring{number}~\apanum{#1}}{\apanum{#1}}} - +\DeclareFieldFormat[thesis]{number}{% + \bibcpstring{publication}\setunit{\addspace}\bibcpstring{number}~\apanum{#1}} % PAGES \DeclareFieldFormat{pageswithprefix}{\mkpageprefix[bookpagination]{#1}} @@ -496,10 +551,6 @@ \DeclareFieldFormat[dataset,software]{version}{\bibcpstring{version}~#1} \DeclareFieldFormat[online]{version}{\mkbibparens{#1}} -% URL -\DeclareFieldFormat{url}{\url{#1}} -\DeclareFieldFormat{urldate}{#1} - % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -522,16 +573,6 @@ % to do \printnames[format][-\value{listtotal}]{field} to ensure we get % all of the names in the list to work on -% It's not completely obvious but it's implied that names identical apart from a suffix -% are to be treated as different name lists for extradate calculation so we add suffix -% to the default definition -\DeclareUniquenameTemplate{ - \namepart[use=true, base=true]{prefix} - \namepart[base=true]{family} - \namepart{given} - \namepart{suffix} -} - \DeclareNameAlias{default}{apaauthor} \DeclareNameFormat{apaauthor}{% @@ -575,7 +616,7 @@ {}} \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\newunitpunct} -\DeclareDelimAlias*[bib,biblist]{nonameyeardelim}{nameyeardelim} +\DeclareDelimAlias[bib,biblist]{nonameyeardelim}{nameyeardelim} \renewbibmacro*{author/editor}{% \ifnameundef{author} @@ -730,7 +771,8 @@ \setunit{\subtitlepunct}% \printfield[apacase]{subtitle}}}% \setunit{\addspace}% - \ifentrytype{inbook}{}{\usebibmacro{addinfo1}}% additional info in parens + \ifthenelse{\ifentrytype{inbook}\OR\ifentrytype{thesis}}{}{\usebibmacro{addinfo1}}% additional info in parens + \ifentrytype{thesis}{\usebibmacro{addinfo3}}{}% \setunit{\addspace}% \printfield{titleaddon}% \setunit{\addspace}% @@ -743,7 +785,6 @@ \printfield{edition}% \setunit*{\addcomma\addspace}% \ifthenelse{\ifentrytype{report}\OR% - \ifentrytype{thesis}\OR% \ifentrytype{unpublished}\OR% \ifentrytype{dataset}\OR% \ifentrytype{software}\OR% @@ -753,9 +794,9 @@ \setunit*{\addcomma\addspace}% \ifentrytype{inbook}{\printfield{pages}}{}% \setunit*{\addcomma\addspace}% - \ifentrytype{book}{\printfield{volumes}}{}% + \ifthenelse{\ifentrytype{book}\OR\ifentrytype{inbook}}{\printfield{volumes}}{}% \setunit*{\addcomma\addspace}% - \ifentrytype{book}{\printfield{volume}}{}}} + \ifthenelse{\ifentrytype{book}\OR\ifentrytype{inbook}}{\printfield{volume}}{}}} % Additional post title information in brackets unless it's the meta subtype "nonacademic" % which is used to conditionalise date formats in the .lbx files @@ -767,22 +808,33 @@ {\bibcplstring{\thefield{entrysubtype}}} {\printfield{entrysubtype}}}% \setunit*{\addsemicolon\addspace}% - \printfield{note}}} + \ifentrytype{report}{}{\printfield{note}}}} % number/issue information \newbibmacro*{addinfo3}{% - \iffieldundef{type} - {\iffieldundef{issue} - {\iffieldnums{number}{\bibcpstring{number}~}{}\printfield{number}} - {\printfield{issue}\setunit{\addspace}% - \iffieldundef{number} + \ifentrytype{thesis} + {\iffieldundef{number} + {} + {\printtext[parens]{\printfield{number}}}% + \setunit{\addspace}% + \iffieldundef{type} + {} + {% Inconsistent - standard thesis types have institution inside the brackts, manual types outside ... + \ifthenelse{\iffieldequalstr{type}{phdthesis}\OR\iffieldequalstr{type}{mathesis}} + {\printtext[brackets]{\printfield{type}\setunit*{\addcomma\addspace}\printlist{institution}}} + {\printtext[brackets]{\printfield{type}}\setunit*{\adddot\addspace}\printlist{institution}}}} + {\iffieldundef{type} + {\iffieldundef{issue} + {\iffieldnums{number}{\bibcpstring{number}~}{}\printfield{number}} + {\printfield{issue}\setunit{\addspace}% + \iffieldundef{number} {} {\iffieldnums{number}{\bibcpstring{number}~}{}\printfield{number}}}} - {\printfield{type}\setunit{\addspace}% - \iffieldundef{number} - {} - {\iffieldnums{number}{\bibcpstring{number}~}{}\printfield{number}}}% - \ifthenelse{\ifentrytype{dataset}\OR\ifentrytype{software}} + {\printfield{type}\setunit{\addspace}% + \iffieldundef{number} + {} + {\bibcpstring{number}~\printfield{number}}}}% Inconsistent - numbers after type aren't necessarily numbers ... + \ifthenelse{\ifentrytype{dataset}\OR\ifentrytype{software}} {\setunit*{\addsemicolon\addspace}% \printfield{version}} {}} @@ -1284,7 +1336,9 @@ {\usebibmacro{in}% \printnames[apanames][-\value{listtotal}]{execproducer}% \setunit{\addspace}% - \bibcplstring[\mkbibparens]{execproducers}% + \ifthenelse{\the\c@execproducer=1}% + {\bibcplstring[\mkbibparens]{execproducer}} + {\bibcplstring[\mkbibparens]{execproducers}}% \setunit{\addcomma\addspace}% \printfield{maintitle}}} @@ -1383,24 +1437,22 @@ \settoggle{bbx:annotation}{#1}} \ExecuteBibliographyOptions{annotation=true} +\long\def\blxapa@appunit#1{% + \iftoggle{blx@keepunit} + {} + {\gappto\blx@unitpunct{#1}% + \global\toggletrue{blx@unit}}} + \renewbibmacro*{annotation}{% - \ifboolexpr{test {\iffieldundef{annotation}} - or not togl {bbx:annotation}} - {\IfFileExists{\bibannotationprefix\thefield{entrykey}.tex} - {\begingroup - \togglefalse{blx@bibliography}% - \newline - \setunit{}% - \printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}% - \endgroup} - {}} + \iftoggle{bbx:annotation} {\begingroup \togglefalse{blx@bibliography}% - \newline - \setunit{}% - \printfield{annotation}% - \endgroup}} - + \blxapa@appunit{\newline}% + \iffieldundef{annotation} + {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}} + {\printfield{annotation}}% + \endgroup} + {}} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1904,6 +1956,8 @@ \setunit{\printdelim{nametitledelim}}\newblock \usebibmacro{title}% \setunit{\addspace}\newblock + \printfield{note}% + \setunit{\addspace}\newblock \usebibmacro{apa:related}% \newunit\newblock \printlist{institution}% @@ -1951,8 +2005,6 @@ \setunit{\printdelim{nametitledelim}}\newblock \usebibmacro{title}% \newunit\newblock - \printlist{institution}% - \newunit\newblock \usebibmacro{location+publisher}% \newunit\newblock \usebibmacro{doi+url}% @@ -2066,9 +2118,22 @@ -%(APA 9.35) No periods after URLS +%(APA 9.35) No periods after URLS and DOIs % we'll override a global url option for for @online entries \ExecuteBibliographyOptions[online]{url=true} + +\DeclareFieldFormat{doi}{% + \ifhyperref + {\href{https://doi.org/#1}{\nolinkurl{https://doi.org/#1}}} + {\nolinkurl{https://doi.org/#1}}% + \nopunct} + +\DeclareFieldFormat{url}{\url{#1}\nopunct} + +\DeclareFieldFormat{urldate}{% + \bibstring{retrieved}\space#1% + \urldatecomma\bibstring{from}} + \newbibmacro*{doi+url}{% \ifboolexpr{ test {\iffieldundef{doi}} or not togl {bbx:doi}} @@ -2078,7 +2143,6 @@ {\usebibmacro{url+urldate}% \setunit{\addspace}}} {\printfield{doi}% - \renewcommand*{\finentrypunct}{\relax}% \setunit{\addspace}}} \renewbibmacro*{url+urldate}{% @@ -2086,18 +2150,9 @@ {} {\iffieldundef{urlyear} {} - {\bibstring{retrieved}% - \setunit{\addspace}% - \printurldate - \setunit{\urldatecomma}% - \bibstring{from}% + {\printurldate \setunit{\addspace}}% - \iffieldundef{url}{}{\printfield{url}\renewcommand*{\finentrypunct}{\relax}}}} - -\DeclareFieldFormat{doi}{% - \ifhyperref - {\href{https://doi.org/#1}{\nolinkurl{https://doi.org/#1}}} - {\nolinkurl{https://doi.org/#1}}} + \printfield{url}}} \newbibmacro*{location+publisher}{% \printlist{location}% diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.cbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.cbx index 22e489feaa..591fa50aea 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.cbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.cbx @@ -12,7 +12,7 @@ %% %% The Current Maintainer of this work is Philip Kime. -\ProvidesFile{apa.cbx}[2021/12/24\space v9.15\space APA biblatex citation style] +\ProvidesFile{apa.cbx}[2022/06/22\space v9.16\space APA biblatex citation style] \RequireBiber[3] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -45,7 +45,6 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % (APA 8.10) Suffices are not shown in citations -% (APA 8.17) 3+ authors have "et al." % (APA 8.20) Initials only for primary author and only when not unique across all *primary* authors \newbibmacro*{labelname:doname}[8]{% @@ -118,12 +117,12 @@ \def\citeresetapa{\global\let\cbx@apa@names\@empty} \citeresetapa \def\cbx@apa@ifnamesaved{% - \xifinlist{\thefield{fullhash}}{\cbx@apa@names} + \xifinlist{\thefield{namehash}}{\cbx@apa@names} {\@firstoftwo} {\@secondoftwo}} \newbibmacro*{cite:author}{% - \iffieldequals{fullhash}{\cbx@lasthash} + \iffieldequals{namehash}{\cbx@lasthash} % Multiple cites in one command {\setunit{\compcitedelim}% \usebibmacro{cite:plabelyear+extradate}}% @@ -131,7 +130,7 @@ {\ifnameundef{labelname} % No author/editor {\usebibmacro{cite:noname}% - \savefield{fullhash}{\cbx@lasthash}} + \savefield{namehash}{\cbx@lasthash}} % Normal cite {\ifnameundef{shortauthor} {\printnames{labelname}}% @@ -139,20 +138,11 @@ {\printnames{shortauthor}} {\printnames[labelname]{author}% \addspace\printnames[sabrackets]{shortauthor}}}% - \savefield{fullhash}{\cbx@lasthash}}}% + \savefield{namehash}{\cbx@lasthash}}}% \setunit{\multicitedelim}} -% Using fullhash instead of namehash otherwise we may omit namelist for -% lists which are equal only because of minnames truncation i.e: -% -% X and Y and Z (2009) -% X and W and V (2010) -% -% which have the same namehash due to minnames visibility truncation to 1 -% would be printed incorrectly as -% \cite{one, two} -> X, Y & Z 2009, 2010 \newbibmacro*{cite}{% - \iffieldequals{fullhash}{\cbx@lasthash} + \iffieldequals{namehash}{\cbx@lasthash} % Multiple cites in one command {\setunit{\compcitedelim}% \usebibmacro{cite:plabelyear+extradate}}% @@ -162,7 +152,7 @@ {\usebibmacro{cite:noname}% \setunit{\printdelim{nameyeardelim}}% \usebibmacro{cite:plabelyear+extradate}% - \savefield{fullhash}{\cbx@lasthash}} + \savefield{namehash}{\cbx@lasthash}} % Normal cite {\ifnameundef{shortauthor} {\printnames{labelname}}% @@ -172,14 +162,14 @@ \addspace\printnames[sabrackets]{shortauthor}}}% \setunit{\printdelim{nameyeardelim}}% \usebibmacro{cite:plabelyear+extradate}% - \savefield{fullhash}{\cbx@lasthash}}}% + \savefield{namehash}{\cbx@lasthash}}}% \setunit{\multicitedelim}} \renewcommand*{\iffinalcitedelim}{% \ifnumequal{\value{textcitecount}}{\value{textcitetotal}-1}} \newbibmacro*{textcite}{% - \iffieldequals{fullhash}{\cbx@lasthash} + \iffieldequals{namehash}{\cbx@lasthash} % Compact cite - more than one thing for same author {\setunit{\compcitedelim}% \usebibmacro{cite:plabelyear+extradate}} @@ -226,7 +216,7 @@ % Actual year printing \usebibmacro{cite:plabelyear+extradate}% % Save name hash for checks later - \savefield{fullhash}{\cbx@lasthash}}% + \savefield{namehash}{\cbx@lasthash}}% \stepcounter{textcitecount}}} \newbibmacro*{cite:plabelyear+extradate}{% @@ -236,6 +226,8 @@ \clearfield{labelday}% don't want days in citations \clearfield{labelendmonth}% don't want months in citations \clearfield{labelendday}% don't want days in citations + \clearfield{labelyeardivision}% don't want yeardivisions in citations + \clearfield{labelendyeardivision}% don't want yeardivisions in citations \iffieldsequal{labelyear}{labelendyear}% Don't want no-op year ranges {\clearfield{labelendyear}} {}% @@ -364,11 +356,11 @@ \newbibmacro*{citeyear}{% \iffieldundef{labelyear} {\usebibmacro{cite:init}} - {\iffieldequals{fullhash}{\cbx@lasthash} + {\iffieldequals{namehash}{\cbx@lasthash} {\setunit{\compcitedelim}% \usebibmacro{cite:plabelyear+extradate}} {\usebibmacro{cite:plabelyear+extradate}% - \savefield{fullhash}{\cbx@lasthash}}}% + \savefield{namehash}{\cbx@lasthash}}}% \setunit{\multicitedelim}} % @@ -424,9 +416,9 @@ \global\undef\cbx@lasthash} \newbibmacro*{cite:post}{% - \xifinlist{\thefield{fullhash}}{\cbx@apa@names} + \xifinlist{\thefield{namehash}}{\cbx@apa@names} {} - {\listxadd{\cbx@apa@names}{\thefield{fullhash}}}} + {\listxadd{\cbx@apa@names}{\thefield{namehash}}}} \newbibmacro*{cite:labelyear}{% \printfield{labelyear}} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.dbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.dbx index f15b08239e..dc81deefca 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.dbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.dbx @@ -12,7 +12,7 @@ %% %% The Current Maintainer of this work is Philip Kime. -\ProvidesFile{apa.dbx}[2021/12/24\space v9.15\space APA biblatex style data model] +\ProvidesFile{apa.dbx}[2022/06/22\space v9.16\space APA biblatex style data model] \RequireBiber[3] \DeclareDatamodelEntrytypes{ diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/austrian-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/austrian-apa.lbx index 84a2cccda3..b511a99e17 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/austrian-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/austrian-apa.lbx @@ -1,9 +1,10 @@ -\ProvidesFile{austrian-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{austrian-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{austrian} % Following DGPs guidlines for German/Austrian % http://homepage.univie.ac.at/harald.werneck/Richtlinien_zur_Manuskriptgestaltung.pdf +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -66,56 +67,130 @@ \NewBibliographyString{charter} \NewBibliographyString{ofthe} \NewBibliographyString{tothe} +\NewBibliographyString{proposed} +\NewBibliographyString{repealed} +\NewBibliographyString{execorder} +\NewBibliographyString{senate} +\NewBibliographyString{resolution} +\NewBibliographyString{houseofrepresentatives} +\NewBibliographyString{report} +\NewBibliographyString{us} +\NewBibliographyString{southcarolina} +\NewBibliographyString{constitution} +\NewBibliographyString{amendment} +\NewBibliographyString{alabama} +\NewBibliographyString{alaska} +\NewBibliographyString{arizona} +\NewBibliographyString{arkansas} +\NewBibliographyString{california} +\NewBibliographyString{colorado} +\NewBibliographyString{connecticut} +\NewBibliographyString{delaware} +\NewBibliographyString{florida} +\NewBibliographyString{georgia} +\NewBibliographyString{hawaii} +\NewBibliographyString{idaho} +\NewBibliographyString{illinois} +\NewBibliographyString{indiana} +\NewBibliographyString{iowa} +\NewBibliographyString{kansas} +\NewBibliographyString{kentucky} +\NewBibliographyString{louisiana} +\NewBibliographyString{maine} +\NewBibliographyString{maryland} +\NewBibliographyString{massachusetts} +\NewBibliographyString{michigan} +\NewBibliographyString{minnesota} +\NewBibliographyString{mississippi} +\NewBibliographyString{missouri} +\NewBibliographyString{montana} +\NewBibliographyString{nebraska} +\NewBibliographyString{nevada} +\NewBibliographyString{newhampshire} +\NewBibliographyString{newjersey} +\NewBibliographyString{newmexico} +\NewBibliographyString{newyork} +\NewBibliographyString{northcarolina} +\NewBibliographyString{northdakota} +\NewBibliographyString{ohio} +\NewBibliographyString{oklahoma} +\NewBibliographyString{oregon} +\NewBibliographyString{pennsylvania} +\NewBibliographyString{rhodeisland} +\NewBibliographyString{southcarolina} +\NewBibliographyString{southdakota} +\NewBibliographyString{tennessee} +\NewBibliographyString{texas} +\NewBibliographyString{utah} +\NewBibliographyString{vermont} +\NewBibliographyString{virginia} +\NewBibliographyString{washington} +\NewBibliographyString{westvirginia} +\NewBibliographyString{wisconsin} +\NewBibliographyString{wyoming} \DeclareBibliographyStrings{% inherit = {austrian}, + inpress = {{\midsentence{}im Druck}{\midsentence{}im Druck}}, % adding \midsentence is a fix as this is supposed to begin lower case in every instance (in citations as well as references) according to the DGP's Richtlinien zur Manuskriptgestaltung (German APA) jourarticle = {{Artikel}{Artikel}}, -% tothe = {{to\space the}{to\space the}},%FIXME -% ofthe = {{of\space the}{of\space the}},%FIXME -% unitednations = {{United\space Nations}{U\adddot N\adddot}}, -% charter = {{charter}{charter}}, -% article = {{article}{art\adddot}},%FIXME -% painting = {{painting}{painting}},%FIXME -% present = {{present}{present}},%FIXME -% song = {{song}{song}},%FIXME -% album = {{album}{album}},%FIXME -% map = {{map}{map}},%FIXME -% photograph = {{photograph}{photograph}},%FIXME -% photographs = {{photographs}{photographs}},%FIXME -% powerpoint = {{Powerpoint\space slides}{Powerpoint\space slides}},%FIXME + tothe = {{zur}{zur}}, + ofthe = {{der}{der}}, + unitednations = {{United\space Nations}{U\adddot N\adddot}}, + charter = {{Charter}{Charter}}, % Let's not translate everything and just capitalize some terms or else we run into problems because we would have to merge some existing definitions (e.g., the two terms "U.N." and "Charter" would actually need to be merged to "U.N.-Charta" for a proper translation). + proposed = {{vorgeschlagen}{vorgeschlagen}}, + repealed = {{ist\space weggefallen\space in}{weggefallen}}, + execorder = {{Executive\space Order}{Exec\adddot\space Order}}, + senate = {{Senate}{S\adddot}}, + resolution = {{Resolution}{Res\adddot}}, + houseofrepresentatives = {{House\space of\space Representatives}{H\adddot R\adddot}}, + report = {{Report}{Rep\adddot}}, + us = {{U\adddot S\adddot}{U\adddot S\adddot}}, + southcarolina = {{South\space Carolina}{S\adddot C\adddot}}, + constitution = {{Constitution}{Const\adddot}}, + section = {{Paragraph}{§}}, + amendment = {{Zusatzartikel}{Zusatzart\adddot}}, + article = {{Artikel}{Art\adddot}}, + painting = {{Gem\"alde}{Gem\"alde}}, + present = {{Gegenwart}{Gegenwart}}, + song = {{Song}{Song}}, + album = {{Album}{Album}}, + map = {{Landkarte}{Landkarte}}, + photograph = {{Foto}{Foto}}, + photographs = {{Fotos}{Fotos}}, + powerpoint = {{Power\hyphenate{}Point\hyphen{}Folien}{Power\hyphenate{}Point\hyphen{}Folien}}, % lecturenotes = {{lecturenotes}{lecturenotes}},%FIXME -% podcast = {{audio\space podcast}{audio\space podcast}},%FIXME -% podcastepisode = {{audio\space podcast\space episode}{audio\space podcast\space episode}},%FIXME -% interview = {{interview}{interview}},%FIXME -% speech = {{speech\space audio\space recording}{speech\space audio\space recording}},%FIXME -% lithograph = {{lithograph}{lith\adddot}},%FIXME -% video = {{video}{video}},%FIXME -% film = {{film}{film}},%FIXME -% tvseries = {{TV\space series}{TV\space series}},%FIXME -% tvepisode = {{TV\space series\space episode}{TV\space series\space episode}},%FIXME -% manunpub = {{unpublished\space manuscript}{unpublished\space manuscript}},%FIXME -% maninprep = {{manuscript\space in\space preparation}{manuscript\space in\space preparation}},%FIXME -% mansub = {{manuscript\space submitted\space for\space publication}{manuscript\space submitted\space for\space publication}},%FIXME -% supplement = {{supplement}{suppl\adddot}},%FIXME + podcast = {{Audiopodcast}{Audiopodcast}}, + podcastepisode = {{Audiopodcastepisode}{Audiopodcastepisode}}, + interview = {{Interview}{Interview}}, + speech = {{Sprachaufzeichnung}{Sprachaufzeichnung}}, + lithograph = {{Lithografie}{Lith\adddot}}, + video = {{Video}{Video}}, + film = {{Film}{Film}}, + tvseries = {{Fernsehserie}{Fernsehserie}}, + tvepisode = {{Fernsehserienepisode}{Fernsehserienepisode}}, + manunpub = {{unver\"offentlichtes\space Manuskript}{unver\"offentlichtes\space Manuskript}}, + maninprep = {{Manuskript\space in\space Vorbereitung}{Manuskript\space in\space Vorbereitung}}, + mansub = {{Manuskript\space eingereicht\space zur\space Publikation}{Manuskript\space eingereicht\space zur\space Publikation}}, + supplement = {{Supplement}{Suppl\adddot}}, % part = {{part}{pt\adddot}},%FIXME andothers = {{et\addabbrvspace al\adddot}{et\addabbrvspace al\adddot}}, revisededition = {{\"uberarbeitete\space Auf\noligature lage}{\"uberarb\adddotspace Aufl\adddot}}, % commenton = {{Comment\space on}{Comment\space on}},%FIXME - producer = {{Produzent}{Produzent}}, -% producers = {{producers}{producers}},%FIXME - execproducer = {{ausf\"uhrender Produzent}{ausf\adddotspace Produzent}}, -% execproducers = {{Executive\space Producers}{Exec\adddot\space Prods\adddot}},%FIXME -% execdirector = {{Executive\space Director}{Exec\adddot\space Dir\adddot}},%FIXME -% execdirectors = {{Executive\space Directors}{Exec\adddot\space Dirs\adddot}},%FIXME - director = {{Regisseur}{Reg\adddot}}, -% directors = {{directors}{dirs\adddot}},%FIXME - writer = {{Autor}{Autor}}, + producer = {{Produz\adddot}{Produz\adddot}}, + producers = {{Produz\adddot}{Produz\adddot}}, + execproducer = {{ausf\adddot\space Produz\adddot}{ausf\adddot\space Produz\adddot}}, + execproducers = {{ausf\adddot\space Produz\adddot}{ausf\adddot\space Produz\adddot}}, + execdirector = {{ausf\adddot\space Reg\adddot}{ausf\adddot\space Reg\adddot}}, + execdirectors = {{ausf\adddot\space Reg\adddot}{ausf\adddot\space Reg\adddot}}, + director = {{Reg\adddot}{Reg\adddot}}, + directors = {{Reg\adddot}{Reg\adddot}}, + writer = {{Autor\addslash\nbhyphen{}in}{Autor\addslash\nbhyphen{}in}}, % writers = {{writers}{writers}},%FIXME -% host = {{host}{host}},%FIXME + host = {{Gastgeber\addslash\nbhyphen{}in}{Gastgeber\addslash\nbhyphen{}in}}, % hosts = {{hosts}{hosts}},%FIXME -% narrator = {{narrator}{narr\adddot}},%FIXME -% narrators = {{narrators}{narrs\adddot}},%FIXME -% guestexpert = {{Guest\space Expert}{Guest\space Expert}},%FIXME + narrator = {{Erz\"ahler\addslash\nbhyphen{}in}{Erz\"ahler\addslash\nbhyphen{}in}}, + narrators = {{erz\"ahlende Personen}{erz\"ahlende Personen}}, + guestexpert = {{geladener\space Experte\space /\space geladene\space Expertin}{geladener\space Experte\space /\space geladene\space Expertin}}, % guestexperts = {{Guest\space Experts}{Guest\space Experts}},%FIXME page = {{Seite}{{}S\adddot}}, pages = {{Seiten}{{}S\adddot}}, @@ -125,9 +200,9 @@ with = {{mit}{mit}}, from = {{unter}{unter}}, archivedat = {{archiviert\space unter}{archiviert\space unter}}, - reviewof = {{Rezension\space des}{Rezension\space des}}, -% paragraph = {{paragraph}{para\adddot}},%FIXME -% paragraphs = {{paragraphs}{paras\adddot}},%FIXME + reviewof = {{Resprechung\space des}{Resprechung\space des}}, % "Rezension" isn't wrong, but according to DGP's Richtlinien zur Manuskriptgestaltung this is supposed to be called "Besprechung" + paragraph = {{Absatz}{Abs.\adddot}}, + paragraphs = {{Abs\"atze}{Abs.\adddot}}, origyear = {{Original\space erschienen}{Original\space erschienen}}, typechair = {{Leitung}{Leitung}}, typechairs = {{Leitung}{Leitung}}, @@ -135,12 +210,63 @@ typevolumes = {{Bandherausgeber}{Bandhrsg\adddot}}, typeseries = {{Reihenherausgeber}{Reihenhrsg\adddot}}, typeseriess = {{Reihenherausgeber}{Reihenhrsg\adddot}}, - typevolseries = {{Reihen- und\space Bandherausgeber}{Reihen-\space\& Bandhrsg\adddot}}, - typevolseriess = {{Reihen- und\space Bandherausgeber}{Reihen-\space\& Bandhrsg\adddot}}, + typevolseries = {{Reihen\hyphen und\space Bandherausgeber}{Reihen\hyphen\space\& Bandhrsg\adddot}}, + typevolseriess = {{Reihen\hyphen und\space Bandherausgeber}{Reihen\hyphen\space\& Bandhrsg\adddot}}, % annodomini = {{A\adddot\addabthinspace D\adddot}{A\adddot\addabthinspace D\adddot}}, % beforechrist = {{B\adddot\addabthinspace C\adddot}{B\adddot\addabthinspace C\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, -% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} +% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, +% publication = {{Publication}{Publication}}, + alabama = {{Alabama}{{A\adddot L\adddot}}}, + alaska = {{Alaska}{{A\adddot K\adddot}}}, + arizona = {{Arizona}{{A\adddot Z\adddot}}}, + arkansas = {{Arkansas}{{A\adddot R\adddot}}}, + california = {{California}{{C\adddot A\adddot}}}, + colorado = {{Colorado}{{C\adddot O\adddot}}}, + connecticut = {{Connecticut}{{C\adddot T\adddot}}}, + delaware = {{Delaware}{{D\adddot E\adddot}}}, + florida = {{Florida}{{F\adddot L\adddot}}}, + georgia = {{Georgia}{{G\adddot A\adddot}}}, + hawaii = {{Hawaii}{{H\adddot I\adddot}}}, + idaho = {{Idaho}{{I\adddot D\adddot}}}, + illinois = {{Illinois}{{I\adddot L\adddot}}}, + indiana = {{Indiana}{{I\adddot N\adddot}}}, + iowa = {{Iowa}{{I\adddot A\adddot}}}, + kansas = {{Kansas}{{K\adddot S\adddot}}}, + kentucky = {{Kentucky}{{K\adddot Y\adddot}}}, + louisiana = {{Louisiana}{{L\adddot A\adddot}}}, + maine = {{Maine}{{M\adddot E\adddot}}}, + maryland = {{Maryland}{{M\adddot D\adddot}}}, + massachusetts = {{Massachusetts}{{M\adddot A\adddot}}}, + michigan = {{Michigan}{{M\adddot I\adddot}}}, + minnesota = {{Minnesota}{{M\adddot N\adddot}}}, + mississippi = {{Mississippi}{{M\adddot S\adddot}}}, + missouri = {{Missouri}{{M\adddot O\adddot}}}, + montana = {{Montana}{{M\adddot T\adddot}}}, + nebraska = {{Nebraska}{{N\adddot E\adddot}}}, + nevada = {{Nevada}{{N\adddot V\adddot}}}, + newhampshire = {{New Hampshire}{{N\adddot H\adddot}}}, + newjersey = {{New Jersey}{{N\adddot J\adddot}}}, + newmexico = {{New Mexico}{{N\adddot M\adddot}}}, + newyork = {{New York}{{N\adddot Y\adddot}}}, + northcarolina = {{North Carolina}{{N\adddot C\adddot}}}, + northdakota = {{North Dakota}{{N\adddot D\adddot}}}, + ohio = {{Ohio}{{O\adddot H\adddot}}}, + oklahoma = {{Oklahoma}{{O\adddot K\adddot}}}, + oregon = {{Oregon}{{O\adddot R\adddot}}}, + pennsylvania = {{Pennsylvania}{{P\adddot A\adddot}}}, + rhodeisland = {{Rhode Island}{{R\adddot I\adddot}}}, + southcarolina = {{South Carolina}{{S\adddot C\adddot}}}, + southdakota = {{South Dakota}{{S\adddot D\adddot}}}, + tennessee = {{Tennessee}{{T\adddot N\adddot}}}, + texas = {{Texas}{{T\adddot X\adddot}}}, + utah = {{Utah}{{U\adddot T\adddot}}}, + vermont = {{Vermont}{{V\adddot T\adddot}}}, + virginia = {{Virginia}{{V\adddot A\adddot}}}, + washington = {{Washington}{{W\adddot A\adddot}}}, + westvirginia = {{West Virginia}{{W\adddot V\adddot}}}, + wisconsin = {{Wisconsin}{{W\adddot I\adddot}}}, + wyoming = {{Wyoming}{{W\adddot Y\adddot}}} } @@ -151,139 +277,90 @@ \DeclareBibliographyExtras{% \renewcommand{\apashortdash}{~}% \def\urldatecomma{\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% - {\iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}% - \ifboolexpr{test {\iffieldundef{#3}} and test {\iffieldundef{#2}}} + {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}% + \ifboolexpr{test {\iffieldundef{#4}} and test {\iffieldundef{#3}}} {} {\addcomma\space}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\mkbibordinal{\thefield{#3}}% - \iffieldundef{#2} + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY + {}% + {\mkbibordinal{\thefield{#4}}% + \iffieldundef{#3} {} {\addspace}}% - \iffieldundef{#2}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + {\mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% - {\iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}% - \printfield{extradate}% - \ifboolexpr{test {\iffieldundef{#3}} and test {\iffieldundef{#2}}} + {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}% + \ifboolexpr{test {\iffieldundef{#4}} and test {\iffieldundef{#3}}} {} {\addcomma\space}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\mkbibordinal{\thefield{#3}}% - \iffieldundef{#2} + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY + {}% + {\mkbibordinal{\thefield{#4}}% + \iffieldundef{#3} {} {\addspace}}% - \iffieldundef{#2}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + {\mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\mkbibordinal{\thefield{#3}}}% - \iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% - {\iffieldundef{#3}% + {\mkbibordinal{\thefield{#4}}}% + \iffieldundef{#3}% MONTH + {}% + {\iffieldundef{#4}% {}% {\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#1}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#1}% YEAR {}% - {\iffieldundef{#2}% + {\iffieldundef{#3}% {}% {\addspace}% - \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}}}% - \def\apa@lbx@de@mkdaterangeapalong#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year}{} - {\datecircaprint - \ifstrequal{#1}{url}% URL dates are unlikely to be BCE ... - {\printtext{% - \iffieldsequal{#1year}{#1endyear} - {\iffieldsequal{#1month}{#1endmonth} - {\mkbibdateapalongmdy{}{}{#1day}} - {\mkbibdateapalongmdy{}{#1month}{#1day}}} - {\mkbibdateapalongmdy{#1year}{#1month}{#1day}}% - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \mkbibdateapalongmdy{#1endyear}{#1endmonth}{#1endday}}}% - \dateuncertainprint}} - {\printtext{% - \ifboolexpr{test {\iffieldsequal{#1year}{#1endyear}} - and test {\iffieldsequal{#1month}{#1endmonth}}} - {\mkbibdateapalong{#1year}{}{#1day}}% - {\mkbibdateapalong{#1year}{#1month}{#1day}}% - \dateeraprint{#1year}% - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \iffieldsequal{#1year}{#1endyear}% - {\mkbibdateapalong{}{#1endmonth}{#1endday}}% - {\mkbibdateapalong{#1endyear}{#1endmonth}{#1endday}% - \dateeraprint{#1endyear}}}% - \enddateuncertainprint}}}}% - \endgroup}% - \def\apa@lbx@de@mkdaterangeapalongextra#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year}{} - {\printtext{% - \datecircaprint - \ifboolexpr{test {\iffieldsequal{#1year}{#1endyear}} - and test {\iffieldsequal{#1month}{#1endmonth}}} - {\mkbibdateapalongextra{#1year}{}{#1day}}% - {\mkbibdateapalongextra{#1year}{#1month}{#1day}}% - \dateeraprint{#1year}% - \dateuncertainprint - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \iffieldsequal{#1year}{#1endyear}% - {\mkbibdateapalongextra{}{#1endmonth}{#1endday}} - {\mkbibdateapalongextra{#1endyear}{#1endmonth}{#1endday}% - \dateeraprint{#1endyear}}}% - \enddateuncertainprint}}}% - \endgroup}% - \savecommand\mkdaterangeapalong - \savecommand\mkdaterangeapalongextra - \def\mkdaterangeapalong{% - \apa@lbx@de@mkdaterangeapalong}% - \def\mkdaterangeapalongextra#1{% - \apa@lbx@de@mkdaterangeapalongextra{#1}}% -} + \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}}}} \UndeclareBibliographyExtras{% \restorecommand\mkdaterangeapalong diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa-test-citations.bib b/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa-test-citations.bib index 464e4da4a9..59045ece96 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa-test-citations.bib +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa-test-citations.bib @@ -60,24 +60,24 @@ } @BOOK{8.12d, - GROUPAUTHOR = {{Department of Veteran Affairs}}, + author = {{Department of Veteran Affairs}}, TITLE = {Title1} } @BOOK{8.12e, - GROUPAUTHOR = {{Department of Veteran Affairs}}, + author = {{Department of Veteran Affairs}}, TITLE = {Title1}, DATE = {2017} } @BOOK{8.12f, - GROUPAUTHOR = {{Department of Veteran Affairs}}, + author = {{Department of Veteran Affairs}}, TITLE = {Title2}, DATE = {2017} } @BOOK{8.12g, - GROUPAUTHOR = {{Department of Veteran Affairs}}, + author = {{Department of Veteran Affairs}}, TITLE = {Title1}, DATE = {2019} } @@ -169,7 +169,7 @@ % (APA 8.13) @BOOK{8.13a, - GROUPAUTHOR = {{Centers for Disease Control and Prevention}}, + author = {{Centers for Disease Control and Prevention}}, TITLE = {Title}, DATE = {2019} } @@ -205,7 +205,7 @@ } @BOOK{8.13g, - GROUPAUTHOR = {{Beck Institute for Cognitive Behaviour Therapy}}, + author = {{Beck Institute for Cognitive Behaviour Therapy}}, TITLE = {Title}, DATE = {2012} } @@ -284,14 +284,14 @@ } @BOOK{8.17d, - GROUPAUTHOR = {{National Institute of Mental Health}}, + author = {{National Institute of Mental Health}}, SHORTAUTHOR = {NIMH}, TITLE = {Title}, DATE = {2020} } @BOOK{8.17e, - GROUPAUTHOR = {{Stanford University}}, + author = {{Stanford University}}, TITLE = {Title}, DATE = {2020} } @@ -309,7 +309,7 @@ } @BOOK{8.17h, - GROUPAUTHOR = {{American Educational Research Association} and {Some other group} and {Yet another group}}, + author = {{American Educational Research Association} and {Some other group} and {Yet another group}}, TITLE = {Title}, DATE = {2014} } @@ -351,6 +351,18 @@ DATE = {1991} } +@BOOK{8.18g, + AUTHOR = {Author Red and Author Green and Author Black and Author Blue}, + TITLE = {Title One}, + DATE = {2022} +} + +@BOOK{8.18h, + AUTHOR = {Author Red and Author Green and Author White and Author Blue}, + TITLE = {Title Two}, + DATE = {2022} +} + % (APA 8.19) @BOOK{8.19a, AUTHOR = {A. Judge and B. Kammeyer-Mueller}, @@ -432,14 +444,14 @@ % (APA 8.21) @BOOK{8.21a, - GROUPAUTHOR = {{The American Psychological Association}}, + author = {{The American Psychological Association}}, SHORTAUTHOR = {APA}, TITLE = {Title1}, DATE = {2017} } @BOOK{8.21b, - GROUPAUTHOR = {{The American Psychological Association}}, + author = {{The American Psychological Association}}, SHORTAUTHOR = {APA}, TITLE = {Title2}, DATE = {2006} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa-test-references.bib b/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa-test-references.bib index b91b1faae5..96a7863f54 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa-test-references.bib +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa-test-references.bib @@ -68,6 +68,25 @@ DATE = {2014} } +% Testing seasons +@ARTICLE{9.14:1, + AUTHOR = {Arthur Test}, + TITLE = {Test Title}, + JOURNALTITLE = {Seasonal Journal}, + VOLUME = {33}, + NUMBER = {2}, + DATE = {2012-22} +} + +@ARTICLE{9.14:2, + AUTHOR = {Arthur Test}, + TITLE = {Test Title 2}, + JOURNALTITLE = {Seasonal Journal}, + VOLUME = {34}, + NUMBER = {3}, + DATE = {2012-22/2012-23} +} + % (APA 9.44) @NAMEONLY{9.44:1a, AUTHOR = {A. S. Benjamin} @@ -1365,7 +1384,7 @@ % (APA 10.4 Example 53) @REPORT{10.4:53, - AUTHOR = {{British Cardiovascular Society Working Group}}, + AUTHOR = {{British Cardiovascular Society Working Group}}, TITLE = {British {Cardiovascular} {Society} {Working} {Group} report}, SUBTITLE = {Out-of-hours Cardiovascular Care: {Management} of Cardiac Emergencies and Hospital In-patients}, @@ -1376,7 +1395,7 @@ % (APA 10.4 Example 54) @REPORT{10.4:54, - AUTHOR = {{U.S. Securities and Exchange Commission}}, + AUTHOR = {{U.S. Securities and Exchange Commission}}, TITLE = {Agency Financial Report}, SUBTITLE = {Fiscal Year 2017}, URL = {https://www.sec.gov/files/sec-2017-agency-financial-report.pdf}, @@ -1385,14 +1404,14 @@ % (APA 10.4 Example 55) @REPORT{10.4:55a, - AUTHOR = {{American Counseling Association}}, + AUTHOR = {{American Counseling Association}}, TITLE = {2014 {ACA} code of ethics}, URL = {https://www.counseling.org/knowledge-center}, DATE = {2014} } @REPORT{10.4:55b, - AUTHOR = {{American Nurses Association}}, + AUTHOR = {{American Nurses Association}}, TITLE = {Code of Ethics for Nurses with Interpretive Statements}, URL = {https://www.nursingworld.org/coe-view-only}, DATE = {2015} @@ -1400,10 +1419,10 @@ @REPORT{10.4:55c, AUTHOR = {{American Psychological Association}}, - TITLE = {Ethical Principles of Psychologists and Code of Conduct}, - TYPE = {2002, amended effective June 1, 2010, and January 1, 2017}, - URL = {https://www.apa.org/ethics/code/index.aspx}, - DATE = {2017} + TITLE = {Ethical Principles of Psychologists and Code of Conduct}, + NOTE = {2002, amended effective June 1, 2010, and January 1, 2017}, + URL = {https://www.apa.org/ethics/code/index.aspx}, + DATE = {2017} } % (APA 10.4 Example 56) @@ -1417,7 +1436,8 @@ AUTHOR+an:role = {1="Principal Investigator"}, TITLE = {Stress, Self-Regulation and Psychopathology in Middle Childhood}, TITLEADDON = {Grant}, - TYPE = {Project No. 5R01HD081252-04}, + TYPE = {Project}, + NUMBER = {5R01HD081252-04}, INSTITUTION = {Eunice Kennedy Shriver National Institute of Child Health \& Human Development}, URL = {https://projectreporter.nih.gov/project_info_details.cfm?aid=9473071&icde=40092311}, @@ -1525,7 +1545,7 @@ BOOKTITLE = {Proceedings of the National Academy of Sciences, USA}, VOLUME = {116}, NUMBER = {47}, - PAGES = {23499–-23504}, + PAGES = {23499--23504}, DATE = {2019}, DOI = {10.1073/pnas.1910510116} } @@ -1558,35 +1578,35 @@ } % (APA 10.6 Example 64) -@THESIS{10.6:64, +% Note the override of the auto-populated "phdthesis" type as this is a +% non-standard, non-localised string type +@PHDTHESIS{10.6:64, AUTHOR = {L. Harris}, TITLE = {Instructional Leadership Perceptions and Practices of Elementary School Leaders}, - TITLEADDON = {Unpublished Doctoral Dissertation}, + TYPE = {Unpublished doctoral dissertation}, INSTITUTION = {University of Virginia}, DATE = {2014} } % (APA 10.6 Example 65) -@THESIS{10.6:65, +@PHDTHESIS{10.6:65, AUTHOR = {M. M. Hollander}, TITLE = {Resistance to Authority}, - SUBTITLE = {Methodological Innovations and New Lessons from the - {Milgram} Experiment}, - TITLEADDON = {Doctoral Dissertation, {University} of {Wisconsin}--{Madison}}, - PUBLISHER = {{ProQuest Dissertations and Theses Global}}, - TYPE = {Publication}, + SUBTITLE = {Methodological Innovations and New Lessons from the {Milgram} Experiment}, + INSTITUTION = {University of Wisconsin--Madison}, + PUBLISHER = {ProQuest Dissertations {and} Theses Global}, NUMBER = {10289373}, DATE = {2017} } % (APA 10.6 Example 66) -@THESIS{10.6:66, +@MASTERSTHESIS{10.6:66, AUTHOR = {V. H. Hutcheson}, TITLE = {Dealing with Dual Differences}, SUBTITLE = {Social Coping Strategies of Gifted and Lesbian, Gay, Bisexual, Transgender, and Queer Adolescents}, - TITLEADDON = {Master's Thesis, {The} {College} of {William} \& {Mary}}, + INSTITUTION = {The College of William \& Mary}, PUBLISHER = {William \& Mary Digital Archive}, URL = {https://digitalarchive.wm.edu/bitstream/handle/10288/16594/HutchesonVirginia2012.pdf}, DATE = {2012} @@ -1923,6 +1943,13 @@ % (APA 10.12 Example 86) % ENTRYSUBTYPE is a localisation string +% Note that if there were only one author, the annotation would be +% "1=execproducer" to get the singular form and apply it only to the first +% item in the name list, even though there is only one. List item +% annotations (those of the form "n=<annotation>" should be the singular form +% whereas whole field annotations (those of the form "=<annotation>" should usually +% be the plural form. So, when using the singular form, a list item index +% is mandatory. @VIDEO{10.12:86, ENTRYSUBTYPE = {tvseries}, AUTHOR = {D. Simon and R. F. Colesberry and Kostroff Noble, N.}, @@ -2264,28 +2291,28 @@ % (APA 10.15 Example 103) % ENTRYTYPE is not a localisation string for such, unfortunately, universal neologisms @ONLINE{10.15:103a, - ENTRYSUBTYPE = {Tweet}, + ENTRYSUBTYPE = {Tweet}, AUTHOR = {{APA Education}}, AUTHOR+an:username = {1="@APAEducation"}, - TITLE = {College Students are Forming Mental-Health + TITLE = {College Students are Forming Mental-Health Clubs--and They're Making a Difference @washingtonpost}, - TITLEADDON = {Thumbnail with link attached}, - EPRINT = {Twitter}, - DATE = {2018-06-29}, - URL = {https://twitter.com/apaeducation/status/1012810490530140161} + TITLEADDON = {Thumbnail with link attached}, + EPRINT = {Twitter}, + DATE = {2018-06-29}, + URL = {https://twitter.com/apaeducation/status/1012810490530140161} } % ENTRYTYPE is not a localisation string for such, unfortunately, universal neologisms @ONLINE{10.15:103b, - ENTRYSUBTYPE = {Tweet}, + ENTRYSUBTYPE = {Tweet}, AUTHOR = {{Badlands National Park}}, AUTHOR+an:username = {1="@BadlandsNPS"}, - TITLE = {Biologists Have Identified More Than 400 + TITLE = {Biologists Have Identified More Than 400 Different Plant Species Growing in {@BadlandsNPS} \#{DYK} \#biodoversity}, - EPRINT = {Twitter}, - DATE = {2018-02-26}, - URL = {https://twitter.com/BadlandsNPS/status/968196500412133379} + EPRINT = {Twitter}, + DATE = {2018-02-26}, + URL = {https://twitter.com/BadlandsNPS/status/968196500412133379} } % ENTRYTYPE is not a localisation string for such, unfortunately, universal neologisms @@ -2303,104 +2330,104 @@ % (APA 10.15 Example 104) % ENTRYTYPE is not a localisation string for such, unfortunately, universal neologisms @ONLINE{10.15:104, - ENTRYSUBTYPE = {Twitter profile}, + ENTRYSUBTYPE = {Twitter profile}, AUTHOR = {{APA Style}}, AUTHOR+an:username = {1="@APA\_Style"}, - TITLE = {Tweets}, - EPRINT = {Twitter}, - URL = {https://twitter.com/APA_Style}, - URLDATE = {2019-11-01} + TITLE = {Tweets}, + EPRINT = {Twitter}, + URL = {https://twitter.com/APA_Style}, + URLDATE = {2019-11-01} } % (APA 10.15 Example 105) % ENTRYTYPE is not a localisation string for such, unfortunately, universal neologisms @ONLINE{10.15:105a, - ENTRYSUBTYPE = {Status update}, - AUTHOR = {N. Gaiman}, - TITLE = {100,000+ {Rohingya} Refugees Could be at + ENTRYSUBTYPE = {Status update}, + AUTHOR = {N. Gaiman}, + TITLE = {100,000+ {Rohingya} Refugees Could be at Serious Risk during {Bangladesh's} Monsoon Season. {My} Fellow {UNHCR} {Goodwill} {Ambassador} {Cate} {Blanchett} is}, - TITLEADDON = {Image attached}, - EPRINT = {Facebook}, - URL = {http://bit.ly/2JQxPAD}, - DATE = {2018-03-22} + TITLEADDON = {Image attached}, + EPRINT = {Facebook}, + URL = {http://bit.ly/2JQxPAD}, + DATE = {2018-03-22} } % ENTRYTYPE is not a localisation string for such, unfortunately, universal neologisms @ONLINE{10.15:105b, - ENTRYSUBTYPE = {Infographic}, - AUTHOR = {{National Institute of Mental Health}}, - TITLE = {Suicide Affects all Ages, Genders, Races, and + ENTRYSUBTYPE = {Infographic}, + AUTHOR = {{National Institute of Mental Health}}, + TITLE = {Suicide Affects all Ages, Genders, Races, and Ethnicities. {Check} out These 5 {Action} {Steps} for {Helping} {Someone} in {Emotional} {Pain}}, - EPRINT = {Facebook}, - URL = {http://bit.ly/321Qstq}, - DATE = {2018-11-28} + EPRINT = {Facebook}, + URL = {http://bit.ly/321Qstq}, + DATE = {2018-11-28} } % Note protecting of automatic sentence-casing in SUBTITLE for url @ONLINE{10.15:105c, - ENTRYSUBTYPE = {video}, - AUTHOR = {{News From Science}}, - TITLE = {These Frogs Walk Instead of Hop}, - SUBTITLE = {{h}ttps://scimag.2{K}lriw{H}}, - EPRINT = {Facebook}, - URL = {https://www.facebook.com/ScienceNOW/videos/10155508587605108}, - DATE = {2018-06-26} + ENTRYSUBTYPE = {video}, + AUTHOR = {{News From Science}}, + TITLE = {These Frogs Walk Instead of Hop}, + SUBTITLE = {{h}ttps://scimag.2{K}lriw{H}}, + EPRINT = {Facebook}, + URL = {https://www.facebook.com/ScienceNOW/videos/10155508587605108}, + DATE = {2018-06-26} } % (APA 10.15 Example 106) % ENTRYTYPE is not a localisation string for such, unfortunately, universal neologisms @ONLINE{10.15:106, - ENTRYSUBTYPE = {Facebook page}, - AUTHOR = {{Smithsonian's National Zoo and Conservation + ENTRYSUBTYPE = {Facebook page}, + AUTHOR = {{Smithsonian's National Zoo and Conservation Biology Institute}}, - TITLE = {Home}, - EPRINT = {Facebook}, - URL = {https://www.facebookcom/nationalzoo}, - URLDATE = {2019-06-22} + TITLE = {Home}, + EPRINT = {Facebook}, + URL = {https://www.facebookcom/nationalzoo}, + URLDATE = {2019-06-22} } % (APA 10.15 Example 107) % ENTRYSUBTYPE is a localisation string @ONLINE{10.15:107, - ENTRYSUBTYPE = {photographs}, + ENTRYSUBTYPE = {photographs}, AUTHOR = {{Zeitz MOCAA}}, AUTHOR+an:username = {1="@zeitzmocaa"}, - TITLE = {Grade 6 Learners from {Parkfields} {Primary} - {School} in {Hanover} {Park} Visited the - Museum for a Tour and Workshop Hosted by}, - EPRINT = {Instagram}, - URL = {https://www.instagram.com/p/BqpHpjFBs3b}, - DATE = {2018-11-26} + TITLE = {Grade 6 Learners from {Parkfields} {Primary} + {School} in {Hanover} {Park} Visited the + Museum for a Tour and Workshop Hosted by}, + EPRINT = {Instagram}, + URL = {https://www.instagram.com/p/BqpHpjFBs3b}, + DATE = {2018-11-26} } % (APA 10.15 Example 108) % ENTRYTYPE is not a localisation string for such, unfortunately, universal neologisms @ONLINE{10.15:108, - ENTRYSUBTYPE = {Highlight}, + ENTRYSUBTYPE = {Highlight}, AUTHOR = {{The New York Public Library}}, AUTHOR+an:username = {1="@nypl"}, - TITLE = {The Raven}, - EPRINT = {Instagram}, - URL = {https://bitly.com/2FV8bu3}, - URLDATE = {2019-04-16} + TITLE = {The Raven}, + EPRINT = {Instagram}, + URL = {https://bitly.com/2FV8bu3}, + URLDATE = {2019-04-16} } % (APA 10.15 Example 109) % ENTRYTYPE is not a localisation string for such, unfortunately, universal neologisms @ONLINE{10.15:109, - ENTRYSUBTYPE = {Online forum post}, + ENTRYSUBTYPE = {Online forum post}, AUTHOR = {{National Aeronautics Space Administration}}, AUTHOR+an:username = {1="nasa"}, - TITLE = {I'm {NASA} Astronaut {Scott} {Tingle}. {Ask} - me anything about adjusting to being back on - {Earth} after my first spaceflight!}, - EPRINT = {Reddit}, - URL = {https://www.reddit.com/r/IAmA/comments/9fagqy/im_nasa_astronaut_scott_tingle_ask_me_anything/}, - DATE = {2018-09-12} + TITLE = {I'm {NASA} Astronaut {Scott} {Tingle}. {Ask} + me anything about adjusting to being back on + {Earth} after my first spaceflight!}, + EPRINT = {Reddit}, + URL = {https://www.reddit.com/r/IAmA/comments/9fagqy/im_nasa_astronaut_scott_tingle_ask_me_anything/}, + DATE = {2018-09-12} } % (APA 10.16 Example 110) @@ -2506,11 +2533,11 @@ } % (APA 11.4 Example 5) -% For courts and year attached to specific elements of the citation list, +% For courts and years attached to specific elements of the citation list, % don't use ORGANIZATION/DATE, use literal citeorg/citedate annotations % use the citeinfo annotation with the special annotation value "appeal" for % any affirmed/repealed status in the citatation list -% DATA/ORIGDATE are also included to make citations work +% DATE/ORIGDATE are also included to make citations work @JURISDICTION{11.4:5, TITLE = {Durflinger v. Artiles}, CITATION = {563 F.Supp. 332 and aff'd and 727 F.2d 888}, diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa-test.pdf b/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa-test.pdf Binary files differindex a1d1a5dfb7..11282803ef 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa-test.pdf +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa-test.pdf diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa-test.tex b/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa-test.tex index ae73685c10..88c1d101ab 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa-test.tex +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa-test.tex @@ -199,19 +199,23 @@ However, in parenthetical cites, authors are separated by «\&»:\\ \apaex{\textcite{8.17g}}\\ \apaex{\parencite{8.17h}} +\noindent\apa{8.18}\\ \noindent Automatic list disambiguation for ambiguous truncations. Note that «et al» is plural so it will only truncate two or more names. If it would truncate just one name, we just give the name:\\ \apaex{\textcite{8.18a}}\\ \apaex{\textcite{8.18b}}\\ \apaex{\textcite{8.18c}}\\ -\apaex{\textcite{8.18d}} +\apaex{\textcite{8.18d}}\\ +\apaex{\textcite{8.18g}}\\ +\apaex{\textcite{8.18h}} \noindent Automatic list disambiguation is only for ambiguous author lists in the same year. This is implied in \apa{8.18} by the phrase «the same in-text citation form». So these are not disambiguated:\\ \apaex{\textcite{8.18e}}\\ -\apaex{\textcite{8.18f}} +\apaex{\textcite{8.18f}}\\ +\apaex{\parencite{8.18e,8.18f}} \noindent\apa{8.19}\\ Citations of works by same authors in the same year:\\ @@ -326,6 +330,16 @@ list member. \end{refsection} \newpage +% (APA 9.14) +\begin{refsection} + +\nocite{9.14:1,9.14:2} + +\printbibliography[title={APA 9.14--Misc Date Elements}] + +\end{refsection} +\newpage + % (APA 9.44) \begin{refsection} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa.pdf b/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa.pdf Binary files differindex 435a58cdd3..315ee33446 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa.pdf +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa.pdf diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa.tex b/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa.tex index 6c140a83ea..039d2bc551 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa.tex +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa.tex @@ -24,7 +24,7 @@ url={http://mirror.ctan.org/macros/latex/exptl/biblatex-contrib/biblatex-apa/}, author={Philip Kime}, email={Philip@kime.org.uk}, - revision={9.15}, + revision={9.16}, date={\today}} \hypersetup{% @@ -44,6 +44,9 @@ Please see the revision history below (section \ref{rev}) for details on change version. This section is just for important things like incompatible changes which users should be aware of. +\minisec{9.16} +|biber| 2.18+ and and |biblatex| 3.18 + are \emph{required}. + \minisec{9.0} Completely overhauled for APA 7th edition. APA 7th edition is a lot more consistent in terms of its formatting blocks and elements, resulting in @@ -139,7 +142,8 @@ localisation. Thanks to Tea Tušar and Bogdan Filipič for the Slovenian localisation. Thanks to Sebastian Ørsted for the Danish localisation. Thanks to Jürgen Spitzmüller for the DGPs localisation hints. Thanks to Sergei Golovan for the Russian localisation. Thanks to Vítor Míguez for the -Galacian localisation. +Galacian localisation. Thanks to Abdulkerim Gok for the Turkish +translation. \section{Use}\label{ref:use} \label{use} @@ -148,10 +152,11 @@ through the provided \TeX Live update utilities which will install it automatically for you. If you need to install manually (to use a new version which has not yet been published to the \TeX Live updaters, for example), you can download it from CTAN and then, put the \path{.cbx}, -\path{.bbx} and \path{.lbx} files in your texmf tree, usually:\\ +\path{.bbx},\path{.dbx} and \path{.lbx} files in your texmf tree, usually:\\ \noindent\path{<texmf>/tex/latex/biblatex/cbx/apa.cbx}\\ \path{<texmf>/tex/latex/biblatex/bbx/apa.bbx}\\ +\path{<texmf>/tex/latex/biblatex/dbx/apa.dbx}\\ \path{<texmf>/tex/latex/biblatex/lbx/<language>-apa.lbx}\\ \noindent Specify the style in the usual way when loading Bib\LaTeX. If you @@ -388,6 +393,16 @@ the examples. \begin{changelog} +\begin{release}{9.16}{2022-06-22} +\item Minor documentation and bug fixes +\item Added Turkish localisation +\item Many German localisation enhancements +\item Adding support for season year divisions (APA 9.14) +\item Corrected support for plural ``et al'' requirement using new biblatex + feature +\item Implemented citation name sorting requirement using new biblatex feature +\end{release} + \begin{release}{9.15}{2021-12-24} \item Remove (need for) |GROUPAUTHOR| field \item Added Catalan support diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/brazilian-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/brazilian-apa.lbx index aca23ff943..2cdaf9e341 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/brazilian-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/brazilian-apa.lbx @@ -1,6 +1,7 @@ -\ProvidesFile{brazilian-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{brazilian-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{brazilian} +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -134,7 +135,8 @@ % annodomini = {{A\adddot D\adddot}{A\adddot D\adddot}}, % beforechrist = {{B\adddot C\adddot}{B\adddot C\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, -% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} +% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, +% publication = {{Publication}{Publication}} } % @@ -146,71 +148,89 @@ \DeclareBibliographyExtras{% \def\urldatecomma{\addcomma\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% - {}% - {\iffieldundef{#3}% + {\iffieldundef{#1}% {}% - {\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#1}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\ifthenelse{\iffieldundef{#2}\OR\iffieldundef{#3}}% - {}% - {\addspace}% + {\mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\addspace}% + \stripzeros{\thefield{#4}}% + \iffieldundef{#1}% YEAR + {}% + {\iffieldundef{#4}% + {\iffieldundef{#3}% + {}% + {\addspace}}% + {\addcomma\addspace}% \iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}}} % diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/british-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/british-apa.lbx index d5b9bff627..95546c2df0 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/british-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/british-apa.lbx @@ -1,6 +1,7 @@ -\ProvidesFile{british-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{british-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{british} +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -138,7 +139,8 @@ annodomini = {{A\adddot D\adddot}{A\adddot D\adddot}}, beforechrist = {{B\adddot C\adddot}{B\adddot C\adddot}}, commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, - beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} + beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, + publication = {{Publication}{Publication}} } % @@ -150,68 +152,86 @@ \DeclareBibliographyExtras{% \def\urldatecomma{\addcomma\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY {}% - {\iffieldundef{#2}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + {\mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY {}% {\addspace}% - \stripzeros{\thefield{#3}}% - \iffieldundef{#1}% + \stripzeros{\thefield{#4}}% + \iffieldundef{#1}% YEAR {}% - {\ifthenelse{\iffieldundef{#3}}% - {\ifthenelse{\iffieldundef{#2}}% + {\iffieldundef{#4}% + {\iffieldundef{#3}% {}% {\addspace}}% {\addcomma\addspace}% diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/catalan-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/catalan-apa.lbx index c4749c28db..877dc0e981 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/catalan-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/catalan-apa.lbx @@ -1,4 +1,4 @@ -\ProvidesFile{catalan-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{catalan-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] % Translation based on: % spanish-apa.lbx file (for source to translate from) @@ -10,6 +10,7 @@ \setcounter{smartand}{0} % Turn off "smart and" or ampersands will all be replaced +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -160,7 +161,8 @@ annodomini = {{despr\'es\space de\space Crist}{dC}}, beforechrist = {{abans\space de\space Crist}{aC}}, commonera = {{era\space comuna}{e\adddot c\adddot}}, - beforecommonera = {{abans\space de\space l'era\space comuna}{a\adddot e\adddot c\adddot}} + beforecommonera = {{abans\space de\space l'era\space comuna}{a\adddot e\adddot c\adddot}} + % publication = {{Publication}{Publication}} } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -169,140 +171,90 @@ \DeclareBibliographyExtras{% \def\urldatecomma{\addcomma\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } - {\clearfield{labelmonth}% - \clearfield{labelday}} - {}% - \iffieldundef{#1}% + {\clearfield{labelmonth}% + \clearfield{labelday}} + {}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}% - \ifboolexpr{test {\iffieldundef{#3}} and test {\iffieldundef{#2}}} + \ifboolexpr{test {\iffieldundef{#4}} and test {\iffieldundef{#3}}} {} {\addcomma\space}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% - {\stripzeros{\thefield{#3}}% - \iffieldundef{#2} + {\stripzeros{\thefield{#4}}% + \iffieldundef{#3} {} {\addspace de\space}}% - \iffieldundef{#2}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + {\mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } - {\clearfield{labelmonth}% - \clearfield{labelday}} - {}% - \iffieldundef{#1}% + {\clearfield{labelmonth}% + \clearfield{labelday}} {}% - {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}% - \printfield{extradate}% - \ifboolexpr{test {\iffieldundef{#3}} and test {\iffieldundef{#2}}} + \iffieldundef{#1}% YEAR + {}% + {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}% + \ifboolexpr{test {\iffieldundef{#4}} and test {\iffieldundef{#3}}} {} {\addcomma\space}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% - {\stripzeros{\thefield{#3}}% - \iffieldundef{#2} + {\stripzeros{\thefield{#4}}% + \iffieldundef{#3} {} {\addspace de\space}}% - \iffieldundef{#2}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + {\mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } - {\clearfield{labelmonth}% - \clearfield{labelday}} - {}% - \iffieldundef{#3}% - {}% - {el\addspace\stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% - {\addspace{en}\addspace}% - {\iffieldundef{#3}% - {en\addspace}% - {\addspace{de}\addspace}% - \mkbibmonth{\thefield{#2}}{\addspace{de}\addspace}}% - \iffieldundef{#1}% - {}% - {\iffieldundef{#2}% + {\clearfield{labelmonth}% + \clearfield{labelday}} {}% - {\addspace}% - \thefield{#1}}}% - \def\apa@lbx@es@mkdaterangeapalong#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year}{} - {\datecircaprint - \ifstrequal{#1}{url}% URL dates are unlikely to be BCE ... - {\printtext{% - \iffieldsequal{#1year}{#1endyear} - {\iffieldsequal{#1month}{#1endmonth} - {\mkbibdateapalongmdy{}{}{#1day}} - {\mkbibdateapalongmdy{}{#1month}{#1day}}} - {\mkbibdateapalongmdy{#1year}{#1month}{#1day}}% - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \mkbibdateapalongmdy{#1endyear}{#1endmonth}{#1endday}}}% - \dateuncertainprint}} - {\printtext{% - \ifboolexpr{test {\iffieldsequal{#1year}{#1endyear}} - and test {\iffieldsequal{#1month}{#1endmonth}}} - {\mkbibdateapalong{#1year}{}{#1day}}% - {\mkbibdateapalong{#1year}{#1month}{#1day}}% - \dateeraprint{#1year}% - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \iffieldsequal{#1year}{#1endyear}% - {\mkbibdateapalong{}{#1endmonth}{#1endday}}% - {\mkbibdateapalong{#1endyear}{#1endmonth}{#1endday}% - \dateeraprint{#1endyear}}}% - \enddateuncertainprint}}}}% - \endgroup}% - \def\apa@lbx@es@mkdaterangeapalongextra#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year}{} - {\printtext{% - \datecircaprint - \ifboolexpr{test {\iffieldsequal{#1year}{#1endyear}} - and test {\iffieldsequal{#1month}{#1endmonth}}} - {\mkbibdateapalongextra{#1year}{}{#1day}}% - {\mkbibdateapalongextra{#1year}{#1month}{#1day}}% - \dateeraprint{#1year}% - \dateuncertainprint - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \iffieldsequal{#1year}{#1endyear}% - {\mkbibdateapalongextra{}{#1endmonth}{#1endday}} - {\mkbibdateapalongextra{#1endyear}{#1endmonth}{#1endday}% - \dateeraprint{#1endyear}}}% - \enddateuncertainprint}}}% - \endgroup}% - \savecommand\mkdaterangeapalong - \savecommand\mkdaterangeapalongextra - \def\mkdaterangeapalong{% - \apa@lbx@es@mkdaterangeapalong}% - \def\mkdaterangeapalongextra#1{% - \apa@lbx@es@mkdaterangeapalongextra{#1}}% -} - + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY + {}% + {el\addspace\stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH + {\addspace{en}\addspace}% + {\iffieldundef{#4}% + {en\addspace}% + {\addspace{de}\addspace}% + \mkbibmonth{\thefield{#3}}{\addspace{de}\addspace}}% + \iffieldundef{#1}% YEAR + {}% + {\iffieldundef{#2}% + {}% + {\addspace}% + \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}}}} \UndeclareBibliographyExtras{% \restorecommand\mkdaterangeapalong diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/danish-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/danish-apa.lbx index 456b176a14..46abe45d0c 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/danish-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/danish-apa.lbx @@ -1,6 +1,7 @@ -\ProvidesFile{danish-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{danish-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{danish} +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -150,7 +151,8 @@ % annodomini = {{A\adddot D\adddot}{A\adddot D\adddot}}, % beforechrist = {{B\adddot C\adddot}{B\adddot C\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, -% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} +% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, +% publication = {{Publication}{Publication}} } % @@ -162,73 +164,91 @@ \DeclareBibliographyExtras{% \def\urldatecomma{\addcomma\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% - {\thefield{#1}}% - \iffieldundef{#3}% + {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% - {} + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% + {}% {\addcomma\addspace}% - \stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + \stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#3} + {\iffieldundef{#4}% {\iffieldundef{#1} {} {\addspace}}% {\adddot\addspace}% - \mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + \mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR + {}% + {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}}% + \iffieldundef{#2}% YEARDIVISION {}% - {\thefield{#1}\printfield{extradate}}% - \iffieldundef{#3}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% {\iffieldundef{#1}% - {} + {}% {\addcomma\addspace}% - \stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + \stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONNTH {}% - {\iffieldundef{#3} + {\iffieldundef{#4} {\iffieldundef{#1} {} {\addspace}}% {\adddot\addspace}% - \mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + \mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% - {\stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + {\stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#3}% + {\iffieldundef{#4}% {}% {\adddot\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#1}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#1}% YEAR {}% - {\iffieldundef{#2}% + {\iffieldundef{#3}% {}% {\addspace}% \thefield{#1}}}} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/dutch-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/dutch-apa.lbx index 61df911361..36e54273ed 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/dutch-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/dutch-apa.lbx @@ -1,6 +1,7 @@ -\ProvidesFile{dutch-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{dutch-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{dutch} +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -138,7 +139,8 @@ % annodomini = {{A\adddot D\adddot}{A\adddot D\adddot}}, % beforechrist = {{B\adddot C\adddot}{B\adddot C\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, -% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} +% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, +% publication = {{Publication}{Publication}} } % @@ -150,71 +152,89 @@ \DeclareBibliographyExtras{% \def\urldatecomma{\addcomma\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% - {}% - {\iffieldundef{#3}% + {\iffieldundef{#1}% {}% - {\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#1}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\ifthenelse{\iffieldundef{#2}\OR\iffieldundef{#3}}% - {}% - {\addspace}% + {\mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\addspace}% + \stripzeros{\thefield{#4}}% + \iffieldundef{#1}% YEAR + {}% + {\iffieldundef{#4}% + {\iffieldundef{#3}% + {}% + {\addspace}}% + {\addcomma\addspace}% \iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}}} % diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/english-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/english-apa.lbx index d6bf533c5f..e407b5bcb6 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/english-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/english-apa.lbx @@ -1,6 +1,7 @@ -\ProvidesFile{english-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{english-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{english} +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -140,7 +141,8 @@ annodomini = {{A\adddot D\adddot}{A\adddot D\adddot}}, beforechrist = {{B\adddot C\adddot}{B\adddot C\adddot}}, commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, - beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} + beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, + publication = {{Publication}{Publication}} } % @@ -152,68 +154,86 @@ \DeclareBibliographyExtras{% \def\urldatecomma{\addcomma\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY {}% - {\iffieldundef{#2}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + {\mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY {}% {\addspace}% - \stripzeros{\thefield{#3}}% - \iffieldundef{#1}% + \stripzeros{\thefield{#4}}% + \iffieldundef{#1}% YEAR {}% - {\ifthenelse{\iffieldundef{#3}}% - {\ifthenelse{\iffieldundef{#2}}% + {\iffieldundef{#4}% + {\iffieldundef{#3}% {}% {\addspace}}% {\addcomma\addspace}% diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/finnish-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/finnish-apa.lbx index 8df87650c8..0e2559833f 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/finnish-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/finnish-apa.lbx @@ -1,4 +1,4 @@ -\ProvidesFile{finnish-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{finnish-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] % Translations based on: % https://libguides.oulu.fi/tieteellinentiedonhankinta/apa @@ -6,6 +6,7 @@ % https://uva.libguides.com/kirjoitusohjeet/esimerkit-APA7 \InheritBibliographyExtras{finnish} +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -146,7 +147,8 @@ % annodomini = {{A\adddot D\adddot}{A\adddot D\adddot}}, % beforechrist = {{B\adddot C\adddot}{B\adddot C\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, -% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} +% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, +% publication = {{Publication}{Publication}} } % @@ -158,68 +160,86 @@ \DeclareBibliographyExtras{% \def\urldatecomma{\addcomma\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY {}% - {\iffieldundef{#2}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + {\mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY {}% {\addspace}% - \stripzeros{\thefield{#3}}% - \iffieldundef{#1}% + \stripzeros{\thefield{#4}}% + \iffieldundef{#1}% YEAR {}% - {\ifthenelse{\iffieldundef{#3}}% - {\ifthenelse{\iffieldundef{#2}}% + {\iffieldundef{#4}% + {\iffieldundef{#3}% {}% {\addspace}}% {\addcomma\addspace}% diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/french-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/french-apa.lbx index 04b843d241..62e628684d 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/french-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/french-apa.lbx @@ -1,6 +1,7 @@ -\ProvidesFile{french-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{french-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{french} +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -136,7 +137,8 @@ % annodomini = {{A\adddot D\adddot}{A\adddot D\adddot}}, % beforechrist = {{B\adddot C\adddot}{B\adddot C\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, -% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} +% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, +% publication = {{Publication}{Publication}} } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -145,71 +147,89 @@ \DeclareBibliographyExtras{% \def\urldatecomma{\addcomma\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% - {}% - {\iffieldundef{#3}% + {\iffieldundef{#1}% {}% - {\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#1}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\ifthenelse{\iffieldundef{#2}\OR\iffieldundef{#3}}% - {}% - {\addspace}% + {\mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\addspace}% + \stripzeros{\thefield{#4}}% + \iffieldundef{#1}% YEAR + {}% + {\iffieldundef{#4}% + {\iffieldundef{#3}% + {}% + {\addspace}}% + {\addcomma\addspace}% \iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}}} % diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/galician-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/galician-apa.lbx index 65e3c95bf1..0d9a616654 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/galician-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/galician-apa.lbx @@ -1,8 +1,9 @@ -\ProvidesFile{galician-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{galician-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{galician} \setcounter{smartand}{0} % Turn off "smart and" or ampersands will all be replaced +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -154,6 +155,7 @@ beforechrist = {{antes\space de\space Cristo}{a\adddot C\adddot}}, commonera = {{era\space com\'un}{e\adddot c\adddot}}, beforecommonera = {{antes\space da\space era\space com\'un}{a\adddot e\adddot c\adddot}} +% publication = {{Publication}{Publication}} } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -162,72 +164,91 @@ \DeclareBibliographyExtras{% \def\urldatecomma{\addcomma\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \iffieldundef{#3}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#2}% + {\iffieldundef{#1}% {}% - {\stripzeros{\thefield{#3}}\addspace de\addspace}}% - \mkbibmonth{\thefield{#2}}% -}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + {\addcomma\addspace}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% + {}% + {\addspace}% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {el\addspace\stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% - {\addspace{en}\addspace}% - {\iffieldundef{#3}% - {en\addspace}% - {\addspace{de}\addspace}% - \mkbibmonth{\thefield{#2}}{\addspace{de}\addspace}}% - \iffieldundef{#1}% - {}% - {\iffieldundef{#2}% + {\iffieldundef{#1}% {}% - {\addspace}% - \thefield{#1}}}} + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH + {}% + {\mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\addspace}% + \stripzeros{\thefield{#4}}% + \iffieldundef{#1}% YEAR + {}% + {\iffieldundef{#4}% + {\iffieldundef{#3}% + {}% + {\addspace}}% + {\addcomma\addspace}% + \iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}}} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/german-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/german-apa.lbx index 56b83de0b8..c0439527cc 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/german-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/german-apa.lbx @@ -1,9 +1,10 @@ -\ProvidesFile{german-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{german-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{german} % Following DGPs guidlines for German/Austrian % http://homepage.univie.ac.at/harald.werneck/Richtlinien_zur_Manuskriptgestaltung.pdf +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -66,54 +67,128 @@ \NewBibliographyString{charter} \NewBibliographyString{ofthe} \NewBibliographyString{tothe} +\NewBibliographyString{proposed} +\NewBibliographyString{repealed} +\NewBibliographyString{execorder} +\NewBibliographyString{senate} +\NewBibliographyString{resolution} +\NewBibliographyString{houseofrepresentatives} +\NewBibliographyString{report} +\NewBibliographyString{us} +\NewBibliographyString{southcarolina} +\NewBibliographyString{constitution} +\NewBibliographyString{amendment} +\NewBibliographyString{alabama} +\NewBibliographyString{alaska} +\NewBibliographyString{arizona} +\NewBibliographyString{arkansas} +\NewBibliographyString{california} +\NewBibliographyString{colorado} +\NewBibliographyString{connecticut} +\NewBibliographyString{delaware} +\NewBibliographyString{florida} +\NewBibliographyString{georgia} +\NewBibliographyString{hawaii} +\NewBibliographyString{idaho} +\NewBibliographyString{illinois} +\NewBibliographyString{indiana} +\NewBibliographyString{iowa} +\NewBibliographyString{kansas} +\NewBibliographyString{kentucky} +\NewBibliographyString{louisiana} +\NewBibliographyString{maine} +\NewBibliographyString{maryland} +\NewBibliographyString{massachusetts} +\NewBibliographyString{michigan} +\NewBibliographyString{minnesota} +\NewBibliographyString{mississippi} +\NewBibliographyString{missouri} +\NewBibliographyString{montana} +\NewBibliographyString{nebraska} +\NewBibliographyString{nevada} +\NewBibliographyString{newhampshire} +\NewBibliographyString{newjersey} +\NewBibliographyString{newmexico} +\NewBibliographyString{newyork} +\NewBibliographyString{northcarolina} +\NewBibliographyString{northdakota} +\NewBibliographyString{ohio} +\NewBibliographyString{oklahoma} +\NewBibliographyString{oregon} +\NewBibliographyString{pennsylvania} +\NewBibliographyString{rhodeisland} +\NewBibliographyString{southcarolina} +\NewBibliographyString{southdakota} +\NewBibliographyString{tennessee} +\NewBibliographyString{texas} +\NewBibliographyString{utah} +\NewBibliographyString{vermont} +\NewBibliographyString{virginia} +\NewBibliographyString{washington} +\NewBibliographyString{westvirginia} +\NewBibliographyString{wisconsin} +\NewBibliographyString{wyoming} \DeclareBibliographyStrings{% inherit = {german}, + inpress = {{\midsentence{}im Druck}{\midsentence{}im Druck}}, % adding \midsentence is a fix as this is supposed to begin lower case in every instance (in citations as well as references) according to the DGP's Richtlinien zur Manuskriptgestaltung (German APA) jourarticle = {{Artikel}{Artikel}}, -% tothe = {{to\space the}{to\space the}},%FIXME -% ofthe = {{of\space the}{of\space the}},%FIXME -% unitednations = {{United\space Nations}{U\adddot N\adddot}}, -% charter = {{charter}{charter}}, -% article = {{article}{art\adddot}},%FIXME -% painting = {{painting}{painting}},%FIXME -% present = {{present}{present}},%FIXME -% song = {{song}{song}},%FIXME -% album = {{album}{album}},%FIXME -% map = {{map}{map}},%FIXME -% photograph = {{photograph}{photograph}},%FIXME -% photographs = {{photographs}{photographs}},%FIXME -% powerpoint = {{Powerpoint\space slides}{Powerpoint\space slides}},%FIXME + tothe = {{zur}{zur}}, + ofthe = {{der}{der}}, + unitednations = {{United\space Nations}{U\adddot N\adddot}}, + charter = {{Charter}{Charter}}, % Let's not translate everything and just capitalize some terms or else we run into problems because we would have to merge some existing definitions (e.g., the two terms "U.N." and "Charter" would actually need to be merged to "U.N.-Charta" for a proper translation). + proposed = {{vorgeschlagen}{vorgeschlagen}}, + repealed = {{ist\space weggefallen\space in}{weggefallen}}, + execorder = {{Executive\space Order}{Exec\adddot\space Order}}, + senate = {{Senate}{S\adddot}}, + resolution = {{Resolution}{Res\adddot}}, + houseofrepresentatives = {{House\space of\space Representatives}{H\adddot R\adddot}}, + report = {{Report}{Rep\adddot}}, + us = {{U\adddot S\adddot}{U\adddot S\adddot}}, + southcarolina = {{South\space Carolina}{S\adddot C\adddot}}, + constitution = {{Constitution}{Const\adddot}}, + section = {{Paragraph}{§}}, + amendment = {{Zusatzartikel}{Zusatzart\adddot}}, + article = {{Artikel}{Art\adddot}}, + painting = {{Gem\"alde}{Gem\"alde}}, + present = {{Gegenwart}{Gegenwart}}, + song = {{Song}{Song}}, + album = {{Album}{Album}}, + map = {{Landkarte}{Landkarte}}, + photograph = {{Foto}{Foto}}, + photographs = {{Fotos}{Fotos}}, + powerpoint = {{Power\hyphenate{}Point\hyphen{}Folien}{Power\hyphenate{}Point\hyphen{}Folien}}, % lecturenotes = {{lecturenotes}{lecturenotes}},%FIXME -% podcast = {{audio\space podcast}{audio\space podcast}},%FIXME -% podcastepisode = {{audio\space podcast\space episode}{audio\space podcast\space episode}},%FIXME -% interview = {{interview}{interview}},%FIXME -% speech = {{speech\space audio\space recording}{speech\space audio\space recording}},%FIXME -% lithograph = {{lithograph}{lith\adddot}},%FIXME -% video = {{video}{video}},%FIXME -% film = {{film}{film}},%FIXME -% tvseries = {{TV\space series}{TV\space series}},%FIXME -% tvepisode = {{TV\space series\space episode}{TV\space series\space episode}},%FIXME -% narrator = {{narrator}{narr\adddot}},%FIXME -% narrators = {{narrators}{narrs\adddot}},%FIXME - producer = {{Produzent}{Produzent}}, -% producers = {{producers}{producers}},%FIXME - execproducer = {{ausf\"uhrender Produzent}{ausf\adddotspace Produzent}}, -% execproducers = {{Executive\space Producers}{Exec\adddot\space Prods\adddot}},%FIXME -% execdirector = {{Executive\space Director}{Exec\adddot\space Dir\adddot}},%FIXME -% execdirectors = {{Executive\space Directors}{Exec\adddot\space Dirs\adddot}},%FIXME - director = {{Regisseur}{Reg\adddot}}, -% directors = {{directors}{dirs\adddot}},%FIXME - writer = {{Autor}{Autor}}, + podcast = {{Audiopodcast}{Audiopodcast}}, + podcastepisode = {{Audiopodcastepisode}{Audiopodcastepisode}}, + interview = {{Interview}{Interview}}, + speech = {{Sprachaufzeichnung}{Sprachaufzeichnung}}, + lithograph = {{Lithografie}{Lith\adddot}}, + video = {{Video}{Video}}, + film = {{Film}{Film}}, + tvseries = {{Fernsehserie}{Fernsehserie}}, + tvepisode = {{Fernsehserienepisode}{Fernsehserienepisode}}, + narrator = {{Erz\"ahler\addslash\nbhyphen{}in}{Erz\"ahler\addslash\nbhyphen{}in}}, + narrators = {{erz\"ahlende Personen}{erz\"ahlende Personen}}, + producer = {{Produz\adddot}{Produz\adddot}}, + producers = {{Produz\adddot}{Produz\adddot}}, + execproducer = {{ausf\adddot\space Produz\adddot}{ausf\adddot\space Produz\adddot}}, + execproducers = {{ausf\adddot\space Produz\adddot}{ausf\adddot\space Produz\adddot}}, + execdirector = {{ausf\adddot\space Reg\adddot}{ausf\adddot\space Reg\adddot}}, + execdirectors = {{ausf\adddot\space Reg\adddot}{ausf\adddot\space Reg\adddot}}, + director = {{Reg\adddot}{Reg\adddot}}, + directors = {{Reg\adddot}{Reg\adddot}}, + writer = {{Autor\addslash\nbhyphen{}in}{Autor\addslash\nbhyphen{}in}}, % writers = {{writers}{writers}},%FIXME -% host = {{host}{host}},%FIXME + host = {{Gastgeber\addslash\nbhyphen{}in}{Gastgeber\addslash\nbhyphen{}in}}, % hosts = {{hosts}{hosts}},%FIXME -% guestexpert = {{Guest\space Expert}{Guest\space Expert}},%FIXME + guestexpert = {{geladener\space Experte\space /\space geladene\space Expertin}{geladener\space Experte\space /\space geladene\space Expertin}}, % guestexperts = {{Guest\space Experts}{Guest\space Experts}},%FIXME with = {{mit}{mit}}, -% manunpub = {{unpublished\space manuscript}{unpublished\space manuscript}},%FIXME -% maninprep = {{manuscript\space in\space preparation}{manuscript\space in\space preparation}},%FIXME -% mansub = {{manuscript\space submitted\space for\space publication}{manuscript\space submitted\space for\space publication}},%FIXME -% supplement = {{supplement}{suppl\adddot}},%FIXME + manunpub = {{unver\"offentlichtes\space Manuskript}{unver\"offentlichtes\space Manuskript}}, + maninprep = {{Manuskript\space in\space Vorbereitung}{Manuskript\space in\space Vorbereitung}}, + mansub = {{Manuskript\space eingereicht\space zur\space Publikation}{Manuskript\space eingereicht\space zur\space Publikation}}, + supplement = {{Supplement}{Suppl\adddot}}, % part = {{part}{pt\adddot}},%FIXME andothers = {{et\addabbrvspace al\adddot}{et\addabbrvspace al\adddot}}, revisededition = {{\"uberarbeitete\space Auf\noligature lage}{\"uberarb\adddotspace Aufl\adddot}}, @@ -125,9 +200,9 @@ available = {{Erh\"altlich}{Erh\"altlich}}, from = {{unter}{unter}}, archivedat = {{archiviert\space unter}{archiviert\space unter}}, - reviewof = {{Rezension\space des}{Rezension\space des}}, -% paragraph = {{paragraph}{para\adddot}},%FIXME -% paragraphs = {{paragraphs}{paras\adddot}},%FIXME + reviewof = {{Resprechung\space des}{Resprechung\space des}}, % "Rezension" isn't wrong, but according to DGP's Richtlinien zur Manuskriptgestaltung this is supposed to be called "Besprechung" + paragraph = {{Absatz}{Abs.\adddot}}, + paragraphs = {{Abs\"atze}{Abs.\adddot}}, origyear = {{Original\space erschienen}{Original\space erschienen}}, typechair = {{Leitung}{Leitung}}, typechairs = {{Leitung}{Leitung}}, @@ -135,12 +210,63 @@ typevolumes = {{Bandherausgeber}{Bandhrsg\adddot}}, typeseries = {{Reihenherausgeber}{Reihenhrsg\adddot}}, typeseriess = {{Reihenherausgeber}{Reihenhrsg\adddot}}, - typevolseries = {{Reihen- und\space Bandherausgeber}{Reihen-\space\& Bandhrsg\adddot}}, - typevolseriess = {{Reihen- und\space Bandherausgeber}{Reihen-\space\& Bandhrsg\adddot}}, + typevolseries = {{Reihen\hyphen und\space Bandherausgeber}{Reihen\hyphen\space\& Bandhrsg\adddot}}, + typevolseriess = {{Reihen\hyphen und\space Bandherausgeber}{Reihen\hyphen\space\& Bandhrsg\adddot}}, % annodomini = {{A\adddot\addabthinspace D\adddot}{A\adddot\addabthinspace D\adddot}}, % beforechrist = {{B\adddot\addabthinspace C\adddot}{B\adddot\addabthinspace C\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, -% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} +% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, +% publication = {{Publication}{Publication}}, + alabama = {{Alabama}{{A\adddot L\adddot}}}, + alaska = {{Alaska}{{A\adddot K\adddot}}}, + arizona = {{Arizona}{{A\adddot Z\adddot}}}, + arkansas = {{Arkansas}{{A\adddot R\adddot}}}, + california = {{California}{{C\adddot A\adddot}}}, + colorado = {{Colorado}{{C\adddot O\adddot}}}, + connecticut = {{Connecticut}{{C\adddot T\adddot}}}, + delaware = {{Delaware}{{D\adddot E\adddot}}}, + florida = {{Florida}{{F\adddot L\adddot}}}, + georgia = {{Georgia}{{G\adddot A\adddot}}}, + hawaii = {{Hawaii}{{H\adddot I\adddot}}}, + idaho = {{Idaho}{{I\adddot D\adddot}}}, + illinois = {{Illinois}{{I\adddot L\adddot}}}, + indiana = {{Indiana}{{I\adddot N\adddot}}}, + iowa = {{Iowa}{{I\adddot A\adddot}}}, + kansas = {{Kansas}{{K\adddot S\adddot}}}, + kentucky = {{Kentucky}{{K\adddot Y\adddot}}}, + louisiana = {{Louisiana}{{L\adddot A\adddot}}}, + maine = {{Maine}{{M\adddot E\adddot}}}, + maryland = {{Maryland}{{M\adddot D\adddot}}}, + massachusetts = {{Massachusetts}{{M\adddot A\adddot}}}, + michigan = {{Michigan}{{M\adddot I\adddot}}}, + minnesota = {{Minnesota}{{M\adddot N\adddot}}}, + mississippi = {{Mississippi}{{M\adddot S\adddot}}}, + missouri = {{Missouri}{{M\adddot O\adddot}}}, + montana = {{Montana}{{M\adddot T\adddot}}}, + nebraska = {{Nebraska}{{N\adddot E\adddot}}}, + nevada = {{Nevada}{{N\adddot V\adddot}}}, + newhampshire = {{New Hampshire}{{N\adddot H\adddot}}}, + newjersey = {{New Jersey}{{N\adddot J\adddot}}}, + newmexico = {{New Mexico}{{N\adddot M\adddot}}}, + newyork = {{New York}{{N\adddot Y\adddot}}}, + northcarolina = {{North Carolina}{{N\adddot C\adddot}}}, + northdakota = {{North Dakota}{{N\adddot D\adddot}}}, + ohio = {{Ohio}{{O\adddot H\adddot}}}, + oklahoma = {{Oklahoma}{{O\adddot K\adddot}}}, + oregon = {{Oregon}{{O\adddot R\adddot}}}, + pennsylvania = {{Pennsylvania}{{P\adddot A\adddot}}}, + rhodeisland = {{Rhode Island}{{R\adddot I\adddot}}}, + southcarolina = {{South Carolina}{{S\adddot C\adddot}}}, + southdakota = {{South Dakota}{{S\adddot D\adddot}}}, + tennessee = {{Tennessee}{{T\adddot N\adddot}}}, + texas = {{Texas}{{T\adddot X\adddot}}}, + utah = {{Utah}{{U\adddot T\adddot}}}, + vermont = {{Vermont}{{V\adddot T\adddot}}}, + virginia = {{Virginia}{{V\adddot A\adddot}}}, + washington = {{Washington}{{W\adddot A\adddot}}}, + westvirginia = {{West Virginia}{{W\adddot V\adddot}}}, + wisconsin = {{Wisconsin}{{W\adddot I\adddot}}}, + wyoming = {{Wyoming}{{W\adddot Y\adddot}}} } @@ -151,139 +277,90 @@ \DeclareBibliographyExtras{% \renewcommand{\apashortdash}{~}% \def\urldatecomma{\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% - {\iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}% - \ifboolexpr{test {\iffieldundef{#3}} and test {\iffieldundef{#2}}} + {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}% + \ifboolexpr{test {\iffieldundef{#4}} and test {\iffieldundef{#3}}} {} {\addcomma\space}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\mkbibordinal{\thefield{#3}}% - \iffieldundef{#2} + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY + {}% + {\mkbibordinal{\thefield{#4}}% + \iffieldundef{#3} {} {\addspace}}% - \iffieldundef{#2}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + {\mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% - {\iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}% - \printfield{extradate}% - \ifboolexpr{test {\iffieldundef{#3}} and test {\iffieldundef{#2}}} + {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}% + \ifboolexpr{test {\iffieldundef{#4}} and test {\iffieldundef{#3}}} {} {\addcomma\space}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\mkbibordinal{\thefield{#3}}% - \iffieldundef{#2} + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY + {}% + {\mkbibordinal{\thefield{#4}}% + \iffieldundef{#3} {} {\addspace}}% - \iffieldundef{#2}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + {\mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\mkbibordinal{\thefield{#3}}}% - \iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% - {\iffieldundef{#3}% + {\mkbibordinal{\thefield{#4}}}% + \iffieldundef{#3}% MONTH + {}% + {\iffieldundef{#4}% {}% {\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#1}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#1}% YEAR {}% - {\iffieldundef{#2}% + {\iffieldundef{#3}% {}% {\addspace}% - \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}}}% - \def\apa@lbx@de@mkdaterangeapalong#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year}{} - {\datecircaprint - \ifstrequal{#1}{url}% URL dates are unlikely to be BCE ... - {\printtext{% - \iffieldsequal{#1year}{#1endyear} - {\iffieldsequal{#1month}{#1endmonth} - {\mkbibdateapalongmdy{}{}{#1day}} - {\mkbibdateapalongmdy{}{#1month}{#1day}}} - {\mkbibdateapalongmdy{#1year}{#1month}{#1day}}% - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \mkbibdateapalongmdy{#1endyear}{#1endmonth}{#1endday}}}% - \dateuncertainprint}} - {\printtext{% - \ifboolexpr{test {\iffieldsequal{#1year}{#1endyear}} - and test {\iffieldsequal{#1month}{#1endmonth}}} - {\mkbibdateapalong{#1year}{}{#1day}}% - {\mkbibdateapalong{#1year}{#1month}{#1day}}% - \dateeraprint{#1year}% - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \iffieldsequal{#1year}{#1endyear}% - {\mkbibdateapalong{}{#1endmonth}{#1endday}}% - {\mkbibdateapalong{#1endyear}{#1endmonth}{#1endday}% - \dateeraprint{#1endyear}}}% - \enddateuncertainprint}}}}% - \endgroup}% - \def\apa@lbx@de@mkdaterangeapalongextra#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year}{} - {\printtext{% - \datecircaprint - \ifboolexpr{test {\iffieldsequal{#1year}{#1endyear}} - and test {\iffieldsequal{#1month}{#1endmonth}}} - {\mkbibdateapalongextra{#1year}{}{#1day}}% - {\mkbibdateapalongextra{#1year}{#1month}{#1day}}% - \dateeraprint{#1year}% - \dateuncertainprint - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \iffieldsequal{#1year}{#1endyear}% - {\mkbibdateapalongextra{}{#1endmonth}{#1endday}} - {\mkbibdateapalongextra{#1endyear}{#1endmonth}{#1endday}% - \dateeraprint{#1endyear}}}% - \enddateuncertainprint}}}% - \endgroup}% - \savecommand\mkdaterangeapalong - \savecommand\mkdaterangeapalongextra - \def\mkdaterangeapalong{% - \apa@lbx@de@mkdaterangeapalong}% - \def\mkdaterangeapalongextra#1{% - \apa@lbx@de@mkdaterangeapalongextra{#1}}% -} + \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}}}} \UndeclareBibliographyExtras{% \restorecommand\mkdaterangeapalong diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/greek-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/greek-apa.lbx index 3ce1beca9e..55deff23ce 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/greek-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/greek-apa.lbx @@ -1,6 +1,7 @@ -\ProvidesFile{greek-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{greek-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{greek} +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -138,7 +139,8 @@ % annodomini = {{A\adddot D\adddot}{A\adddot D\adddot}}, % beforechrist = {{B\adddot C\adddot}{B\adddot C\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, -% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} +% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, +% publication = {{Publication}{Publication}} } % @@ -168,71 +170,89 @@ \else #1\BibliographyWarning{Month out of range}% \fi}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \lbx@gr@mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\ifthenelse{\iffieldundef{#2}\OR\iffieldundef{#1}}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \lbx@gr@mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\ifthenelse{\iffieldundef{#2}\OR\iffieldundef{#1}}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% - {}% - {\iffieldundef{#3}% + {\iffieldundef{#1}% {}% - {\addspace}% - \lbx@gr@mkbibmonth{\thefield{#2}}}% - \iffieldundef{#1}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\ifthenelse{\iffieldundef{#2}\OR\iffieldundef{#3}}% - {}% - {\addspace}% + {\mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\addspace}% + \stripzeros{\thefield{#4}}% + \iffieldundef{#1}% YEAR + {}% + {\iffieldundef{#4}% + {\iffieldundef{#3}% + {}% + {\addspace}}% + {\addcomma\addspace}% \iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}}} % diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/italian-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/italian-apa.lbx index 0760cb84aa..19bad1de8a 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/italian-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/italian-apa.lbx @@ -1,6 +1,7 @@ -\ProvidesFile{italian-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{italian-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{italian} +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -138,7 +139,8 @@ % annodomini = {{A\adddot D\adddot}{A\adddot D\adddot}}, % beforechrist = {{B\adddot C\adddot}{B\adddot C\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, -% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} +% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, +% publication = {{Publication}{Publication}} } % @@ -150,68 +152,86 @@ \DeclareBibliographyExtras{% \def\urldatecomma{\addcomma\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY {}% - {\iffieldundef{#2}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + {\mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY {}% {\addspace}% - \stripzeros{\thefield{#3}}% - \iffieldundef{#1}% + \stripzeros{\thefield{#4}}% + \iffieldundef{#1}% YEAR {}% - {\ifthenelse{\iffieldundef{#3}}% - {\ifthenelse{\iffieldundef{#2}}% + {\iffieldundef{#4}% + {\iffieldundef{#3}% {}% {\addspace}}% {\addcomma\addspace}% diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/naustrian-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/naustrian-apa.lbx index 35e2c389bd..ec9190592a 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/naustrian-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/naustrian-apa.lbx @@ -1,9 +1,10 @@ -\ProvidesFile{naustrian-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{naustrian-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{naustrian} % Following DGPs guidlines for German/Austrian % http://homepage.univie.ac.at/harald.werneck/Richtlinien_zur_Manuskriptgestaltung.pdf +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -66,54 +67,128 @@ \NewBibliographyString{charter} \NewBibliographyString{ofthe} \NewBibliographyString{tothe} +\NewBibliographyString{proposed} +\NewBibliographyString{repealed} +\NewBibliographyString{execorder} +\NewBibliographyString{senate} +\NewBibliographyString{resolution} +\NewBibliographyString{houseofrepresentatives} +\NewBibliographyString{report} +\NewBibliographyString{us} +\NewBibliographyString{southcarolina} +\NewBibliographyString{constitution} +\NewBibliographyString{amendment} +\NewBibliographyString{alabama} +\NewBibliographyString{alaska} +\NewBibliographyString{arizona} +\NewBibliographyString{arkansas} +\NewBibliographyString{california} +\NewBibliographyString{colorado} +\NewBibliographyString{connecticut} +\NewBibliographyString{delaware} +\NewBibliographyString{florida} +\NewBibliographyString{georgia} +\NewBibliographyString{hawaii} +\NewBibliographyString{idaho} +\NewBibliographyString{illinois} +\NewBibliographyString{indiana} +\NewBibliographyString{iowa} +\NewBibliographyString{kansas} +\NewBibliographyString{kentucky} +\NewBibliographyString{louisiana} +\NewBibliographyString{maine} +\NewBibliographyString{maryland} +\NewBibliographyString{massachusetts} +\NewBibliographyString{michigan} +\NewBibliographyString{minnesota} +\NewBibliographyString{mississippi} +\NewBibliographyString{missouri} +\NewBibliographyString{montana} +\NewBibliographyString{nebraska} +\NewBibliographyString{nevada} +\NewBibliographyString{newhampshire} +\NewBibliographyString{newjersey} +\NewBibliographyString{newmexico} +\NewBibliographyString{newyork} +\NewBibliographyString{northcarolina} +\NewBibliographyString{northdakota} +\NewBibliographyString{ohio} +\NewBibliographyString{oklahoma} +\NewBibliographyString{oregon} +\NewBibliographyString{pennsylvania} +\NewBibliographyString{rhodeisland} +\NewBibliographyString{southcarolina} +\NewBibliographyString{southdakota} +\NewBibliographyString{tennessee} +\NewBibliographyString{texas} +\NewBibliographyString{utah} +\NewBibliographyString{vermont} +\NewBibliographyString{virginia} +\NewBibliographyString{washington} +\NewBibliographyString{westvirginia} +\NewBibliographyString{wisconsin} +\NewBibliographyString{wyoming} \DeclareBibliographyStrings{% inherit = {naustrian}, + inpress = {{\midsentence{}im Druck}{\midsentence{}im Druck}}, % adding \midsentence is a fix as this is supposed to begin lower case in every instance (in citations as well as references) according to the DGP's Richtlinien zur Manuskriptgestaltung (German APA) jourarticle = {{Artikel}{Artikel}}, -% tothe = {{to\space the}{to\space the}},%FIXME -% ofthe = {{of\space the}{of\space the}},%FIXME -% unitednations = {{United\space Nations}{U\adddot N\adddot}}, -% charter = {{charter}{charter}}, -% article = {{article}{art\adddot}},%FIXME -% painting = {{painting}{painting}},%FIXME -% present = {{present}{present}},%FIXME -% song = {{song}{song}},%FIXME -% album = {{album}{album}},%FIXME -% map = {{map}{map}},%FIXME -% photograph = {{photograph}{photograph}},%FIXME -% photographs = {{photographs}{photographs}},%FIXME -% powerpoint = {{Powerpoint\space slides}{Powerpoint\space slides}},%FIXME + tothe = {{zur}{zur}}, + ofthe = {{der}{der}}, + unitednations = {{United\space Nations}{U\adddot N\adddot}}, + charter = {{Charter}{Charter}}, % Let's not translate everything and just capitalize some terms or else we run into problems because we would have to merge some existing definitions (e.g., the two terms "U.N." and "Charter" would actually need to be merged to "U.N.-Charta" for a proper translation). + proposed = {{vorgeschlagen}{vorgeschlagen}}, + repealed = {{ist\space weggefallen\space in}{weggefallen}}, + execorder = {{Executive\space Order}{Exec\adddot\space Order}}, + senate = {{Senate}{S\adddot}}, + resolution = {{Resolution}{Res\adddot}}, + houseofrepresentatives = {{House\space of\space Representatives}{H\adddot R\adddot}}, + report = {{Report}{Rep\adddot}}, + us = {{U\adddot S\adddot}{U\adddot S\adddot}}, + southcarolina = {{South\space Carolina}{S\adddot C\adddot}}, + constitution = {{Constitution}{Const\adddot}}, + section = {{Paragraph}{§}}, + amendment = {{Zusatzartikel}{Zusatzart\adddot}}, + article = {{Artikel}{Art\adddot}}, + painting = {{Gem\"alde}{Gem\"alde}}, + present = {{Gegenwart}{Gegenwart}}, + song = {{Song}{Song}}, + album = {{Album}{Album}}, + map = {{Landkarte}{Landkarte}}, + photograph = {{Foto}{Foto}}, + photographs = {{Fotos}{Fotos}}, + powerpoint = {{Power\hyphenate{}Point\hyphen{}Folien}{Power\hyphenate{}Point\hyphen{}Folien}}, % lecturenotes = {{lecturenotes}{lecturenotes}},%FIXME -% podcast = {{audio\space podcast}{audio\space podcast}},%FIXME -% podcastepisode = {{audio\space podcast\space episode}{audio\space podcast\space episode}},%FIXME -% interview = {{interview}{interview}},%FIXME -% speech = {{speech\space audio\space recording}{speech\space audio\space recording}},%FIXME -% lithograph = {{lithograph}{lith\adddot}},%FIXME -% video = {{video}{video}},%FIXME -% film = {{film}{film}},%FIXME -% tvseries = {{TV\space series}{TV\space series}},%FIXME -% tvepisode = {{TV\space series\space episode}{TV\space series\space episode}},%FIXME -% narrator = {{narrator}{narr\adddot}},%FIXME -% narrators = {{narrators}{narrs\adddot}},%FIXME - producer = {{Produzent}{Produzent}}, -% producers = {{producers}{producers}},%FIXME - execproducer = {{ausf\"uhrender Produzent}{ausf\adddotspace Produzent}}, -% execproducers = {{Executive\space Producers}{Exec\adddot\space Prods\adddot}},%FIXME -% execdirector = {{Executive\space Director}{Exec\adddot\space Dir\adddot}},%FIXME -% execdirectors = {{Executive\space Directors}{Exec\adddot\space Dirs\adddot}},%FIXME - director = {{Autor}{Aut\adddot}}, -% directors = {{directors}{dirs\adddot}},%FIXME - writer = {{Schriftsteller}{Schriftsteller}}, + podcast = {{Audiopodcast}{Audiopodcast}}, + podcastepisode = {{Audiopodcastepisode}{Audiopodcastepisode}}, + interview = {{Interview}{Interview}}, + speech = {{Sprachaufzeichnung}{Sprachaufzeichnung}}, + lithograph = {{Lithografie}{Lith\adddot}}, + video = {{Video}{Video}}, + film = {{Film}{Film}}, + tvseries = {{Fernsehserie}{Fernsehserie}}, + tvepisode = {{Fernsehserienepisode}{Fernsehserienepisode}}, + narrator = {{Erz\"ahler\addslash\nbhyphen{}in}{Erz\"ahler\addslash\nbhyphen{}in}}, + narrators = {{erz\"ahlende Personen}{erz\"ahlende Personen}}, + producer = {{Produz\adddot}{Produz\adddot}}, + producers = {{Produz\adddot}{Produz\adddot}}, + execproducer = {{ausf\adddot\space Produz\adddot}{ausf\adddot\space Produz\adddot}}, + execproducers = {{ausf\adddot\space Produz\adddot}{ausf\adddot\space Produz\adddot}}, + execdirector = {{ausf\adddot\space Reg\adddot}{ausf\adddot\space Reg\adddot}}, + execdirectors = {{ausf\adddot\space Reg\adddot}{ausf\adddot\space Reg\adddot}}, + director = {{Reg\adddot}{Reg\adddot}}, + directors = {{Reg\adddot}{Reg\adddot}} + writer = {{Autor\addslash\nbhyphen{}in}{Autor\addslash\nbhyphen{}in}}, % writers = {{writers}{writers}},%FIXME -% host = {{host}{host}},%FIXME + host = {{Gastgeber\addslash\nbhyphen{}in}{Gastgeber\addslash\nbhyphen{}in}}, % hosts = {{hosts}{hosts}},%FIXME -% guestexpert = {{Guest\space Expert}{Guest\space Expert}},%FIXME + guestexpert = {{geladener\space Experte\space /\space geladene\space Expertin}{geladener\space Experte\space /\space geladene\space Expertin}}, % guestexperts = {{Guest\space Experts}{Guest\space Experts}},%FIXME with = {{mit}{mit}}, -% manunpub = {{unpublished\space manuscript}{unpublished\space manuscript}},%FIXME -% maninprep = {{manuscript\space in\space preparation}{manuscript\space in\space preparation}},%FIXME -% mansub = {{manuscript\space submitted\space for\space publication}{manuscript\space submitted\space for\space publication}},%FIXME -% supplement = {{supplement}{suppl\adddot}},%FIXME + manunpub = {{unver\"offentlichtes\space Manuskript}{unver\"offentlichtes\space Manuskript}}, + maninprep = {{Manuskript\space in\space Vorbereitung}{Manuskript\space in\space Vorbereitung}}, + mansub = {{Manuskript\space eingereicht\space zur\space Publikation}{Manuskript\space eingereicht\space zur\space Publikation}}, + supplement = {{Supplement}{Suppl\adddot}}, % part = {{part}{pt\adddot}},%FIXME andothers = {{et\addabbrvspace al\adddot}{et\addabbrvspace al\adddot}}, revisededition = {{\"uberarbeitete\space Auf\noligature lage}{\"uberarb\adddotspace Aufl\adddot}}, @@ -125,9 +200,9 @@ available = {{erh\"altlich}{erh\"altlich}}, from = {{unter}{unter}}, archivedat = {{archiviert\space unter}{archiviert\space unter}}, - reviewof = {{Rezension\space des}{Rezension\space des}}, -% paragraph = {{paragraph}{para\adddot}},%FIXME -% paragraphs = {{paragraphs}{paras\adddot}},%FIXME + reviewof = {{Resprechung\space des}{Resprechung\space des}}, % "Rezension" isn't wrong, but according to DGP's Richtlinien zur Manuskriptgestaltung this is supposed to be called "Besprechung" + paragraph = {{Absatz}{Abs.\adddot}}, + paragraphs = {{Abs\"atze}{Abs.\adddot}}, origyear = {{Original\space erschienen}{Original\space erschienen}}, typechair = {{Leitung}{Leitung}}, typechairs = {{Leitung}{Leitung}}, @@ -135,12 +210,63 @@ typevolumes = {{Bandherausgeber}{Bandhrsg\adddot}}, typeseries = {{Reihenherausgeber}{Reihenhrsg\adddot}}, typeseriess = {{Reihenherausgeber}{Reihenhrsg\adddot}}, - typevolseries = {{Reihen- und\space Bandherausgeber}{Reihen-\space\& Bandhrsg\adddot}}, - typevolseriess = {{Reihen- und\space Bandherausgeber}{Reihen-\space\& Bandhrsg\adddot}}, + typevolseries = {{Reihen\hyphen und\space Bandherausgeber}{Reihen\hyphen\space\& Bandhrsg\adddot}}, + typevolseriess = {{Reihen\hyphen und\space Bandherausgeber}{Reihen\hyphen\space\& Bandhrsg\adddot}}, % annodomini = {{A\adddot\addabthinspace D\adddot}{A\adddot\addabthinspace D\adddot}}, % beforechrist = {{B\adddot\addabthinspace C\adddot}{B\adddot\addabthinspace C\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, -% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} +% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, +% publication = {{Publication}{Publication}}, + alabama = {{Alabama}{{A\adddot L\adddot}}}, + alaska = {{Alaska}{{A\adddot K\adddot}}}, + arizona = {{Arizona}{{A\adddot Z\adddot}}}, + arkansas = {{Arkansas}{{A\adddot R\adddot}}}, + california = {{California}{{C\adddot A\adddot}}}, + colorado = {{Colorado}{{C\adddot O\adddot}}}, + connecticut = {{Connecticut}{{C\adddot T\adddot}}}, + delaware = {{Delaware}{{D\adddot E\adddot}}}, + florida = {{Florida}{{F\adddot L\adddot}}}, + georgia = {{Georgia}{{G\adddot A\adddot}}}, + hawaii = {{Hawaii}{{H\adddot I\adddot}}}, + idaho = {{Idaho}{{I\adddot D\adddot}}}, + illinois = {{Illinois}{{I\adddot L\adddot}}}, + indiana = {{Indiana}{{I\adddot N\adddot}}}, + iowa = {{Iowa}{{I\adddot A\adddot}}}, + kansas = {{Kansas}{{K\adddot S\adddot}}}, + kentucky = {{Kentucky}{{K\adddot Y\adddot}}}, + louisiana = {{Louisiana}{{L\adddot A\adddot}}}, + maine = {{Maine}{{M\adddot E\adddot}}}, + maryland = {{Maryland}{{M\adddot D\adddot}}}, + massachusetts = {{Massachusetts}{{M\adddot A\adddot}}}, + michigan = {{Michigan}{{M\adddot I\adddot}}}, + minnesota = {{Minnesota}{{M\adddot N\adddot}}}, + mississippi = {{Mississippi}{{M\adddot S\adddot}}}, + missouri = {{Missouri}{{M\adddot O\adddot}}}, + montana = {{Montana}{{M\adddot T\adddot}}}, + nebraska = {{Nebraska}{{N\adddot E\adddot}}}, + nevada = {{Nevada}{{N\adddot V\adddot}}}, + newhampshire = {{New Hampshire}{{N\adddot H\adddot}}}, + newjersey = {{New Jersey}{{N\adddot J\adddot}}}, + newmexico = {{New Mexico}{{N\adddot M\adddot}}}, + newyork = {{New York}{{N\adddot Y\adddot}}}, + northcarolina = {{North Carolina}{{N\adddot C\adddot}}}, + northdakota = {{North Dakota}{{N\adddot D\adddot}}}, + ohio = {{Ohio}{{O\adddot H\adddot}}}, + oklahoma = {{Oklahoma}{{O\adddot K\adddot}}}, + oregon = {{Oregon}{{O\adddot R\adddot}}}, + pennsylvania = {{Pennsylvania}{{P\adddot A\adddot}}}, + rhodeisland = {{Rhode Island}{{R\adddot I\adddot}}}, + southcarolina = {{South Carolina}{{S\adddot C\adddot}}}, + southdakota = {{South Dakota}{{S\adddot D\adddot}}}, + tennessee = {{Tennessee}{{T\adddot N\adddot}}}, + texas = {{Texas}{{T\adddot X\adddot}}}, + utah = {{Utah}{{U\adddot T\adddot}}}, + vermont = {{Vermont}{{V\adddot T\adddot}}}, + virginia = {{Virginia}{{V\adddot A\adddot}}}, + washington = {{Washington}{{W\adddot A\adddot}}}, + westvirginia = {{West Virginia}{{W\adddot V\adddot}}}, + wisconsin = {{Wisconsin}{{W\adddot I\adddot}}}, + wyoming = {{Wyoming}{{W\adddot Y\adddot}}} } @@ -151,139 +277,90 @@ \DeclareBibliographyExtras{% \renewcommand{\apashortdash}{~}% \def\urldatecomma{\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% - {\iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}% - \ifboolexpr{test {\iffieldundef{#3}} and test {\iffieldundef{#2}}} + {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}% + \ifboolexpr{test {\iffieldundef{#4}} and test {\iffieldundef{#3}}} {} {\addcomma\space}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\mkbibordinal{\thefield{#3}}% - \iffieldundef{#2} + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY + {}% + {\mkbibordinal{\thefield{#4}}% + \iffieldundef{#3} {} {\addspace}}% - \iffieldundef{#2}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + {\mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% - {\iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}% - \printfield{extradate}% - \ifboolexpr{test {\iffieldundef{#3}} and test {\iffieldundef{#2}}} + {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}% + \ifboolexpr{test {\iffieldundef{#4}} and test {\iffieldundef{#3}}} {} {\addcomma\space}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\mkbibordinal{\thefield{#3}}% - \iffieldundef{#2} + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY + {}% + {\mkbibordinal{\thefield{#4}}% + \iffieldundef{#3} {} {\addspace}}% - \iffieldundef{#2}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + {\mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\mkbibordinal{\thefield{#3}}}% - \iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% - {\iffieldundef{#3}% + {\mkbibordinal{\thefield{#4}}}% + \iffieldundef{#3}% MONTH + {}% + {\iffieldundef{#4}% {}% {\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#1}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#1}% YEAR {}% - {\iffieldundef{#2}% + {\iffieldundef{#3}% {}% {\addspace}% - \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}}}% - \def\apa@lbx@de@mkdaterangeapalong#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year}{} - {\datecircaprint - \ifstrequal{#1}{url}% URL dates are unlikely to be BCE ... - {\printtext{% - \iffieldsequal{#1year}{#1endyear} - {\iffieldsequal{#1month}{#1endmonth} - {\mkbibdateapalongmdy{}{}{#1day}} - {\mkbibdateapalongmdy{}{#1month}{#1day}}} - {\mkbibdateapalongmdy{#1year}{#1month}{#1day}}% - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \mkbibdateapalongmdy{#1endyear}{#1endmonth}{#1endday}}}% - \dateuncertainprint}} - {\printtext{% - \ifboolexpr{test {\iffieldsequal{#1year}{#1endyear}} - and test {\iffieldsequal{#1month}{#1endmonth}}} - {\mkbibdateapalong{#1year}{}{#1day}}% - {\mkbibdateapalong{#1year}{#1month}{#1day}}% - \dateeraprint{#1year}% - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \iffieldsequal{#1year}{#1endyear}% - {\mkbibdateapalong{}{#1endmonth}{#1endday}}% - {\mkbibdateapalong{#1endyear}{#1endmonth}{#1endday}% - \dateeraprint{#1endyear}}}% - \enddateuncertainprint}}}}% - \endgroup}% - \def\apa@lbx@de@mkdaterangeapalongextra#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year}{} - {\printtext{% - \datecircaprint - \ifboolexpr{test {\iffieldsequal{#1year}{#1endyear}} - and test {\iffieldsequal{#1month}{#1endmonth}}} - {\mkbibdateapalongextra{#1year}{}{#1day}}% - {\mkbibdateapalongextra{#1year}{#1month}{#1day}}% - \dateeraprint{#1year}% - \dateuncertainprint - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \iffieldsequal{#1year}{#1endyear}% - {\mkbibdateapalongextra{}{#1endmonth}{#1endday}} - {\mkbibdateapalongextra{#1endyear}{#1endmonth}{#1endday}% - \dateeraprint{#1endyear}}}% - \enddateuncertainprint}}}% - \endgroup}% - \savecommand\mkdaterangeapalong - \savecommand\mkdaterangeapalongextra - \def\mkdaterangeapalong{% - \apa@lbx@de@mkdaterangeapalong}% - \def\mkdaterangeapalongextra#1{% - \apa@lbx@de@mkdaterangeapalongextra{#1}}% -} + \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}}}} \UndeclareBibliographyExtras{% \restorecommand\mkdaterangeapalong diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/ngerman-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/ngerman-apa.lbx index 766be76849..a53119f813 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/ngerman-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/ngerman-apa.lbx @@ -1,9 +1,10 @@ -\ProvidesFile{ngerman-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{ngerman-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{ngerman} % Following DGPs guidlines for German/Austrian % http://homepage.univie.ac.at/harald.werneck/Richtlinien_zur_Manuskriptgestaltung.pdf +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -66,54 +67,128 @@ \NewBibliographyString{charter} \NewBibliographyString{ofthe} \NewBibliographyString{tothe} +\NewBibliographyString{proposed} +\NewBibliographyString{repealed} +\NewBibliographyString{execorder} +\NewBibliographyString{senate} +\NewBibliographyString{resolution} +\NewBibliographyString{houseofrepresentatives} +\NewBibliographyString{report} +\NewBibliographyString{us} +\NewBibliographyString{southcarolina} +\NewBibliographyString{constitution} +\NewBibliographyString{amendment} +\NewBibliographyString{alabama} +\NewBibliographyString{alaska} +\NewBibliographyString{arizona} +\NewBibliographyString{arkansas} +\NewBibliographyString{california} +\NewBibliographyString{colorado} +\NewBibliographyString{connecticut} +\NewBibliographyString{delaware} +\NewBibliographyString{florida} +\NewBibliographyString{georgia} +\NewBibliographyString{hawaii} +\NewBibliographyString{idaho} +\NewBibliographyString{illinois} +\NewBibliographyString{indiana} +\NewBibliographyString{iowa} +\NewBibliographyString{kansas} +\NewBibliographyString{kentucky} +\NewBibliographyString{louisiana} +\NewBibliographyString{maine} +\NewBibliographyString{maryland} +\NewBibliographyString{massachusetts} +\NewBibliographyString{michigan} +\NewBibliographyString{minnesota} +\NewBibliographyString{mississippi} +\NewBibliographyString{missouri} +\NewBibliographyString{montana} +\NewBibliographyString{nebraska} +\NewBibliographyString{nevada} +\NewBibliographyString{newhampshire} +\NewBibliographyString{newjersey} +\NewBibliographyString{newmexico} +\NewBibliographyString{newyork} +\NewBibliographyString{northcarolina} +\NewBibliographyString{northdakota} +\NewBibliographyString{ohio} +\NewBibliographyString{oklahoma} +\NewBibliographyString{oregon} +\NewBibliographyString{pennsylvania} +\NewBibliographyString{rhodeisland} +\NewBibliographyString{southcarolina} +\NewBibliographyString{southdakota} +\NewBibliographyString{tennessee} +\NewBibliographyString{texas} +\NewBibliographyString{utah} +\NewBibliographyString{vermont} +\NewBibliographyString{virginia} +\NewBibliographyString{washington} +\NewBibliographyString{westvirginia} +\NewBibliographyString{wisconsin} +\NewBibliographyString{wyoming} \DeclareBibliographyStrings{% inherit = {ngerman}, + inpress = {{\midsentence{}im Druck}{\midsentence{}im Druck}}, % adding \midsentence is a fix as this is supposed to begin lower case in every instance (in citations as well as references) according to the DGP's Richtlinien zur Manuskriptgestaltung (German APA) jourarticle = {{Artikel}{Artikel}}, -% tothe = {{to\space the}{to\space the}},%FIXME -% ofthe = {{of\space the}{of\space the}},%FIXME -% unitednations = {{United\space Nations}{U\adddot N\adddot}}, -% charter = {{charter}{charter}}, -% article = {{article}{art\adddot}},%FIXME -% painting = {{painting}{painting}},%FIXME -% present = {{present}{present}},%FIXME -% song = {{song}{song}},%FIXME -% album = {{album}{album}},%FIXME -% map = {{map}{map}},%FIXME -% photograph = {{photograph}{photograph}},%FIXME -% photographs = {{photographs}{photographs}},%FIXME -% powerpoint = {{Powerpoint\space slides}{Powerpoint\space slides}},%FIXME + tothe = {{zur}{zur}}, + ofthe = {{der}{der}}, + unitednations = {{United\space Nations}{U\adddot N\adddot}}, + charter = {{Charter}{Charter}}, % Let's not translate everything and just capitalize some terms or else we run into problems because we would have to merge some existing definitions (e.g., the two terms "U.N." and "Charter" would actually need to be merged to "U.N.-Charta" for a proper translation). + proposed = {{vorgeschlagen}{vorgeschlagen}}, + repealed = {{ist\space weggefallen\space in}{weggefallen}}, + execorder = {{Executive\space Order}{Exec\adddot\space Order}}, + senate = {{Senate}{S\adddot}}, + resolution = {{Resolution}{Res\adddot}}, + houseofrepresentatives = {{House\space of\space Representatives}{H\adddot R\adddot}}, + report = {{Report}{Rep\adddot}}, + us = {{U\adddot S\adddot}{U\adddot S\adddot}}, + southcarolina = {{South\space Carolina}{S\adddot C\adddot}}, + constitution = {{Constitution}{Const\adddot}}, + section = {{Paragraph}{§}}, + amendment = {{Zusatzartikel}{Zusatzart\adddot}}, + article = {{Artikel}{Art\adddot}}, + painting = {{Gem\"alde}{Gem\"alde}}, + present = {{Gegenwart}{Gegenwart}}, + song = {{Song}{Song}}, + album = {{Album}{Album}}, + map = {{Landkarte}{Landkarte}}, + photograph = {{Foto}{Foto}}, + photographs = {{Fotos}{Fotos}}, + powerpoint = {{Power\hyphenate{}Point\hyphen{}Folien}{Power\hyphenate{}Point\hyphen{}Folien}}, % lecturenotes = {{lecturenotes}{lecturenotes}},%FIXME -% podcast = {{audio\space podcast}{audio\space podcast}},%FIXME -% podcastepisode = {{audio\space podcast\space episode}{audio\space podcast\space episode}},%FIXME -% interview = {{interview}{interview}},%FIXME -% speech = {{speech\space audio\space recording}{speech\space audio\space recording}},%FIXME -% lithograph = {{lithograph}{lith\adddot}},%FIXME -% video = {{video}{video}},%FIXME -% film = {{film}{film}},%FIXME -% tvseries = {{TV\space series}{TV\space series}},%FIXME -% tvepisode = {{TV\space series\space episode}{TV\space series\space episode}},%FIXME -% narrator = {{narrator}{narr\adddot}},%FIXME -% narrators = {{narrators}{narrs\adddot}},%FIXME - producer = {{Produzent}{Produzent}}, -% producers = {{producers}{producers}},%FIXME - execproducer = {{ausf\"uhrender Produzent}{ausf\adddotspace Produzent}}, -% execproducers = {{Executive\space Producers}{Exec\adddot\space Prods\adddot}},%FIXME -% execdirector = {{Executive\space Director}{Exec\adddot\space Dir\adddot}},%FIXME -% execdirectors = {{Executive\space Directors}{Exec\adddot\space Dirs\adddot}},%FIXME - director = {{Regisseur}{Reg\adddot}}, -% directors = {{directors}{dirs\adddot}},%FIXME - writer = {{Autor}{Autor}}, + podcast = {{Audiopodcast}{Audiopodcast}}, + podcastepisode = {{Audiopodcastepisode}{Audiopodcastepisode}}, + interview = {{Interview}{Interview}}, + speech = {{Sprachaufzeichnung}{Sprachaufzeichnung}}, + lithograph = {{Lithografie}{Lith\adddot}}, + video = {{Video}{Video}}, + film = {{Film}{Film}}, + tvseries = {{Fernsehserie}{Fernsehserie}}, + tvepisode = {{Fernsehserienepisode}{Fernsehserienepisode}}, + narrator = {{Erz\"ahler\addslash\nbhyphen{}in}{Erz\"ahler\addslash\nbhyphen{}in}}, + narrators = {{erz\"ahlende Personen}{erz\"ahlende Personen}}, + producer = {{Produz\adddot}{Produz\adddot}}, + producers = {{Produz\adddot}{Produz\adddot}}, + execproducer = {{ausf\adddot\space Produz\adddot}{ausf\adddot\space Produz\adddot}}, + execproducers = {{ausf\adddot\space Produz\adddot}{ausf\adddot\space Produz\adddot}}, + execdirector = {{ausf\adddot\space Reg\adddot}{ausf\adddot\space Reg\adddot}}, + execdirectors = {{ausf\adddot\space Reg\adddot}{ausf\adddot\space Reg\adddot}}, + director = {{Reg\adddot}{Reg\adddot}}, + directors = {{Reg\adddot}{Reg\adddot}}, + writer = {{Autor\addslash\nbhyphen{}in}{Autor\addslash\nbhyphen{}in}}, % writers = {{writers}{writers}},%FIXME -% host = {{host}{host}},%FIXME + host = {{Gastgeber\addslash\nbhyphen{}in}{Gastgeber\addslash\nbhyphen{}in}}, % hosts = {{hosts}{hosts}},%FIXME -% guestexpert = {{Guest\space Expert}{Guest\space Expert}},%FIXME + guestexpert = {{geladener\space Experte\space /\space geladene\space Expertin}{geladener\space Experte\space /\space geladene\space Expertin}}, % guestexperts = {{Guest\space Experts}{Guest\space Experts}},%FIXME with = {{mit}{mit}}, -% manunpub = {{unpublished\space manuscript}{unpublished\space manuscript}},%FIXME -% maninprep = {{manuscript\space in\space preparation}{manuscript\space in\space preparation}},%FIXME -% mansub = {{manuscript\space submitted\space for\space publication}{manuscript\space submitted\space for\space publication}},%FIXME -% supplement = {{supplement}{suppl\adddot}},%FIXME + manunpub = {{unver\"offentlichtes\space Manuskript}{unver\"offentlichtes\space Manuskript}}, + maninprep = {{Manuskript\space in\space Vorbereitung}{Manuskript\space in\space Vorbereitung}}, + mansub = {{Manuskript\space eingereicht\space zur\space Publikation}{Manuskript\space eingereicht\space zur\space Publikation}}, + supplement = {{Supplement}{Suppl\adddot}}, % part = {{part}{pt\adddot}},%FIXME abstract = {{Abstract}{Abstract}}, andothers = {{et\addabbrvspace al\adddot}{et\addabbrvspace al\adddot}}, @@ -126,9 +201,9 @@ available = {{Erh\"altlich}{Erh\"altlich}}, from = {{unter}{unter}}, archivedat = {{archiviert\space unter}{archiviert\space unter}}, - reviewof = {{Rezension\space des}{Rezension\space des}}, -% paragraph = {{paragraph}{para\adddot}},%FIXME -% paragraphs = {{paragraphs}{paras\adddot}},%FIXME + reviewof = {{Resprechung\space des}{Resprechung\space des}}, % "Rezension" isn't wrong, but according to DGP's Richtlinien zur Manuskriptgestaltung this is supposed to be called "Besprechung" + paragraph = {{Absatz}{Abs.\adddot}}, + paragraphs = {{Abs\"atze}{Abs.\adddot}}, origyear = {{Original\space erschienen}{Original\space erschienen}}, typechair = {{Leitung}{Leitung}}, typechairs = {{Leitung}{Leitung}}, @@ -136,13 +211,64 @@ typevolumes = {{Bandherausgeber}{Bandhrsg\adddot}}, typeseries = {{Reihenherausgeber}{Reihenhrsg\adddot}}, typeseriess = {{Reihenherausgeber}{Reihenhrsg\adddot}}, - typevolseries = {{Reihen- und\space Bandherausgeber}{Reihen-\space\& Bandhrsg\adddot}}, - typevolseriess = {{Reihen- und\space Bandherausgeber}{Reihen-\space\& Bandhrsg\adddot}}, + typevolseries = {{Reihen\hyphen und\space Bandherausgeber}{Reihen\hyphen\space\& Bandhrsg\adddot}}, + typevolseriess = {{Reihen\hyphen und\space Bandherausgeber}{Reihen\hyphen\space\& Bandhrsg\adddot}}, % annodomini = {{A\adddot\addabthinspace D\adddot}{A\adddot\addabthinspace D\adddot}}, % beforechrist = {{B\adddot\addabthinspace C\adddot}{B\adddot\addabthinspace C\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, % beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, - nodate = {{nicht\space datiert}{{}n\adddot\addabthinspace d\adddot}} + nodate = {{nicht\space datiert}{{}n\adddot\addabthinspace d\adddot}}, +% publication = {{Publication}{Publication}}, + alabama = {{Alabama}{{A\adddot L\adddot}}}, + alaska = {{Alaska}{{A\adddot K\adddot}}}, + arizona = {{Arizona}{{A\adddot Z\adddot}}}, + arkansas = {{Arkansas}{{A\adddot R\adddot}}}, + california = {{California}{{C\adddot A\adddot}}}, + colorado = {{Colorado}{{C\adddot O\adddot}}}, + connecticut = {{Connecticut}{{C\adddot T\adddot}}}, + delaware = {{Delaware}{{D\adddot E\adddot}}}, + florida = {{Florida}{{F\adddot L\adddot}}}, + georgia = {{Georgia}{{G\adddot A\adddot}}}, + hawaii = {{Hawaii}{{H\adddot I\adddot}}}, + idaho = {{Idaho}{{I\adddot D\adddot}}}, + illinois = {{Illinois}{{I\adddot L\adddot}}}, + indiana = {{Indiana}{{I\adddot N\adddot}}}, + iowa = {{Iowa}{{I\adddot A\adddot}}}, + kansas = {{Kansas}{{K\adddot S\adddot}}}, + kentucky = {{Kentucky}{{K\adddot Y\adddot}}}, + louisiana = {{Louisiana}{{L\adddot A\adddot}}}, + maine = {{Maine}{{M\adddot E\adddot}}}, + maryland = {{Maryland}{{M\adddot D\adddot}}}, + massachusetts = {{Massachusetts}{{M\adddot A\adddot}}}, + michigan = {{Michigan}{{M\adddot I\adddot}}}, + minnesota = {{Minnesota}{{M\adddot N\adddot}}}, + mississippi = {{Mississippi}{{M\adddot S\adddot}}}, + missouri = {{Missouri}{{M\adddot O\adddot}}}, + montana = {{Montana}{{M\adddot T\adddot}}}, + nebraska = {{Nebraska}{{N\adddot E\adddot}}}, + nevada = {{Nevada}{{N\adddot V\adddot}}}, + newhampshire = {{New Hampshire}{{N\adddot H\adddot}}}, + newjersey = {{New Jersey}{{N\adddot J\adddot}}}, + newmexico = {{New Mexico}{{N\adddot M\adddot}}}, + newyork = {{New York}{{N\adddot Y\adddot}}}, + northcarolina = {{North Carolina}{{N\adddot C\adddot}}}, + northdakota = {{North Dakota}{{N\adddot D\adddot}}}, + ohio = {{Ohio}{{O\adddot H\adddot}}}, + oklahoma = {{Oklahoma}{{O\adddot K\adddot}}}, + oregon = {{Oregon}{{O\adddot R\adddot}}}, + pennsylvania = {{Pennsylvania}{{P\adddot A\adddot}}}, + rhodeisland = {{Rhode Island}{{R\adddot I\adddot}}}, + southcarolina = {{South Carolina}{{S\adddot C\adddot}}}, + southdakota = {{South Dakota}{{S\adddot D\adddot}}}, + tennessee = {{Tennessee}{{T\adddot N\adddot}}}, + texas = {{Texas}{{T\adddot X\adddot}}}, + utah = {{Utah}{{U\adddot T\adddot}}}, + vermont = {{Vermont}{{V\adddot T\adddot}}}, + virginia = {{Virginia}{{V\adddot A\adddot}}}, + washington = {{Washington}{{W\adddot A\adddot}}}, + westvirginia = {{West Virginia}{{W\adddot V\adddot}}}, + wisconsin = {{Wisconsin}{{W\adddot I\adddot}}}, + wyoming = {{Wyoming}{{W\adddot Y\adddot}}} } @@ -153,139 +279,90 @@ \DeclareBibliographyExtras{% \renewcommand{\apashortdash}{~}% \def\urldatecomma{\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% - {\iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}% - \ifboolexpr{test {\iffieldundef{#3}} and test {\iffieldundef{#2}}} + {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}% + \ifboolexpr{test {\iffieldundef{#4}} and test {\iffieldundef{#3}}} {} {\addcomma\space}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\mkbibordinal{\thefield{#3}}% - \iffieldundef{#2} + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY + {}% + {\mkbibordinal{\thefield{#4}}% + \iffieldundef{#3} {} {\addspace}}% - \iffieldundef{#2}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + {\mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% - {\iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}% - \printfield{extradate}% - \ifboolexpr{test {\iffieldundef{#3}} and test {\iffieldundef{#2}}} + {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}% + \ifboolexpr{test {\iffieldundef{#4}} and test {\iffieldundef{#3}}} {} {\addcomma\space}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\mkbibordinal{\thefield{#3}}% - \iffieldundef{#2} + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY + {}% + {\mkbibordinal{\thefield{#4}}% + \iffieldundef{#3} {} {\addspace}}% - \iffieldundef{#2}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + {\mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\mkbibordinal{\thefield{#3}}}% - \iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% - {\iffieldundef{#3}% + {\mkbibordinal{\thefield{#4}}}% + \iffieldundef{#3}% MONTH + {}% + {\iffieldundef{#4}% {}% {\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#1}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#1}% YEAR {}% - {\iffieldundef{#2}% + {\iffieldundef{#3}% {}% {\addspace}% - \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}}}% - \def\apa@lbx@de@mkdaterangeapalong#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year}{} - {\datecircaprint - \ifstrequal{#1}{url}% URL dates are unlikely to be BCE ... - {\printtext{% - \iffieldsequal{#1year}{#1endyear} - {\iffieldsequal{#1month}{#1endmonth} - {\mkbibdateapalongmdy{}{}{#1day}} - {\mkbibdateapalongmdy{}{#1month}{#1day}}} - {\mkbibdateapalongmdy{#1year}{#1month}{#1day}}% - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \mkbibdateapalongmdy{#1endyear}{#1endmonth}{#1endday}}}% - \dateuncertainprint}} - {\printtext{% - \ifboolexpr{test {\iffieldsequal{#1year}{#1endyear}} - and test {\iffieldsequal{#1month}{#1endmonth}}} - {\mkbibdateapalong{#1year}{}{#1day}}% - {\mkbibdateapalong{#1year}{#1month}{#1day}}% - \dateeraprint{#1year}% - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \iffieldsequal{#1year}{#1endyear}% - {\mkbibdateapalong{}{#1endmonth}{#1endday}}% - {\mkbibdateapalong{#1endyear}{#1endmonth}{#1endday}% - \dateeraprint{#1endyear}}}% - \enddateuncertainprint}}}}% - \endgroup}% - \def\apa@lbx@de@mkdaterangeapalongextra#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year}{} - {\printtext{% - \datecircaprint - \ifboolexpr{test {\iffieldsequal{#1year}{#1endyear}} - and test {\iffieldsequal{#1month}{#1endmonth}}} - {\mkbibdateapalongextra{#1year}{}{#1day}}% - {\mkbibdateapalongextra{#1year}{#1month}{#1day}}% - \dateeraprint{#1year}% - \dateuncertainprint - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \iffieldsequal{#1year}{#1endyear}% - {\mkbibdateapalongextra{}{#1endmonth}{#1endday}} - {\mkbibdateapalongextra{#1endyear}{#1endmonth}{#1endday}% - \dateeraprint{#1endyear}}}% - \enddateuncertainprint}}}% - \endgroup}% - \savecommand\mkdaterangeapalong - \savecommand\mkdaterangeapalongextra - \def\mkdaterangeapalong{% - \apa@lbx@de@mkdaterangeapalong}% - \def\mkdaterangeapalongextra#1{% - \apa@lbx@de@mkdaterangeapalongextra{#1}}% -} + \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}}}} \UndeclareBibliographyExtras{% \restorecommand\mkdaterangeapalong diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/norsk-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/norsk-apa.lbx index 89c32580d6..0f413b1a64 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/norsk-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/norsk-apa.lbx @@ -1,6 +1,7 @@ -\ProvidesFile{norsk-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{norsk-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{norsk} +\NewBibliographyString{publication} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} \NewBibliographyString{typechairs} @@ -98,7 +99,8 @@ % annodomini = {{A\adddot D\adddot}{A\adddot D\adddot}}, % beforechrist = {{B\adddot C\adddot}{B\adddot C\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, -% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} +% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, +% publication = {{Publication}{Publication}} } % @@ -108,75 +110,94 @@ % Drop end* when they are the same as * % You must use \printdate to get here otherwise it will be ignored + \DeclareBibliographyExtras{% \def\urldatecomma{\addcomma\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% {\iffieldundef{#1}% {} {\addcomma\addspace}% - \stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + \stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#3} + {\iffieldundef{#4} {\iffieldundef{#1} {} {\addspace}}% {\adddot\addspace}% - \mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + \mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% {\iffieldundef{#1}% {} {\addcomma\addspace}% - \stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + \stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#3} + {\iffieldundef{#4} {\iffieldundef{#1} {} {\addspace}}% {\adddot\addspace}% - \mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + \mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% - {\iffieldundef{#3}% + {\stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH + {}% + {\iffieldundef{#4}% {}% {\adddot\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#1}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#1}% YEAR {}% - {\iffieldundef{#2}% + {\iffieldundef{#3}% {}% {\addspace}% \iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}}} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/norwegian-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/norwegian-apa.lbx index 2b1a224646..dfb908e142 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/norwegian-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/norwegian-apa.lbx @@ -1,6 +1,7 @@ -\ProvidesFile{norwegian-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{norwegian-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{norwegian} +\NewBibliographyString{publication} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} \NewBibliographyString{typechairs} @@ -137,7 +138,8 @@ % annodomini = {{A\adddot D\adddot}{A\adddot D\adddot}}, % beforechrist = {{B\adddot C\adddot}{B\adddot C\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, -% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} +% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, +% publication = {{Publication}{Publication}} } % @@ -149,73 +151,91 @@ \DeclareBibliographyExtras{% \def\urldatecomma{\addcomma\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% {\iffieldundef{#1}% {} {\addcomma\addspace}% - \stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + \stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#3} + {\iffieldundef{#4} {\iffieldundef{#1} {} {\addspace}}% {\adddot\addspace}% - \mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + \mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% {\iffieldundef{#1}% {} {\addcomma\addspace}% - \stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + \stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#3} + {\iffieldundef{#4} {\iffieldundef{#1} {} {\addspace}}% {\adddot\addspace}% - \mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + \mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% - {\iffieldundef{#3}% + {\stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH + {}% + {\iffieldundef{#4}% {}% {\adddot\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#1}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#1}% YEAR {}% - {\iffieldundef{#2}% + {\iffieldundef{#3}% {}% {\addspace}% \iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}}} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/nswissgerman-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/nswissgerman-apa.lbx index 9da8adbda1..fb8861e044 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/nswissgerman-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/nswissgerman-apa.lbx @@ -1,9 +1,10 @@ -\ProvidesFile{nswissgerman-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{nswissgerman-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{nswissgerman} % Following DGPs guidlines for German/Austrian/Swiss German % http://homepage.univie.ac.at/harald.werneck/Richtlinien_zur_Manuskriptgestaltung.pdf +\NewBibliographyString{publication} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} \NewBibliographyString{typechairs} @@ -65,54 +66,128 @@ \NewBibliographyString{charter} \NewBibliographyString{ofthe} \NewBibliographyString{tothe} +\NewBibliographyString{proposed} +\NewBibliographyString{repealed} +\NewBibliographyString{execorder} +\NewBibliographyString{senate} +\NewBibliographyString{resolution} +\NewBibliographyString{houseofrepresentatives} +\NewBibliographyString{report} +\NewBibliographyString{us} +\NewBibliographyString{southcarolina} +\NewBibliographyString{constitution} +\NewBibliographyString{amendment} +\NewBibliographyString{alabama} +\NewBibliographyString{alaska} +\NewBibliographyString{arizona} +\NewBibliographyString{arkansas} +\NewBibliographyString{california} +\NewBibliographyString{colorado} +\NewBibliographyString{connecticut} +\NewBibliographyString{delaware} +\NewBibliographyString{florida} +\NewBibliographyString{georgia} +\NewBibliographyString{hawaii} +\NewBibliographyString{idaho} +\NewBibliographyString{illinois} +\NewBibliographyString{indiana} +\NewBibliographyString{iowa} +\NewBibliographyString{kansas} +\NewBibliographyString{kentucky} +\NewBibliographyString{louisiana} +\NewBibliographyString{maine} +\NewBibliographyString{maryland} +\NewBibliographyString{massachusetts} +\NewBibliographyString{michigan} +\NewBibliographyString{minnesota} +\NewBibliographyString{mississippi} +\NewBibliographyString{missouri} +\NewBibliographyString{montana} +\NewBibliographyString{nebraska} +\NewBibliographyString{nevada} +\NewBibliographyString{newhampshire} +\NewBibliographyString{newjersey} +\NewBibliographyString{newmexico} +\NewBibliographyString{newyork} +\NewBibliographyString{northcarolina} +\NewBibliographyString{northdakota} +\NewBibliographyString{ohio} +\NewBibliographyString{oklahoma} +\NewBibliographyString{oregon} +\NewBibliographyString{pennsylvania} +\NewBibliographyString{rhodeisland} +\NewBibliographyString{southcarolina} +\NewBibliographyString{southdakota} +\NewBibliographyString{tennessee} +\NewBibliographyString{texas} +\NewBibliographyString{utah} +\NewBibliographyString{vermont} +\NewBibliographyString{virginia} +\NewBibliographyString{washington} +\NewBibliographyString{westvirginia} +\NewBibliographyString{wisconsin} +\NewBibliographyString{wyoming} \DeclareBibliographyStrings{% inherit = {nswissgerman}, + inpress = {{\midsentence{}im Druck}{\midsentence{}im Druck}}, % adding \midsentence is a fix as this is supposed to begin lower case in every instance (in citations as well as references) according to the DGP's Richtlinien zur Manuskriptgestaltung (German APA) jourarticle = {{Artikel}{Artikel}}, -% tothe = {{to\space the}{to\space the}},%FIXME -% ofthe = {{of\space the}{of\space the}},%FIXME -% unitednations = {{United\space Nations}{U\adddot N\adddot}}, -% charter = {{charter}{charter}}, -% article = {{article}{art\adddot}},%FIXME -% painting = {{painting}{painting}},%FIXME -% present = {{present}{present}},%FIXME -% song = {{song}{song}},%FIXME -% album = {{album}{album}},%FIXME -% map = {{map}{map}},%FIXME -% photograph = {{photograph}{photograph}},%FIXME -% photographs = {{photographs}{photographs}},%FIXME -% powerpoint = {{Powerpoint\space slides}{Powerpoint\space slides}},%FIXME + tothe = {{zur}{zur}}, + ofthe = {{der}{der}}, + unitednations = {{United\space Nations}{U\adddot N\adddot}}, + charter = {{Charter}{Charter}}, % Let's not translate everything and just capitalize some terms or else we run into problems because we would have to merge some existing definitions (e.g., the two terms "U.N." and "Charter" would actually need to be merged to "U.N.-Charta" for a proper translation). + proposed = {{vorgeschlagen}{vorgeschlagen}}, + repealed = {{ist\space weggefallen\space in}{weggefallen}}, + execorder = {{Executive\space Order}{Exec\adddot\space Order}}, + senate = {{Senate}{S\adddot}}, + resolution = {{Resolution}{Res\adddot}}, + houseofrepresentatives = {{House\space of\space Representatives}{H\adddot R\adddot}}, + report = {{Report}{Rep\adddot}}, + us = {{U\adddot S\adddot}{U\adddot S\adddot}}, + southcarolina = {{South\space Carolina}{S\adddot C\adddot}}, + constitution = {{Constitution}{Const\adddot}}, + section = {{Paragraph}{§}}, + amendment = {{Zusatzartikel}{Zusatzart\adddot}}, + article = {{Artikel}{Art\adddot}}, + painting = {{Gem\"alde}{Gem\"alde}}, + present = {{Gegenwart}{Gegenwart}}, + song = {{Song}{Song}}, + album = {{Album}{Album}}, + map = {{Landkarte}{Landkarte}}, + photograph = {{Foto}{Foto}}, + photographs = {{Fotos}{Fotos}}, + powerpoint = {{Power\hyphenate{}Point\hyphen{}Folien}{Power\hyphenate{}Point\hyphen{}Folien}}, % lecturenotes = {{lecturenotes}{lecturenotes}},%FIXME -% podcast = {{audio\space podcast}{audio\space podcast}},%FIXME -% podcastepisode = {{audio\space podcast\space episode}{audio\space podcast\space episode}},%FIXME -% interview = {{interview}{interview}},%FIXME -% speech = {{speech\space audio\space recording}{speech\space audio\space recording}},%FIXME -% lithograph = {{lithograph}{lith\adddot}},%FIXME -% video = {{video}{video}},%FIXME -% film = {{film}{film}},%FIXME -% tvseries = {{TV\space series}{TV\space series}},%FIXME -% tvepisode = {{TV\space series\space episode}{TV\space series\space episode}},%FIXME -% narrator = {{narrator}{narr\adddot}},%FIXME -% narrators = {{narrators}{narrs\adddot}},%FIXME - producer = {{Produzent}{Produzent}}, -% producers = {{producers}{producers}},%FIXME - execproducer = {{ausf\"uhrender Produzent}{ausf\adddotspace Produzent}}, -% execproducers = {{Executive\space Producers}{Exec\adddot\space Prods\adddot}},%FIXME -% execdirector = {{Executive\space Director}{Exec\adddot\space Dir\adddot}},%FIXME -% execdirectors = {{Executive\space Directors}{Exec\adddot\space Dirs\adddot}},%FIXME - director = {{Regisseur}{Reg\adddot}}, -% directors = {{directors}{dirs\adddot}},%FIXME - writer = {{Autor}{Autor}}, + podcast = {{Audiopodcast}{Audiopodcast}}, + podcastepisode = {{Audiopodcastepisode}{Audiopodcastepisode}}, + interview = {{Interview}{Interview}}, + speech = {{Sprachaufzeichnung}{Sprachaufzeichnung}}, + lithograph = {{Lithografie}{Lith\adddot}}, + video = {{Video}{Video}}, + film = {{Film}{Film}}, + tvseries = {{Fernsehserie}{Fernsehserie}}, + tvepisode = {{Fernsehserienepisode}{Fernsehserienepisode}}, + narrator = {{Erz\"ahler\addslash\nbhyphen{}in}{Erz\"ahler\addslash\nbhyphen{}in}}, + narrators = {{erz\"ahlende Personen}{erz\"ahlende Personen}}, + producer = {{Produz\adddot}{Produz\adddot}}, + producers = {{Produz\adddot}{Produz\adddot}}, + execproducer = {{ausf\adddot\space Produz\adddot}{ausf\adddot\space Produz\adddot}}, + execproducers = {{ausf\adddot\space Produz\adddot}{ausf\adddot\space Produz\adddot}}, + execdirector = {{ausf\adddot\space Reg\adddot}{ausf\adddot\space Reg\adddot}}, + execdirectors = {{ausf\adddot\space Reg\adddot}{ausf\adddot\space Reg\adddot}}, + director = {{Reg\adddot}{Reg\adddot}}, + directors = {{Reg\adddot}{Reg\adddot}}, + writer = {{Autor\addslash\nbhyphen{}in}{Autor\addslash\nbhyphen{}in}} % writers = {{writers}{writers}},%FIXME -% host = {{host}{host}},%FIXME + host = {{Gastgeber\addslash\nbhyphen{}in}{Gastgeber\addslash\nbhyphen{}in}}, % hosts = {{hosts}{hosts}},%FIXME -% guestexpert = {{Guest\space Expert}{Guest\space Expert}},%FIXME + guestexpert = {{geladener\space Experte\space /\space geladene\space Expertin}{geladener\space Experte\space /\space geladene\space Expertin}}, % guestexperts = {{Guest\space Experts}{Guest\space Experts}},%FIXME with = {{mit}{mit}}, -% manunpub = {{unpublished\space manuscript}{unpublished\space manuscript}},%FIXME -% maninprep = {{manuscript\space in\space preparation}{manuscript\space in\space preparation}},%FIXME -% mansub = {{manuscript\space submitted\space for\space publication}{manuscript\space submitted\space for\space publication}},%FIXME -% supplement = {{supplement}{suppl\adddot}},%FIXME + manunpub = {{unver\"offentlichtes\space Manuskript}{unver\"offentlichtes\space Manuskript}}, + maninprep = {{Manuskript\space in\space Vorbereitung}{Manuskript\space in\space Vorbereitung}}, + mansub = {{Manuskript\space eingereicht\space zur\space Publikation}{Manuskript\space eingereicht\space zur\space Publikation}}, + supplement = {{Supplement}{Suppl\adddot}}, % part = {{part}{pt\adddot}},%FIXME andothers = {{et\addabbrvspace al\adddot}{et\addabbrvspace al\adddot}}, revisededition = {{\"uberarbeitete\space Auf\noligature lage}{\"uberarb\adddotspace Aufl\adddot}}, @@ -124,9 +199,9 @@ available = {{erh\"altlich}{erh\"altlich}}, from = {{unter}{unter}}, archivedat = {{archiviert\space unter}{archiviert\space unter}}, - reviewof = {{Rezension\space des}{Rezension\space des}}, -% paragraph = {{paragraph}{para\adddot}},%FIXME -% paragraphs = {{paragraphs}{paras\adddot}},%FIXME + reviewof = {{Resprechung\space des}{Resprechung\space des}}, % "Rezension" isn't wrong, but according to DGP's Richtlinien zur Manuskriptgestaltung this is supposed to be called "Besprechung" + paragraph = {{Absatz}{Abs.\adddot}}, + paragraphs = {{Abs\"atze}{Abs.\adddot}}, origyear = {{Original\space erschienen}{Original\space erschienen}}, typechair = {{Leitung}{Leitung}}, typechairs = {{Leitung}{Leitung}}, @@ -134,12 +209,63 @@ typevolumes = {{Bandherausgeber}{Bandhrsg\adddot}}, typeseries = {{Reihenherausgeber}{Reihenhrsg\adddot}}, typeseriess = {{Reihenherausgeber}{Reihenhrsg\adddot}}, - typevolseries = {{Reihen- und\space Bandherausgeber}{Reihen-\space\& Bandhrsg\adddot}}, - typevolseriess = {{Reihen- und\space Bandherausgeber}{Reihen-\space\& Bandhrsg\adddot}}, + typevolseries = {{Reihen\hyphen und\space Bandherausgeber}{Reihen\hyphen\space\& Bandhrsg\adddot}}, + typevolseriess = {{Reihen\hyphen und\space Bandherausgeber}{Reihen\hyphen\space\& Bandhrsg\adddot}}, % annodomini = {{A\adddot\addabthinspace D\adddot}{A\adddot\addabthinspace D\adddot}}, % beforechrist = {{B\adddot\addabthinspace C\adddot}{B\adddot\addabthinspace C\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, -% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} +% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, +% publication = {{Publication}{Publication}}, + alabama = {{Alabama}{{A\adddot L\adddot}}}, + alaska = {{Alaska}{{A\adddot K\adddot}}}, + arizona = {{Arizona}{{A\adddot Z\adddot}}}, + arkansas = {{Arkansas}{{A\adddot R\adddot}}}, + california = {{California}{{C\adddot A\adddot}}}, + colorado = {{Colorado}{{C\adddot O\adddot}}}, + connecticut = {{Connecticut}{{C\adddot T\adddot}}}, + delaware = {{Delaware}{{D\adddot E\adddot}}}, + florida = {{Florida}{{F\adddot L\adddot}}}, + georgia = {{Georgia}{{G\adddot A\adddot}}}, + hawaii = {{Hawaii}{{H\adddot I\adddot}}}, + idaho = {{Idaho}{{I\adddot D\adddot}}}, + illinois = {{Illinois}{{I\adddot L\adddot}}}, + indiana = {{Indiana}{{I\adddot N\adddot}}}, + iowa = {{Iowa}{{I\adddot A\adddot}}}, + kansas = {{Kansas}{{K\adddot S\adddot}}}, + kentucky = {{Kentucky}{{K\adddot Y\adddot}}}, + louisiana = {{Louisiana}{{L\adddot A\adddot}}}, + maine = {{Maine}{{M\adddot E\adddot}}}, + maryland = {{Maryland}{{M\adddot D\adddot}}}, + massachusetts = {{Massachusetts}{{M\adddot A\adddot}}}, + michigan = {{Michigan}{{M\adddot I\adddot}}}, + minnesota = {{Minnesota}{{M\adddot N\adddot}}}, + mississippi = {{Mississippi}{{M\adddot S\adddot}}}, + missouri = {{Missouri}{{M\adddot O\adddot}}}, + montana = {{Montana}{{M\adddot T\adddot}}}, + nebraska = {{Nebraska}{{N\adddot E\adddot}}}, + nevada = {{Nevada}{{N\adddot V\adddot}}}, + newhampshire = {{New Hampshire}{{N\adddot H\adddot}}}, + newjersey = {{New Jersey}{{N\adddot J\adddot}}}, + newmexico = {{New Mexico}{{N\adddot M\adddot}}}, + newyork = {{New York}{{N\adddot Y\adddot}}}, + northcarolina = {{North Carolina}{{N\adddot C\adddot}}}, + northdakota = {{North Dakota}{{N\adddot D\adddot}}}, + ohio = {{Ohio}{{O\adddot H\adddot}}}, + oklahoma = {{Oklahoma}{{O\adddot K\adddot}}}, + oregon = {{Oregon}{{O\adddot R\adddot}}}, + pennsylvania = {{Pennsylvania}{{P\adddot A\adddot}}}, + rhodeisland = {{Rhode Island}{{R\adddot I\adddot}}}, + southcarolina = {{South Carolina}{{S\adddot C\adddot}}}, + southdakota = {{South Dakota}{{S\adddot D\adddot}}}, + tennessee = {{Tennessee}{{T\adddot N\adddot}}}, + texas = {{Texas}{{T\adddot X\adddot}}}, + utah = {{Utah}{{U\adddot T\adddot}}}, + vermont = {{Vermont}{{V\adddot T\adddot}}}, + virginia = {{Virginia}{{V\adddot A\adddot}}}, + washington = {{Washington}{{W\adddot A\adddot}}}, + westvirginia = {{West Virginia}{{W\adddot V\adddot}}}, + wisconsin = {{Wisconsin}{{W\adddot I\adddot}}}, + wyoming = {{Wyoming}{{W\adddot Y\adddot}}} } @@ -150,139 +276,90 @@ \DeclareBibliographyExtras{% \renewcommand{\apashortdash}{~}% \def\urldatecomma{\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% - {\iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}% - \ifboolexpr{test {\iffieldundef{#3}} and test {\iffieldundef{#2}}} + {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}% + \ifboolexpr{test {\iffieldundef{#4}} and test {\iffieldundef{#3}}} {} {\addcomma\space}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\mkbibordinal{\thefield{#3}}% - \iffieldundef{#2} + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY + {}% + {\mkbibordinal{\thefield{#4}}% + \iffieldundef{#3} {} {\addspace}}% - \iffieldundef{#2}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + {\mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% - {\iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}% - \printfield{extradate}% - \ifboolexpr{test {\iffieldundef{#3}} and test {\iffieldundef{#2}}} + {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}% + \ifboolexpr{test {\iffieldundef{#4}} and test {\iffieldundef{#3}}} {} {\addcomma\space}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\mkbibordinal{\thefield{#3}}% - \iffieldundef{#2} + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY + {}% + {\mkbibordinal{\thefield{#4}}% + \iffieldundef{#3} {} {\addspace}}% - \iffieldundef{#2}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + {\mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\mkbibordinal{\thefield{#3}}}% - \iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% - {\iffieldundef{#3}% + {\mkbibordinal{\thefield{#4}}}% + \iffieldundef{#3}% MONTH + {}% + {\iffieldundef{#4}% {}% {\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#1}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#1}% YEAR {}% - {\iffieldundef{#2}% + {\iffieldundef{#3}% {}% {\addspace}% - \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}}}% - \def\apa@lbx@de@mkdaterangeapalong#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year}{} - {\datecircaprint - \ifstrequal{#1}{url}% URL dates are unlikely to be BCE ... - {\printtext{% - \iffieldsequal{#1year}{#1endyear} - {\iffieldsequal{#1month}{#1endmonth} - {\mkbibdateapalongmdy{}{}{#1day}} - {\mkbibdateapalongmdy{}{#1month}{#1day}}} - {\mkbibdateapalongmdy{#1year}{#1month}{#1day}}% - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \mkbibdateapalongmdy{#1endyear}{#1endmonth}{#1endday}}}% - \dateuncertainprint}} - {\printtext{% - \ifboolexpr{test {\iffieldsequal{#1year}{#1endyear}} - and test {\iffieldsequal{#1month}{#1endmonth}}} - {\mkbibdateapalong{#1year}{}{#1day}}% - {\mkbibdateapalong{#1year}{#1month}{#1day}}% - \dateeraprint{#1year}% - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \iffieldsequal{#1year}{#1endyear}% - {\mkbibdateapalong{}{#1endmonth}{#1endday}}% - {\mkbibdateapalong{#1endyear}{#1endmonth}{#1endday}% - \dateeraprint{#1endyear}}}% - \enddateuncertainprint}}}}% - \endgroup}% - \def\apa@lbx@de@mkdaterangeapalongextra#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year}{} - {\printtext{% - \datecircaprint - \ifboolexpr{test {\iffieldsequal{#1year}{#1endyear}} - and test {\iffieldsequal{#1month}{#1endmonth}}} - {\mkbibdateapalongextra{#1year}{}{#1day}}% - {\mkbibdateapalongextra{#1year}{#1month}{#1day}}% - \dateeraprint{#1year}% - \dateuncertainprint - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \iffieldsequal{#1year}{#1endyear}% - {\mkbibdateapalongextra{}{#1endmonth}{#1endday}} - {\mkbibdateapalongextra{#1endyear}{#1endmonth}{#1endday}% - \dateeraprint{#1endyear}}}% - \enddateuncertainprint}}}% - \endgroup}% - \savecommand\mkdaterangeapalong - \savecommand\mkdaterangeapalongextra - \def\mkdaterangeapalong{% - \apa@lbx@de@mkdaterangeapalong}% - \def\mkdaterangeapalongextra#1{% - \apa@lbx@de@mkdaterangeapalongextra{#1}}% -} + \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}}}} \UndeclareBibliographyExtras{% \restorecommand\mkdaterangeapalong diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/nynorsk-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/nynorsk-apa.lbx index f9e0e316c3..f0897caef9 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/nynorsk-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/nynorsk-apa.lbx @@ -1,6 +1,7 @@ -\ProvidesFile{nynorsk-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{nynorsk-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{nynorsk} +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -138,7 +139,8 @@ % annodomini = {{A\adddot D\adddot}{A\adddot D\adddot}}, % beforechrist = {{B\adddot C\adddot}{B\adddot C\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, -% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} +% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, +% publication = {{Publication}{Publication}} } % @@ -150,73 +152,91 @@ \DeclareBibliographyExtras{% \def\urldatecomma{\addcomma\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% {\iffieldundef{#1}% {} {\addcomma\addspace}% - \stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + \stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#3} + {\iffieldundef{#4} {\iffieldundef{#1} {} {\addspace}}% {\adddot\addspace}% - \mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + \mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% {\iffieldundef{#1}% {} {\addcomma\addspace}% - \stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + \stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#3} + {\iffieldundef{#4} {\iffieldundef{#1} {} {\addspace}}% {\adddot\addspace}% - \mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + \mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% - {\iffieldundef{#3}% + {\stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH + {}% + {\iffieldundef{#4}% {}% {\adddot\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#1}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#1}% YEAR {}% - {\iffieldundef{#2}% + {\iffieldundef{#3}% {}% {\addspace}% \iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}}} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/portuguese-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/portuguese-apa.lbx index 1dbfefa02b..f8a48b2e1c 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/portuguese-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/portuguese-apa.lbx @@ -1,6 +1,7 @@ -\ProvidesFile{portuguese-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{portuguese-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{portuguese} +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -134,7 +135,8 @@ % annodomini = {{A\adddot D\adddot}{A\adddot D\adddot}}, % beforechrist = {{B\adddot C\adddot}{B\adddot C\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, -% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} +% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, +% publication = {{Publication}{Publication}} } % @@ -146,71 +148,90 @@ \DeclareBibliographyExtras{% \def\urldatecomma{\addcomma\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \renewcommand{\apashortdash}{~}% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}}% - \iffieldundef{#2}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#3}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% {}% {\addspace}% - \stripzeros{\thefield{#3}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% - {}% - {\iffieldundef{#3}% + {\iffieldundef{#1}% {}% - {\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#1}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH {}% - {\ifthenelse{\iffieldundef{#2}\OR\iffieldundef{#3}}% - {}% - {\addspace}% + {\mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\addspace}% + \stripzeros{\thefield{#4}}% + \iffieldundef{#1}% YEAR + {}% + {\iffieldundef{#4}% + {\iffieldundef{#3}% + {}% + {\addspace}}% + {\addcomma\addspace}% \iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}}} % diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/russian-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/russian-apa.lbx index fc84c011b8..77ee7f87c0 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/russian-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/russian-apa.lbx @@ -1,6 +1,7 @@ -\ProvidesFile{russian-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{russian-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{russian} +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -133,7 +134,8 @@ annodomini = {{нашей\space эры}{н\adddotspace э\adddot}}, beforechrist = {{до\space нашей\space эры}{до н\adddotspace э\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, -% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} +% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, +% publication = {{Publication}{Publication}} } \protected\gdef\lbx@sl@mkbibmonth#1{% @@ -156,73 +158,91 @@ \fi}% \DeclareBibliographyExtras{% - \def\urldatecomma{\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \def\urldatecomma{\addcomma\addspace}% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% - {\iffieldundef{#3} + {\iffieldundef{#1}% + {} + {\addcomma\addspace}% + \stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH + {}% + {\iffieldundef{#4} {\iffieldundef{#1} {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - {\addspace\lbx@sl@mkbibmonth{\thefield{#2}}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + \mkbibmonth{\thefield{#3}}}% + {\addspace\lbx@sl@mkbibmonth{\thefield{#3}}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% {\iffieldundef{#1}% {}% {\addcomma\addspace}% - \stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#1}% + {} + {\addcomma\addspace}% + \stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#3} + {\iffieldundef{#4} {\iffieldundef{#1} {}% {\addcomma\addspace}% - \mkbibmonth{\thefield{#2}}}% - {\addspace\lbx@sl@mkbibmonth{\thefield{#2}}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + \mkbibmonth{\thefield{#3}}}% + {\addspace\lbx@sl@mkbibmonth{\thefield{#3}}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% - {\iffieldundef{#3}% - {\mkbibmonth{\thefield{#2}}}% - {\addspace\lbx@sl@mkbibmonth{\thefield{#2}}}}% - \iffieldundef{#1}% + {\stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH + {}% + {\iffieldundef{#4}% + {\mkbibmonth{\thefield{#3}}}% + {\addspace\lbx@sl@mkbibmonth{\thefield{#3}}}}% + \iffieldundef{#1}% YEAR {}% - {\iffieldundef{#2}% + {\iffieldundef{#3}% {}% {\addspace}% \iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}}} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/slovene-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/slovene-apa.lbx index d393becabf..1d37d34dd0 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/slovene-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/slovene-apa.lbx @@ -1,6 +1,7 @@ -\ProvidesFile{slovene-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{slovene-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{slovene} +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -161,7 +162,8 @@ % annodomini = {{A\adddot D\adddot}{A\adddot D\adddot}}, % beforechrist = {{B\adddot C\adddot}{B\adddot C\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, -% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} +% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, +% publication = {{Publication}{Publication}} } \protected\gdef\lbx@sl@mkbibmonth#1{% @@ -185,75 +187,94 @@ \DeclareBibliographyExtras{% \def\urldatecomma{\addcomma\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% {\iffieldundef{#1}% {} {\addcomma\addspace}% - \stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + \stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#3} + {\iffieldundef{#4} {\iffieldundef{#1} {} {\addspace}}% {\adddot\addspace}% - \mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + \mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% {\iffieldundef{#1}% {} {\addcomma\addspace}% - \stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + \stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#3} + {\iffieldundef{#4} {\iffieldundef{#1} {} {\addspace}}% {\adddot\addspace}% - \mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + \mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% - {\iffieldundef{#3}% + {\stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH + {}% + {\iffieldundef{#4}% {}% {\adddot\addspace}% - \lbx@sl@mkbibmonth{\thefield{#2}}}% - \iffieldundef{#1}% + \lbx@sl@mkbibmonth{\thefield{#3}}}% + \iffieldundef{#1}% YEAR {}% - {\iffieldundef{#2}% + {\iffieldundef{#3}% {}% {\addspace}% \iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}}} + \endinput diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/spanish-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/spanish-apa.lbx index 83bfc65e5d..b4b1f2e724 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/spanish-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/spanish-apa.lbx @@ -1,8 +1,9 @@ -\ProvidesFile{spanish-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{spanish-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{spanish} \setcounter{smartand}{0} % Turn off "smart and" or ampersands will all be replaced +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -154,6 +155,7 @@ beforechrist = {{antes\space de\space Cristo}{a\adddot\space C\adddot}}, commonera = {{era\space com\'un}{e\adddot c\adddot}}, beforecommonera = {{antes\space de\space la\space era\space com\'un}{a\adddot e\adddot c\adddot}} + % publication = {{Publication}{Publication}} } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -162,140 +164,90 @@ \DeclareBibliographyExtras{% \def\urldatecomma{\addcomma\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } - {\clearfield{labelmonth}% - \clearfield{labelday}} - {}% - \iffieldundef{#1}% + {\clearfield{labelmonth}% + \clearfield{labelday}} + {}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}% - \ifboolexpr{test {\iffieldundef{#3}} and test {\iffieldundef{#2}}} + \ifboolexpr{test {\iffieldundef{#4}} and test {\iffieldundef{#3}}} {} {\addcomma\space}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% - {\stripzeros{\thefield{#3}}% - \iffieldundef{#2} + {\stripzeros{\thefield{#4}}% + \iffieldundef{#3} {} {\addspace de\space}}% - \iffieldundef{#2}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + {\mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } - {\clearfield{labelmonth}% - \clearfield{labelday}} - {}% - \iffieldundef{#1}% + {\clearfield{labelmonth}% + \clearfield{labelday}} {}% - {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}% - \printfield{extradate}% - \ifboolexpr{test {\iffieldundef{#3}} and test {\iffieldundef{#2}}} + \iffieldundef{#1}% YEAR + {}% + {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}% + \ifboolexpr{test {\iffieldundef{#4}} and test {\iffieldundef{#3}}} {} {\addcomma\space}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% - {\stripzeros{\thefield{#3}}% - \iffieldundef{#2} + {\stripzeros{\thefield{#4}}% + \iffieldundef{#3} {} {\addspace de\space}}% - \iffieldundef{#2}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + {\mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } - {\clearfield{labelmonth}% - \clearfield{labelday}} - {}% - \iffieldundef{#3}% - {}% - {el\addspace\stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% - {\addspace{en}\addspace}% - {\iffieldundef{#3}% - {en\addspace}% - {\addspace{de}\addspace}% - \mkbibmonth{\thefield{#2}}{\addspace{de}\addspace}}% - \iffieldundef{#1}% - {}% - {\iffieldundef{#2}% + {\clearfield{labelmonth}% + \clearfield{labelday}} {}% - {\addspace}% - \thefield{#1}}}% - \def\apa@lbx@es@mkdaterangeapalong#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year}{} - {\datecircaprint - \ifstrequal{#1}{url}% URL dates are unlikely to be BCE ... - {\printtext{% - \iffieldsequal{#1year}{#1endyear} - {\iffieldsequal{#1month}{#1endmonth} - {\mkbibdateapalongmdy{}{}{#1day}} - {\mkbibdateapalongmdy{}{#1month}{#1day}}} - {\mkbibdateapalongmdy{#1year}{#1month}{#1day}}% - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \mkbibdateapalongmdy{#1endyear}{#1endmonth}{#1endday}}}% - \dateuncertainprint}} - {\printtext{% - \ifboolexpr{test {\iffieldsequal{#1year}{#1endyear}} - and test {\iffieldsequal{#1month}{#1endmonth}}} - {\mkbibdateapalong{#1year}{}{#1day}}% - {\mkbibdateapalong{#1year}{#1month}{#1day}}% - \dateeraprint{#1year}% - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \iffieldsequal{#1year}{#1endyear}% - {\mkbibdateapalong{}{#1endmonth}{#1endday}}% - {\mkbibdateapalong{#1endyear}{#1endmonth}{#1endday}% - \dateeraprint{#1endyear}}}% - \enddateuncertainprint}}}}% - \endgroup}% - \def\apa@lbx@es@mkdaterangeapalongextra#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year}{} - {\printtext{% - \datecircaprint - \ifboolexpr{test {\iffieldsequal{#1year}{#1endyear}} - and test {\iffieldsequal{#1month}{#1endmonth}}} - {\mkbibdateapalongextra{#1year}{}{#1day}}% - {\mkbibdateapalongextra{#1year}{#1month}{#1day}}% - \dateeraprint{#1year}% - \dateuncertainprint - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \iffieldsequal{#1year}{#1endyear}% - {\mkbibdateapalongextra{}{#1endmonth}{#1endday}} - {\mkbibdateapalongextra{#1endyear}{#1endmonth}{#1endday}% - \dateeraprint{#1endyear}}}% - \enddateuncertainprint}}}% - \endgroup}% - \savecommand\mkdaterangeapalong - \savecommand\mkdaterangeapalongextra - \def\mkdaterangeapalong{% - \apa@lbx@es@mkdaterangeapalong}% - \def\mkdaterangeapalongextra#1{% - \apa@lbx@es@mkdaterangeapalongextra{#1}}% -} - + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY + {}% + {el\addspace\stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH + {\addspace{en}\addspace}% + {\iffieldundef{#4}% + {en\addspace}% + {\addspace{de}\addspace}% + \mkbibmonth{\thefield{#3}}{\addspace{de}\addspace}}% + \iffieldundef{#1}% YEAR + {}% + {\iffieldundef{#2}% + {}% + {\addspace}% + \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}}}} \UndeclareBibliographyExtras{% \restorecommand\mkdaterangeapalong diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/swedish-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/swedish-apa.lbx index bab849a095..95938c6a77 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/swedish-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/swedish-apa.lbx @@ -1,6 +1,7 @@ -\ProvidesFile{swedish-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{swedish-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{swedish} +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -142,79 +143,97 @@ % annodomini = {{A\adddot D\adddot}{A\adddot D\adddot}}, % beforechrist = {{B\adddot C\adddot}{B\adddot C\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, -% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} +% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, +% publication = {{Publication}{Publication}} } - \DeclareBibliographyExtras{% \def\urldatecomma{\addcomma\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% {\iffieldundef{#1}% {} {\addcomma\addspace}% - \stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + \stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#3} + {\iffieldundef{#4} {\iffieldundef{#1} {} {\addspace}}% {\adddot\addspace}% - \mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + \mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% {\iffieldundef{#1}% {} {\addcomma\addspace}% - \stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + \stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH {}% - {\iffieldundef{#3} + {\iffieldundef{#4} {\iffieldundef{#1} {} {\addspace}}% {\adddot\addspace}% - \mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + \mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\stripzeros{\thefield{#3}}}% - \iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% - {\iffieldundef{#3}% + {\stripzeros{\thefield{#4}}}% + \iffieldundef{#3}% MONTH + {}% + {\iffieldundef{#4}% {}% {\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#1}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#1}% YEAR {}% - {\iffieldundef{#2}% + {\iffieldundef{#3}% {}% {\addspace}% \iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}}} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/swissgerman-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/swissgerman-apa.lbx index b2730b66f3..7a9b8015dd 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/swissgerman-apa.lbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/swissgerman-apa.lbx @@ -1,9 +1,10 @@ -\ProvidesFile{swissgerman-apa.lbx}[2021/12/24\space v9.15\space APA biblatex localisation] +\ProvidesFile{swissgerman-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] \InheritBibliographyExtras{swissgerman} % Following DGPs guidlines for German/Austrian/Swiss German % http://homepage.univie.ac.at/harald.werneck/Richtlinien_zur_Manuskriptgestaltung.pdf +\NewBibliographyString{publication} \NewBibliographyString{jourarticle} \NewBibliographyString{revisededition} \NewBibliographyString{typechair} @@ -66,55 +67,128 @@ \NewBibliographyString{charter} \NewBibliographyString{ofthe} \NewBibliographyString{tothe} +\NewBibliographyString{proposed} +\NewBibliographyString{repealed} +\NewBibliographyString{execorder} +\NewBibliographyString{senate} +\NewBibliographyString{resolution} +\NewBibliographyString{houseofrepresentatives} +\NewBibliographyString{report} +\NewBibliographyString{us} +\NewBibliographyString{southcarolina} +\NewBibliographyString{constitution} +\NewBibliographyString{amendment} +\NewBibliographyString{alabama} +\NewBibliographyString{alaska} +\NewBibliographyString{arizona} +\NewBibliographyString{arkansas} +\NewBibliographyString{california} +\NewBibliographyString{colorado} +\NewBibliographyString{connecticut} +\NewBibliographyString{delaware} +\NewBibliographyString{florida} +\NewBibliographyString{georgia} +\NewBibliographyString{hawaii} +\NewBibliographyString{idaho} +\NewBibliographyString{illinois} +\NewBibliographyString{indiana} +\NewBibliographyString{iowa} +\NewBibliographyString{kansas} +\NewBibliographyString{kentucky} +\NewBibliographyString{louisiana} +\NewBibliographyString{maine} +\NewBibliographyString{maryland} +\NewBibliographyString{massachusetts} +\NewBibliographyString{michigan} +\NewBibliographyString{minnesota} +\NewBibliographyString{mississippi} +\NewBibliographyString{missouri} +\NewBibliographyString{montana} +\NewBibliographyString{nebraska} +\NewBibliographyString{nevada} +\NewBibliographyString{newhampshire} +\NewBibliographyString{newjersey} +\NewBibliographyString{newmexico} +\NewBibliographyString{newyork} +\NewBibliographyString{northcarolina} +\NewBibliographyString{northdakota} +\NewBibliographyString{ohio} +\NewBibliographyString{oklahoma} +\NewBibliographyString{oregon} +\NewBibliographyString{pennsylvania} +\NewBibliographyString{rhodeisland} +\NewBibliographyString{southcarolina} +\NewBibliographyString{southdakota} +\NewBibliographyString{tennessee} +\NewBibliographyString{texas} +\NewBibliographyString{utah} +\NewBibliographyString{vermont} +\NewBibliographyString{virginia} +\NewBibliographyString{washington} +\NewBibliographyString{westvirginia} +\NewBibliographyString{wisconsin} +\NewBibliographyString{wyoming} \DeclareBibliographyStrings{% inherit = {swissgerman}, + inpress = {{\midsentence{}im Druck}{\midsentence{}im Druck}}, % adding \midsentence is a fix as this is supposed to begin lower case in every instance (in citations as well as references) according to the DGP's Richtlinien zur Manuskriptgestaltung (German APA) jourarticle = {{Artikel}{Artikel}}, -% tothe = {{to\space the}{to\space the}},%FIXME -% ofthe = {{of\space the}{of\space the}},%FIXME -% unitednations = {{United\space Nations}{U\adddot N\adddot}}, -% charter = {{charter}{charter}}, -% article = {{article}{art\adddot}},%FIXME -% painting = {{painting}{painting}},%FIXME -% present = {{present}{present}},%FIXME -% song = {{song}{song}},%FIXME -% album = {{album}{album}},%FIXME -% map = {{map}{map}},%FIXME -% photograph = {{photograph}{photograph}},%FIXME -% photographs = {{photographs}{photographs}},%FIXME -% powerpoint = {{Powerpoint\space slides}{Powerpoint\space slides}},%FIXME + tothe = {{zur}{zur}}, + ofthe = {{der}{der}}, + unitednations = {{United\space Nations}{U\adddot N\adddot}}, + charter = {{Charter}{Charter}}, % Let's not translate everything and just capitalize some terms or else we run into problems because we would have to merge some existing definitions (e.g., the two terms "U.N." and "Charter" would actually need to be merged to "U.N.-Charta" for a proper translation). + proposed = {{vorgeschlagen}{vorgeschlagen}}, + repealed = {{ist\space weggefallen\space in}{weggefallen}}, + execorder = {{Executive\space Order}{Exec\adddot\space Order}}, + senate = {{Senate}{S\adddot}}, + resolution = {{Resolution}{Res\adddot}}, + houseofrepresentatives = {{House\space of\space Representatives}{H\adddot R\adddot}}, + report = {{Report}{Rep\adddot}}, + us = {{U\adddot S\adddot}{U\adddot S\adddot}}, + southcarolina = {{South\space Carolina}{S\adddot C\adddot}}, + constitution = {{Constitution}{Const\adddot}}, + section = {{Paragraph}{§}}, + amendment = {{Zusatzartikel}{Zusatzart\adddot}}, + article = {{Artikel}{Art\adddot}}, + painting = {{Gem\"alde}{Gem\"alde}}, + present = {{Gegenwart}{Gegenwart}}, + song = {{Song}{Song}}, + album = {{Album}{Album}}, + map = {{Landkarte}{Landkarte}}, + photograph = {{Foto}{Foto}}, + photographs = {{Fotos}{Fotos}}, + powerpoint = {{Power\hyphenate{}Point\hyphen{}Folien}{Power\hyphenate{}Point\hyphen{}Folien}}, % lecturenotes = {{lecturenotes}{lecturenotes}},%FIXME -% podcast = {{audio\space podcast}{audio\space podcast}},%FIXME -% podcastepisode = {{audio\space podcast\space episode}{audio\space podcast\space episode}},%FIXME -% interview = {{interview}{interview}},%FIXME -% speech = {{speech\space audio\space recording}{speech\space audio\space recording}},%FIXME -% lithograph = {{lithograph}{lith\adddot}},%FIXME -% video = {{video}{video}},%FIXME -% film = {{film}{film}},%FIXME -% tvseries = {{TV\space series}{TV\space series}},%FIXME -% tvepisode = {{TV\space series\space episode}{TV\space series\space episode}},%FIXME -% narrator = {{narrator}{narr\adddot}},%FIXME -% narrators = {{narrators}{narrs\adddot}},%FIXME - producer = {{Produzent}{Produzent}}, -% producers = {{producers}{producers}},%FIXME - execproducer = {{ausf\"uhrender Produzent}{ausf\adddotspace Produzent}}, -% execproducers = {{Executive\space Producers}{Exec\adddot\space Prods\adddot}},%FIXME -% execdirector = {{Executive\space Director}{Exec\adddot\space Dir\adddot}},%FIXME -% execdirectors = {{Executive\space Directors}{Exec\adddot\space Dirs\adddot}},%FIXME -% execproducers = {{Executive\space Producers}{Executive\space Producers}},%FIXME - director = {{Regisseur}{Regi\adddot}}, -% directors = {{directors}{dirs\adddot}},%FIXME - writer = {{Autor}{Autor}}, + podcast = {{Audiopodcast}{Audiopodcast}}, + podcastepisode = {{Audiopodcastepisode}{Audiopodcastepisode}}, + interview = {{Interview}{Interview}}, + speech = {{Sprachaufzeichnung}{Sprachaufzeichnung}}, + lithograph = {{Lithografie}{Lith\adddot}}, + video = {{Video}{Video}}, + film = {{Film}{Film}}, + tvseries = {{Fernsehserie}{Fernsehserie}}, + tvepisode = {{Fernsehserienepisode}{Fernsehserienepisode}}, + narrator = {{Erz\"ahler\addslash\nbhyphen{}in}{Erz\"ahler\addslash\nbhyphen{}in}}, + narrators = {{erz\"ahlende Personen}{erz\"ahlende Personen}}, + producer = {{Produz\adddot}{Produz\adddot}}, + producers = {{Produz\adddot}{Produz\adddot}}, + execproducer = {{ausf\adddot\space Produz\adddot}{ausf\adddot\space Produz\adddot}}, + execproducers = {{ausf\adddot\space Produz\adddot}{ausf\adddot\space Produz\adddot}}, + execdirector = {{ausf\adddot\space Reg\adddot}{ausf\adddot\space Reg\adddot}}, + execdirectors = {{ausf\adddot\space Reg\adddot}{ausf\adddot\space Reg\adddot}}, + director = {{Reg\adddot}{Reg\adddot}}, + directors = {{Reg\adddot}{Reg\adddot}}, + writer = {{Autor\addslash\nbhyphen{}in}{Autor\addslash\nbhyphen{}in}}, % writers = {{writers}{writers}},%FIXME -% host = {{host}{host}},%FIXME + host = {{Gastgeber\addslash\nbhyphen{}in}{Gastgeber\addslash\nbhyphen{}in}}, % hosts = {{hosts}{hosts}},%FIXME -% guestexpert = {{Guest\space Expert}{Guest\space Expert}},%FIXME + guestexpert = {{geladener\space Experte\space /\space geladene\space Expertin}{geladener\space Experte\space /\space geladene\space Expertin}}, % guestexperts = {{Guest\space Experts}{Guest\space Experts}},%FIXME with = {{mit}{mit}}, -% manunpub = {{unpublished\space manuscript}{unpublished\space manuscript}},%FIXME -% maninprep = {{manuscript\space in\space preparation}{manuscript\space in\space preparation}},%FIXME -% mansub = {{manuscript\space submitted\space for\space publication}{manuscript\space submitted\space for\space publication}},%FIXME -% supplement = {{supplement}{suppl\adddot}},%FIXME + manunpub = {{unver\"offentlichtes\space Manuskript}{unver\"offentlichtes\space Manuskript}}, + maninprep = {{Manuskript\space in\space Vorbereitung}{Manuskript\space in\space Vorbereitung}}, + mansub = {{Manuskript\space eingereicht\space zur\space Publikation}{Manuskript\space eingereicht\space zur\space Publikation}}, + supplement = {{Supplement}{Suppl\adddot}}, % part = {{part}{pt\adddot}},%FIXME andothers = {{et\addabbrvspace al\adddot}{et\addabbrvspace al\adddot}}, revisededition = {{\"uberarbeitete\space Auf\noligature lage}{\"uberarb\adddotspace Aufl\adddot}}, @@ -126,9 +200,9 @@ available = {{erh\"altlich}{erh\"altlich}}, from = {{unter}{unter}}, archivedat = {{archiviert\space unter}{archiviert\space unter}}, - reviewof = {{Rezension\space des}{Rezension\space des}}, -% paragraph = {{paragraph}{para\adddot}},%FIXME -% paragraphs = {{paragraphs}{paras\adddot}},%FIXME + reviewof = {{Resprechung\space des}{Resprechung\space des}}, % "Rezension" isn't wrong, but according to DGP's Richtlinien zur Manuskriptgestaltung this is supposed to be called "Besprechung" + paragraph = {{Absatz}{Abs.\adddot}}, + paragraphs = {{Abs\"atze}{Abs.\adddot}}, origyear = {{Original\space erschienen}{Original\space erschienen}}, typechair = {{Leitung}{Leitung}}, typechairs = {{Leitung}{Leitung}}, @@ -136,12 +210,63 @@ typevolumes = {{Bandherausgeber}{Bandhrsg\adddot}}, typeseries = {{Reihenherausgeber}{Reihenhrsg\adddot}}, typeseriess = {{Reihenherausgeber}{Reihenhrsg\adddot}}, - typevolseries = {{Reihen- und\space Bandherausgeber}{Reihen-\space\& Bandhrsg\adddot}}, - typevolseriess = {{Reihen- und\space Bandherausgeber}{Reihen-\space\& Bandhrsg\adddot}}, + typevolseries = {{Reihen\hyphen und\space Bandherausgeber}{Reihen\hyphen\space\& Bandhrsg\adddot}}, + typevolseriess = {{Reihen\hyphen und\space Bandherausgeber}{Reihen\hyphen\space\& Bandhrsg\adddot}}, % annodomini = {{A\adddot\addabthinspace D\adddot}{A\adddot\addabthinspace D\adddot}}, % beforechrist = {{B\adddot\addabthinspace C\adddot}{B\adddot\addabthinspace C\adddot}}, % commonera = {{C\adddot E\adddot}{C\adddot E\adddot}}, -% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}} +% beforecommonera = {{B\adddot C\adddot E\adddot}{B\adddot C\adddot E\adddot}}, +% publication = {{Publication}{Publication}}, + alabama = {{Alabama}{{A\adddot L\adddot}}}, + alaska = {{Alaska}{{A\adddot K\adddot}}}, + arizona = {{Arizona}{{A\adddot Z\adddot}}}, + arkansas = {{Arkansas}{{A\adddot R\adddot}}}, + california = {{California}{{C\adddot A\adddot}}}, + colorado = {{Colorado}{{C\adddot O\adddot}}}, + connecticut = {{Connecticut}{{C\adddot T\adddot}}}, + delaware = {{Delaware}{{D\adddot E\adddot}}}, + florida = {{Florida}{{F\adddot L\adddot}}}, + georgia = {{Georgia}{{G\adddot A\adddot}}}, + hawaii = {{Hawaii}{{H\adddot I\adddot}}}, + idaho = {{Idaho}{{I\adddot D\adddot}}}, + illinois = {{Illinois}{{I\adddot L\adddot}}}, + indiana = {{Indiana}{{I\adddot N\adddot}}}, + iowa = {{Iowa}{{I\adddot A\adddot}}}, + kansas = {{Kansas}{{K\adddot S\adddot}}}, + kentucky = {{Kentucky}{{K\adddot Y\adddot}}}, + louisiana = {{Louisiana}{{L\adddot A\adddot}}}, + maine = {{Maine}{{M\adddot E\adddot}}}, + maryland = {{Maryland}{{M\adddot D\adddot}}}, + massachusetts = {{Massachusetts}{{M\adddot A\adddot}}}, + michigan = {{Michigan}{{M\adddot I\adddot}}}, + minnesota = {{Minnesota}{{M\adddot N\adddot}}}, + mississippi = {{Mississippi}{{M\adddot S\adddot}}}, + missouri = {{Missouri}{{M\adddot O\adddot}}}, + montana = {{Montana}{{M\adddot T\adddot}}}, + nebraska = {{Nebraska}{{N\adddot E\adddot}}}, + nevada = {{Nevada}{{N\adddot V\adddot}}}, + newhampshire = {{New Hampshire}{{N\adddot H\adddot}}}, + newjersey = {{New Jersey}{{N\adddot J\adddot}}}, + newmexico = {{New Mexico}{{N\adddot M\adddot}}}, + newyork = {{New York}{{N\adddot Y\adddot}}}, + northcarolina = {{North Carolina}{{N\adddot C\adddot}}}, + northdakota = {{North Dakota}{{N\adddot D\adddot}}}, + ohio = {{Ohio}{{O\adddot H\adddot}}}, + oklahoma = {{Oklahoma}{{O\adddot K\adddot}}}, + oregon = {{Oregon}{{O\adddot R\adddot}}}, + pennsylvania = {{Pennsylvania}{{P\adddot A\adddot}}}, + rhodeisland = {{Rhode Island}{{R\adddot I\adddot}}}, + southcarolina = {{South Carolina}{{S\adddot C\adddot}}}, + southdakota = {{South Dakota}{{S\adddot D\adddot}}}, + tennessee = {{Tennessee}{{T\adddot N\adddot}}}, + texas = {{Texas}{{T\adddot X\adddot}}}, + utah = {{Utah}{{U\adddot T\adddot}}}, + vermont = {{Vermont}{{V\adddot T\adddot}}}, + virginia = {{Virginia}{{V\adddot A\adddot}}}, + washington = {{Washington}{{W\adddot A\adddot}}}, + westvirginia = {{West Virginia}{{W\adddot V\adddot}}}, + wisconsin = {{Wisconsin}{{W\adddot I\adddot}}}, + wyoming = {{Wyoming}{{W\adddot Y\adddot}}} } @@ -152,139 +277,90 @@ \DeclareBibliographyExtras{% \renewcommand{\apashortdash}{~}% \def\urldatecomma{\addspace}% - \protected\def\mkbibdateapalong#1#2#3{% + \protected\def\mkbibdateapalong#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% - {\iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}% - \ifboolexpr{test {\iffieldundef{#3}} and test {\iffieldundef{#2}}} + {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}% + \ifboolexpr{test {\iffieldundef{#4}} and test {\iffieldundef{#3}}} {} {\addcomma\space}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\mkbibordinal{\thefield{#3}}% - \iffieldundef{#2} + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY + {}% + {\mkbibordinal{\thefield{#4}}% + \iffieldundef{#3} {} {\addspace}}% - \iffieldundef{#2}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongextra#1#2#3{% + {\mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#1}% + \iffieldundef{#1}% YEAR {}% - {\iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}% - \printfield{extradate}% - \ifboolexpr{test {\iffieldundef{#3}} and test {\iffieldundef{#2}}} + {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}% + \ifboolexpr{test {\iffieldundef{#4}} and test {\iffieldundef{#3}}} {} {\addcomma\space}}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\mkbibordinal{\thefield{#3}}% - \iffieldundef{#2} + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY + {}% + {\mkbibordinal{\thefield{#4}}% + \iffieldundef{#3} {} {\addspace}}% - \iffieldundef{#2}% + \iffieldundef{#3}% MONTH {}% - {\mkbibmonth{\thefield{#2}}}}% - \protected\def\mkbibdateapalongmdy#1#2#3{% + {\mkbibmonth{\thefield{#3}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% % As per 10.1, Articles only have year \ifboolexpr{ test {\ifentrytype{article}} and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } {\clearfield{labelmonth}% \clearfield{labelday}} {}% - \iffieldundef{#3}% + \iffieldundef{#2}% YEARDIVISION {}% - {\mkbibordinal{\thefield{#3}}}% - \iffieldundef{#2}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#4}% DAY {}% - {\iffieldundef{#3}% + {\mkbibordinal{\thefield{#4}}}% + \iffieldundef{#3}% MONTH + {}% + {\iffieldundef{#4}% {}% {\addspace}% - \mkbibmonth{\thefield{#2}}}% - \iffieldundef{#1}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#1}% YEAR {}% - {\iffieldundef{#2}% + {\iffieldundef{#3}% {}% {\addspace}% - \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}}}% - \def\apa@lbx@de@mkdaterangeapalong#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year}{} - {\datecircaprint - \ifstrequal{#1}{url}% URL dates are unlikely to be BCE ... - {\printtext{% - \iffieldsequal{#1year}{#1endyear} - {\iffieldsequal{#1month}{#1endmonth} - {\mkbibdateapalongmdy{}{}{#1day}} - {\mkbibdateapalongmdy{}{#1month}{#1day}}} - {\mkbibdateapalongmdy{#1year}{#1month}{#1day}}% - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \mkbibdateapalongmdy{#1endyear}{#1endmonth}{#1endday}}}% - \dateuncertainprint}} - {\printtext{% - \ifboolexpr{test {\iffieldsequal{#1year}{#1endyear}} - and test {\iffieldsequal{#1month}{#1endmonth}}} - {\mkbibdateapalong{#1year}{}{#1day}}% - {\mkbibdateapalong{#1year}{#1month}{#1day}}% - \dateeraprint{#1year}% - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \iffieldsequal{#1year}{#1endyear}% - {\mkbibdateapalong{}{#1endmonth}{#1endday}}% - {\mkbibdateapalong{#1endyear}{#1endmonth}{#1endday}% - \dateeraprint{#1endyear}}}% - \enddateuncertainprint}}}}% - \endgroup}% - \def\apa@lbx@de@mkdaterangeapalongextra#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year}{} - {\printtext{% - \datecircaprint - \ifboolexpr{test {\iffieldsequal{#1year}{#1endyear}} - and test {\iffieldsequal{#1month}{#1endmonth}}} - {\mkbibdateapalongextra{#1year}{}{#1day}}% - {\mkbibdateapalongextra{#1year}{#1month}{#1day}}% - \dateeraprint{#1year}% - \dateuncertainprint - \iffieldundef{#1endyear}% - {}% - {\iffieldequalstr{#1endyear}{}% open-ended range? - {\mbox{\bibdatedash}} - {\bibdatedash% - \iffieldsequal{#1year}{#1endyear}% - {\mkbibdateapalongextra{}{#1endmonth}{#1endday}} - {\mkbibdateapalongextra{#1endyear}{#1endmonth}{#1endday}% - \dateeraprint{#1endyear}}}% - \enddateuncertainprint}}}% - \endgroup}% - \savecommand\mkdaterangeapalong - \savecommand\mkdaterangeapalongextra - \def\mkdaterangeapalong{% - \apa@lbx@de@mkdaterangeapalong}% - \def\mkdaterangeapalongextra#1{% - \apa@lbx@de@mkdaterangeapalongextra{#1}}% -} + \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\thefield{#1}}}}} \UndeclareBibliographyExtras{% \restorecommand\mkdaterangeapalong diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/turkish-apa.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/turkish-apa.lbx new file mode 100644 index 0000000000..fae30835eb --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/turkish-apa.lbx @@ -0,0 +1,360 @@ +\ProvidesFile{turkish-apa.lbx}[2022/06/22\space v9.16\space APA biblatex localisation] +\InheritBibliographyExtras{turkish} + +\NewBibliographyString{publication} +\NewBibliographyString{jourarticle} +\NewBibliographyString{revisededition} +\NewBibliographyString{typechair} +\NewBibliographyString{typechairs} +\NewBibliographyString{typevolume} +\NewBibliographyString{typevolumes} +\NewBibliographyString{typeseries} +\NewBibliographyString{typeseriess} +\NewBibliographyString{typevolseries} +\NewBibliographyString{typevolseriess} +\NewBibliographyString{on} +\NewBibliographyString{retrieved} +\NewBibliographyString{available} +\NewBibliographyString{from} +\NewBibliographyString{archivedat} +\NewBibliographyString{origyear} +\NewBibliographyString{reviewof} +\NewBibliographyString{with} +\NewBibliographyString{supplement} +\NewBibliographyString{commenton} +\NewBibliographyString{manunpub} +\NewBibliographyString{maninprep} +\NewBibliographyString{mansub} +\NewBibliographyString{producer} +\NewBibliographyString{producers} +\NewBibliographyString{execproducer} +\NewBibliographyString{execproducers} +\NewBibliographyString{execdirector} +\NewBibliographyString{execdirectors} +\NewBibliographyString{director} +\NewBibliographyString{directors} +\NewBibliographyString{writer} +\NewBibliographyString{writers} +\NewBibliographyString{host} +\NewBibliographyString{hosts} +\NewBibliographyString{guestexpert} +\NewBibliographyString{guestexperts} +\NewBibliographyString{narrator} +\NewBibliographyString{narrators} +\NewBibliographyString{film} +\NewBibliographyString{tvseries} +\NewBibliographyString{tvepisode} +\NewBibliographyString{video} +\NewBibliographyString{song} +\NewBibliographyString{album} +\NewBibliographyString{podcast} +\NewBibliographyString{podcastepisode} +\NewBibliographyString{interview} +\NewBibliographyString{speech} +\NewBibliographyString{lithograph} +\NewBibliographyString{map} +\NewBibliographyString{lecturenotes} +\NewBibliographyString{powerpoint} +\NewBibliographyString{photograph} +\NewBibliographyString{photographs} +\NewBibliographyString{present} +\NewBibliographyString{painting} +\NewBibliographyString{article} +\NewBibliographyString{unitednations} +\NewBibliographyString{charter} +\NewBibliographyString{ofthe} +\NewBibliographyString{tothe} +\NewBibliographyString{alabama} +\NewBibliographyString{alaska} +\NewBibliographyString{arizona} +\NewBibliographyString{arkansas} +\NewBibliographyString{california} +\NewBibliographyString{colorado} +\NewBibliographyString{connecticut} +\NewBibliographyString{delaware} +\NewBibliographyString{florida} +\NewBibliographyString{georgia} +\NewBibliographyString{hawaii} +\NewBibliographyString{idaho} +\NewBibliographyString{illinois} +\NewBibliographyString{indiana} +\NewBibliographyString{iowa} +\NewBibliographyString{kansas} +\NewBibliographyString{kentucky} +\NewBibliographyString{louisiana} +\NewBibliographyString{maine} +\NewBibliographyString{maryland} +\NewBibliographyString{massachusetts} +\NewBibliographyString{michigan} +\NewBibliographyString{minnesota} +\NewBibliographyString{mississippi} +\NewBibliographyString{missouri} +\NewBibliographyString{montana} +\NewBibliographyString{nebraska} +\NewBibliographyString{nevada} +\NewBibliographyString{newhampshire} +\NewBibliographyString{newjersey} +\NewBibliographyString{newmexico} +\NewBibliographyString{newyork} +\NewBibliographyString{northcarolina} +\NewBibliographyString{northdakota} +\NewBibliographyString{ohio} +\NewBibliographyString{oklahoma} +\NewBibliographyString{oregon} +\NewBibliographyString{pennsylvania} +\NewBibliographyString{rhodeisland} +\NewBibliographyString{southcarolina} +\NewBibliographyString{southdakota} +\NewBibliographyString{tennessee} +\NewBibliographyString{texas} +\NewBibliographyString{utah} +\NewBibliographyString{vermont} +\NewBibliographyString{virginia} +\NewBibliographyString{washington} +\NewBibliographyString{westvirginia} +\NewBibliographyString{wisconsin} +\NewBibliographyString{wyoming} + + +\DeclareBibliographyStrings{% + inherit = {turkish}, + jourarticle = {{makale}{makale}}, +% tothe = {{ona}{ona}}, % no certain translation +% ofthe = {{onun}{onun}}, % no certain translation + unitednations = {{Birle\c{s}mi\c{s}\space Milletler}{BM}}, + charter = {{t\"{u}z\"{u}k}{t\"{u}z\"{u}k}}, % not sure about the translation + proposed = {{teklif\space edilmi\c{s}}{teklif\space ed\adddot}}, + repealed = {{feshedilmi\c{s}}{fesih\space ed\adddot}}, + execorder = {{\"{u}st\space karar}{\"{u}st\space karar}}, + senate = {{senato}{senato}}, + resolution = {{\c{c}\"{o}z\"{u}m}{\c{c}\"{o}z\adddot}}, + houseofrepresentatives = {{temsilciler\space meclisi}{tem\adddotspace mec\adddot}}, + report = {{rapor}{rapor}}, + us = {{Amerika\space Birle\c{s}ik\space Devletleri}{ABD}}, + constitution = {{anayasa}{anayasa}}, + section = {{b\"{o}l\"{u}m}{b\"{o}l\adddot}, + amendment = {{yasa\space de\u{g}i\c{s}ikli\u{g}i}{yasa\space de\u{g}\adddot}}, + article = {{makale}{makale}}, + painting = {{resim}{resim}}, + present = {{sunum}{sunum}}, %not sure about the translation + song = {{\c{s}ark\i}}{\c{s}ark\i}}, + album = {{alb\"{u}m}{alb\"{u}m}}, + map = {{harita}{harita}}, + photograph = {{foto\u{g}raf}{foto\u{g}raf}}, + photographs = {{foto\u{g}raflar}{foto\u{g}raflar}}, + powerpoint = {{sunum\space slaytlar\i}{sun\adddotspace slayt\adddot}}, + lecturenotes = {{notlar}{not\adddot}}, + podcast = {{ses\space kayd\i}{ses\space kay\adddot}}, + podcastepisode = {{ses\space kay\i t\space b\"{o}l\"{u}m\"{u}}{ses\space kay\adddotspace b\"{o}l\adddot}}, + interview = {{m\"{u}lakat]}{m\"{u}lakat}}, + speech = {{konu\c{s}ma}{konu\c{s}ma}}, + lithograph = {{litografi}{litografi}}, + video = {{video}{video}}, + film = {{film}{film}}, + tvseries = {{TV\space dizisi}{TV\space dizisi}}, + tvepisode = {{TV\space dizi\space b\"{o}l\"{u}m\"{u}}{TV\space dizi\space b\"{o}l\adddot}}, + narrator = {{seslendiren]}{ses\adddot}}, + narrators = {{seslendirenler}{ses\adddot}}, + producer = {{yap\i mc \i}{yap\adddot}}, + producers = {{yap\i mc \i lar}{yap\adddot}}, + execproducer = {{\"{u}st\space yap\i mc \i}{\"{u}st\space yap\adddot}}, + execproducers = {{\"{u}st\space yap\i mc \i lar}{\"{u}st\space yap\adddot}}, + execdirector = {{\"{u}st\space y\"{o}netmen}{\"{u}st\space y\"{o}n\adddot}}, + execdirectors = {{\"{u}st\space y\"{o}netmenler}{\"{u}st\space y\"{o}n\adddot}}, + director = {{y\"{o}netmen}{y\"{o}n\adddot}}, + directors = {{y\"{o}netmenler}{y\"{o}n\adddot}}, + writer = {{yazar}{yazar}}, + writers = {{yazarlar}{yazarlar}}, + host = {{ev\space sahibi}{ev\space sah\adddot}}, + hosts = {{ev\space sahipleri]}{ev\space sah\adddot}}, + guestexpert = {{misafir\space uzman}{mis\adddotspace uzm\adddot}}, + guestexperts = {{misafir\space uzmanlar}{mis\adddotspace uzm\adddot}}, + with = {{ile}{ile}}, + manunpub = {{metin\space yay\i mlanmam\i \c{s}}{met\adddotspace yay\i mlanmam\i \c{s}}}, + maninprep = {{metin\space haz\i rl\i k\space a\c{s}amas\i nda}{met\adddotspace haz\adddotspace a\c{s}a\adddot}}, + mansub = {{yay\i mlanmak\space i\c{c}in\space g\"{o}nderilmi\c{s}\space metin}{yay\adddotspace i\c{c}in\space g\"{o}n\adddotspace met\adddot}}, + supplement = {{ek}{ek}}, + part = {{par\c{c}a}{par\adddot}}, + andothers = {{ve\space di\u{g}erleri}{ve\space di\u{g}\adddot}}, + revisededition = {{G\"{o}zden\space ge\c{c}irilmi\c{s}\space bas\i m}{G\"{o}z\adddotspace ge\c{c}\adddotspace bs\adddot}}, + commenton = {{yorum}{yrm\adddot}}, %not sure about the translation + page = {{sayfa}{{}s\adddot}}, + pages = {{sayfalar}{{}ss\adddot}}, + on = {{tarihinde}{tar\adddot}}, + retrieved = {{eri\c{s}im\space tarihi}{eri\c{s}im\space tarihi}}, + available = {{Haz\i r}{Haz\i r}}, +% from = {{from}{from}}, % there are two forms of "from" in Turkish. not sure to include just one. + archivedat = {{ar\c{s}ivde}{ar\c{s}iv\adddot}}, + reprintas = {{yeni\space bask\i s\i}{yeni\space bs\adddot}}, + reprintfrom = {{yeni\space bask\i s\i}{yeni\space bs\adddot}}, + reviewof = {{derleme\space eser}{der\adddotspace eser}}, + paragraph = {{paragraf}{par\adddot}}, + paragraphs = {{paragraflar}{Par\adddot}}, + mathesis = {{y\"{u}ksek\space lisans\space tezi}{Y\adddotspace L\adddotspace tezi}}, + phdthesis = {{doktora\space tezi}{dok\adddotspace tezi}}, + origyear = {{as\i l\space eser\space yay\i n\space tarihi}{as\i l\space eser\space yay\i n\space tarihi}}, + typechair = {{ba\c{s}kan}{ba\c{s}\adddot}}, + typechairs = {{ba\c{s}kanlar}{ba\c{s}\adddot}}, + typevolume = {{cilt\space edit\"{o}r\"{u}}{cilt\space ed\adddot}}, + typevolumes = {{cilt\space edit\"{o}rleri}{cilt\space ed\adddot}}, + typeseries = {{seri\space edit\"{o}r\"{u}}{seri\space ed\adddot}}, + typeseriess = {{seri\space edit\"{o}rleri}{seri\space ed\adddot}}, + typevolseries = {{cilt\space ve\space seri\space edit\"{o}r\"{u}}{cilt\space\& seri\space ed\adddot}}, + typevolseriess = {{cilt\space ve\space seri\space edit\"{o}rleri}{cilt\space\& seri\space ed\adddot}}, + annodomini = {{milattan\space sonra}{M\adddotspace S\adddot}}, + beforechrist = {{milattan\space \"{o}nce}{M\adddotspace \"{O}\adddot}}, + commonera = {{milattan\space sonra}{M\adddotspace S\adddot}}, + beforecommonera = {{milattan\space \"{o}nce}{M\adddotspace \"{O}\adddot}}, + publication = {{yay\i n}{yay\i n}} + alabama = {{Alabama}{{A\adddot L\adddot}}}, + alaska = {{Alaska}{{A\adddot K\adddot}}}, + arizona = {{Arizona}{{A\adddot Z\adddot}}}, + arkansas = {{Arkansas}{{A\adddot R\adddot}}}, + california = {{California}{{C\adddot A\adddot}}}, + colorado = {{Colorado}{{C\adddot O\adddot}}}, + connecticut = {{Connecticut}{{C\adddot T\adddot}}}, + delaware = {{Delaware}{{D\adddot E\adddot}}}, + florida = {{Florida}{{F\adddot L\adddot}}}, + georgia = {{Georgia}{{G\adddot A\adddot}}}, + hawaii = {{Hawaii}{{H\adddot I\adddot}}}, + idaho = {{Idaho}{{I\adddot D\adddot}}}, + illinois = {{Illinois}{{I\adddot L\adddot}}}, + indiana = {{Indiana}{{I\adddot N\adddot}}}, + iowa = {{Iowa}{{I\adddot A\adddot}}}, + kansas = {{Kansas}{{K\adddot S\adddot}}}, + kentucky = {{Kentucky}{{K\adddot Y\adddot}}}, + louisiana = {{Louisiana}{{L\adddot A\adddot}}}, + maine = {{Maine}{{M\adddot E\adddot}}}, + maryland = {{Maryland}{{M\adddot D\adddot}}}, + massachusetts = {{Massachusetts}{{M\adddot A\adddot}}}, + michigan = {{Michigan}{{M\adddot I\adddot}}}, + minnesota = {{Minnesota}{{M\adddot N\adddot}}}, + mississippi = {{Mississippi}{{M\adddot S\adddot}}}, + missouri = {{Missouri}{{M\adddot O\adddot}}}, + montana = {{Montana}{{M\adddot T\adddot}}}, + nebraska = {{Nebraska}{{N\adddot E\adddot}}}, + nevada = {{Nevada}{{N\adddot V\adddot}}}, + newhampshire = {{New Hampshire}{{N\adddot H\adddot}}}, + newjersey = {{New Jersey}{{N\adddot J\adddot}}}, + newmexico = {{New Mexico}{{N\adddot M\adddot}}}, + newyork = {{New York}{{N\adddot Y\adddot}}}, + northcarolina = {{North Carolina}{{N\adddot C\adddot}}}, + northdakota = {{North Dakota}{{N\adddot D\adddot}}}, + ohio = {{Ohio}{{O\adddot H\adddot}}}, + oklahoma = {{Oklahoma}{{O\adddot K\adddot}}}, + oregon = {{Oregon}{{O\adddot R\adddot}}}, + pennsylvania = {{Pennsylvania}{{P\adddot A\adddot}}}, + rhodeisland = {{Rhode Island}{{R\adddot I\adddot}}}, + southcarolina = {{South Carolina}{{S\adddot C\adddot}}}, + southdakota = {{South Dakota}{{S\adddot D\adddot}}}, + tennessee = {{Tennessee}{{T\adddot N\adddot}}}, + texas = {{Texas}{{T\adddot X\adddot}}}, + utah = {{Utah}{{U\adddot T\adddot}}}, + vermont = {{Vermont}{{V\adddot T\adddot}}}, + virginia = {{Virginia}{{V\adddot A\adddot}}}, + washington = {{Washington}{{W\adddot A\adddot}}}, + westvirginia = {{West Virginia}{{W\adddot V\adddot}}}, + wisconsin = {{Wisconsin}{{W\adddot I\adddot}}}, + wyoming = {{Wyoming}{{W\adddot Y\adddot}}} +} + + +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Drop end* when they are the same as * +% You must use \print*date to get here otherwise it will be ignored + +\DeclareBibliographyExtras{% + \def\urldatecomma{\addcomma\addspace}% + \protected\def\mkbibdateapalong#1#2#3#4{% + % As per 10.1, Articles only have year + \ifboolexpr{ test {\ifentrytype{article}} + and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } + {\clearfield{labelmonth}% + \clearfield{labelday}} + {}% + \iffieldundef{#1}% YEAR + {}% + {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% + {}% + {\addspace}% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongextra#1#2#3#4{% + % As per 10.1, Articles only have year + \ifboolexpr{ test {\ifentrytype{article}} + and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } + {\clearfield{labelmonth}% + \clearfield{labelday}} + {}% + \iffieldundef{#1}% YEAR + {}% + {\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extradate}}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\iffieldundef{#3}% + {}% + {\addspace}% + \stripzeros{\thefield{#4}}}}% + \protected\def\mkbibdateapalongmdy#1#2#3#4{% + % As per 10.1, Articles only have year + \ifboolexpr{ test {\ifentrytype{article}} + and not test {\iffieldequalstr{entrysubtype}{nonacademic}} } + {\clearfield{labelmonth}% + \clearfield{labelday}} + {}% + \iffieldundef{#2}% YEARDIVISION + {}% + {\iffieldundef{#1}% + {}% + {\addcomma\addspace}% + \iffieldbibstring{#2}{\bibcplstring{\thefield{#2}}}{\thefield{#2}}}% + \iffieldundef{#3}% MONTH + {}% + {\mkbibmonth{\thefield{#3}}}% + \iffieldundef{#4}% DAY + {}% + {\addspace}% + \stripzeros{\thefield{#4}}% + \iffieldundef{#1}% YEAR + {}% + {\iffieldundef{#4}% + {\iffieldundef{#3}% + {}% + {\addspace}}% + {\addcomma\addspace}% + \iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}}} + +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/biblatex/CHANGES.md b/macros/latex/contrib/biblatex/CHANGES.md index 9e6034eac4..b79faf7faf 100644 --- a/macros/latex/contrib/biblatex/CHANGES.md +++ b/macros/latex/contrib/biblatex/CHANGES.md @@ -1,3 +1,15 @@ +# RELEASE NOTES FOR VERSION 3.18 +- New sorting name key generation macro `\visibility` which allows + application of sorting name key generation to apply only to sorting + within citations. +- New sorting macro `\intciteorder` which allows sorting by order internal + to a cite command like \cite{a,b,c}. +- New option `pluralothers` to force "et al" to be plural (i.e. only + replace two or more names). This is required for some styles (e.g. APA) +- Added `\localrefcontext` as a local alternative + to the global `\newrefcontext`. + `\localrefcontext` can be nested and is only active in the current group. + # RELEASE NOTES FOR VERSION 3.17 - **INCOMPATIBLE CHANGE** The behaviour of index-less granular xdata references to list fields has diff --git a/macros/latex/contrib/biblatex/bibtex/bst/biblatex.bst b/macros/latex/contrib/biblatex/bibtex/bst/biblatex.bst index 06e60bb887..6cd54a3486 100644 --- a/macros/latex/contrib/biblatex/bibtex/bst/biblatex.bst +++ b/macros/latex/contrib/biblatex/bibtex/bst/biblatex.bst @@ -184,7 +184,7 @@ STRINGS { ctrl.alphaothers ctrl.sortalphaothers ctrl.sortstr last.name last.hash last.year last.extra } FUNCTION {initialize} { - "$Revision: 3.17 $" + "$Revision: 3.18 $" #12 entry.max$ substring$ #-3 entry.max$ substring$ "Biblatex version: " swap$ * top$ @@ -1928,7 +1928,7 @@ FUNCTION {input:control:options} { % This version corresponds to the .bcf version, *not* the biblatex version! FUNCTION {input:control:version} { input:control:parse - "$Revision: 3.8 $" + "$Revision: 3.9 $" #12 entry.max$ substring$ #-3 entry.max$ substring$ 'tempstrga := diff --git a/macros/latex/contrib/biblatex/doc/biblatex.pdf b/macros/latex/contrib/biblatex/doc/biblatex.pdf Binary files differindex 6dd284f9f4..4157c6667d 100644 --- a/macros/latex/contrib/biblatex/doc/biblatex.pdf +++ b/macros/latex/contrib/biblatex/doc/biblatex.pdf diff --git a/macros/latex/contrib/biblatex/doc/biblatex.tex b/macros/latex/contrib/biblatex/doc/biblatex.tex index e3194961d0..24e8335b47 100644 --- a/macros/latex/contrib/biblatex/doc/biblatex.tex +++ b/macros/latex/contrib/biblatex/doc/biblatex.tex @@ -68,7 +68,7 @@ url={\biblatexhome}, author={Philip Kime, Moritz Wemheuer, Philipp Lehman}, email={}, - revision={3.17}, + revision={3.18}, date={\today}} \hypersetup{% @@ -1757,7 +1757,7 @@ Date fields such as the default data model dates \bibfield{date}, \bibfield{orig \acr{ISO8601-2} Extended Format dates are astronomical dates in which year <0> exists. When outputting dates in BCE or BC era (see the \opt{dateera} option below), note that they will typically be one year earlier since BCE/BC era do not have a year 0 (year 0 is 1 BCE/BC). This conversion is automatic. See examples in \tabref{bib:use:tab2}. -Date field names \emph{must} end with the string <date>, as with the default date fields. Bear this in mind when adding new date fields to the datamodel (see \secref{aut:ctm:dm}). \biblatex will check all date fields after reading the date model and will exit with an error if it finds a date field which does not adhere to this naming convention. +Date field names \emph{must} end with the string <date>, as with the default date fields. Bear this in mind when adding new date fields to the datamodel (see \secref{aut:ctm:dm}). \biblatex will check all date fields after reading the data model and will exit with an error if it finds a date field which does not adhere to this naming convention. \acr{ISO8601-2} supports dates before common era (BCE/BC) by way of a negative date format and supports <approximate> (circa) and uncertain dates. Such date formats set internal markers which can be tested for so that appropriate localised markers (such as \opt{circa} or \opt{beforecommonera}) can be inserted. Also supported are <unspecified> dates (\acr{ISO8601-2} 4.3) which are automatically expanded into appropriate data ranges accompanied by a field \bibfield{$<$datetype$>$dateunspecified} which details the granularity of the unspecified data. Styles may use this information to format such dates appropriately but the standard styles do not do this. See \tabref{bib:use:tab3} on page~\pageref{bib:use:tab3} for the allowed \acr{ISO8601-2} <unspecified> formats, their range expansions and \bibfield{$<$datetype$>$dateunspecified} values (see \secref{aut:bbx:fld:gen}). @@ -2146,6 +2146,13 @@ Whether or not to sort citations if multiple entry keys are passed to a citation Whether or not to sort set members according to the active reference context sorting scheme. By default this is false and set members appear in the order given in the data source. +\boolitem[false]{pluralothers} + +Controls whether the localised <and others> string (e.g. <et al>) is forced +to be plural. If true, it will only be printed in place of two or more +names and if there is only one name it would replace, the name itself is +printed instead. Defaults to false. + \intitem[3]{maxnames} A threshold affecting all lists of names (\bibfield{author}, \bibfield{editor}, etc.). If a list exceeds this threshold, \ie if it holds more than \prm{integer} names, it is automatically truncated according to the setting of the \opt{minnames} option. \opt{maxnames} is the master option which sets \opt{maxbibnames}, \opt{maxcitenames} and \opt{maxsortnames}. Note that the \opt{uniquelist} feature can locally override \opt{maxnames}, see the documentation of the \opt{uniquelist} option in \secref{use:opt:pre:int} and \secref{aut:cav:amb}. @@ -4345,6 +4352,11 @@ The \opt{refcontext} environment cannot be nested and \biblatex will generate an \cmditem{newrefcontext}[key=value, \dots]{name} This command is similar to the \env{refcontext} environment except that it is a stand"=alone command rather than an environment. It automatically ends any previous reference context section begun with \cmd{newrefcontext} (if any) and immediately starts a new one. Note that the context section started by the last \cmd{newrefcontext} command in the document will extend to the very end of the document. Use \cmd{endrefcontext} if you want to terminate it earlier. + +\cmditem{localrefcontext}[key=value, \dots]{name} + +This command is similar to the \env{newrefcontext} command except that it sets up the reference context only locally. +This is useful if the reference context needs to be changed within a group. There is no need to end a local reference context, it will automatically be reset once the group ends. \end{ltxsyntax} % At the beginning of the document, there is always a global context containing global settings for each of the reference context options. Here is an example summarising the reference contexts with various settings: @@ -4454,6 +4466,12 @@ Here, the data for the citation of \bibfield{key2} will be drawn from the refcon % Here, the data for the citation of \bibfield{key2} will be drawn from refcontext with \opt{labelprefix=C} and not \opt{labelprefix=A} since the explicit options override the named refcontext (resulting in a label with prefix <C> and not <A> or <B>). +\begin{ltxsyntax} +\cmditem{GenRefcontextData}{key=value, \dots} + +This command takes the same key/value options as \cmd{DeclareRefcontext}. It forces the currently active refcontext, optionally modified by the key/value options, to be written to the \file{.bcf} so that \biber will create a sorted data list for the specified refcontext. Normally this is automatic when \cmd{printbibliography}/\cmd{prinbiblist} is used in a reference context but there are situations where the data for a refcontext will be needed but no reference list is generated in that context e.g. to sort citations with the \opt{sortcites} option when the sorting of citations requires a different refcontext to that used for the actual reference list. +\end{ltxsyntax} + \subsubsection{Dynamic Entry Sets} \label{use:bib:set} @@ -5006,7 +5024,7 @@ The commands and facilities presented in this section may be used to adapt the f \subsubsection{Generic Commands and Hooks} \label{use:fmt:fmt} -The commands in this section may be redefined with \cmd{renewcommand} in the document preamble. Those marked as <Context Sensitive> in the margin can also be customised with \cmd{DeclareDelimFormat} and are printed with \cmd{printdelim} (\secref{use:fmt:csd}). Note that all commands starting with \cmd{mk\dots} take one argument. All of these commands are defined in \path{biblatex.def}. +The commands in this section may be redefined with \cmd{renewcommand} in the document preamble. Those marked as <Context Sensitive> in the margin can also (and generally should) be customised with \cmd{DeclareDelimFormat} and are printed with \cmd{printdelim} (\secref{use:fmt:csd}). Note that all commands starting with \cmd{mk\dots} take one argument. All of these commands are defined in \path{biblatex.def}. \begin{ltxsyntax} @@ -5092,7 +5110,7 @@ This command should be used with \cmd{bibnamedelimd} as a reversed-name separato The dash to be used as a replacement for recurrent authors or editors in the bibliography. The default is an <em> or an <en> dash, depending on the indentation of the list of references. \csitem{labelnamepunct}\DeprecatedMark -A separator to be printed after the name used for alphabetizing in the bibliography (\bibfield{author} or \bibfield{editor}, if the \bibfield{author} field is undefined) instead of \cmd{newunitpunct}. The default is \cmd{newunitpunct}, \ie it is not handled differently from regular unit punctuation but permits convenient reconfiguration. This punctuation command is deprecated and has been superseded by the context-sensitive \cmd{nametitledelim} (see \secref{use:fmt:csd}). For backwards compatibility reasons, however, \cmd{nametitledelim} still defaults to \cmd{labelnamepunct} in the \texttt{bib} and \texttt{biblist} contexts. Style authors may want to consider replacing \cmd{labelnampunct} with \texttt{\textbackslash printdelim\{nametitledelim\}} and users may want to prefer modifying the context-sensitive \texttt{nametitledelim} in the \texttt{bib} context with \cmd{DeclareDelimFormat} over redefining \cmd{labelnamepunct}, e.g. +A separator to be printed after the name used for alphabetizing in the bibliography (\bibfield{author} or \bibfield{editor}, if the \bibfield{author} field is undefined) instead of \cmd{newunitpunct}. The default is \cmd{newunitpunct}, \ie it is not handled differently from regular unit punctuation but permits convenient reconfiguration. This punctuation command is deprecated and has been superseded by the context-sensitive \cmd{nametitledelim} (see \secref{use:fmt:csd}). For backwards compatibility reasons, however, \cmd{nametitledelim} still defaults to \cmd{labelnamepunct} in the \texttt{bib} and \texttt{biblist} contexts. Style authors may want to consider replacing \cmd{labelnampunct} with \texttt{\textbackslash printdelim\{nametitledelim\}} and users may want to prefer modifying the context-sensitive \texttt{nametitledelim} in the \texttt{bib} context with \cmd{DeclareDelimFormat} over redefining \cmd{labelnamepunct}, \eg \begin{ltxexample} \DeclareDelimFormat[bib]{nametitledelim}{% \addcolon\space} @@ -5325,8 +5343,9 @@ The separator between the block of related entries of type <relatedtype>. There \subsubsection{Context-sensitive Delimiters} \label{use:fmt:csd} -The delimiters described in \secref{use:fmt:fmt} are globally defined. That is, no matter where you use them, they print the same thing. This is not necessarily desirable for delimiters which you might want to print different things in different contexts. Here <context> means things like <inside a text citation> or <inside a bibliography item>. For this reason, \biblatex\ provides a more sophisticated delimiter specification and user interface alongside the standard one based on normal macros defined with \cmd{newcommand}. +Many delimiters described in \secref{use:fmt:fmt} are globally defined. That is, no matter where you use them, they print the same thing. This is not necessarily desirable for delimiters which you might want to print different things in different contexts. Here <context> means things like <inside a text citation> or <inside a bibliography item>. For this reason, \biblatex\ provides a more sophisticated delimiter specification and user interface alongside the standard one based on normal macros defined with \cmd{newcommand}. + For backwards compatibility reasons all context-sensitive delimiters (\ie all delimiters marked as <context sensitive> in \secref{use:fmt:fmt}) can be redefined with \cmd{renewcommand} in the global context. It is, however, strongly recommended to use the interface documented below (primarily \cmd{DeclareDelimFormat}) to redefine these delimiters---even if \cmd{renewcommand} would suffice for the job at hand. \begin{ltxsyntax} \cmditem{DeclareDelimFormat}[context, \dots]{name}{code} @@ -5420,7 +5439,7 @@ This means that \cmd{nametitledelim} is defined globally as <\cmd{addcomma}\cmd{ \printdelim[textcite]{nametitledelim} \end{ltxexample} % -Would print \cmd{addspace} regardless of the surrounding context of the \cmd{printdelim}. Contexts are just arbitrary strings and so you can establish them at any time, using \cmd{delimcontext}. If \cmd{printdelim} finds no special value for the delimiter \prm{name} in the current context, it simply prints \cmd{name}. This means that style authors can use \cmd{printdelim} and users expecting to be able to use \cmd{renewcommand} to redefine delimiters can do so with one caveat---such a definition won't change any context-specific delimiters which are defined: +would print \cmd{addspace} regardless of the surrounding context of the \cmd{printdelim}. Contexts are just arbitrary strings and so you can establish them at any time, using \cmd{delimcontext}. If \cmd{printdelim} finds no special value for the delimiter \prm{name} in the current context, it simply prints \cmd{name}. This means that style authors can use \cmd{printdelim} and users expecting to be able to use \cmd{renewcommand} to redefine delimiters can do so with one caveat---such a definition won't change any context-specific delimiters which are defined: \begin{ltxexample}[style=latex] \DeclareDelimFormat{delima}{X} @@ -6482,7 +6501,7 @@ All \latex environments enclosed in \cmd{begin} and \cmd{end} form a group. This <<\endrefsection>> \end{ltxexample} % -This will not from a group, but otherwise works as usual. As far as \biblatex is concerned, it does not matter which syntax you use. The alternative syntax is also supported by the \env{refsegment} environment. Note that the commands \cmd{newrefsection} and \cmd{newrefsegment} do not form a group. See \secref{use:bib:sec, use:bib:seg} for details. +This will not form a group, but otherwise works as usual. As far as \biblatex is concerned, it does not matter which syntax you use. The alternative syntax is also supported by the \env{refsegment} environment. Note that the commands \cmd{newrefsection} and \cmd{newrefsegment} do not form a group. See \secref{use:bib:sec, use:bib:seg} for details. \subsection{Using the fallback \bibtex\ backend} \label{use:bibtex} @@ -9344,7 +9363,7 @@ The \prm{specification} is an undelimited list of \cmd{sort} directives which sp \cmditem{sort}{elements} -Specifies the elements considered in the sorting process. The \prm{elements} are an undelimited list of \cmd{field}, \cmd{literal}, \cmd{citecount} and \cmd{citeorder} commands which are evaluated in the order in which they are given. If an element is defined, it is added to the sort key and the sorting routine skips to the next \cmd{sort} directive. If it is undefined, the next element is evaluated. Since literal strings are always defined, any \cmd{literal} commands should be the sole or the last element in a \cmd{sort} directive. All \prm{elements} should be the same datatype as described in \secref{bib:fld:dat} since they will be potentially compared to any of the other \prm{elements} in other entries.. The \cmd{sort} command supports the following optional arguments: +Specifies the elements considered in the sorting process. The \prm{elements} are an undelimited list of \cmd{field}, \cmd{literal}, \cmd{citecount}, \cmd{intciteorder} and \cmd{citeorder} commands which are evaluated in the order in which they are given. If an element is defined, it is added to the sort key and the sorting routine skips to the next \cmd{sort} directive. If it is undefined, the next element is evaluated. Since literal strings are always defined, any \cmd{literal} commands should be the sole or the last element in a \cmd{sort} directive. All \prm{elements} should be the same datatype as described in \secref{bib:fld:dat} since they will be potentially compared to any of the other \prm{elements} in other entries.. The \cmd{sort} command supports the following optional arguments: \begin{optionlist*} @@ -9417,7 +9436,7 @@ The \cmd{citeorder} element has a special meaning. It requests a sort based on t there is a distinction between the lexical order and the semantic order. Here «one» and «two» have the same semantic order but a unique lexical order. The semantic order only matters if you specify further sorting to disambiguate entries with the same semantic order. For example, this is the definition of the \opt{none} sorting template: \begin{ltxexample} -\DeclareSortingTemplate{none}{ +\DeclareSortingTemplate{lexical}{ \sort{\citeorder} } \end{ltxexample} @@ -9425,7 +9444,7 @@ there is a distinction between the lexical order and the semantic order. Here « This sorts the bibliography purely lexically by the order of the keys in the citation commands. In the example above, it sorts «one» before «two». However, suppose that you consider «one» and «two» to have the same order (semantic order) since they are cited at the same time and want to further sort these by year. Suppose «two» has an earlier \bibfield{year} than «one»: \begin{ltxexample} -\DeclareSortingTemplate{noneyear}{ +\DeclareSortingTemplate{lexicalyear}{ \sort{\citeorder} \sort{<<year>>} } @@ -9433,6 +9452,25 @@ This sorts the bibliography purely lexically by the order of the keys in the cit % This sorts «two» before «one», even though lexically, «one» would sort before «two». This is possible because the semantic order can be disambiguated by the further sorting on year. With the standard \opt{none} sorting template, the lexical order and semantic order are identical because there is nothing further to disambiguate them. This means that you can use \cmd{citeorder} just like any other sorting specification element, choosing how to further sort entries cited at the same time (in the same citation command). +See also \cmd{intciteorder} below. + +\csitem{intciteorder} + +The \cmd{intciteorder} element has a special meaning. It requests a sort based on the lexical order internal to the same citation command. For example: + +\begin{ltxexample} +\cite{one,two} +\end{ltxexample} +% +Here both citations have the same \cmd{citeorder} but different \cmd{intciteorder}. This sorting command is basically a more granular form of \cmd{citeorder} so that order can be distinguished for citations within the same citation command. So, for example, with the above example, this will guarantee sorting of <one> before <two>: + +\begin{ltxexample} +\DeclareSortingTemplate{fulllexical}{ + \sort{\citeorder} + \sort{\intciteorder} +} +\end{ltxexample} + \cmditem{DeclareSortingNamekeyTemplate}[name]{specification} Defines how the sorting keys for names are constructed. This can change the sorting order of names arbitrarily because you can choose how to put together the name parts when constructing the string to compare when sorting. The sorting key construction template so defined is called \prm{name} which defaults to «global» if this optional parameter is absent. When constructing the sorting key for a name, a sorting key for each name part is constructed and the key for each name is formed into an ordered key list with a special internal separator. The point of this option is to accommodate languages or situations where sorting of names needs to be customised (for example, Icelandic names are sometimes sorted by given names rather than by family names). This macro may be used multiple times to define templates with different names which can then be referred to later. Sorting name key templates can be specified at the following scopes, in order of increasing precedence: @@ -9465,7 +9503,49 @@ By default there is only a global template which has the following \prm{specific } \end{ltxexample} % -This means that the key is constructed by concatenating, in order, the name prefix (only if the \opt{useprefix} option is true) with the family name(s), the given names(s), the name suffix and then the name prefix (only if the \opt{useprefix} option is false). +This means that the key is constructed by concatenating, in order, the name prefix (only if the \opt{useprefix} option is true) with the family name(s), the given names(s), the name suffix and then the name prefix (only if the \opt{useprefix} option is false). The visible number of names in the name list used to construct the key is the default sorting visibility, see below. + +\cmditem{visibility}{visibilityscope} + +\prm{visibilityscope} determines which visibility settings to use for the name list. This determines how many names in the name list are visible to the sorting algorithm. This is by default set to <sort>, which is the standard visibility for sorting determined by the \opt{max*/min*names} and \opt{uniquelist} options. \cmd{visibility} can be omitted entirely if this default is desired. The only other scope is <cite> which forces the sorting algorithm to use the name list visibility of the citations rather than that of the reference list sorting. This is useful when using the \opt{sortcites} option in the situation when a style has different name list truncation rules for citations than it has for the reference list. Citations can then be forced to sort using a different reference context that uses a modified sorting name key template that enforces the correct name list truncation for citation sorting with: + +\begin{ltxexample} +\DeclareSortingNamekeyTemplate[mycitesorttemplate]{ + \visibilty{cite} + . + . + . +\end{ltxexample} +% +and then force this to be used with e.g.: + +\begin{ltxexample} + \newrefcontext[sortingnamekeytemplate=mycitesorttemplate] + \cite{a,b,c} +\end{ltxexample} +% +One thing to note is that a reference context will not be written to the \file{.bcf} if no \cmd{printbibliography} or \cmd{printbiblist} occurs within it which will mean that \biber will not generate any sorted data for the refcontext. Therefore if the requirement is to just correctly sort citations using this refcontext, you will need to force the writing of the refcontext using \cmd{GenRefcontextData} (see \secref{use:bib:context}): + +\begin{ltxexample} + % make sure sorting data using this template is + % generated since no \printbibliography/\printbiblist + % occurs in the refcontext with + % sortingnamekeytemplatename=mycitesorttemplate, + % this won't happen by default + \GenRefcontextData{sortingnamekeytemplatename=mycitesorttemplate} + % Switch to this refcontext to use the correct + % sorted data using the sorting name key template + % which uses "cite" visibility for the name lists + \newrefcontext[sortingnamekeytemplate=mycitesorttemplate] + % citations are correctly sorted + \cite{a,b,c} + % Switch to the default sorting name key template + % for the actual list of references which uses the + % default sorting visibility for the name lists + \newrefcontext[sortingnamekeytemplate=global] + % references are correctly sorted + \printbibliography +\end{ltxexample} \cmditem{keypart}{part} @@ -9497,7 +9577,7 @@ constructing the sorting specification. As an example, suppose you wanted to be able to sort names by given name rather than family name, you could define a sorting name key template like this: \begin{ltxexample} -\DeclareSortingNamekeyTemplate[givenfirst]{ +\DeclareNamekeyTemplate[givenfirst]{ \keypart{ \namepart{<<given>>} } @@ -12507,7 +12587,12 @@ The punctuation to be printed between the given and family name parts when a nam The dash to be used as a replacement for recurrent authors or editors in the bibliography. The default is an <em> or an <en> dash, depending on the indentation of the list of references. \csitem{labelnamepunct}\DeprecatedMark -A separator to be printed after the name used for alphabetizing in the bibliography (\bibfield{author} or \bibfield{editor}, if the \bibfield{author} field is undefined) instead of \cmd{newunitpunct}. The default is \cmd{newunitpunct}, \ie it is not handled differently from regular unit punctuation but permits convenient reconfiguration. This punctuation command is deprecated and has been superseded by the context-sensitive \cmd{nametitledelim} (see \secref{use:fmt:csd}). For backwards compatibility reasons, however, \cmd{nametitledelim} still defaults to \cmd{labelnamepunct} in the \texttt{bib} and \texttt{biblist} contexts. Style authors may want to consider replacing \cmd{labelnampunct} with \texttt{\textbackslash printdelim\{nametitledelim\}} and users may want to prefer modifying the context-sensitive \texttt{nametitledelim} with \cmd{DeclareDelimFormat} over redefining \cmd{labelnamepunct}. +A separator to be printed after the name used for alphabetizing in the bibliography (\bibfield{author} or \bibfield{editor}, if the \bibfield{author} field is undefined) instead of \cmd{newunitpunct}. The default is \cmd{newunitpunct}, \ie it is not handled differently from regular unit punctuation but permits convenient reconfiguration. This punctuation command is deprecated and has been superseded by the context-sensitive \cmd{nametitledelim} (see \secref{use:fmt:csd}). For backwards compatibility reasons, however, \cmd{nametitledelim} still defaults to \cmd{labelnamepunct} in the \texttt{bib} and \texttt{biblist} contexts. Style authors may want to consider replacing \cmd{labelnampunct} with \texttt{\textbackslash printdelim\{nametitledelim\}} and users may want to prefer modifying the context-sensitive \texttt{nametitledelim} with \cmd{DeclareDelimFormat} over redefining \cmd{labelnamepunct}, \eg +\begin{ltxexample} +\DeclareDelimFormat[bib]{nametitledelim}{% + \addcolon\space} +\end{ltxexample} + \csitem{subtitlepunct} The separator to be printed between the fields \bibfield{title} and \bibfield{subtitle}, \bibfield{booktitle} and \bibfield{booksubtitle}, as well as \bibfield{maintitle} and \bibfield{mainsubtitle}. Use this separator instead of \cmd{newunitpunct} at this location. The default is \cmd{newunitpunct}, \ie it is not handled differently from regular unit punctuation but permits convenient reconfiguration. @@ -12576,16 +12661,16 @@ Similar to \cmd{multicitedelim}, but intended for citation styles that <compress Similar to \cmd{multicitedelim}, but intended for \cmd{textcite} and related commands (\secref{use:cit:cbx}). The default is a comma plus an interword space. The standard styles modify this provisional definition to ensure that the delimiter before the final citation is the localised term <and>, separated by interword spaces. \csitem{nametitledelim}\CSdelimMark -The delimiter to be printed between the author\slash editor and the title. This command should be incorporated in the definition of all citation commands of author-title and some verbose citation styles and in the bibliography drivers---in author-year bibliographies \cs{nametitledelim} may be printed between the author\slash editor-year block and the title. The default definition inside bibliographies is the now deprecated \cmd{labelnamepunct} (for backwrds compatibility reasons) and is a comma plus an interword space otherwise. +The delimiter to be printed between the author\slash editor and the title. This command should be incorporated in the definition of all citation commands of author-title and some verbose citation styles and in the bibliography drivers---in author-year bibliographies \cs{nametitledelim} may be printed between the author\slash editor-year block and the title. The default definition inside bibliographies (\ie in the \texttt{bib} and \texttt{biblist} contexts) is the now deprecated \cmd{labelnamepunct} (for backwards compatibility reasons), in \texttt{textcite} context it is a space and it is a comma plus an interword space otherwise. \csitem{nameyeardelim}\CSdelimMark -The delimiter to be printed between the author\slash editor and the year. This command should be incorporated in the definition of all citation commands of author-year citation styles and in the bibliography drivers. The default definition is an interword space. +The delimiter to be printed between the author\slash editor and the year. This command should be incorporated in the definition of all citation commands of author-year citation styles and in the bibliography drivers. The default definition is an interword space. For backwards compatibility reasons there are separate definitions in the \texttt{bib}, \texttt{biblist}, \texttt{textcite} and global context. \csitem{namelabeldelim}\CSdelimMark The delimiter printed between the name\slash title and the label. This command should be incorporated in the definition of all citation commands of alphabetic and numeric citation styles. The default definition is an interword space. \csitem{nonameyeardelim}\CSdelimMark -The delimiter printed between the substitute for the labelname when it does not exist (usually the label or title in standard styles) and the year citation styles and the bibliography drivers. This command should be incorporated in the definition of all citation commands of author-year citation styles and in the bibliography drivers. The default definition is an interword space. +The delimiter printed between the substitute for the labelname when it does not exist (usually the label or title in standard styles) and the year citation styles and the bibliography drivers. This command should be incorporated in the definition of all citation commands of author-year citation styles and in the bibliography drivers. The default definition is an interword space. For backwards compatibility reasons there are separate definitions in the \texttt{bib}, \texttt{biblist}, \texttt{textcite} and global context. \csitem{authortypedelim}\CSdelimMark The delimiter printed between the author and the \texttt{authortype}. The default is a comma followed by a space. @@ -13178,6 +13263,10 @@ The name of the name list currently being processed by \cmd{printnames}. This in \begin{ltxsyntax} +\cmditem{AtBeginRefsection}{code} + +Appends the \prm{code} to an internal hook executed at the beginning of every reference section. The \prm{code} is executed just after setting the reference section number. This command may only be used in the preamble. + \cmditem{AtBeginBibliography}{code} Appends the \prm{code} to an internal hook executed at the beginning of the bibliography. The \prm{code} is executed at the beginning of the list of references, immediately after the \prm{begin code} of \cmd{defbibenvironment}. This command may only be used in the preamble. @@ -14766,6 +14855,14 @@ use$<$name$>$ &\+&\+&\_&\+&\+&\_&\_\\ This revision history is a list of changes relevant to users of this package. Changes of a more technical nature which do not affect the user interface or the behavior of the package are not included in the list. More technical details are to be found in the \file{CHANGES.md} file. The numbers on the right indicate the relevant section of this manual. \begin{changelog} +\begin{release}{3.18}{2022-06-22} +\item Added sorting option \cmd{intciteorder}\see{aut:ctm:srt} +\item Added global option \opt{pluralothers}\see{use:opt:pre:gen} +\item Added \cmd{localrefcontext}\see{use:bib:context} +\item Added \cmd{visibility} option to \cmd{DeclareSortingNamekeyTemplate}\see{aut:ctm:srt} +\item Added \cmd{GenRefcontextData}\see{use:bib:context} +\item Added \cmd{AtBeginRefsection}\see{aut:fmt:hok} +\end{release} \begin{release}{3.17}{2022-01-25} \item Changed behaviour of index-less granular XDATA references\see{use:use:xdat} \item Added \cmd{DeclareNonamestring} \see{aut:ctm:nonamestring} diff --git a/macros/latex/contrib/biblatex/doc/examples/31-style-numeric-comp-bibtex.pdf b/macros/latex/contrib/biblatex/doc/examples/31-style-numeric-comp-bibtex.pdf Binary files differindex 341968dbcb..17ccb35690 100644 --- a/macros/latex/contrib/biblatex/doc/examples/31-style-numeric-comp-bibtex.pdf +++ b/macros/latex/contrib/biblatex/doc/examples/31-style-numeric-comp-bibtex.pdf diff --git a/macros/latex/contrib/biblatex/latex/biblatex.def b/macros/latex/contrib/biblatex/latex/biblatex.def index 58c7414182..8e52b7fa0d 100644 --- a/macros/latex/contrib/biblatex/latex/biblatex.def +++ b/macros/latex/contrib/biblatex/latex/biblatex.def @@ -1472,6 +1472,7 @@ \DeclareSortingTemplate{none}{ \sort{\citeorder} + \sort{\intciteorder} } \DeclareSortingTemplate{count}{ diff --git a/macros/latex/contrib/biblatex/latex/biblatex.sty b/macros/latex/contrib/biblatex/latex/biblatex.sty index afafd19134..d21d369757 100644 --- a/macros/latex/contrib/biblatex/latex/biblatex.sty +++ b/macros/latex/contrib/biblatex/latex/biblatex.sty @@ -12,8 +12,8 @@ % particular purpose. % Set up the version strings here -\def\abx@date{2022/02/02} -\def\abx@version{3.17} +\def\abx@date{2022/06/22} +\def\abx@version{3.18} \def\abx@bbxid{\abx@date\space v\abx@version\space biblatex bibliography style (PK/MW)} \def\abx@cbxid{\abx@date\space v\abx@version\space biblatex citation style (PK/MW)} \def\abx@lbxid{\abx@date\space v\abx@version\space biblatex localization (PK/MW)} @@ -22,7 +22,7 @@ % This is not updated by build script as the control file version % does not necessarily change with the package version. % This is used when writing the .bcf -\def\blx@bcfversion{3.8} +\def\blx@bcfversion{3.9} % This is not updated by build script as the bbl version % does not necessarily change with the package version. @@ -150,6 +150,14 @@ \PackageWarning{biblatex}{#1}% \endgroup}} +\def\blx@err@patch#1{% + \blx@error + {Patching #1 failed} + {This is an internal issue typically caused by a + conflict\MessageBreak between biblatex and some + other package. Modifying\MessageBreak the package + loading order may fix the problem}} + %% Compatibility % this hook is executed once at the beginning of loading the package % just a few lines down @@ -328,6 +336,26 @@ {}} {}% \appto\TE@hook{\blx@TE@hook}% + % we need to patch \addtocontents + \toggletrue{blx@tempa}% + % kernel definition + \patchcmd\addtocontents + {\let\glossary\@gobble} + {\let\glossary\@gobble + \blx@contentssafe@citecommands} + {} + {\togglefalse{blx@tempa}}% + % try tag.sto's definition + \iftoggle{blx@tempa} + {} + {\patchcmd\addtocontents + {\let\glossary\Gobble} + {\let\glossary\Gobble + \blx@contentssafe@citecommands} + {} + {% give up + \blx@err@patch{\string\addtocontents}}}% + % patch footnote \toggletrue{blx@tempa}% \def\do#1{% \patchcmd#1% @@ -604,10 +632,10 @@ } -\protected\def\blx@providecounter#1{% - \ifltxcounter{#1} +\protected\def\blx@providecount#1{% + \ifcscounter{#1} {} - {\newcounter{#1}}} + {\expandafter\newcount\csname #1\endcsname}} \def\blx@citecmds{} % \autocite and \autocites are not defined via \DeclareCiteCommand @@ -629,13 +657,6 @@ \boolfalse{backtracker}% \defcounter{refsection}{#1}} -\patchcmd\addtocontents - {\let\glossary\@gobble} - {\let\glossary\@gobble - \blx@contentssafe@citecommands} - {} - {\blx@err@patch{\addtocontents}} - % trick hyperref into believing we're natbib \let\NAT@parse\@empty % trick showkeys into believing we're havard @@ -853,11 +874,12 @@ \newcount\blx@tempcntc \newcounter{blx@maxsection} \def\theblx@maxsection{\the\c@blx@maxsection} -\newcounter{blx@maxsegment@0} +\expandafter\newcount\csname blx@maxsegment@0\endcsname \newcount\blx@notetype \newcount\blx@parenlevel@text \newcount\blx@parenlevel@foot -\newcounter{blx@sectionciteorder@0} +\expandafter\newcount\csname blx@sectionciteorder@0\endcsname +\expandafter\newcount\csname blx@sectionciteorderinternal@0\endcsname \newcount\blx@entrysetcounter \newcount\blx@biblioinstance @@ -919,6 +941,7 @@ \newtoggle{blx@labeltitle} \newtoggle{blx@labeltitleyear} \newtoggle{blx@labeldateparts} +\newtoggle{blx@pluralothers} \newtoggle{blx@natbib} \newtoggle{blx@mcite} \newtoggle{blx@loadfiles} @@ -1345,13 +1368,6 @@ \protected\def\abx@missing#1{% \mbox{\reset@font\bfseries#1}} -\def\blx@err@patch#1{% - \blx@error - {Patching #1 failed} - {This is an internal issue typically caused by a - conflict\MessageBreak between biblatex and some - other package. Modifying\MessageBreak the package - loading order may fix the problem}} \def\blx@err@nolang#1{% \blx@error @@ -2256,13 +2272,14 @@ {\csuse{blx@bbx@#1}} {\ifcsdef{blx@bbx@*} {\blx@warning{% - No driver for entry type '#1'.\MessageBreak + No driver for '#1'.\MessageBreak Using fallback driver}% \csuse{blx@bbx@*}} {\blx@error - {No driver for '\abx@field@entrytype' found} - {I can't find a driver for the entry type - '\abx@field@entrytype'\MessageBreak + {No driver for '#1' found} + {I can't find a driver for + '#1'\MessageBreak + (entry type '\abx@field@entrytype')\MessageBreak and there is no fallback driver either}}}} % {<type>}{<true>}{<false>} @@ -4580,6 +4597,11 @@ \c@liststop#2\relax \fi \fi}% + \ifboolexpr{test {\iftoggle{blx@pluralothers}} + and + test {\ifnumcomp{\value{listtotal}-\value{liststop}}{=}{1}}} + {\c@liststop\c@listtotal} + {}% \blx@namecodes} \def\blx@namesetup@i#1{% @@ -8421,16 +8443,17 @@ \listcsxadd{blx@keyaliases@\the\c@refsection}{\detokenize{#1}}} % blx@dlist@list@<section>@<refcontext> - a list of list items in a refcontext in a -% section (for tracking bibliography lists, -% obeys skipbiblist) +% section (for tracking bibliography lists, +% obeys skipbiblist) % blx@dlist@entry@<section>@<list> - a list of normal entries in a list in a -% section (for tracking bibliographies, -% obeys skipbib) +% section (for tracking bibliographies, +% obeys skipbib) % blx@dlist@centry@<section>@<list> - a list of normal entries in a list in a -% section (for tracking citations, -% obeys skipbib). Same as @entry@ but -% with added set children - +% section (for tracking citations, +% does not obey skipbib). +% Same as @entry@, but includes skipbib'd entries +% and set children +% % {<entrykey>}{<entrytype>}{<options>} \protected\def\blx@bbl@entry#1#2#3{% \begingroup @@ -8463,9 +8486,11 @@ \ifdef\abx@field@entrysubtype {\listcsxadd{blx@subt@\the\c@refsection @\abx@field@entrysubtype}{\abx@field@entrykey}} {}% + \nottoggle{blx@setonly} + {\listcsxadd{blx@dlist@centry@\the\c@refsection @\blx@dlist@name}{\abx@field@entrykey}} + {}% \nottoggle{blx@skipbib} - {\listcsxadd{blx@dlist@entry@\the\c@refsection @\blx@dlist@name}{\abx@field@entrykey}% - \listcsxadd{blx@dlist@centry@\the\c@refsection @\blx@dlist@name}{\abx@field@entrykey}} + {\listcsxadd{blx@dlist@entry@\the\c@refsection @\blx@dlist@name}{\abx@field@entrykey}} {}}% {}% \nottoggle{blx@skipbiblist} @@ -9600,7 +9625,7 @@ \xifinlist{\blx@refcontext@context @\blx@tempe @entry}\blx@dlistnames {} {\listxadd\blx@dlistnames{\blx@refcontext@context @\blx@tempe @entry}% - \csxappto{blx@dlists}{% + \xappto\blx@dlists{% \blx@xml@dlist{\blx@refcontext@context}{entry}{\blx@tempe}{\blx@xml@dlist@refcontext{\blx@refcontext@sortingtemplatename}{\blx@refcontext@sortingnamekeytemplatename}{\blx@refcontext@labelprefix@real}{\blx@refcontext@uniquenametemplatename}{\blx@refcontext@labelalphanametemplatename}}{}}}% \ifdefvoid\blx@tempa {\blx@warn@bibempty\endgroup} @@ -9651,7 +9676,7 @@ \begingroup \delimcontext{bib}% \edef\on@line{\on@line}% - \ifnum\csname c@blx@maxsegment@\the\c@refsection\endcsname=\z@ + \ifnum\csname blx@maxsegment@\the\c@refsection\endcsname=\z@ \blx@warning{No reference segments found}% \fi \@ifnextchar[%] @@ -9683,7 +9708,7 @@ {\letcs\blx@tempa{blx@dlist@entry@\the\c@refsection @\blx@refcontext@context}}% \blx@filter\blx@tempa{blx@segm@\the\c@refsection @\the\c@refsegment}% \blx@bibliography\blx@tempa}% - \ifnum\c@refsegment<\csname c@blx@maxsegment@\the\c@refsection\endcsname + \ifnum\c@refsegment<\csname blx@maxsegment@\the\c@refsection\endcsname \advance\c@refsegment\@ne \expandafter\blx@refsegments \else @@ -10195,6 +10220,8 @@ \noexpand\blx@kv@setkeys{blx@refcontext}{\csuse{blx@refcontext@name@#2}}}% \blx@tempa}% % Override with explicit refcontext keyvals, if given + \def\blx@gdef@or@def{\gdef}% + \def\blx@xdef@or@edef{\xdef}% \blx@kv@setkeys{blx@refcontext}{#1}% % Add the sortingtemplate to the list of sortingtemplates so we can track % special cases like sorting=none which need cite order change detection @@ -10241,16 +10268,70 @@ \blx@refcontext@uniquenametemplatename/% \blx@refcontext@labelalphanametemplatename}} +% local version of \newrefcontext +\def\localrefcontext{% + \@ifnextchar[%] + {\localrefcontext@i} + {\localrefcontext@i[]}} + +\def\localrefcontext@i[#1]{% + \@ifnextchar\bgroup + {\localrefcontext@ii[{#1}]} + {\localrefcontext@ii[{#1}]{}}} + +\newcommand*{\localrefcontext@ii}[2][]{% + \ifblank{#2} + {} + {\begingroup + \edef\blx@tempa{\endgroup% + \noexpand\blx@kv@setkeys{blx@refcontext}{\csuse{blx@refcontext@name@#2}}}% + \blx@tempa}% + % Override with explicit refcontext keyvals, if given + \def\blx@gdef@or@def{\def}% + \def\blx@xdef@or@edef{\edef}% + \blx@kv@setkeys{blx@refcontext}{#1}% + % Add the sortingtemplate to the list of sortingtemplates so we can track + % special cases like sorting=none which need cite order change detection + \xifinlist\blx@refcontext@sortingtemplatename\blx@sortingtemplatenames + {} + {\listxadd\blx@sortingtemplatenames\blx@refcontext@sortingtemplatename}% + \blx@edef@refcontext{% + \blx@refcontext@sortingtemplatename/% + \blx@refcontext@sortingnamekeytemplatename/% + \blx@refcontext@labelprefix/% + \blx@refcontext@uniquenametemplatename/% + \blx@refcontext@labelalphanametemplatename}% + % Add the refcontext to the list of refcontexts so we can compare on next run + \xifinlist\blx@refcontext@context\blx@refcontexts + {} + {\listxadd\blx@refcontexts\blx@refcontext@context}% + \blx@auxwrite\@mainaux{}{\string\abx@aux@refcontext{\blx@refcontext@context}}% + \ifcsundef{blx@sortingtemplate@\blx@refcontext@sortingtemplatename} + {\blx@err@invopt{sorting=\blx@refcontext@sortingtemplatename}{}} + {}% + \ifcsundef{blx@sortingnamekeytemplate@\blx@refcontext@sortingnamekeytemplatename} + {\blx@err@invopt{sortingnamekeytemplate=\blx@refcontext@sortingnamekeytemplatename}{}} + {}% + \ifcsundef{blx@uniquenametemplate@\blx@refcontext@uniquenametemplatename} + {\blx@err@invopt{uniquenametemplate=\blx@refcontext@uniquenametemplatename}{}} + {}% + \ifcsundef{blx@labelalphanametemplate@\blx@refcontext@labelalphanametemplatename} + {\blx@err@invopt{labelalphanametemplate=\blx@refcontext@labelalphanametemplatename}{}} + {}} + +\def\blx@gdef@or@def{\gdef} +\def\blx@xdef@or@edef{\xdef} + % Meta option to set all name template options \blx@kv@defkey{blx@refcontext}{nametemplates}{% - \gdef\blx@refcontext@sortingnamekeytemplatename{#1}% - \gdef\blx@refcontext@uniquenametemplatename{#1}% - \gdef\blx@refcontext@labelalphanametemplatename{#1}} + \blx@gdef@or@def\blx@refcontext@sortingnamekeytemplatename{#1}% + \blx@gdef@or@def\blx@refcontext@uniquenametemplatename{#1}% + \blx@gdef@or@def\blx@refcontext@labelalphanametemplatename{#1}} -\blx@kv@defkey{blx@refcontext}{sorting}{\gdef\blx@refcontext@sortingtemplatename{#1}} -\blx@kv@defkey{blx@refcontext}{sortingnamekeytemplatename}{\gdef\blx@refcontext@sortingnamekeytemplatename{#1}} -\blx@kv@defkey{blx@refcontext}{uniquenametemplatename}{\gdef\blx@refcontext@uniquenametemplatename{#1}} -\blx@kv@defkey{blx@refcontext}{labelalphanametemplatename}{\gdef\blx@refcontext@labelalphanametemplatename{#1}} +\blx@kv@defkey{blx@refcontext}{sorting}{\blx@gdef@or@def\blx@refcontext@sortingtemplatename{#1}} +\blx@kv@defkey{blx@refcontext}{sortingnamekeytemplatename}{\blx@gdef@or@def\blx@refcontext@sortingnamekeytemplatename{#1}} +\blx@kv@defkey{blx@refcontext}{uniquenametemplatename}{\blx@gdef@or@def\blx@refcontext@uniquenametemplatename{#1}} +\blx@kv@defkey{blx@refcontext}{labelalphanametemplatename}{\blx@gdef@or@def\blx@refcontext@labelalphanametemplatename{#1}} % labelprefix cannot be used as is because it is used to construct the internal % refcontext name which is referenced/expanded a lot all over the place. So, @@ -10259,8 +10340,8 @@ % the way and so unexpandable content like \dag breaks. % Unexpandable content should be protected with \detokenize. \blx@kv@defkey{blx@refcontext}{labelprefix}{% - \xdef\blx@refcontext@labelprefix{\blx@mdfivesum{#1}}% - \gdef\blx@refcontext@labelprefix@real{#1}% + \blx@xdef@or@edef\blx@refcontext@labelprefix{\blx@mdfivesum{#1}}% + \blx@gdef@or@def\blx@refcontext@labelprefix@real{#1}% \iftoggle{blx@defernumbers} {}% {\iftoggle{blx@labelnumber} @@ -10269,6 +10350,7 @@ 'defernumbers=true'}} {}}} + % [refcontext keys]{<keyword1>,<keyword2>,...} \newcommand*{\assignrefcontextkeyws}{% \@ifstar @@ -10356,7 +10438,49 @@ \blx@kv@defkey{blx@assignrefcontext}{uniquenametemplatename}{\def\blx@tempd{#1}} \blx@kv@defkey{blx@assignrefcontext}{labelalphanametemplatename}{\def\blx@tempe{#1}} +% Manually force a refcontext datalist in the .bcf +\newcommand*{\GenRefcontextData}[1]{% + \begingroup + \edef\blx@tempb{\the\c@refsection}% + \def\blx@tempc{global}% + \def\blx@tempd{global}% + \def\blx@tempe{global}% + \let\blx@tempf\blx@sorting% + \let\blx@tempg\@empty% + \ifblank{#1} + {} + {\blx@kv@setkeys{blx@refcontextmanual}{#1}}% + \def\blx@tempa{\blx@tempf/\blx@tempc/\blx@tempg/\blx@tempd/\blx@tempe}% + \xifinlist{\blx@tempa @\blx@tempb @entry}\blx@dlistnames + {} + {\listxadd\blx@dlistnames{\blx@tempa @\blx@tempb @entry}% + \xappto\blx@dlists{% + \blx@xml@dlist{\blx@tempa}{entry}{\blx@tempb}{\blx@xml@dlist@refcontext{\blx@tempf}{\blx@tempc}{\blx@tempg}{\blx@tempd}{\blx@tempe}}{}}}% + \endgroup} + +% Meta option to set all name template options +\blx@kv@defkey{blx@refcontextmanual}{nametemplates}{% + \def\blx@tempc@sortingnamekeytemplatename{#1}% + \def\blx@tempd@uniquenametemplatename{#1}% + \def\blx@tempe@labelalphanametemplatename{#1}} +\blx@kv@defkey{blx@refcontextmanual}{sorting}{\def\blx@tempf{#1}} +\blx@kv@defkey{blx@refcontextmanual}{sortingnamekeytemplatename}{\def\blx@tempc{#1}} +\blx@kv@defkey{blx@refcontextmanual}{uniquenametemplatename}{\def\blx@tempd{#1}} +\blx@kv@defkey{blx@refcontextmanual}{labelalphanametemplatename}{\def\blx@tempe{#1}} +\blx@kv@defkey{blx@refcontextmanual}{labelprefix}{% + \def\blx@tempg{#1}% + \iftoggle{blx@defernumbers} + {}% + {\iftoggle{blx@labelnumber} + {\blx@warning{% + Option 'labelprefix' requires global\MessageBreak + 'defernumbers=true'}} + {}}} + % Reference sections +\newrobustcmd*{\AtBeginRefsection}{\gappto\blx@hook@refsectioninit} +\@onlypreamble\AtBeginRefsection + \newrobustcmd*{\newrefsection}{% \endrefcontext \ifnum\c@refsection>\z@ @@ -10389,14 +10513,15 @@ \endgroup \stepcounter{blx@maxsection}% \setcounter{refsection}{\value{blx@maxsection}}% + \csuse{blx@hook@refsectioninit}% \xifinlist{\the\c@refsection}\blx@allrefsections {} {\listxadd\blx@allrefsections{\the\c@refsection}}% \ifcsdef{blx@defaultrefcontexts@\the\c@refsection} {} {\global\cslet{blx@defaultrefcontexts@\the\c@refsection}\@empty}% - \blx@providecounter{blx@maxsegment@\the\c@refsection}% - \blx@providecounter{blx@sectionciteorder@\the\c@refsection}% + \blx@providecount{blx@maxsegment@\the\c@refsection}% + \blx@providecount{blx@sectionciteorder@\the\c@refsection}% \blx@inf@refsec \blx@secinit \if@filesw @@ -10444,36 +10569,36 @@ \def\blx@endrefsection{% \blx@endrefsegment - \blx@providecounter{blx@sectionciteorder@\the\c@refsection}% + \blx@providecount{blx@sectionciteorder@\the\c@refsection}% % make sure we always output aliases to the .bcf otherwise after their % first resolution by biber, they will be invisible to subsequent biber % runs since biblatex will resolve the \keyalias{} macro to the main % entry key, biber won't put \keyalias{}in the .bbl on subsequent runs % and biblatex will report a missing citekey - \def\do##1{% - \blx@xmlsanitizeafter{\def\blx@tempa}{##1}% - % Make sure this counter exists. Sometimes it might not when using, e.g: - % refsection=chapter and \includeonly to put in the chapters or when - % inserting citations into table of contents - \stepcounter{blx@sectionciteorder@\the\c@refsection}% - \blx@auxwrite\blx@bcfout{}{% - \blx@xml@citekey{\blx@tempa}{} - {\expandafter\the\csname c@blx@sectionciteorder@\the\c@refsection\endcsname}}}% - \ifcsundef{blx@keyaliases@\the\c@refsection} + \ifcsempty{blx@keyaliases@\the\c@refsection} {} - {\dolistcsloop{blx@keyaliases@\the\c@refsection}}% + {\def\do##1{% + \blx@xmlsanitizeafter{\def\blx@tempa}{##1}% + % Make sure this counter exists. Sometimes it might not when using, e.g: + % refsection=chapter and \includeonly to put in the chapters or when + % inserting citations into table of contents + \global\advance\csname blx@sectionciteorder@\the\c@refsection\endcsname\@ne + \blx@auxwrite\blx@bcfout{}{% + \blx@xml@citekey{\blx@tempa}{} + {\expandafter\the\csname blx@sectionciteorder@\the\c@refsection\endcsname}{1}}}% + \dolistcsloop{blx@keyaliases@\the\c@refsection}}% % output key counts (for \citecount sorting) if citecounter option is not false \ifcsundef{blx@cites@\the\c@refsection} {} {\ifundef\blx@citecounter {} {\def\do##1{% - \ifcsundef{blx@currcount@\the\c@refsection @##1} - {\csdef{blx@currcount@\the\c@refsection @##1}{0}} - {}% - \blx@auxwrite\blx@bcfout{} - {\blx@xml@citekeycount{##1}{\csuse{blx@currcount@\the\c@refsection @##1}}}}}% - \dolistcsloop{blx@cites@\the\c@refsection}}% + \ifcsundef{blx@currcount@\the\c@refsection @##1} + {\csdef{blx@currcount@\the\c@refsection @##1}{0}} + {}% + \blx@auxwrite\blx@bcfout{} + {\blx@xml@citekeycount{##1}{\csuse{blx@currcount@\the\c@refsection @##1}}}}% + \dolistcsloop{blx@cites@\the\c@refsection}}}% \ifnum\c@refsection>\z@ \blx@auxwrite\blx@bcfout{}{% \blx@xml@endsection\blx@nl @@ -10512,8 +10637,8 @@ \blx@err@nestenv{refsegment}% \blx@endrefsegment \fi - \stepcounter{blx@maxsegment@\the\c@refsection}% - \setcounter{refsegment}{\value{blx@maxsegment@\the\c@refsection}}% + \global\advance\csname blx@maxsegment@\the\c@refsection\endcsname\@ne + \setcounter{refsegment}{\csuse{blx@maxsegment@\the\c@refsection}}% \blx@inf@refseg \blx@info{Setting label 'refsegment:\the\c@refsection\the\c@refsegment'}% \label{refsegment:\the\c@refsection\the\c@refsegment}% @@ -10993,7 +11118,6 @@ \apptocmd{\blx@hook@entrykey}} \@onlypreamble\AtEveryEntrykey - \def\blx@imc@UseEveryCiteHook{\csuse{blx@hook@cite}} \def\blx@imc@UseEveryCitekeyHook{\csuse{blx@hook@citekey}} \def\blx@imc@UseEveryMultiCiteHook{\csuse{blx@hook@mcite}} @@ -11109,7 +11233,8 @@ \def\blx@citation@all{% \blx@auxwrite\@mainaux{}{\string\abx@aux@nociteall}% \ifbool{citerequest} - {\blx@bibreq{*}% + {\global\advance\csname blx@sectionciteorder@\the\c@refsection\endcsname\@ne + \blx@bibreq{*}% \global\csletcs {blx@segm@\the\c@refsection @\the\c@refsegment} {blx@dlist@entry@\the\c@refsection @\blx@refcontext@context}% @@ -11122,6 +11247,7 @@ \listgadd\blx@nocites{*}} \protected\def\blx@bibreq#1{% + \advance\blx@tempcntc\@ne% holds internal \cite{} citation order \begingroup \blx@xmlsanitizeafter{\def\blx@tempa}{#1}% \let\blx@tempb\@empty @@ -11134,12 +11260,15 @@ not test {\ifinlist{#1}\blx@directcites}} {\def\blx@tempb{ nocite="1"}} {}% + \blx@auxwrite\blx@bcfout{}{\blx@xml@citekey{\blx@tempa}{\blx@tempb}% + {\expandafter\the\csname blx@sectionciteorder@\the\c@refsection\endcsname}% + {\expandafter\the\csname blx@tempcntc\endcsname}}% % citeall is always order "0" - this makes no real difference as biber % ignores all other citekeys in the section if citeall is present - \ifstrequal{*}{#1} - {\blx@auxwrite\blx@bcfout{}{\blx@xml@citekey{\blx@tempa}{\blx@tempb}{0}}} - {\blx@auxwrite\blx@bcfout{}{\blx@xml@citekey{\blx@tempa}{\blx@tempb}{% - \expandafter\the\csname c@blx@sectionciteorder@\the\c@refsection\endcsname}}}% + % \ifstrequal{*}{#1} + % {\blx@auxwrite\blx@bcfout{}{\blx@xml@citekey{\blx@tempa}{\blx@tempb}{0}}} + % {\blx@auxwrite\blx@bcfout{}{\blx@xml@citekey{\blx@tempa}{\blx@tempb}{% + % \expandafter\the\csname blx@sectionciteorder@\the\c@refsection\endcsname}}}% \endgroup} % {<set>}{<key1,key2,key3>} @@ -11182,8 +11311,16 @@ \endgroup} % {<entrykey>,...} +% a crude way to check for a do-nothing argument: +% loop over it to see what happens \protected\def\blx@citeloop#1{% - \expandafter\blx@citeloop@i\expandafter{\detokenize{#1}}} + \togglefalse{blx@tempa}% + \def\do{\toggletrue{blx@tempa}\listbreak}% + \expandafter\docsvlist\expandafter{\detokenize{#1}}% + \iftoggle{blx@tempa} + {\expandafter\blx@citeloop@i\expandafter{\detokenize{#1}}} + {\abx@missing@entry{empty citation}% + \@latex@warning{\blx@msg@cundefon{}}}} \protected\def\blx@citeloop@i#1{% \begingroup % This must be here and not after \blx@citeadd as this changes the refcontext @@ -11194,10 +11331,11 @@ % Make sure this counter exists. Sometimes it might not when using, e.g: % refsection=chapter and \includeonly to put in the chapters or when % inserting citations into table of contents - \blx@providecounter{blx@sectionciteorder@\the\c@refsection}% - \stepcounter{blx@sectionciteorder@\the\c@refsection}% + \blx@providecount{blx@sectionciteorder@\the\c@refsection}% + \global\advance\csname blx@sectionciteorder@\the\c@refsection\endcsname\@ne \blx@tempcnta\z@ \blx@tempcntb\z@ + \blx@tempcntc\z@ \let\blx@tempa\@empty \forcsvlist\blx@citeadd{#1}% adds to \blx@tempa \blx@thenotecheck @@ -11507,7 +11645,9 @@ \def\blx@ibidtracker@constrict{% \blx@ifcitesingle - {\blx@mpfnsave + {\iftoggle{blx@footnote} + {\blx@mpfnsave} + {}% \blx@ibidtracker@context} {\blx@ibidreset@context}}% @@ -11553,7 +11693,9 @@ \let\blx@idemtracker@strict\blx@idemtracker@global \def\blx@idemtracker@constrict{% - \blx@mpfnsave + \iftoggle{blx@footnote} + {\blx@mpfnsave} + {}% \blx@idemtracker@context} \def\blx@idemreset@force{% @@ -11602,7 +11744,9 @@ \def\blx@opcittracker@constrict{% \blx@ifcitesingle - {\blx@mpfnsave + {\iftoggle{blx@footnote} + {\blx@mpfnsave} + {}% \blx@opcittracker@context} {\blx@opcitreset@context}}% @@ -11913,8 +12057,8 @@ % Make sure this counter exists. Sometimes it might not when using, e.g: % refsection=chapter and \includeonly to put in the chapters or when % inserting citations into table of contents - \blx@providecounter{blx@sectionciteorder@\the\c@refsection}% - \stepcounter{blx@sectionciteorder@\the\c@refsection}% + \blx@providecount{blx@sectionciteorder@\the\c@refsection}% + \global\advance\csname blx@sectionciteorder@\the\c@refsection\endcsname\@ne \blx@nocitation{#1}\blx@msg@cundef} % {<macro>}[<arg1>][<arg2>]{<arg3>} @@ -13093,9 +13237,9 @@ \xdef\blx@xml@uniquenametemplatenamepart#1#2#3{% ~~~~<bcf:namepart #1#2>#3</bcf:namepart>\blx@nl} -\xdef\blx@xml@sortingnamekeytemplate#1#2{% - ~~<bcf:sortingnamekeytemplate name="#1">\blx@nl% - #2% +\xdef\blx@xml@sortingnamekeytemplate#1#2#3{% + ~~<bcf:sortingnamekeytemplate name="#1" visibility="#2">\blx@nl% + #3% ~~</bcf:sortingnamekeytemplate>\blx@nl} \xdef\blx@xml@sortingnamekeykeypart#1#2{% @@ -13166,8 +13310,8 @@ ~~</bcf:bibdata>\blx@nl} \xdef\blx@xml@datasource#1#2#3#4#5{% ~~~~<bcf:datasource type="#1" datatype="#2"#3#4>#5</bcf:datasource>\blx@nl} -\xdef\blx@xml@citekey#1#2#3{% - ~~~~<bcf:citekey order="#3"#2>#1</bcf:citekey>} +\xdef\blx@xml@citekey#1#2#3#4{% + ~~~~<bcf:citekey order="#3" intorder="#4"#2>#1</bcf:citekey>} \xdef\blx@xml@citeset#1#2{% ~~~~<bcf:citekey type="set" members="#2">#1</bcf:citekey>} \xdef\blx@xml@citekeycount#1#2{% @@ -13222,6 +13366,7 @@ \blx@xml@toggle{nohashothers}% \blx@xml@toggle{noroman}% \blx@xml@toggle{nosortothers}% + \blx@xml@toggle{pluralothers}% \blx@xml@toggle{singletitle}% \blx@xml@toggle{skipbib}% \blx@xml@toggle{skipbiblist}% @@ -13275,8 +13420,8 @@ \blx@xml@toggle{nosortothers}% \blx@xml@toggle{singletitle}% \blx@xml@toggle{skipbib}% - \blx@xml@toggle{skiplab}% \blx@xml@toggle{skipbiblist}% + \blx@xml@toggle{skiplab}% \blx@xml@svalue{uniquelist}{\blx@uniquelist}% \blx@xml@svalue{uniquename}{\blx@uniquename}% \blx@xml@toggle{uniqueprimaryauthor}% @@ -13476,7 +13621,7 @@ \eappto\blx@tempa{\blx@xml@comment{SORTING NAME KEY TEMPLATES}}% \def\do##1{% \eappto\blx@tempa{% - \blx@xml@sortingnamekeytemplate{##1}{\csuse{blx@sortingnamekeytemplate@##1}}}}% + \blx@xml@sortingnamekeytemplate{##1}{\csuse{blx@sortingnamekeytemplatesvisibility@##1}}{\csuse{blx@sortingnamekeytemplate@##1}}}}% \dolistloop\blx@sortingnamekeytemplates % presort/sorting excludes/sorting includes \def\do##1{% @@ -14159,7 +14304,7 @@ Use '\string\DeclareBiblistFilter' to define it}} {\def\blx@thebiblistfilter{#1}}} -% [<langids>][<entrytype>]{translitsource}{translittarget} +% [<entrytype>]{specification} \newrobustcmd*{\DeclareSortTranslit}[2][]{% \begingroup \ifblank{#1} @@ -14176,6 +14321,7 @@ \@onlypreamble\DeclareSortTranslit \blx@DeclareBackendOption{global,type}[xml]{translit} +% [<langids>]{<field or set>}{translitsource}{translittarget} \newcommand*{\blx@translit@setup}[4][]{% \eappto\blx@tempb{% \ifblank{#1} @@ -14234,6 +14380,8 @@ \let\namepart\blx@sortnk@namepart \let\keypart\blx@sortnk@keypart \let\literal\blx@sortnk@literal + \let\visibility\blx@sortnk@visibility + \csgdef{blx@sortingnamekeytemplatesvisibility@\blx@snkname}{sort}% default \let\blx@tempa\@empty \blx@tempcnta\z@ #2% @@ -14271,6 +14419,9 @@ \eappto\blx@tempb{% \blx@xml@sortingnamekeyliteral{\blx@tempe}{#1}}} +\newcommand*{\blx@sortnk@visibility}[1]{% + \csgdef{blx@sortingnamekeytemplatesvisibility@\blx@snkname}{#1}} + \newcommand*{\blx@sortnk@namepart}[2][]{% \advance\blx@tempcntb\@ne \edef\blx@tempe{ order="\the\blx@tempcntb"}% @@ -14313,6 +14464,8 @@ \def\citeorder{% \global\cslet{blx@sortingtemplate@citeorder@relevant@#2}\@empty \blx@sortdef@field{citeorder}}% + \def\intciteorder{% + \blx@sortdef@field{intciteorder}}% \def\citecount{% \blx@sortdef@field{citecount}}% \blx@tempcnta\z@ @@ -15561,6 +15714,9 @@ \def\blx@opt@uniquelist@true{true} \def\blx@opt@uniquelist@minyear{minyear} +\DeclareBiblatexOption{global}[boolean]{pluralothers}[true]{% + \settoggle{blx@pluralothers}{#1}} + \blx@DeclareBackendOption{entry,namelist}[string]{uniquelist} \DeclareBiblatexOption{global,type}[boolean]{nohashothers}[true]{% @@ -15841,7 +15997,7 @@ % Set defaults \blx@kv@setkeys{blx@opt@ldt}{style=numeric} \blx@kv@setkeys{blx@opt@pre}{% - sorting=nty,sortlocale=auto,sortcase,sortupper,sortcites=false, + sorting=nty,sortlocale=auto,sortcase,sortupper,sortcites=false,pluralothers=false, maxnames=3,minnames=1,maxalphanames=3,minalphanames=1, maxitems=3,minitems=1,mincrossrefs=2,minxrefs=2, useauthor=true,useeditor=true,usetranslator=false, @@ -16071,6 +16227,7 @@ \fi \blx@bblinput \setcounter{blx@maxsection}{0}% + \csuse{blx@hook@refsectioninit}% \csuse{abx@preamble}% \blx@inf@refsec \blx@inf@refseg} diff --git a/macros/latex/contrib/biblatex/latex/blx-bibtex.def b/macros/latex/contrib/biblatex/latex/blx-bibtex.def index 9590e748a5..7e84884ac7 100644 --- a/macros/latex/contrib/biblatex/latex/blx-bibtex.def +++ b/macros/latex/contrib/biblatex/latex/blx-bibtex.def @@ -737,6 +737,11 @@ } \def\blx@ctrlwrite{% + \ifcsundef{blx@sorting@\blx@sorting} + {\blx@warning@noline{Sorting template '\blx@sorting'\MessageBreak + not available with BibTeX backend.\MessageBreak + Switch to Biber or select one of the default templates}} + {}% \begingroup \blx@safe@actives \let\protect\string diff --git a/macros/latex/contrib/biblatex/latex/lbx/danish.lbx b/macros/latex/contrib/biblatex/latex/lbx/danish.lbx index d1dafe601f..7733f4e601 100644 --- a/macros/latex/contrib/biblatex/latex/lbx/danish.lbx +++ b/macros/latex/contrib/biblatex/latex/lbx/danish.lbx @@ -75,45 +75,45 @@ \DeclareBibliographyStrings{% bibliography = {{Bibliografi}{Bibliografi}}, - references = {{Litteraturhenvisninger}{Litteratur}}, + references = {{Litteratur}{Litteratur}}, shorthands = {{Forkortelser}{Forkortelser}}, - editor = {{redakt\o r}{red\adddot}}, - editors = {{redakt\o rer}{red\adddot}}, + editor = {{redakt{\o}r}{red\adddot}}, + editors = {{redakt{\o}rer}{red\adddot}}, compiler = {{kompilator}{kompilator}}, compilers = {{kompilatorer}{kompilatorer}}, - redactor = {{medredakt\o r}{medred\adddot}}, - redactors = {{medredakt\o rer}{medred\adddot}}, - reviser = {{revision}{rev\adddot}}, - revisers = {{revision}{rev\adddot}}, + redactor = {{medredakt{\o}r}{medred\adddot}}, + redactors = {{medredakt{\o}rer}{medred\adddot}}, + reviser = {{korrekturl{\ae}ser}{korrek\adddot}}, + revisers = {{korrekturl{\ae}sere}{korrek\adddot}}, founder = {{stifter}{stifter}}, founders = {{stiftere}{stiftere}}, - continuator = {{videref\o rer}{videref\adddot}}, - continuators = {{videref\o rere}{videref\adddot}}, - collaborator = {{medarbejder}{medarb\adddot}}, - collaborators = {{medarbejdere}{medarb\adddot}}, - translator = {{overs\ae tter}{overs\adddot}}, - translators = {{overs\ae ttere}{overs\adddot}}, - commentator = {{kommentator}{komm\adddot}}, - commentators = {{kommentatorer}{komm\adddot}}, - annotator = {{kommentator}{komm\adddot}}, - annotators = {{kommentatorer}{komm\adddot}}, - commentary = {{kommentar}{komm\adddot}}, - annotations = {{annoteringer}{ann\adddot}}, + continuator = {{videref{\o}rer}{videref\adddot}}, + continuators = {{videref{\o}rere}{videref\adddot}}, + collaborator = {{samarbejdspartner}{samarb\adddot}}, + collaborators = {{samarbejdspartnere}{samarb\adddot}}, + translator = {{overs{\ae}tter}{overs\adddot}}, + translators = {{overs{\ae}ttere}{overs\adddot}}, + commentator = {{kommentator}{komment\adddot}}, + commentators = {{kommentatorer}{komment\adddot}}, + annotator = {{kommentator}{komment\adddot}}, + annotators = {{kommentatorer}{komment\adddot}}, + commentary = {{kommentering}{komment\adddot}}, + annotations = {{annotering}{annot\adddot}}, introduction = {{indledning}{indl\adddot}}, - foreword = {{forord}{forord}}, - afterword = {{efterord}{efterord}}, - editortr = {{redakt\o r og overs\ae tter}% + foreword = {{forord}{forord}},%or prolog + afterword = {{epilog}{epilog}},%or efterskrift + editortr = {{redakt{\o}r og overs{\ae}tter}% {red\adddotspace og overs\adddot}}, - editorstr = {{redakt\o rer og overs\ae ttere}% + editorstr = {{redakt{\o}rer og overs{\ae}ttere}% {red\adddotspace og overs\adddot}}, - editorco = {{redakt\o r og kommentator} - {red\adddotspace og komm\adddot}}, - editorsco = {{redakt\o rer og kommentatorer} - {red\adddotspace og komm\adddot}}, - editoran = {{redakt\o r og kommentator}% - {red\adddotspace og komm\adddot}}, - editorsan = {{redakt\o rer og kommentatorer}% - {red\adddotspace og komm\adddot}}, + editorco = {{redakt{\o}r og kommentator} + {red\adddotspace og komment\adddot}}, + editorsco = {{redakt{\o}rer og kommentatorer} + {red\adddotspace og komment\adddot}}, + editoran = {{redakt{\o}r og kommentator}% + {red\adddotspace og komment\adddot}}, + editorsan = {{redakt{\o}rer og kommentatorer}% + {red\adddotspace og komment\adddot}}, editorin = {{redaktion og indledning}% {red\adddotspace og indl\adddot}}, editorsin = {{redaktion og indledning}% @@ -122,122 +122,122 @@ {red\adddotspace og forord}}, editorsfo = {{redaktion og forord}% {red\adddotspace og forord}}, - editoraf = {{redaktion og efterord}% - {red\adddotspace og efterord}}, - editorsaf = {{redaktion og efterord}% - {red\adddotspace og efterord}}, - editortrco = {{redakt\o r, overs\ae tter og kommentator}% - {red.,\addabbrvspace overs\adddotspace og komm\adddot}}, - editorstrco = {{redakt\o rer, overs\ae ttere og kommentatorer}% - {red.,\addabbrvspace overs\adddotspace og komm\adddot}}, - editortran = {{redakt\o r, overs\ae tter og kommentator}% - {red.,\addabbrvspace overs\adddotspace og komm\adddot}}, - editorstran = {{redakt\o rer, overs\ae ttere og kommentatorer}% - {red.,\addabbrvspace overs\adddotspace og komm\adddot}}, - editortrin = {{redaktion, overs\ae ttelse og indledning}% - {red.,\addabbrvspace overs\adddotspace og indl\adddot}}, - editorstrin = {{redaktion, overs\ae ttelse og indledning}% - {red.,\addabbrvspace overs\adddotspace og indl\adddot}}, - editortrfo = {{redaktion, overs\ae ttelse og forord}% - {red.,\addabbrvspace overs\adddotspace og forord}}, - editorstrfo = {{redaktion, overs\ae ttelse og forord}% - {red.,\addabbrvspace overs\adddotspace og forord}}, - editortraf = {{redaktion, overs\ae ttelse og efterord}% - {red.,\addabbrvspace overs\adddotspace og efterord}}, - editorstraf = {{redaktion, overs\ae ttelse og efterord}% - {red.,\addabbrvspace overs\adddotspace og efterord}}, + editoraf = {{redaktion og epilog}% + {red\adddotspace og epilog}}, + editorsaf = {{redaktion og epilog}% + {red\adddotspace og epilog}}, + editortrco = {{redakt{\o}r, overs{\ae}tter og kommentator}% + {red\adddot,\addabbrvspace overs\adddotspace og komment\adddot}}, + editorstrco = {{redakt{\o}rer, overs{\ae}ttere og kommentatorer}% + {red\adddot,\addabbrvspace overs\adddotspace og komment\adddot}}, + editortran = {{redakt{\o}r, overs{\ae}tter og kommentator}% + {red\adddot,\addabbrvspace overs\adddotspace og komment\adddot}}, + editorstran = {{redakt{\o}rer, overs{\ae}ttere og kommentatorer}% + {red\adddot,\addabbrvspace overs\adddotspace og komment\adddot}}, + editortrin = {{redaktion, overs{\ae}ttelse og indledning}% + {red\adddot,\addabbrvspace overs\adddotspace og indl\adddot}}, + editorstrin = {{redaktion, overs{\ae}ttelse og indledning}% + {red\addot,\addabbrvspace overs\adddotspace og indl\adddot}}, + editortrfo = {{redaktion, overs{\ae}ttelse og forord}% + {red\adddot,\addabbrvspace overs\adddotspace og forord}}, + editorstrfo = {{redaktion, overs{\ae}ttelse og forord}% + {red\adddot,\addabbrvspace overs\adddotspace og forord}}, + editortraf = {{redaktion, overs{\ae}ttelse og epilog}% + {red\adddot,\addabbrvspace overs\adddotspace og epilog}}, + editorstraf = {{redaktion, overs{\ae}ttelse og epilog}% + {red\adddot,\addabbrvspace overs\adddotspace og epilog}}, editorcoin = {{redaktion, kommentarer og indledning}% - {red.,\addabbrvspace komm\adddotspace og indl\adddot}}, + {red\adddot,\addabbrvspace komment\adddotspace og indl\adddot}}, editorscoin = {{redaktion, kommentarer og indledning}% - {red.,\addabbrvspace komm\adddotspace og indl\adddot}}, + {red\adddot,\addabbrvspace komment\adddotspace og indl\adddot}}, editorcofo = {{redaktion, kommentarer og forord}% - {red.,\addabbrvspace komm\adddotspace og forord}}, + {red\adddot,\addabbrvspace komment\adddotspace og forord}}, editorscofo = {{redaktion, kommentarer og forord}% - {red.,\addabbrvspace komm\adddotspace og forord}}, - editorcoaf = {{redaktion, kommentarer og efterord}% - {red.,\addabbrvspace komm\adddotspace og efterord}}, - editorscoaf = {{redaktion, kommentarer og efterord}% - {red.,\addabbrvspace komm\adddotspace og efterord}}, - editoranin = {{redaktion, annoteringer og indledning}% - {red.,\addabbrvspace ann\adddotspace og indl\adddot}}, - editorsanin = {{redaktion, \adddotspace og indledning}% - {red.,\addabbrvspace ann\adddotspace og indl\adddot}}, - editoranfo = {{redaktion, \adddotspace og forord}% - {red.,\addabbrvspace ann\adddotspace og forord}}, - editorsanfo = {{redaktion, annoteringer og forord}% - {red.,\addabbrvspace ann\adddotspace og forord}}, - editoranaf = {{redaktion, annoteringer og efterord}% - {red.,\addabbrvspace ann\adddotspace og efterord}}, - editorsanaf = {{redaktion, annoteringer og efterord}% - {red.,\addabbrvspace ann\adddotspace og efterord}}, - editortrcoin = {{redaktion, overs\ae ttelse, kommentarer og indledning}% - {red.,\addabbrvspace overs., komm\adddotspace og indl\adddot}}, - editorstrcoin = {{redaktion, overs\ae ttelse, kommentarer og indledning}% - {red.,\addabbrvspace overs., komm\adddotspace og indl\adddot}}, - editortrcofo = {{redaktion, overs\ae ttelse, kommentarer og forord}% - {red.,\addabbrvspace overs., komm\adddotspace og forord}}, - editorstrcofo = {{redaktion, overs\ae ttelse, kommentarer og forord}% - {red.,\addabbrvspace overs., komm\adddotspace og forord}}, - editortrcoaf = {{redaktion, overs\ae ttelse, kommentarer og efterord}% - {red.,\addabbrvspace overs., komm\adddotspace og efterord}}, - editorstrcoaf = {{redaktion, overs\ae ttelse, kommentarer og efterord}% - {red.,\addabbrvspace overs., komm\adddotspace og efterord}}, - editortranin = {{redaktion, overs\ae ttelse, annoteringer og indledning}% - {red.,\addabbrvspace overs., ann\adddotspace og indl\adddot}}, - editorstranin = {{redaktion, overs\ae ttelse, annoteringer og indledning}% - {red.,\addabbrvspace overs., ann\adddotspace og indl\adddot}}, - editortranfo = {{redaktion, overs\ae ttelse, annoteringer og forord}% - {red.,\addabbrvspace overs., ann\adddotspace og forord}}, - editorstranfo = {{redaktion, overs\ae ttelse, annoteringer og forord}% - {red.,\addabbrvspace overs., ann\adddotspace og forord}}, - editortranaf = {{redaktion, overs\ae ttelse, annoteringer og efterord}% - {red.,\addabbrvspace overs., ann\adddotspace og efterord}}, - editorstranaf = {{redaktion, overs\ae ttelse, annoteringer og efterord}% - {red.,\addabbrvspace overs., ann\adddotspace og efterord}}, - translatorco = {{overs\ae ttelse og kommentarer}% - {overs\adddotspace og komm\adddot}}, - translatorsco = {{overs\ae ttelse og kommentarer}% - {overs\adddotspace og komm\adddot}}, - translatoran = {{overs\ae ttelse og annoteringer}% - {overs\adddotspace og ann\adddot}}, - translatorsan = {{overs\ae ttelse og annoteringer}% - {overs\adddotspace og ann\adddot}}, - translatorin = {{overs\ae ttelse og indledning}% + {red\adddot,\addabbrvspace komment\adddotspace og forord}}, + editorcoaf = {{redaktion, kommentarer og epilog}% + {red\adddot,\addabbrvspace komment\adddotspace og epilog}}, + editorscoaf = {{redaktion, kommentarer og epilog}% + {red\adddot,\addabbrvspace komment\adddotspace og epilog}}, + editoranin = {{redaktion, annotering og indledning}% + {red\adddot,\addabbrvspace annot\adddotspace og indl\adddot}}, + editorsanin = {{redaktion, annotering og indledning}% + {red\adddot,\addabbrvspace annot\adddotspace og indl\adddot}}, + editoranfo = {{redaktion, annotering og forord}% + {red\adddot,\addabbrvspace annot\adddotspace og forord}}, + editorsanfo = {{redaktion, annotering og forord}% + {red\adddot,\addabbrvspace annot\adddotspace og forord}}, + editoranaf = {{redaktion, annotering og epilog}% + {red\adddot,\addabbrvspace annot\adddotspace og epilog}}, + editorsanaf = {{redaktion, annotering og epilog}% + {red\adddot,\addabbrvspace annot\adddotspace og epilog}}, + editortrcoin = {{redaktion, overs{\ae}ttelse, kommentarer og indledning}% + {red\adddot,\addabbrvspace overs\adddot, komment\adddotspace og indl\adddot}}, + editorstrcoin = {{redaktion, overs{\ae}ttelse, kommentarer og indledning}% + {red\adddot,\addabbrvspace overs\adddot, komment\adddotspace og indl\adddot}}, + editortrcofo = {{redaktion, overs{\ae}ttelse, kommentarer og forord}% + {red\adddot,\addabbrvspace overs\adddot, komment\adddotspace og forord}}, + editorstrcofo = {{redaktion, overs{\ae}ttelse, kommentarer og forord}% + {red\adddot,\addabbrvspace overs\adddot, komment\adddotspace og forord}}, + editortrcoaf = {{redaktion, overs{\ae}ttelse, kommentarer og epilog}% + {red\adddot,\addabbrvspace overs\adddot, komment\adddotspace og epilog}}, + editorstrcoaf = {{redaktion, overs{\ae}ttelse, kommentarer og epilog}% + {red\adddot,\addabbrvspace overs\adddot, komment\adddotspace og epilog}}, + editortranin = {{redaktion, overs{\ae}ttelse, annotering og indledning}% + {red\adddot,\addabbrvspace overs\adddot, annot\adddotspace og indl\adddot}}, + editorstranin = {{redaktion, overs{\ae}ttelse, annotering og indledning}% + {red\adddot,\addabbrvspace overs\adddot, annot\adddotspace og indl\adddot}}, + editortranfo = {{redaktion, overs{\ae}ttelse, annotering og forord}% + {red\adddot,\addabbrvspace overs\adddot, annot\adddotspace og forord}}, + editorstranfo = {{redaktion, overs{\ae}ttelse, annotering og forord}% + {red\adddot,\addabbrvspace overs\adddot, annot\adddotspace og forord}}, + editortranaf = {{redaktion, overs{\ae}ttelse, annotering og epilog}% + {red\adddot,\addabbrvspace overs\adddot, annot\adddotspace og epilog}}, + editorstranaf = {{redaktion, overs{\ae}ttelse, annotering og epilog}% + {red\adddot,\addabbrvspace overs\adddot, annot\adddotspace og epilog}}, + translatorco = {{overs{\ae}ttelse og kommentarer}% + {overs\adddotspace og komment\adddot}}, + translatorsco = {{overs{\ae}ttelse og kommentarer}% + {overs\adddotspace og komment\adddot}}, + translatoran = {{overs{\ae}ttelse og annotering}% + {overs\adddotspace og annot\adddot}}, + translatorsan = {{overs{\ae}ttelse og annotering}% + {overs\adddotspace og annot\adddot}}, + translatorin = {{overs{\ae}ttelse og indledning}% {overs\adddotspace og indl\adddot}}, - translatorsin = {{overs\ae ttelse og indledning}% + translatorsin = {{overs{\ae}ttelse og indledning}% {overs\adddotspace og indl\adddot}}, - translatorfo = {{overs\ae ttelse og forord}% + translatorfo = {{overs{\ae}ttelse og forord}% {overs\adddotspace og forord}}, - translatorsfo = {{overs\ae ttelse og forord}% + translatorsfo = {{overs{\ae}ttelse og forord}% {overs\adddotspace og forord}}, - translatoraf = {{overs\ae ttelse og efterord}% - {overs\adddotspace og efterord}}, - translatorsaf = {{overs\ae ttelse og efterord}% - {overs\adddotspace og efterord}}, - translatorcoin = {{overs\ae ttelse, kommentarer og indledning}% - {overs., komm\adddotspace og indl\adddot}}, - translatorscoin = {{overs\ae ttelse, kommentarer og indledning}% - {overs., komm\adddotspace og indl\adddot}}, - translatorcofo = {{overs\ae ttelse, kommentarer og forord}% - {overs., komm\adddotspace og forord}}, - translatorscofo = {{overs\ae ttelse, kommentarer og forord}% - {overs., komm\adddotspace og forord}}, - translatorcoaf = {{overs\ae ttelse, kommentarer og efterord}% - {overs., komm\adddotspace og efterord}}, - translatorscoaf = {{overs\ae ttelse, kommentarer og efterord}% - {overs., komm\adddotspace og efterord}}, - translatoranin = {{overs\ae ttelse, annoteringer og indledning}% - {overs., ann\adddotspace og indl\adddot}}, - translatorsanin = {{overs\ae ttelse, annoteringer og indledning}% - {overs., ann\adddotspace og indl\adddot}}, - translatoranfo = {{overs\ae ttelse, annoteringer og forord}% - {overs., ann\adddotspace og forord}}, - translatorsanfo = {{overs\ae ttelse, annoteringer og forord}% - {overs., ann\adddotspace og forord}}, - translatoranaf = {{overs\ae ttelse, annoteringer og efterord}% - {overs., ann\adddotspace og efterord}}, - translatorsanaf = {{overs\ae ttelse, annoteringer og efterord}% - {overs., ann\adddotspace og efterord}}, + translatoraf = {{overs{\ae}ttelse og epilog}% + {overs\adddotspace og epilog}}, + translatorsaf = {{overs{\ae}ttelse og epilog}% + {overs\adddotspace og epilog}}, + translatorcoin = {{overs{\ae}ttelse, kommentarer og indledning}% + {overs\adddot, komment\adddotspace og indl\adddot}}, + translatorscoin = {{overs{\ae}ttelse, kommentarer og indledning}% + {overs\adddot, komment\adddotspace og indl\adddot}}, + translatorcofo = {{overs{\ae}ttelse, kommentarer og forord}% + {overs\adddot, komment\adddotspace og forord}}, + translatorscofo = {{overs{\ae}ttelse, kommentarer og forord}% + {overs\adddot, komment\adddotspace og forord}}, + translatorcoaf = {{overs{\ae}ttelse, kommentarer og epilog}% + {overs\adddot, komment\adddotspace og epilog}}, + translatorscoaf = {{overs{\ae}ttelse, kommentarer og epilog}% + {overs\adddot, komment\adddotspace og epilog}}, + translatoranin = {{overs{\ae}ttelse, annotering og indledning}% + {overs\adddot, annot\adddotspace og indl\adddot}}, + translatorsanin = {{overs{\ae}ttelse, annotering og indledning}% + {overs\adddot, annot\adddotspace og indl\adddot}}, + translatoranfo = {{overs{\ae}ttelse, annotering og forord}% + {overs\adddot, annot\adddotspace og forord}}, + translatorsanfo = {{overs{\ae}ttelse, annotering og forord}% + {overs\adddot, annot\adddotspace og forord}}, + translatoranaf = {{overs{\ae}ttelse, annotering og epilog}% + {overs\adddot, annot\adddotspace og epilog}}, + translatorsanaf = {{overs{\ae}ttelse, annotering og epilog}% + {overs\adddot, annot\adddotspace og epilog}}, organizer = {{organisator}{org\adddot}}, organizers = {{organisatorer}{org\adddot}}, byorganizer = {{organiseret af}{org\adddotspace av}}, @@ -252,118 +252,118 @@ bycollaborator = {{i samarbejde med}{i samarb\adddotspace m\adddot}}, bytranslator = {{oversat \lbx@lfromlang\ af}% {overs\adddot\ \lbx@sfromlang\ af}}, - bycommentator = {{kommenteret af}{komm\adddot\ af}}, - byannotator = {{annoteret af}{ann\adddot\ af}}, - withcommentator = {{med kommentarer af}{m\adddotspace komm\adddot\ af}}, - withannotator = {{med annoteringer af}{m\adddotspace ann\adddot\ af}}, + bycommentator = {{kommenteret af}{komment\adddot\ af}}, + byannotator = {{annoteret af}{annot\adddot\ af}}, + withcommentator = {{med kommentarer af}{m\adddotspace komment\adddot\ af}}, + withannotator = {{med annotering af}{m\adddotspace annot\adddot\ af}}, withintroduction = {{med indledning af}{m\adddotspace indl\adddot\ af}}, withforeword = {{med forord af}{m\adddotspace forord af}}, - withafterword = {{med efterord af}{m\adddotspace efterord af}}, + withafterword = {{med epilog af}{m\adddotspace epilog af}}, byeditortr = {{redigeret og oversat \lbx@lfromlang\ af}% {red\adddotspace og overs\adddot\ \lbx@sfromlang\ af}}, byeditorco = {{redigeret og kommenteret af}% - {red\adddotspace og komm\adddot\ af}}, - byeditoran = {{redigeret med annoteringer af}% - {red\adddotspace m\adddotspace ann\adddotspace af}}, + {red\adddotspace og komment\adddot\ af}}, + byeditoran = {{redigeret med annotering af}% + {red\adddotspace m\adddotspace annot\adddotspace af}}, byeditorin = {{redigeret med indledning af}% {red\adddotspace med indl\adddot\ af}}, byeditorfo = {{redigeret med forord af}% {red\adddotspace med forord af}}, - byeditoraf = {{redigeret med efterord af}% - {red\adddotspace med efterord af}}, + byeditoraf = {{redigeret med epilog af}% + {red\adddotspace med epilog af}}, byeditortrco = {{redigeret, oversat \lbx@lfromlang\ og kommenteret af}% - {red.,\addabbrvspace overs\adddot\ \lbx@sfromlang\ og komm\adddot\ af}}, + {red\adddot,\addabbrvspace overs\adddot\ \lbx@sfromlang\ og komment\adddot\ af}}, byeditortran = {{redigeret, oversat \lbx@lfromlang\ og annoteret af}% - {red.,\addabbrvspace overs\adddot\ \lbx@sfromlang\ og ann\adddot\ af}}, + {red\adddot,\addabbrvspace overs\adddot\ \lbx@sfromlang\ og annot\adddot\ af}}, byeditortrin = {{redigeret, oversat \lbx@lfromlang\ og med indledning af}% - {red.,\addabbrvspace overs\adddot\ \lbx@sfromlang\ og indl\adddot\ af}}, + {red\adddot,\addabbrvspace overs\adddot\ \lbx@sfromlang\ og indl\adddot\ af}}, byeditortrfo = {{redigeret, oversat \lbx@lfromlang\ og med forord af}% - {red.,\addabbrvspace overs\adddot\ \lbx@sfromlang\ og forord af}}, - byeditortraf = {{redigeret, oversat \lbx@lfromlang\ og med efterord af}% - {red.,\addabbrvspace overs\adddot\ \lbx@sfromlang\ og efterord af}}, + {red\adddot,\addabbrvspace overs\adddot\ \lbx@sfromlang\ og forord af}}, + byeditortraf = {{redigeret, oversat \lbx@lfromlang\ og med epilog af}% + {red\adddot,\addabbrvspace overs\adddot\ \lbx@sfromlang\ og epilog af}}, byeditorcoin = {{redigeret, kommenteret og med indledning af}% - {red.,\addabbrvspace komm\adddot\ og indl\adddotspace af}}, + {red\adddot,\addabbrvspace komment\adddot\ og indl\adddotspace af}}, byeditorcofo = {{redigeret, kommenteret og med forord af}% - {red.,\addabbrvspace komm\adddot\ og forord af}}, - byeditorcoaf = {{redigeret, kommenteret og med efterord af}% - {red.,\addabbrvspace komm\adddot\ og efterord af}}, + {red\adddot,\addabbrvspace komment\adddot\ og forord af}}, + byeditorcoaf = {{redigeret, kommenteret og med epilog af}% + {red\adddot,\addabbrvspace komment\adddot\ og epilog af}}, byeditoranin = {{redigeret, annoteret og med indledning af}% - {red.,\addabbrvspace ann\adddot\ og indl\adddot\ af}}, + {red\adddot,\addabbrvspace annot\adddot\ og indl\adddot\ af}}, byeditoranfo = {{redigeret, annoteret og med forord af}% - {red.,\addabbrvspace ann\adddot\ og forord af}}, - byeditoranaf = {{redigeret, annoteret og med efterord af}% - {red.,\addabbrvspace ann\adddot\ og efterord af}}, + {red\adddot,\addabbrvspace annot\adddot\ og forord af}}, + byeditoranaf = {{redigeret, annoteret og med epilog af}% + {red\adddot,\addabbrvspace annot\adddot\ og epilog af}}, byeditortrcoin = {{redigeret, oversat \lbx@lfromlang, kommenteret og med indledning af}% - {red.,\addabbrvspace overs\adddot\ \lbx@sfromlang, komm\adddot\ og indl\adddot\ af}}, + {red\adddot,\addabbrvspace overs\adddot\ \lbx@sfromlang, komment\adddot\ og indl\adddot\ af}}, byeditortrcofo = {{redigeret, oversat \lbx@lfromlang, kommenteret og med forord af}% - {red.,\addabbrvspace overs\adddot\ \lbx@sfromlang, komm\adddot\ og forord af}}, - byeditortrcoaf = {{redigeret, oversat \lbx@lfromlang, kommenteret og med efterord af}% - {red.,\addabbrvspace overs\adddot\ \lbx@sfromlang, komm\adddot\ og efterord af}}, - byeditortranin = {{redigeret, oversat \lbx@lfromlang, med annoteringer og indledning af}% - {red.,\addabbrvspace overs\adddot\ \lbx@sfromlang, ann\adddot\ og indl\adddot\ af}}, - byeditortranfo = {{redigeret, oversat \lbx@lfromlang, med annoteringer og forord af}% - {red.,\addabbrvspace overs\adddot\ \lbx@sfromlang, ann\adddot\ og forord af}}, - byeditortranaf = {{redigeret, oversat \lbx@lfromlang, med annoteringer og efterord af}% - {red.,\addabbrvspace overs\adddot\ \lbx@sfromlang, ann\adddot\ og efterord af}}, + {red\adddot,\addabbrvspace overs\adddot\ \lbx@sfromlang, komment\adddot\ og forord af}}, + byeditortrcoaf = {{redigeret, oversat \lbx@lfromlang, kommenteret og med epilog af}% + {red\adddot,\addabbrvspace overs\adddot\ \lbx@sfromlang, komment\adddot\ og epilog af}}, + byeditortranin = {{redigeret, oversat \lbx@lfromlang, med annotering og indledning af}% + {red\adddot,\addabbrvspace overs\adddot\ \lbx@sfromlang, annot\adddot\ og indl\adddot\ af}}, + byeditortranfo = {{redigeret, oversat \lbx@lfromlang, med annotering og forord af}% + {red\adddot,\addabbrvspace overs\adddot\ \lbx@sfromlang, annot\adddot\ og forord af}}, + byeditortranaf = {{redigeret, oversat \lbx@lfromlang, med annotering og epilog af}% + {red\adddot,\addabbrvspace overs\adddot\ \lbx@sfromlang, annot\adddot\ og epilog af}}, bytranslatorco = {{oversat \lbx@lfromlang\ med kommentarer af}% - {overs\adddot\ \lbx@sfromlang\ m\adddotspace komm\adddot\ af}}, + {overs\adddot\ \lbx@sfromlang\ m\adddotspace komment\adddot\ af}}, bytranslatoran = {{oversat \lbx@lfromlang\ og annoteret af}% - {overs\adddot\ \lbx@sfromlang\ og ann\adddot\ af}}, + {overs\adddot\ \lbx@sfromlang\ og annot\adddot\ af}}, bytranslatorin = {{oversat \lbx@lfromlang\ med indledning af}% {overs\adddot\ \lbx@sfromlang\ m\adddotspace indl\adddot\ af}}, bytranslatorfo = {{oversat \lbx@lfromlang\ med forord af}% {overs\adddot\ \lbx@sfromlang\ m\adddotspace forord af}}, - bytranslatoraf = {{oversat \lbx@lfromlang\ med efterord af}% - {overs\adddot\ \lbx@sfromlang\ m\adddotspace efterord af}}, + bytranslatoraf = {{oversat \lbx@lfromlang\ med epilog af}% + {overs\adddot\ \lbx@sfromlang\ m\adddotspace epilog af}}, bytranslatorcoin = {{oversat \lbx@lfromlang\addspace med kommentarer og indledning af}% - {overs\adddot\ \lbx@sfromlang\addspace m\adddotspace komm\adddotspace og indl\adddotspace af}}, + {overs\adddot\ \lbx@sfromlang\addspace m\adddotspace komment\adddotspace og indl\adddotspace af}}, bytranslatorcofo = {{oversat \lbx@lfromlang\addspace med kommentarer og forord af}% - {overs\adddot\ \lbx@sfromlang\addspace m\adddotspace komm\adddot\ og forord af}}, - bytranslatorcoaf = {{oversat \lbx@lfromlang\addspace med kommentarer og efterord af}% - {overs\adddot\ \lbx@sfromlang\addspace m\adddotspace komm\adddot\ og efterord af}}, - bytranslatoranin = {{oversat \lbx@lfromlang\addspace med annoteringer og indledning af}% - {overs\adddot\ \lbx@sfromlang\addspace m\adddotspace ann\adddot\ og indl\adddot\ af}}, - bytranslatoranfo = {{oversat \lbx@lfromlang\addspace med annoteringer og forord af}% - {overs\adddot\ \lbx@sfromlang\addspace m\adddotspace ann\adddot\ og forord af}}, - bytranslatoranaf = {{oversat \lbx@lfromlang\addspace med annoteringer og efterord af}% - {overs\adddot\ \lbx@sfromlang\addspace m\adddotspace ann\adddot\ og efterord af}}, + {overs\adddot\ \lbx@sfromlang\addspace m\adddotspace komment\adddot\ og forord af}}, + bytranslatorcoaf = {{oversat \lbx@lfromlang\addspace med kommentarer og epilog af}% + {overs\adddot\ \lbx@sfromlang\addspace m\adddotspace komment\adddot\ og epilog af}}, + bytranslatoranin = {{oversat \lbx@lfromlang\addspace med annotering og indledning af}% + {overs\adddot\ \lbx@sfromlang\addspace m\adddotspace annot\adddot\ og indl\adddot\ af}}, + bytranslatoranfo = {{oversat \lbx@lfromlang\addspace med annotering og forord af}% + {overs\adddot\ \lbx@sfromlang\addspace m\adddotspace annot\adddot\ og forord af}}, + bytranslatoranaf = {{oversat \lbx@lfromlang\addspace med annotering og epilog af}% + {overs\adddot\ \lbx@sfromlang\addspace m\adddotspace annot\adddot\ og epilog af}}, and = {{og}{og}}, - andothers = {{med flere}{m.fl\adddot}}, - andmore = {{med mere}{m.m\adddot}}, + andothers = {{med flere}{m\adddot fl\adddot}}, + andmore = {{med mere}{m\adddot m\adddot}}, volume = {{bind}{bd\adddot}}, volumes = {{bind}{bd\adddot}}, involumes = {{i}{i}}, - jourvol = {{\aa rgang}{\aa rg\adddot}}, - jourser = {{r\ae kke}{rk\adddot}}, + jourvol = {{{\aa}rgang}{{\aa}rg\adddot}}, + jourser = {{r{\ae}kke}{rk\adddot}}, book = {{bog}{bog}}, part = {{del}{del}}, issue = {{nummer}{nr\adddot}}, - newseries = {{ny r\ae kke}{ny rk\adddot}}, - oldseries = {{gammel r\ae kke}{gl. rk\adddot}}, + newseries = {{ny r{\ae}kke}{ny rk\adddot}}, + oldseries = {{gammel r{\ae}kke}{gl. rk\adddot}}, edition = {{udgave}{udg\adddot}}, reprint = {{genoptryk}{genoptr\adddot}}, reprintof = {{genoptryk af}{genoptr\adddot\ af}}, - reprintas = {{genoptryk under titlen}{genoptr\adddot\ under titlen}}, - reprintfrom = {{genoptryk fra}{genoptr\adddot\ fra}}, - translationof = {{overs\ae ttelse af}{overs\adddot\ af}}, - translationas = {{oversat under titlen}{overs\adddotspace\ under titlen}}, - translationfrom = {{oversat fra}{overs\adddotspace\ fra}}, + reprintas = {{genoptryk under titlen}{genoptr\adddotspace under titlen}}, + reprintfrom = {{genoptryk fra}{genoptr\adddotspace fra}}, + translationof = {{overs{\ae}ttelse af}{overs\adddot\ af}}, + translationas = {{oversat under titlen}{overs\adddotspace under titlen}}, + translationfrom = {{oversat fra}{overs\adddotspace fra}}, reviewof = {{bed\o mmelse af}{bed\adddotspace af}}, origpubas = {{oprindeligt udgivet som}{opr\adddot\ udg\adddot\ som}}, origpubin = {{oprindeligt udgivet i}{opr\adddot\ udg\adddot\ i}}, astitle = {{under titlen}{under titlen}}, bypublisher = {{af}{af}}, - nodate = {{uden \aa rstal}{u.\aa\adddot}}, + nodate = {{uden dato}{u\adddot d\adddot}},%CORRECT: uden dato, NOT: uden år. page = {{side}{s\adddot}}, - pages = {{sider}{s\adddot}}, + pages = {{side}{s\adddot}},%not pluralized in Danish. In the context: side 1–16. NOT: sider 1–16. column = {{spalte}{sp\adddot}}, - columns = {{spalter}{sp\adddot}}, + columns = {{spalte}{sp\adddot}}, line = {{linje}{l\adddot}}, - lines = {{linjer}{l\adddot}}, + lines = {{linje}{l\adddot}}, verse = {{vers}{v\adddot}}, verses = {{vers}{v\adddot}}, section = {{paragraf}{par\adddot}}, - sections = {{paragraffer}{par\adddot}}, + sections = {{paragraf}{par\adddot}}, paragraph = {{afsnit}{afsn\adddot}}, paragraphs = {{afsnit}{afsn\adddot}}, pagetotal = {{side}{s\adddot}}, @@ -371,44 +371,44 @@ columntotal = {{spalte}{sp\adddot}}, columntotals = {{spalter}{sp\adddot}}, line = {{linje}{l\adddot}}, - lines = {{linjer}{l\adddot}}, + lines = {{linje}{l\adddot}}, verse = {{vers}{v\adddot}}, verses = {{vers}{v\adddot}}, linetotal = {{linje}{l\adddot}}, - linetotals = {{linje}{l\adddot}}, + linetotals = {{linjer}{l\adddot}}, versetotal = {{vers}{v\adddot}}, versetotals = {{vers}{v\adddot}}, - sectiontotal = {{paragraf}{par\adddot}}, - sectiontotals = {{paragraffer}{par\adddot}}, + sectiontotal = {{sektion}{sekt\adddot}}, + sectiontotals = {{sektioner}{sekt\adddot}}, paragraphtotal = {{afsnit}{afsn\adddot}}, paragraphtotals = {{afsnit}{afsn\adddot}},% in = {{i}{i}}, - inseries = {{i r\ae kken}{i rk\adddot}}, - ofseries = {{fra r\ae kken}{fra rk\adddot}}, + inseries = {{i r{\ae}kken}{i rk\adddot}}, + ofseries = {{fra r{\ae}kken}{fra rk\adddot}}, number = {{nummer}{nr\adddot}}, -% numbers = {{numre}{nr\adddot}}, + % numbers = {{numre}{nr\adddot}},%It is unclear where it comes from and what it is for. undefined variable and thus gives an xkeyval error. chapter = {{kapitel}{kap\adddot}}, - bathesis = {{bachelorafhandling}{bachelorafh\adddot}}, - mathesis = {{masterafhandling}{masterafh\adddot}}, - phdthesis = {{PhD afhandling}{PhD afh\adddot}}, - candthesis = {{specialeafhandling}{specialeafh\adddot}}, + bathesis = {{Bachelorafhandling}{Bachelorafh\adddot}}, + mathesis = {{Masterafhandling}{Masterafh\adddot}}, + phdthesis = {{PhD-afhandling}{PhD-afh\adddot}}, + candthesis = {{Kandidatspeciale}{Kand\adddotspace spec\adddot}}, resreport = {{forskningsrapport}{forskningsrap\adddot}}, - techreport = {{teknisk rapport}{tekn\adddot\ rap\adddot}}, + techreport = {{teknisk rapport}{tekn.\adddot\ rapp\adddot}}, software = {{software}{software}}, datacd = {{data-cd}{data-cd}}, audiocd = {{lyd-cd}{lyd-cd}}, version = {{version}{vers\adddot}}, url = {{webadresse}{webadr\adddot}}, - urlfrom = {{tilg\ae ngelig fra}{tilg\adddotspace fra}}, - urlseen = {{bes\o gt}{bes\adddot}}, + urlfrom = {{tilg{\ae}ngelig fra}{tilg\adddotspace fra}}, + urlseen = {{hentet}{hentet}},%retrieved date inpreparation = {{under udarbejdelse}{under udarb\adddot}}, submitted = {{indleveret}{indlev\adddot}}, forthcoming = {{under udgivelse}{under udgiv\adddot}}, inpress = {{i trykken}{i trykken}}, - prepublished = {{pr\ae publiceret}{pr\ae publ\adddot}}, + prepublished = {{pr{\ae}publiceret}{pr{\ae}publ\adddot}}, citedas = {{herefter citeret som}{herefter cit\adddot\ som}}, thiscite = {{her}{her}}, - seenote = {{se note}{se nt\adddot}}, + seenote = {{se note}{se note}}, quotedin = {{citeret efter}{cit\adddot\ efter}}, idem = {{den samme}{d\adddot s\adddot}}, idemsf = {{den samme}{d\adddot s\adddot}}, @@ -419,14 +419,14 @@ idempn = {{de samme}{d\adddot s\adddot}}, idempp = {{de samme}{d\adddot s\adddot}}, ibidem = {{ibidem}{ibid\adddot}}, - opcit = {{op.\adddotspace cit\adddot}{op.\adddotspace cit\adddot}}, - loccit = {{loc.\adddotspace cit\adddot}{loc.\adddotspace cit\adddot}}, - confer = {{j\ae vnf\o r}{jvf\adddot}}, + opcit = {{op\adddotspace cit\adddot}{op\adddotspace cit\adddot}}, + loccit = {{loc\adddotspace cit\adddot}{loc\adddotspace cit\adddot}}, + confer = {{j{\ae}vnf{\o}r}{jf\adddot}}, sequens = {{f\adddot}{f\adddot}}, sequentes = {{ff\adddot}{ff\adddot}}, passim = {{passim}{pass\adddot}}, see = {{se}{s\adddot}}, - seealso = {{se ogs\aa}{se ogs\aa}}, + seealso = {{se ogs{\aa}}{se ogs{\aa}}}, backrefpage = {{se side}{se s\adddot}}, backrefpages = {{se siderne}{se s\adddot}}, january = {{januar}{jan\adddot}}, @@ -455,7 +455,7 @@ langfrench = {{fransk}{fransk}}, langgalician = {{galicisk}{galicisk}}, langgerman = {{tysk}{tysk}}, - langgreek = {{gr\ae sk}{gr\ae sk}}, + langgreek = {{gr{\ae}sk}{gr{\ae}sk}}, langhungarian = {{ungarsk}{ungarsk}}, langitalian = {{italiensk}{italiensk}}, langjapanese = {{japansk}{japansk}}, @@ -484,7 +484,7 @@ fromfrench = {{fra fransk}{fra fransk}}, fromgalician = {{fra galicisk}{fra galicisk}}, fromgerman = {{fra tysk}{fra tysk}}, - fromgreek = {{fra gr\ae sk}{fra gr\ae sk}}, + fromgreek = {{fra gr{\ae}sk}{fra gr{\ae}sk}}, fromhungarian = {{fra ungarsk}{fra ungarsk}}, fromitalian = {{fra italiensk}{fra italiensk}}, fromjapanese = {{fra japansk}{fra japansk}}, @@ -500,55 +500,55 @@ fromswedish = {{fra svensk}{fra svensk}}, fromukrainian = {{fra ukrainsk}{fra ukrainsk}}, countryde = {{Tyskland}{DE}}, - countryeu = {{Europ\ae iske Union}{EU}}, - countryep = {{Europ\ae iske Union}{EP}}, + countryeu = {{Europ{\ae}iske Union}{EU}}, + countryep = {{Europ{\ae}iske Union}{EP}},%must be wrong. Does this refer to European Parliament or European Patent? countryfr = {{Frankrig}{FR}}, countryuk = {{Storbritannien}{GB}}, countryus = {{USA}{US}}, patent = {{patent}{pat\adddot}}, - patentde = {{tysk patent}{tysk pat\adddot}}, - patenteu = {{europ\ae isk patent}{eur\adddot\ pat\adddot}}, - patentfr = {{fransk patent}{fransk pat\adddot}}, - patentuk = {{britisk patent}{brit\adddot\ pat\adddot}}, - patentus = {{amerikansk patent}{am\adddot\ pat\adddot}}, - patreq = {{patentans\o gning}{pat\adddot\ ans\o gn\adddot}}, - patreqde = {{tysk patentans\o gning}{tysk pat\adddot\ ans\o gn\adddot}}, - patreqeu = {{europ\ae isk patentans\o gning}{eur\adddot\ pat\adddot\ ans\o gn\adddot}}, - patreqfr = {{fransk patentans\o gning}{fransk pat\adddot\ ans\o gn\adddot}}, - patrequk = {{britisk patentans\o gning}{brit\adddot\ pat\adddot\ ans\o gn\adddot}}, - patrequs = {{amerikansk patentans\o gning}{am\adddot\ pat\adddot\ ans\o gn\adddot}}, + patentde = {{DE-patent}{DE-pat\adddot}}, + patenteu = {{EU-patent}{EU-pat\adddot}}, + patentfr = {{FR-patent}{FR-pat\adddot}}, + patentuk = {{UK-patent}{UK-pat\adddot}}, + patentus = {{US-patent}{US-pat\adddot}}, + patreq = {{patentans{\o}gning}{pat\adddot\ ans{\o}gn\adddot}}, + patreqde = {{tysk patentans{\o}gning}{tysk pat\adddot\ ans{\o}gn\adddot}}, + patreqeu = {{europ{\ae}isk patentans{\o}gning}{EU-pat\adddot\ ans{\o}gn\adddot}}, + patreqfr = {{fransk patentans{\o}gning}{fransk pat\adddot\ ans{\o}gn\adddot}}, + patrequk = {{britisk patentans{\o}gning}{brit\adddot\ pat\adddot\ ans{\o}gn\adddot}}, + patrequs = {{amerikansk patentans{\o}gning}{am\adddot\ pat\adddot\ ans{\o}gn\adddot}}, file = {{fil}{fil}}, library = {{bibliotek}{bibl\adddot}}, - abstract = {{resum\'{e}}{resum\'{e}}}, - annotation = {{kommentarer}{komm\adddot}}, + abstract = {{Abstract}{Abstract}},%akademically it is an abstract and not a "resumé". They are not the same thing. + annotation = {{kommentarer}{komment\adddot}}, commonera = {{efter vor tidsregning}{e\adddot v\adddot t\adddot}}, - beforecommonera = {{f\o r vor tidsregning}{f\adddot v\adddot t\adddot}}, - annodomini = {{efter Kristi f\o dsel}{e\adddot Kr\adddot}}, - beforechrist = {{f\o r Kristi f\o dsel}{f\adddot Kr\adddot}}, + beforecommonera = {{f{\o}r vor tidsregning}{f\adddot v\adddot t\adddot}}, + annodomini = {{efter Kristi f{\o}dsel}{e\adddot Kr\adddot}}, + beforechrist = {{f{\o}r Kristi f{\o}dsel}{f\adddot Kr\adddot}}, circa = {{cirka}{ca\adddot}}, - spring = {{for\aa r}{for\aa r}}, + spring = {{for{\aa}r}{for{\aa}r}}, summer = {{sommer}{sommer}}, - autumn = {{efter\aa r}{efter\aa r}}, + autumn = {{efter{\aa}r}{efter{\aa}r}}, winter = {{vinter}{vinter}}, -% springN = {{}{}},% FIXME: missing -% summerN = {{}{}},% FIXME: missing -% autumnN = {{}{}},% FIXME: missing -% winterN = {{}{}},% FIXME: missing -% springS = {{}{}},% FIXME: missing -% summerS = {{}{}},% FIXME: missing -% autumnS = {{}{}},% FIXME: missing -% winterS = {{}{}},% FIXME: missing -% Q1 = {{}{}},% FIXME: missing -% Q2 = {{}{}},% FIXME: missing -% Q3 = {{}{}},% FIXME: missing -% Q4 = {{}{}},% FIXME: missing -% QD1 = {{}{}},% FIXME: missing -% QD2 = {{}{}},% FIXME: missing -% QD3 = {{}{}},% FIXME: missing -% S1 = {{}{}},% FIXME: missing -% S2 = {{}{}},% FIXME: missing - am = {{formiddag}{form\adddot}}, - pm = {{eftermiddag}{efterm\adddot}}, + springN = {{for{\aa}r, nordlige halvkugle}{for{\aa}r, nordlige halvkugle}}, + summerN = {{sommer, nordlige halvkugle}{sommer, nordlige halvkugle}}, + autumnN = {{efter{\aa}r, nordlige halvkugle}{efter{\aa}r, nordlige halvkugle}}, + winterN = {{vinter, nordlige halvkugle}{vinter, nordlige halvkugle}}, + springS = {{for{\aa}r, sydlige halvkugle}{for{\aa}r, sydlige halvkugle}}, + summerS = {{sommer, sydlige halvkugle}{sommer, sydlige halvkugle}}, + autumnS = {{efter{\aa}r, sydlige halvkugle}{efter{\aa}r, sydlige halvkugle}}, + winterS = {{vinter, sydlige halvkugle}{vinter, sydlige halvkugle}}, + Q1 = {{1\adddot~kvartal}{Q1}}, + Q2 = {{2\adddot~kvartal}{Q2}}, + Q3 = {{3\adddot~kvartal}{Q3}}, + Q4 = {{4\adddot~kvartal}{Q4}}, + QD1 = {{1\adddot~kvarter}{Q1}},%reference to academic quadrimesters, in Danish: kvarter, akademisk kvarter. + QD2 = {{2\adddot~kvarter}{Q2}}, + QD3 = {{3\adddot~kvarter}{Q3}}, + S1 = {{1\adddot~halv{\aa}r}{H1}},%or 1.~semester + S2 = {{2\adddot~halv{\aa}r}{H2}},%or 2.~semester + am = {{formiddag}{formiddag}}, + pm = {{eftermiddag}{eftermiddag}}, } \endinput diff --git a/macros/latex/contrib/biblatex/latex/lbx/galician.lbx b/macros/latex/contrib/biblatex/latex/lbx/galician.lbx index 25eed96d07..dbd5a0071a 100644 --- a/macros/latex/contrib/biblatex/latex/lbx/galician.lbx +++ b/macros/latex/contrib/biblatex/latex/lbx/galician.lbx @@ -548,7 +548,6 @@ nodate = {{sen data}{s\adddot d\adddot}}, % QD3 = {{}{}},% FIXME: missing % S1 = {{}{}},% FIXME: missing % S2 = {{}{}},% FIXME: missing - am = {{AM}{AM}}, pm = {{PM}{PM}}, } diff --git a/macros/latex/contrib/biblatex/latex/lbx/spanish.lbx b/macros/latex/contrib/biblatex/latex/lbx/spanish.lbx index 38121886d6..cd055ec351 100644 --- a/macros/latex/contrib/biblatex/latex/lbx/spanish.lbx +++ b/macros/latex/contrib/biblatex/latex/lbx/spanish.lbx @@ -284,7 +284,7 @@ bytranslatoranaf = {{traducido \lbx@lfromlang, anotado y epilogado por}% {trad\adddotspace \lbx@sfromlang, anot\adddotspace y ep\'{\i}l\adddotspace por}}, and = {{y}{y}}, - andothers = {{y~col\adddot}{y~col\adddot}}, + andothers = {{et\addabbrvspace al\adddot}{et\addabbrvspace al\adddot}}, andmore = {{et\adddotspace al\adddot}{et\adddotspace al\adddot}}, volume = {{volumen}{vol\adddot}}, volumes = {{vol\'umenes}{vols\adddot}}, diff --git a/macros/latex/contrib/biblatex/latex/lbx/turkish.lbx b/macros/latex/contrib/biblatex/latex/lbx/turkish.lbx index 6e6711ff08..9d1b8db04d 100644 --- a/macros/latex/contrib/biblatex/latex/lbx/turkish.lbx +++ b/macros/latex/contrib/biblatex/latex/lbx/turkish.lbx @@ -453,6 +453,7 @@ november = {{Kas\i m}{Kas\adddot}}, december = {{Aral\i k}{Ara\adddot}}, langamerican = {{Amerikanca}{Amerikanca}}, + langbasque = {{Bask\c{c}a}{Bask\c{c}a}}, langbrazilian = {{Brezilyanca}{Brezilyanca}}, langbulgarian = {{Bulgarca}{Bulgarca}}, langcatalan = {{Katalanca}{Katalanca}}, @@ -473,17 +474,21 @@ langlatin = {{Latince}{Latince}}, langlatvian = {{Letonca}{Letonca}}, langlithuanian = {{Litvanca}{Litvanca}}, + langmarathi = {{Marathice}{Marathice}}, langnorwegian = {{Norve\c{c}\c{c}e}{Norve\c{c}\c{c}e}}, langpolish = {{Polonyaca}{Polonyaca}}, langportuguese = {{Portekizce}{Portekizce}}, + langromanian = {{Rumence}{Rumence}}, langrussian = {{Rus\c{c}a}{Rus\c{c}a}}, langserbian = {{S\i rp\c{c}a}{S\i rp\c{c}a}}, langslovak = {{Slovak\c{c}a}{Slovak\c{c}a}}, langslovene = {{Slovence}{Slovence}}, langspanish = {{\.{I}spanyolca}{\.{I}spanyolca}}, langswedish = {{\.{I}sve\c{c}\c{c}e}{\.{I}sve\c{c}\c{c}e}}, + langturkish = {{T\"{u}rk\c{c}e}{T\"{u}rk\c{c}e}}, langukrainian = {{Ukraynaca}{Ukraynaca}}, fromamerican = {{Amerikanca'dan}{Amerikanca'dan}}, + frombasque = {{Bask\c{c}a'dan}{Bask\c{c}a'dan}}, frombrazilian = {{Brezilyanca'dan}{Brezilyanca'dan}}, frombulgarian = {{Bulgarca'dan}{Bulgarca'dan}}, fromcatalan = {{Katalanca'dan}{Katalanca'dan}}, @@ -504,15 +509,18 @@ fromlatin = {{Latince'den}{Latince'den}}, fromlatvian = {{Latvianca'dan}{Latvianca'dan}}, fromlithuanian = {{Litvanca'dan}{Litvanca'dan}}, + frommarathi = {{Marathice'den}{Marathice'den}}, fromnorwegian = {{Norve\c{c}\c{c}e'den}{Norve\c{c}\c{c}e'den}}, frompolish = {{Polonyaca'dan}{Polonyaca'dan}}, fromportuguese = {{Portekizce'den}{Portekizce'den}}, + fromromanian = {{Rumence'den}{Rumence'den}}, fromrussian = {{Rus\c{c}a'dan}{Rus\c{c}a'dan}}, fromserbian = {{S\i rp\c{c}a'dan}{S\i rp\c{c}a'dan}}, fromslovak = {{Slovak\c{c}a'dan}{Slovak\c{c}a'dan}}, fromslovene = {{Slovence'den}{Slovence'den}}, fromspanish = {{\.{I}spanyolca'dan}{\.{I}spanyolca'dan}}, fromswedish = {{\.{I}sve\c{c}\c{c}e'den}{\.{I}sve\c{c}\c{c}e'den}}, + fromturkish = {{T\"{u}rk\c{c}e'den}{T\"{u}rk\c{c}e'den}}, fromukrainian = {{Ukraynaca'dan}{Ukraynaca'dan}}, countryde = {{Almanya}{DE}}, countryeu = {{Avrupa Birli\u{g}i}{AB}}, @@ -545,23 +553,23 @@ summer = {{Yaz}{Yaz}}, autumn = {{Sonbahar}{Sonbahar}}, winter = {{K\i \c{s}}{K\i \c{s}}}, -% springN = {{}{}},% FIXME: missing -% summerN = {{}{}},% FIXME: missing -% autumnN = {{}{}},% FIXME: missing -% winterN = {{}{}},% FIXME: missing -% springS = {{}{}},% FIXME: missing -% summerS = {{}{}},% FIXME: missing -% autumnS = {{}{}},% FIXME: missing -% winterS = {{}{}},% FIXME: missing -% Q1 = {{}{}},% FIXME: missing -% Q2 = {{}{}},% FIXME: missing -% Q3 = {{}{}},% FIXME: missing -% Q4 = {{}{}},% FIXME: missing -% QD1 = {{}{}},% FIXME: missing -% QD2 = {{}{}},% FIXME: missing -% QD3 = {{}{}},% FIXME: missing -% S1 = {{}{}},% FIXME: missing -% S2 = {{}{}},% FIXME: missing + springN = {{\.{I}lkbahar (Kuzey Yar\i mk\"{u}re)}{\.{I}lkbahar KY}}, + summerN = {{Yaz (Kuzey Yar\i mk\"{u}re)}{Yaz KY}}, + autumnN = {{Sonbahar (Kuzey Yar\i mk\"{u}re)}{Sonbahar KY}}, + winterN = {{K\i \c{s} (Kuzey Yar\i mk\"{u}re)}{K\i \c{s} KY}}, + springS = {{\.{I}lkbahar (G\"{u}ney Yar\i mk\"{u}re)}{\.{I}lkbahar GY}}, + summerS = {{Yaz (G\"{u}ney Yar\i mk\"{u}re)}{Yaz GY}}, + autumnS = {{Sonbahar (G\"{u}ney Yar\i mk\"{u}re)}{Sonbahar GY}}, + winterS = {{K\i \c{s} (G\"{u}ney Yar\i mk\"{u}re)}{K\i \c{s} GY}}, + Q1 = {{birinci \c{c}eyrek}{1\adddot \c{C}}}, + Q2 = {{ikinci \c{c}eyrek}{2\adddot \c{C}}}, + Q3 = {{\"{u}\c{c}\"{u}nc\"{u} \c{c}eyrek}{3\adddot \c{C}}}, + Q4 = {{d\"{o}rd\"{u}nc\"{u} \c{c}eyrek}{4\adddot \c{C}}}, + QD1 = {{birinci d\"{o}rt\"{u}k}{1\adddot D}}, + QD2 = {{ikinci d\"{o}rt\"{u}k}{2\adddot D}}, + QD3 = {{\"{u}\c{c}\"{u}nc\"{u} d\"{o}rt\"{u}k}{3\adddot D}}, + S1 = {{birinci yar\i y\i l}{1\adddot YY}}, + S2 = {{ikinci yar\i y\i l}{1\adddot YY}}, am = {{\"{o}\u{g}leden \"{o}nce}{\"{O}\"{O}}}, pm = {{\"{o}\u{g}leden sonra}{\"{O}S}}, } diff --git a/macros/latex/contrib/chess-problem-diagrams/README b/macros/latex/contrib/chess-problem-diagrams/README index 6e9503a16e..bc5dc2fecf 100644 --- a/macros/latex/contrib/chess-problem-diagrams/README +++ b/macros/latex/contrib/chess-problem-diagrams/README @@ -1,5 +1,5 @@ diagram --- A package for typesetting chessproblems -Version v1.15 / Stefan Hoening 1994-2019 +Version v1.21 / Stefan Hoening 1994-2022 CONTENTS @@ -17,7 +17,7 @@ Install the fonts package (bartel-chess-fonts) into your tex installation. Run TeX/LaTeX on diagram.ins to unpack the dtx. -Put the extracted 'diagram.sty' into tex/latex/diagram. +Put the extracted 'cpdparse.sty' and 'diagram.sty' into tex/latex/diagram. DOCUMENTATION diff --git a/macros/latex/contrib/chess-problem-diagrams/diagram.dtx b/macros/latex/contrib/chess-problem-diagrams/diagram.dtx index 249d14058b..883588b391 100644 --- a/macros/latex/contrib/chess-problem-diagrams/diagram.dtx +++ b/macros/latex/contrib/chess-problem-diagrams/diagram.dtx @@ -13,9 +13,9 @@ %% %% % \fi -% \def\fileversion{v1.15} -% \def\docdate{2019/12/28} -% \CheckSum{4545} +% \def\fileversion{v1.21} +% \def\docdate{2022/06/14} +% \CheckSum{4577} % \changes{v0.1}{15 Februar 2004}{First Version} % \changes{v0.2}{23 Februar 2004}{Added the documentation for the % {\itshape information collecting} macros which may be used @@ -76,6 +76,24 @@ % \changes{v1.14}{02 September 2019}{Fixed issue with stereo- and space-diagrams.} % \changes{v1.15}{28 December 2019}{Fixed frame issue with stereo- and space-diagrams.\\ % Added hook commands for begin/end diagram.} +% \changes{v1.16}{09 February 2020}{Fixed date display issue in +% figurine environment.\\ +% Added hook commands to figurine environment.\\ +% Fixed documentation bug: separation character in themes command is +% comma not semicolon.\\ +% command diagnumbering fixed: boolean is changed to true globally.} +% \changes{v1.17}{27 December 2020}{Added generation of cpdparse.sty +% containing generic command for parsing lists.} +% \changes{v1.18}{04 February 2021}{03f/0be:om: Typo: above@newlne\\ +% 03f/035:om: solnamestype has no effect} +% \changes{v1.19}{04 March 2021}{Minor fix in cl@arsol\\ +% Added (empty) command gerne.} +% \changes{v1.20}{13 June 2022}{Introduced two booleans to better +% control displaying diagram number globally and locally.\\ +% Removed the old boolean 'di@no'.} +% \changes{v1.21}{14 June 2022}{Impletemted issue: 03f/309:\\ +% handle empty arguments in information collecting commands\\ +% Fixed typo in @dia@fidealbum command.} % % \DoNotIndex{\@arabic,\def,\@idxitem,\@ifnextchar,\@ifstar, % \@ne,\@ptsize,\ ,\advance,\AtEndOfPackage,\begin,\begingroup, @@ -284,7 +302,9 @@ % \item \DescribeMacro{\specialdiagnum} % May be used to suppress the default diagram numbering (which % uses a counter) and instead directly providing a diagram -% "number" which may be an arbritary text. +% "number" which may be an arbritary text. This may also be used to +% suppress displaying a diagram number by providing an empty argument +% \verb+{}+. % \item \DescribeMacro{\sourcenr} % May be used to specify the number which was used for the % problem inside an originals section. @@ -343,11 +363,22 @@ % authors original comment.) % \item \DescribeMacro{\themes} % May be used to specify themes displayed in the problem. -% Different themes should be separated with ";~". When creating a +% Different themes should be separated with ",~". When creating a % theme index, the themes will automatically be used to create % the register. +% \item \DescribeMacro{\genre} +% May be used to specify genre of the problem. +% Different genres should be separated with ",~". +% The values are intended to using \LaTeX\-import within the PDB. % \end{itemize} % +% When providing an empty argument to commands \verb+\award+, +% \verb+\after+, \verb+\dedic+, \verb+\correction+ and \verb+\version+ +% only a warning is issued to the logfile. In previous +% versions of \verb+diagram.sty+ using empty arguments with the +% mentioned commands produced empty lines above the diagram. +% +% % There are some commands which not only collect information but % normally direct result in a change of the diagram. These are: % @@ -526,7 +557,7 @@ % need smaller or larger boards. This can be achieved by % specifying the rows and columns as an optional parameter to the % |\begin{diagram}| environment. You first have to specify the -% lines and then the rows as the following examples shows. +% columns and then the rows as the following examples shows. % % \bigskip % \begin{diagram}[17x11] @@ -644,13 +675,13 @@ % \DescribeMacro{\noframe} % \DescribeMacro{\noinnerframe} % To stylize a cylindric board one typically does not show parts -% of the frame. When using |\verticalcylinder| the horizontal +% of the frame. When using |\verticalcylinder|\, the horizontal % lines of the outer frame will not be drawn. -% |\horizontalcylinder| suppresses the drawing of the vertical -% lines of the outer frame. Using |\noframe| completely supresses -% the outer frame. |\noinnerframe| suppresses the innerframe. +% |\horizontalcylinder|\, suppresses the drawing of the vertical +% lines of the outer frame. Using |\noframe|\, completely supresses +% the outer frame. |\noinnerframe|\, suppresses the innerframe. % In case of stereo- or space-chess-diagrams |\verticalcylinder|, -% |\horizontalcylinder| and |\noframe| suppresses the inner +% |\horizontalcylinder|\, and |\noframe|\, suppresses the inner % frame. % % \subsection{Change the coloring of the fields} @@ -985,7 +1016,7 @@ % Specifies the preamble of our style file. % \begin{macrocode} %<*style> -\ProvidesPackage{diagram}[2019/12/28] +\ProvidesPackage{diagram}[2022/06/19] % \end{macrocode} % % \begin{macro}{\DefaultDiagramSize} @@ -1043,7 +1074,9 @@ \newif\ifspace@vertical \def\spacehorizontal{\space@verticalfalse} -\newif\ifdi@no +% \newif\ifdi@no +\newboolean{@cpd@numbering@global} +\newboolean{@cpd@numbering@local} \newcounter{board@nr} \renewcommand{\theboard@nr}{\thediag} % \newif\iffigcnt @@ -1278,6 +1311,7 @@ % \end{macro} % \end{macro} % +% % \begin{macro}{\diagram} % \begin{macro}{\@diagram} % Defines the code executed in |\begin{diagram}|. In case no @@ -1550,6 +1584,7 @@ \let\month=\ds@month% \let\year=\ds@year% \let\label=\ds@label% + \cpd@begindiagram@hook% } \def\endfigurine{% @@ -1578,6 +1613,7 @@ \fi% % \@show@figurine% + \cpd@enddiagram@hook% \endgroup% } % @@ -1727,10 +1763,15 @@ % % \begin{macrocode} \def\spacelayout#1{\csname space@#1\endcsname} -\def\nodiagnumbering{\global\di@nofalse} +\def\nodiagnumbering{% + % \global\di@nofalse + \setboolean{@cpd@numbering@global}{false} +} \newcommand*{\@dianumber@prefix}{} \def\diagnumbering#1{% - \di@notrue\diagnum{\@ne}% + \setboolean{@cpd@numbering@global}{true}% + % \global\di@notrue% + \diagnum{\@ne}% \gdef\thediag{\@dianumber@prefix\csname @#1\endcsname\c@board@nr}% } % \end{macrocode} @@ -1761,9 +1802,16 @@ % % \begin{macrocode} \def\specialdiagnum#1{% - \@specialtrue% - \number@tk={#1}\@numbertrue\def\thediag{#1}\def\@currentlabel{#1}% - \ignorespaces% + \ifthenelse{\equal{}{#1}}{% + % We disable displaying the diagram number + \setboolean{@cpd@numbering@local}{false}% + }{% + \setboolean{@cpd@numbering@local}{true}% + \@specialtrue% + \number@tk={#1}\@numbertrue% + \def\thediag{#1}\def\@currentlabel{#1}% + \ignorespaces% + } } % \end{macrocode} % @@ -1841,24 +1889,44 @@ \ignorespaces% } \def\award#1{% - \award@tk={#1}\@awardtrue% - \ignorespaces% + \ifthenelse{\equal{}{#1}}{% + \message{^^JWARNING: ignoring empty 'award' argument.^^J}% + }{% + \award@tk={#1}\@awardtrue% + \ignorespaces% + }% } \def\version#1{% - \version@tk={#1}\@versiontrue% - \ignorespaces% + \ifthenelse{\equal{}{#1}}{% + \message{^^JWARNING: ignoring empty 'version' argument.^^J}% + }{% + \version@tk={#1}\@versiontrue% + \ignorespaces% + }% } \def\after#1{% - \after@tk={#1}\@aftertrue% - \ignorespaces% + \ifthenelse{\equal{}{#1}}{% + \message{^^JWARNING: ignoring empty 'after' argument.^^J}% + }{% + \after@tk={#1}\@aftertrue% + \ignorespaces% + }% } \def\correction#1{% - \correction@tk={#1}\@correctiontrue% - \ignorespaces% + \ifthenelse{\equal{}{#1}}{% + \message{^^JWARNING: ignoring empty 'correction' argument.^^J}% + }{% + \correction@tk={#1}\@correctiontrue% + \ignorespaces% + }% } \def\dedication#1{% - \dedic@tk={#1}\@dedicationtrue% - \ignorespaces% + \ifthenelse{\equal{}{#1}}{% + \message{^^JWARNING: ignoring empty 'correction' argument.^^J}% + }{% + \dedic@tk={#1}\@dedicationtrue% + \ignorespaces% + }% } \def\fidealbum#1{% \fidealbum@tk={#1}\@fidealbumtrue% @@ -1968,6 +2036,9 @@ \theme@tk={#1}\@themetrue% \ignorespaces% } +\def\genre#1{% + \relax% Currently not used within diagram.sty +} \long\def\comment#1{% \comment@tk={#1}\@commenttrue% \ignorespaces% @@ -2173,7 +2244,10 @@ % single paragraph. % \begin{macrocode} \def\@dia@number{% - \ifdi@no\above@newline{\authorfont\thediag}\fi% + %\ifdi@no\above@newline{\authorfont\thediag}\fi% + \ifthenelse{\boolean{@cpd@numbering@local}}{% + \above@newline{\authorfont\thediag}% + }{}% } % \end{macrocode} % \end{macro} @@ -2313,7 +2387,7 @@ \def\@dia@fidealbum{% \if@fidealbum% - \above@newlne% + \above@newline% {\expandafter\@show@album\the\fidealbum@tk;}% \fi% } @@ -2579,26 +2653,7 @@ \sourcefont% \if@sourcenr\the\sourcenr@tk\ \fi% \the\source@tk% - \if@year% - \ \ % - \if@day% - \ifnum\from@month>\z@% - \the\day@tk.% - \write@month\from@month% - \ifnum\to@month>\z@% - -\write@month\to@month% - \fi% - .% - \fi% - \else% - \write@month\the\from@month% - \ifnum\to@month>\z@% - -\write@month\the\to@month% - \fi% - /% - \fi% - \the\year@tk% - \fi% + \if@date\ \ \fi\@dia@date% \if@issue , \the\issue@tk\fi% \if@pages , \the\pages@tk\fi% \fi}% @@ -2681,7 +2736,7 @@ } \def\@months#1-#2;{\from@month=#1\to@month=#2\@datetrue} \def\@dia@writename#1; {\above@newline{\authorfont\@dianame#1; }\l@@klist} -\def\@sol@writename#1; {\sep@names\@dianame#1; \l@@klist} +\def\@sol@writename#1; {\sep@names\@solname#1; \l@@klist} \def\name@sep{,\ } \def\sep@names{\if@notfirst\name@sep\else\@notfirsttrue\fi} \def\@checkshort#1/#2#3;{% @@ -2720,7 +2775,7 @@ \def\@normalname#1; {#1} \def\space@vertical{\space@verticaltrue} \def\space@horizontal{\space@verticalfalse} -\def\cl@arsol{\immediate\openout\s@lfd=\jobname.sol} +\def\cl@arsol{\immediate\openout\s@lfd=\jobname.sol\relax} \def\getc@lor#1{% \if#1\ds@white% \help@a\z@\global% @@ -3032,6 +3087,11 @@ \def\@set@label#1;{\ifds@label\label{#1}\fi} \def\init@vars{% \global\s@lufalse + \ifthenelse{\boolean{@cpd@numbering@global}}{% + \setboolean{@cpd@numbering@local}{true}% + }{% + \setboolean{@cpd@numbering@local}{false}% + }% \setboolean{cpd@checkPieceCounts}{false}% \setcounter{cpd@defWhitePieces}{\z@}% \setcounter{cpd@defBlackPieces}{\z@}% @@ -3574,4 +3634,29 @@ %</style> % \end{macrocode} % +% \section{The implementation of cpdparse.sty} +% +% The following contains the style file \emph{cpdparse.sty}, which +% implements generic parsing of lists. +% +% \begin{macrocode} +%<*cpdparse> +\ProvidesPackage{cpdparse}[2020/12/27] +% \end{macrocode} +% +% \begin{macrocode} +\def\cpd@parse@list{\futurelet\cpd@parse@lookahead\cpd@parse@check} +\def\cpd@parse@check{% + \ifx\cpd@parse@lookahead\relax\relax% + \let\cpd@parse@next=\relax% + \else% + \let\cpd@parse@next=\cpd@parse@action% + \fi% + \cpd@parse@next% +} +% \end{macrocode} +% +%</cpdparse> +% +% % \Finale diff --git a/macros/latex/contrib/chess-problem-diagrams/diagram.ins b/macros/latex/contrib/chess-problem-diagrams/diagram.ins index 0c2928c9fe..8bfba54fe7 100644 --- a/macros/latex/contrib/chess-problem-diagrams/diagram.ins +++ b/macros/latex/contrib/chess-problem-diagrams/diagram.ins @@ -2,5 +2,6 @@ \askforoverwritefalse \generate{% \file{diagram.sty}{\from{diagram.dtx}{style}}% + \file{cpdparse.sty}{\from{diagram.dtx}{cpdparse}}% } \endbatchfile diff --git a/macros/latex/contrib/chess-problem-diagrams/diagram.pdf b/macros/latex/contrib/chess-problem-diagrams/diagram.pdf Binary files differindex 0fe72da32d..9ea04fbd39 100644 --- a/macros/latex/contrib/chess-problem-diagrams/diagram.pdf +++ b/macros/latex/contrib/chess-problem-diagrams/diagram.pdf diff --git a/macros/latex/contrib/microtype/README.md b/macros/latex/contrib/microtype/README.md index 9b8dbbff0a..0a3faccb4f 100644 --- a/macros/latex/contrib/microtype/README.md +++ b/macros/latex/contrib/microtype/README.md @@ -4,7 +4,7 @@ The `microtype` package **Subliminal refinements towards typographical perfection** - (v3.0e -- 2022/06/20) + (v3.0f -- 2022/06/23) Overview diff --git a/macros/latex/contrib/microtype/microtype-code.pdf b/macros/latex/contrib/microtype/microtype-code.pdf Binary files differindex ad172ab136..fa07085058 100644 --- a/macros/latex/contrib/microtype/microtype-code.pdf +++ b/macros/latex/contrib/microtype/microtype-code.pdf diff --git a/macros/latex/contrib/microtype/microtype-utf.dtx b/macros/latex/contrib/microtype/microtype-utf.dtx index 2d6110dd2e..fc6226a095 100644 --- a/macros/latex/contrib/microtype/microtype-utf.dtx +++ b/macros/latex/contrib/microtype/microtype-utf.dtx @@ -27,7 +27,7 @@ \ProvidesFile %</!EBGaramond> %<*driver> - {\jobname.dtx}[2022/06/20 v3.0e] + {\jobname.dtx}[2022/06/23 v3.0f] %</driver> %<CharisSIL> {mt-CharisSIL.cfg}[2017/07/07 v1.1 microtype config. file: Charis SIL (RS)] %<LatinModernRoman> {mt-LatinModernRoman.cfg}[2021/02/21 v1.1 microtype config. file: Latin Modern Roman (RS)] @@ -37,8 +37,7 @@ %<TU-empty> {mt-TU-empty.cfg}[2021/06/22 v1.1 microtype config. file: fonts with nonstandard glyph set (RS)] %<*driver> \makeatletter -\AddToHook{package/doc/before}{\pkgcls@targetdate=1 \def\pkgcls@targetlabel{v2}} -\documentclass[10pt,a4paper]{ltxdoc} +\documentclass[10pt,a4paper,doc2]{ltxdoc} \usepackage{fontspec} \usepackage{luatexbase} \RequireLuaModule{luainputenc} diff --git a/macros/latex/contrib/microtype/microtype.dtx b/macros/latex/contrib/microtype/microtype.dtx index eb724cae42..1df1413136 100644 --- a/macros/latex/contrib/microtype/microtype.dtx +++ b/macros/latex/contrib/microtype/microtype.dtx @@ -37,7 +37,7 @@ %<lua-> {microtype-luatex.def} %<xe-> {microtype-xetex.def} %<*package|letterspace|m-t|pdf-|lua-|xe-|show> - [2022/06/20 v3.0e + [2022/06/23 v3.0f %<package> Micro-typographical refinements %<letterspace> Robust letterspacing %<show> Visual debugging for the microtype package @@ -52,8 +52,8 @@ %<luafile>local microtype = microtype %<luafile>microtype.module = { %<luafile> name = "microtype", -%<luafile> version = "3.0e", -%<luafile> date = "2022/06/20", +%<luafile> version = "3.0f", +%<luafile> date = "2022/06/23", %<luafile> description = "microtype module.", %<luafile> author = "E. Roux, R. Schlicht and P. Gesang", %<luafile> copyright = "E. Roux, R. Schlicht and P. Gesang", @@ -3337,9 +3337,10 @@ % `\contributor NightShade <@\at @>', ^^A https://tex.stackexchange.com/users/260836/nightshade % \contributor Nelson Lago <@\at @>, ^^A https://github.com/urrameu % \contributor Brian Dunn <@\at @>, ^^A https://github.com/bdtc -% \contributor Ralf Steinle <rasteinle\at web.de> +% \contributor Ralf Steinle <rasteinle\at web.de>, +% \contributor Denis Bitouz\'e <@\at @> ^^A https://tex.stackexchange.com/users/18401/denis-bitouz%c3%a9 % and -% \contributor Denis Bitouz\'e <@\at @>. ^^A https://tex.stackexchange.com/users/18401/denis-bitouz%c3%a9 +% \contributor Christophe Dervieux <@\at @>. ^^A https://github.com/cderv % %\iffalse %\section{History of micro-typography} ^^A some time ... @@ -3486,6 +3487,8 @@ % %\VersionDate{\expandafter\@gobble\fileversion}{\filedate} % +%\VersionDate{3.0e}{2022/06/20} +% %\VersionDate{3.0d}{2022/03/14} % %\VersionDate{3.0c}{2022/02/22} @@ -3864,11 +3867,11 @@ %^^A\DoNotIndex{\adjustspacing,\copyfont,\expandglyphsinfont, %^^A \ignoreligaturesinfont,\outputmode,\protrudechars,\tracingfonts} ^^A luatex %\DoNotIndex{\eplain,\usepkg@pkg} ^^A eplain -%\DoNotIndex{\@backslashchar,\@car,\@cclvi,\@classoptionslist,\@currext, -% \@currname,\@defaultunits,\@elt,\@empty,\@@enc@update,\@eqnnum,\@expandtwoargs, -% \@firstofone,\@firstoftwo,\@fontenc@load@list,\@footnotetext,\@gobble,\@gobbletwo, -% \@ifclassloaded,\@ifl@t@r,\@ifl@aded,\@ifpackagelater,\@ifpackageloaded,\@ifstar, -% \@ifundefined,\@item,\@let@token,\@m,\@M,\@makeother,\@minus,\@mpfootnotetext, +%\DoNotIndex{\@backslashchar,\@car,\@cclvi,\@changed@cmd,\@classoptionslist, +% \@current@cmd,\@currext,\@currname,\@defaultunits,\@empty,\@@enc@update, +% \@eqnnum,\@expandtwoargs,\@firstofone,\@firstoftwo,\@footnotetext,\@gobble, +% \@gobbletwo,\@ifclassloaded,\@ifl@t@r,\@ifl@aded,\@ifpackagelater,\@ifpackageloaded, +% \@ifstar,\@ifundefined,\@item,\@let@token,\@m,\@M,\@makeother,\@minus,\@mpfootnotetext, % \@nameuse,\@ne,\@newlistfalse,\@nil,\@nnil,\@onelevel@sanitize,\@onlypreamble, % \@pkgextension,\@plus,\@ptionlist,\@removeelement,\@secondoftwo,\@spaces,\@sptoken, % \@tempa,\@tempb,\@tempc,\@tempcnta,\@tempcntb,\@tempdima,\@typeset@protect, @@ -3877,16 +3880,17 @@ % \maybe@ic@,\nfss@text,\not@math@alphabet,\on@line,\p@,\set@display@protect, % \strip@prefix,\strip@pt,\@text@composite,\tw@,\z@,\z@skip,\zap@space, % \active,\bfseries,\documentclass,\dotfill,\fbox,\fboxrule,\fboxsep,\fmtversion, -% \footnotesize,\huge,\Huge,\itshape,\large,\Large,\LARGE,\leavevmode,\llap, -% \makeatletter,\makebox,\mathrm,\mbox,\mdseries,\medskip,\newbox,\newcommand, -% \newcount,\newdimen,\newif,\newline,\newskip,\newtoks,\nobreak,\nonfrenchspacing, -% \normalbaselineskip,\normalsize,\numberline,\obeylines,\par,\parbox,\providecommand, -% \quad,\raggedright,\renewcommand,\rmfamily,\scalebox,\sffamily,\scriptsize,\scshape, -% \slshape,\small,\space,\strut,\textwidth,\texttt,\tiny,\tracingnone,\ttfamily, -% \upshape,\usefont,\tiny,\AddToHook,\AtBeginDocument,\AtEndOfPackage,\CheckCommand, -% \CurrentOption,\DeclareOption,\DeclareRobustCommand,\IfFileExists,\IfFormatAtLeastTF, -% \InputIfFileExists,\MessageBreak,\PackageError,\PackageInfo,\PackageWarning, -% \PassOptionsToPackage,\ProcessOptions,\RawNoindent,\RequirePackage,\UnicodeEncodingName} +% \fontseriesforce,\fontshapeforce,\footnotesize,\huge,\Huge,\itshape,\large,\Large, +% \LARGE,\leavevmode,\llap,\makeatletter,\makebox,\mathrm,\mbox,\mdseries,\medskip, +% \newbox,\newcommand,\newcount,\newdimen,\newif,\newline,\newskip,\newtoks,\nobreak, +% \nonfrenchspacing,\normalbaselineskip,\normalshape,\normalsize,\numberline,\obeylines, +% \par,\parbox,\providecommand,\quad,\raggedright,\renewcommand,\rmfamily,\scalebox, +% \sffamily,\scriptsize,\scshape,\slshape,\small,\space,\sscshape,\strut,\swshape, +% \textwidth,\texttt,\tiny,\tracingnone,\ttfamily,\upshape,\ulcshape,\usefont,\tiny, +% \AddToHook,\AtBeginDocument,\AtEndOfPackage,\CheckCommand,\CurrentOption,\DeclareOption, +% \DeclareRobustCommand,\IfFileExists,\IfFormatAtLeastTF,\InputIfFileExists,\MessageBreak, +% \PackageError,\PackageInfo,\PackageWarning,\PassOptionsToPackage,\ProcessOptions, +% \RawNoindent,\RequirePackage,\UnicodeEncodingName} %^^A\DoNotIndex{\add@accent,\cf@encoding,\curr@fontshape,\define@newfont, %^^A \do@subst@correction,\f@encoding,\f@family,\f@size,\font@name,\fontencoding, %^^A \fontseries,\fontshape,\glb@currsize,\glb@settings,\normalfont,\pickup@font, @@ -8310,15 +8314,19 @@ time will almost certainly lead to undesired results. Have your choice!}% % \end{macrocode} %\end{macro} %\begin{macro}{\MT@prot@iflicrcmd} +%\changes{v3.0f}{2022/06/22}{no need to know about encodings +% (also fixes \githubissue{20}, reported by +% \contributor Christophe Dervieux <@\at @>)} % Fun with <LICR>: -% Test if the first command of the third command of the first command -% is \cmd\@text@composite, in which case also grab the next token, +% If we have an encoding command, test if the first command of the third command +% (\eg, |\T1\"|) is \cmd\@text@composite, in which case also grab the next token, % otherwise it should be a text command. % \begin{macrocode} \def\MT@getthird#1#2#3#4\@nil{#3} -\def\MT@prot@iflicrcmd#1{% - \MT@exp@cs\MT@prot@iffirstcmd{#1-cmd}{% - \expandafter\expandafter\expandafter\let +\def\MT@prot@iflicrcmd{% + \MT@prot@iffirstcmd\@current@cmd\@secondoftwo\@firstofone + {\MT@prot@iffirstcmd\@changed@cmd\@firstofone\@gobble}% + {\expandafter\expandafter\expandafter\let \expandafter\expandafter\expandafter\@tempa \expandafter\MT@getthird\MT@prot@next\relax\@nil \MT@exp@two@c\ifx\@car\@tempa\relax\@nil\@text@composite @@ -8326,34 +8334,7 @@ time will almost certainly lead to undesired results. Have your choice!}% \else \def\MT@temp*##1{\MT@prot@l{\the\MT@toks##1}}% \fi - \MT@tlist@break - }\relax -} -%</package> -% \end{macrocode} -%\end{macro} -%\begin{macro}{\MT@enc@list} -%\changes{v3.0e}{2022/06/09}{new macro: no more guesswork about encodings} -% The list of all loaded font encodings. For \LaTeX\ formats older than -% 2020/02/11 (before \cmd\@fontenc@load@list\ was introduced), we don't -% bother doing any guesswork (like \pkg{babel} used to do). Also, we -% don't consider the older <EU1>/<EU2> encodings. -% \begin{macrocode} -%<pdf-|lua-|xe->\def\MT@enc@list -%<pdf-> {{T1}{OT1}} -%<lua-|xe-> {{TU}} -%<*package> -\MT@addto@setup{% - \ifx\@fontenc@load@list\@undefined \else - \def\@elt#1{,#1,}% - \edef\@tempa{\@fontenc@load@list}% - \MT@map@clist@c\@tempa{% - \MT@ifempty{#1}\relax{% - \MT@in@tlist{#1}\MT@enc@list - \ifMT@inlist@\else\edef\MT@enc@list{\MT@enc@list{#1}}\fi - }% - }% - \fi + }% } % \end{macrocode} %\end{macro} @@ -8440,6 +8421,7 @@ time will almost certainly lead to undesired results. Have your choice!}% %\changes{v3.0e}{2022/06/09}{new macro: make list of commands extensible} %\changes{v3.0e}{2022/05/13}{ignore \cmd\@empty} %\changes{v3.0e}{2022/06/15}{add standard font selection commands} +%\changes{v3.0f}{2022/06/22}{add \microtype's commands} % Here's the list of commands to be added to our toks. % We'll postpone the handling of commands whose argument would have % to be processed (\eg, \cmd\textrm). @@ -8449,14 +8431,23 @@ time will almost certainly lead to undesired results. Have your choice!}% {S\rmfamily}{S\sffamily}{S\ttfamily}{S\mdseries}{S\bfseries}% {S\upshape}{S\slshape}{S\itshape}{S\scshape}% {S\normalfont}{S\selectfont}% + {S\lsstyle}% {S\tiny}{S\scriptsize}{S\footnotesize}{S\small}{S\normalsize}% {S\large}{S\Large}{S\LARGE}{S\huge}{S\Huge}% {O\fontencoding}{O\fontfamily}{O\fontseries}{O\fontshape}% + {O\microtypesetup}{O\microtypecontext}% {T\fontsize}% } % \end{macrocode} -%\end{macro} -% If \pkg{yfonts} is loaded, we add the relevant commands (again, those that +% \LaTeX\ 2020/02/02 introduced some more commands. +%\changes{v3.0f}{2022/06/22}{add new NFSS commands} +% \begin{macrocode} +\IfFormatAtLeastTF{2020/02/02} + {\g@addto@macro\MT@prot@check@cmds{% + {S\swshape}{S\ulcshape}{S\sscshape}{S\normalshape}% + {O\fontseriesforce}{O\fontshapeforce}}}{} +% \end{macrocode} +% If \pkg{yfonts} is loaded, we add the relevant commands (again, only those that % don't take an argument). % \begin{macrocode} \MT@addto@setup{% @@ -8464,6 +8455,7 @@ time will almost certainly lead to undesired results. Have your choice!}% {\g@addto@macro\MT@prot@check@cmds{{S\frakfamily}{S\swabfamily}{S\gothfamily}}}% } % \end{macrocode} +%\end{macro} %\begin{macro}{\MT@prot@get@first@group} % If next char is |{|, start a group and try again, else continue until % we find a beginning char. @@ -8503,7 +8495,7 @@ time will almost certainly lead to undesired results. Have your choice!}% \let\MT@prot@ifmacro\MT@prot@ifmacro@ \MT@map@tlist@c\MT@prot@check@cmds\MT@prot@check % \end{macrocode} -% \dots~or a command/active char whose first command is one of the following. +% \dots~or a command/active char whose first command is one of the following: % \begin{macrocode} \MT@prot@ifmacro{% \MT@prot@iffirstcmd\UTFviii@two@octets{% @@ -8522,7 +8514,7 @@ time will almost certainly lead to undesired results. Have your choice!}% % \end{macrocode} % or, finally, a <LICR> command. % \begin{macrocode} - \MT@map@tlist@c\MT@enc@list\MT@prot@iflicrcmd + \MT@prot@iflicrcmd }% }% }% @@ -19992,7 +19984,7 @@ This is the current font stretched by 5\%, normal, and shrunk by 5\%: % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % -% \CheckSum{12609} +% \CheckSum{12598} % % \Finale % diff --git a/macros/latex/contrib/microtype/microtype.pdf b/macros/latex/contrib/microtype/microtype.pdf Binary files differindex 2d895f24f7..642f98889a 100644 --- a/macros/latex/contrib/microtype/microtype.pdf +++ b/macros/latex/contrib/microtype/microtype.pdf diff --git a/macros/latex/contrib/schwalbe-chess/README b/macros/latex/contrib/schwalbe-chess/README index 34562fb943..fe64042379 100644 --- a/macros/latex/contrib/schwalbe-chess/README +++ b/macros/latex/contrib/schwalbe-chess/README @@ -1,5 +1,5 @@ schwalbe --- A package for typesetting chessproblems -Version v2.9 / Stefan Hoening 2012-2020 +Version v2.12 / Stefan Hoening 2012-2022 CONTENTS diff --git a/macros/latex/contrib/schwalbe-chess/schwalbe.dtx b/macros/latex/contrib/schwalbe-chess/schwalbe.dtx index 62dbe69dcc..15b4b459fc 100644 --- a/macros/latex/contrib/schwalbe-chess/schwalbe.dtx +++ b/macros/latex/contrib/schwalbe-chess/schwalbe.dtx @@ -13,9 +13,9 @@ %% %% % \fi -% \def\fileversion{v2.9} -% \def\docdate{2022/05/28} -% \CheckSum{2247} +% \def\fileversion{v2.12} +% \def\docdate{2022/06/16} +% \CheckSum{2266} % \changes{v1.1}{03 June 2011}{Reflecting change in command % @writename inside diagram.sty} % \changes{v1.2}{01 July 2011}{Added parameter for Band to Heft @@ -59,6 +59,17 @@ % Loesungen environment.} % \changes{v2.9}{28 May 2022}{Added code to simplify measuring size of % articles.} +% \changes{v2.10}{02 June 2022}{Added missing dots (.) in commands +% cpd@Loesung and cpd@Loesung@star.\\ +% Added commands win and loose.\\ +% Volume is provided as arabic number in 'Heft' command now.\\ +% Fixed issue with Ruler as 'AddToHook' command is not available in +% old \LaTeX{} installations.} +% \changes{v2.11}{13 June 2022}{Changed to depend on diagram.sty from +% 13 June 2022.} +% \changes{v2.12}{19 June 2022}{Moved ruler code to separate style +% file swruler.sty.\\ +% Added class option 'ruler' to activate displaying the ruler.} % % \DoNotIndex{\@arabic,\def,\@idxitem,\@ifnextchar,\@ifstar, % \@ne,\@ptsize,\ ,\advance,\AtEndOfPackage,\begin,\begingroup, @@ -108,7 +119,9 @@ % Parameter in der angegebenen Reihenfolge: % % \begin{enumerate} -% \item der Band, zu dem das Heft gehört +% \item der Band, zu dem das Heft gehört (als arabische Zahl)\footnote{In den +% vorherigen Fassungen der schwalbe.cls wurde hier die römische +% Darstellung der Zahl angegeben.} % \item die Nummer des Heftes % \item der Monat des Erscheinens als Zahl % \item das Jahr des Erscheinens @@ -119,7 +132,7 @@ % der Seitenummmer 361 beginnt wird demzufolge folgendermassen % eingeleitet: % -% \verb+\Heft{XXXIV}{299}{12}{2019}{361}+ +% \verb+\Heft{34}{299}{12}{2019}{361}+ % % \DescribeEnv{Editorial} % Die \verb+Editorial+ Umgebung benötigt einen Parameter, der @@ -331,7 +344,7 @@ % % \DescribeEnv{Loeserliste} % Nach dem einleitenden \verb+\begin{Loeserliste}+ ist als -% Parameter das Jahr anzugeben, auf dass sich die Löserliste +% Parameter das Jahr anzugeben, auf das sich die Löserliste % bezieht. % % \DescribeEnv{Turnierausschreibung} @@ -371,6 +384,11 @@ % zwischen den Gliedern der Abkürzung wählen. Daher definiert % der Style Befehle für einige Häufig vorkommende Abkürzungen: % +% \DescribeMacro{\win} +% \DescribeMacro{\loose} +% Für die Notation von Studienlösungen gibt es die Befehle \verb+\win+ +% und \verb+\loose+. +% % \medskip % \begin{tabular}{|l|l|l|} % \hline @@ -429,12 +447,35 @@ % \DescribeMacro{\mal} % Als Kurzschreibweise für das $\times$ Symbol ist der Befehl \verb+\mal+ definiert. % +% \DescribeMacro{\ShowRuler} +% Um den Umfang der einzelnen Artikel einfacher Abschätzen zu können, +% kann man mittels \verb+\ShowRuler+ ein Lineal auf jeder Seite +% anzeigen lassen. +% Der Befehl erwartet als Parameter den \textbf{x}- und +% \textbf{y}-Abstand zum Seitenursprung. Die Angaben müssen als +% vielfaches von \textbf{1pt} angegeben werden. +% +% In der \textbf{schwalbe-class} kann das Lineal durch die Option +% \textbf{ruler} aktiviert werden: +% +% \begin{verbatim} +% \documentclass[ruler]{schwalbe} +% \end{verbatim} +% +% Mit aktivierter \textbf{ruler}-Option kann das Anzeigen des Lineals +% durch Anlegen einer Datei \verb+__finalpdf__.tex+ deaktiviert +% werden. Das habe ich in dem Prozess, der die Schwalbe-Hefte baut, +% automatisiert. +% +% Der Code zur Erzeugung des Lineals ist eine eigene Style-Datei +% \verb+swruler.sty+ ausgelagert, so dass man das Lineal ohne +% \textbf{schwalbe-class} verwenden kann. +% % \DescribeEnv{MeasureMode} % \DescribeMacro{\MeasureNewpage} -% Um den Umfang der einzelnen Artikel einfacher Abschätzen zu können, -% füge ich vor jedem Artikel den Befehl \verb+\MeasureNewpage+ ein, -% der ein \verb+\newpage+ durchführt, wenn der Boolean -% \verb+MeasureMode+ gleich \verb+true+ ist. +% Außerdem füge ich vor jedem Artikel den Befehl +% \verb+\MeasureNewpage+ ein, der ein \verb+\newpage+ durchführt, wenn +% der Boolean \verb+MeasureMode+ gleich \verb+true+ ist. % % \StopEventually{\PrintIndex\PrintChanges} % @@ -470,9 +511,15 @@ % \begin{macrocode} %<*class> \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{schwalbe}[2022/05/28] +\ProvidesClass{schwalbe}[2022/06/23] +\DeclareOption{ruler}{% + \AtBeginDocument{\IfFileExists{__finalpdf__.tex}{}{% + \ShowRuler{32mm / 1pt}{-44mm / 1pt}}} +}% +\ProcessOptions\relax% \LoadClass[11pt,a4paper]{article} -\RequirePackage[12pt]{schwalbe}[2019/12/28] +\RequirePackage[12pt]{schwalbe}[2022/06/23] +\RequirePackage{swruler}[2022/06/19] \RequirePackage{cpdparse}[2020/12/27] \RequirePackage[T2A,T1]{fontenc}% fsRUS 140121 \RequirePackage[koi8-r,utf8]{inputenc}% fsRUS 140121 @@ -533,6 +580,8 @@ \def\zB{z.\,B.\ignorespaces} \def\su{s.\,u.\ignorespaces} \def\ep{e.\,p.\ignorespaces} +\def\win{$\pm$} +\def\loose{$\mp$} \def\seedia{s.\,Diagr.} % %----------------------------------------------------------- @@ -590,11 +639,13 @@ % Band, Heftnummer, Monat, Jahr und erste Seitennummer des Heftes % spezifiziert. % \begin{macrocode} +\newcounter{sw@volume}% \newcounter{sw@issue}% \newcounter{sw@month}% \newcounter{sw@year}% \newcommand{\Heft}[5]{% \def\heft@band{#1}% + \setcounter{sw@volume}{#1}% \setcounter{sw@issue}{#2}% \setcounter{sw@month}{#3}% \setcounter{sw@year}{#4}% @@ -604,7 +655,7 @@ {\large\bfseries% HEFT~#2% \hfill% - BAND #1% + BAND \Roman{sw@volume}% \hfill% \sw@monat{\value{sw@month}}~#4% }% @@ -693,9 +744,9 @@ , S.~\the\pages@tk% \fi% \else% - \if@special\relax% + \ifthenelse{\boolean{@cpd@numbering@local}}{}{% \thediag% - \fi + }% \fi\fi% \egroup% } @@ -980,7 +1031,7 @@ \AtEndDocument{\immediate\closeout\@cpdfile@loeserkuerzel} \newcommand{\x@cpd@saveloeser}[2]{% - \immediate\write\@cpdfile@loeserkuerzel{\unexpanded{#1:#2}} + \immediate\write\@cpdfile@loeserkuerzel{\unexpanded{#1:#2}}% } \newcommand{\y@cpd@saveloeser}[2]{% \x@cpd@saveloeser{#1}{#2}% @@ -1040,11 +1091,11 @@ } \newcommand{\showsol}{} \newcommand{\cpd@Loesung}[3]{% - \textbf{#1}\ \sw@loesung@authors{#2}% + \textbf{#1}\ \sw@loesung@authors{#2}.\ % \renewcommand{\showsol}{#3}% } \newcommand{\cpd@Loesung@star}[3]{% - \textbf{#1}\ \sw@loesung@authors{#2}\ #3% + \textbf{#1}\ \sw@loesung@authors{#2}.\ #3.% \renewcommand{\showsol}{}% } \newcommand{\Loesung}{% @@ -1954,48 +2005,7 @@ \newcommand{\mal}{\mbox{\ifmmode\times\else$\times$\fi}} % \end{macrocode} % -% Das Makro \verb+\Ruler+ erzeugt ein Lineal mit einer $1/20$ -% Einteilung der Seitenhöhe. -% -% \begin{macrocode} -\newcommand{\Ruler}{% -\makebox{% -\setlength{\unitlength}{13mm} -\begin{picture}(1,20) -\put(0.4,-20){\line(0,1){20}} - -\multiput(0.4,-20)(0,2){11}{\line(1,0){0.4}} -\multiput(0.4,-19)(0,2){10}{\line(1,0){0.2}} -\put(0,-20){10} -\put(0,-18){9} -\put(0,-16){8} -\put(0,-14){7} -\put(0,-12){6} -\put(0,-10){5} -\put(0,-8){4} -\put(0,-6){3} -\put(0,-4){2} -\put(0,-2){1} -\end{picture} -}}% Ruler -% \end{macrocode} -% -% Das Makro \verb+\ShowRuler+ sorgt dafür, dass das mittels -% \verb+\Ruler+ erzeugte Lineal auf jeder Seite angezeigt wird. -% -% \begin{macrocode} -\newcommand{\ShowRuler}{% -\AddToHook{shipout/background}{\put(32mm,-46mm){\Ruler}}% -}% -% \end{macrocode} -% -% Wenn beim Übersetzen der \LaTeX-Datei in aktuellen Verzeichnis keine -% \verb+__finalpdf__.tex+ existiert, wird die Anzeige des -% Lineals mittels \verb+\ShowRuler+ aktiviert. Durch Anlegen der Datei -% kann das Einblenden des Lineals deaktiviert werden. -% % \begin{macrocode} -\AtBeginDocument{\IfFileExists{__finalpdf__.tex}{}{\ShowRuler}} \newboolean{MeasureMode} \setboolean{MeasureMode}{false} @@ -2012,7 +2022,7 @@ % \begin{macrocode} %<*style> \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{schwalbe}[2019/12/28] +\ProvidesPackage{schwalbe}[2022/06/23] % \end{macrocode} % % Der \textit{Schwalbe-Style} ist eine Erweiterung des @@ -2027,7 +2037,7 @@ % \end{macrocode} % % \begin{macrocode} -\RequirePackage{diagram}[2020/02/09] +\RequirePackage{diagram}[2022/06/19] % % % Wir definieren das Diagrammlayout ein wenig um. @@ -2095,11 +2105,9 @@ \def\@dia@number{}% Die Diagrammnummer wird bei den Autoren gesetzt! % \def\@dia@numberx{% - \if@special% - \thediag% - \else\ifdi@no% - \thediag% - \fi\fi% + \ifthenelse{\boolean{@cpd@numbering@local}}{% + {\authorfont\thediag}% + }{}% } % \def\@dia@authors{% @@ -2111,8 +2119,10 @@ \let\@action=\@dia@writename% Parse the list of authors \@parseTokenlist\aut@tk;% \else% - \above@newline - {\authorfont\@dia@numberx}% + \ifthenelse{\boolean{@cpd@numbering@local}}{% + \above@newline% + \@dia@numberx% + }{}% \fi% } % @@ -2156,20 +2166,83 @@ \newlength{\double@boardwidth}% \def\doublediagram#1{% - \def\dia@above{\if@special\else% - \setlength{\helplength}{\textwidth}% - \addtolength{\helplength}{-3\board@width}% - \setlength{\boardskip}{.5\helplength}% - \setlength{\double@boardwidth}{2\board@width}% - \addtolength{\double@boardwidth}{\boardskip}% - \begin{minipage}[b]{\double@boardwidth}% - #1% - \end{minipage}% - \fi}% + \def\dia@above{% + \ifthenelse{@cpd@numbering@local}{}{% + % \if@special\else% + \setlength{\helplength}{\textwidth}% + \addtolength{\helplength}{-3\board@width}% + \setlength{\boardskip}{.5\helplength}% + \setlength{\double@boardwidth}{2\board@width}% + \addtolength{\double@boardwidth}{\boardskip}% + \begin{minipage}[b]{\double@boardwidth}% + #1% + \end{minipage}% + % \fi + }% + }% } %</style> % \end{macrocode} % +% \section{Die Implementierung des \textbf{swruler.sty}} +% +% \begin{macrocode} +%<*rulerstyle> +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{swruler}[2022/06/19] +\RequirePackage{calc} +% \end{macrocode} +% +% Das Makro \verb+\Ruler+ erzeugt ein Lineal mit einer $1/20$ +% Einteilung der Seitenhöhe. +% +% \begin{macrocode} +\newcommand{\Ruler}{% +\makebox{% +\setlength{\unitlength}{\textheight / 20} +\begin{picture}(1,20) +\put(0.4,-20){\line(0,1){20}} +\multiput(0.4,-20)(0,2){11}{\line(1,0){0.4}} +\multiput(0.4,-19)(0,2){10}{\line(1,0){0.2}} +\put(0,-20){10} +\put(0,-18){9} +\put(0,-16){8} +\put(0,-14){7} +\put(0,-12){6} +\put(0,-10){5} +\put(0,-8){4} +\put(0,-6){3} +\put(0,-4){2} +\put(0,-2){1} +\end{picture} +}}% Ruler +% \end{macrocode} +% +% +% Das Makro \verb+\ShowRuler+ sorgt dafür, dass das mittels +% \verb+\Ruler+ erzeugte Lineal auf jeder Seite angezeigt wird. +% Da in älteren \LaTeX-Versionen das Kommando \verb+\AddToHook+ noch +% nicht existiert, wird in diesem Fall eine Warnung ausgegeben. Ein +% Lineal kann dann nicht angezeigt werden. +% +% \begin{macrocode} +\providecommand{\AddToHook}[2]{% +\message{^^JWARNING: Your LaTeX is too old to activate a Ruler on each page.^^J}% +}% +\newcommand{\ShowRuler}[2]{% +\AddToHook{shipout/background}{\put(#1,#2){\Ruler}}% +}% +% \end{macrocode} +% +% Wenn beim Übersetzen der \LaTeX-Datei in aktuellen Verzeichnis keine +% \verb+__finalpdf__.tex+ existiert, wird die Anzeige des +% Lineals mittels \verb+\ShowRuler+ aktiviert. Durch Anlegen der Datei +% kann das Einblenden des Lineals deaktiviert werden. +% +% \begin{macrocode} +%</rulerstyle> +% \end{macrocode} +% % \Finale diff --git a/macros/latex/contrib/schwalbe-chess/schwalbe.ins b/macros/latex/contrib/schwalbe-chess/schwalbe.ins index bbea30d9b0..a7641a3c45 100644 --- a/macros/latex/contrib/schwalbe-chess/schwalbe.ins +++ b/macros/latex/contrib/schwalbe-chess/schwalbe.ins @@ -3,5 +3,6 @@ \generate{% \file{schwalbe.sty}{\from{schwalbe.dtx}{style}}% \file{schwalbe.cls}{\from{schwalbe.dtx}{class}}% + \file{swruler.sty}{\from{schwalbe.dtx}{rulerstyle}}% } \endbatchfile diff --git a/macros/latex/contrib/schwalbe-chess/schwalbe.pdf b/macros/latex/contrib/schwalbe-chess/schwalbe.pdf Binary files differindex bc3f10ddba..35ec9985a3 100644 --- a/macros/latex/contrib/schwalbe-chess/schwalbe.pdf +++ b/macros/latex/contrib/schwalbe-chess/schwalbe.pdf diff --git a/macros/luatex/generic/barracuda/PLANNER.txt b/macros/luatex/generic/barracuda/PLANNER.txt index ca7a9e041f..f6f613ddba 100644 --- a/macros/luatex/generic/barracuda/PLANNER.txt +++ b/macros/luatex/generic/barracuda/PLANNER.txt @@ -5,7 +5,7 @@ Basic rules ----------- + Every new version will be uploaded to CTAN network -+ For each single task there will be a correspomding commit ++ For each single task there will be a single commit Hypothetical development task list: ----------------------------------- @@ -18,52 +18,101 @@ Hypothetical development task list: 20__-__-__: [dev] proportional options 20__-__-__: [dev] a number parameter can be a string? unit measure... 20__-__-__: [prj] a command line program to print barcodes -20__-__-__: [dev] guard text in EAN simbology -20__-__-__: [dev] UPC support 20__-__-__: [dev] make optional file name in all the Driver methods 20__-__-__: [prj] test l3build for testing and CTAN files packaging 20__-__-__: [dev] load barcode parameters from an external file 20__-__-__: [dev] new Parameter Class +202_-__-__: [dev][barcode] new `alias` feature +202_-__-__: [dev][barcode] new `preset` feature +202_-__-__: [project][build] make a Lua script to easily create the CTAN upload + : compressed files +202_-__-__: [dev] statistical data on how many barcode symbols was printed +202_-__-__: [upc] UPC-E barcode symbology -Scheduled task list for Data Matrix 2D simbology implementation: +Scheduled task list for Data Matrix 2D symbology implementation: ---------------------------------------------------------------- -2020-__-__: [dmx] data matrix first run -2020-__-__: [dmx] ecc200 error correction code -2020-__-__: [svg] opcode for grids -2020-__-__: [pdf] opcode for grids -2020-__-__: [gas] ga-asm grid opcode -2020-__-__: [geo] grid vector object -2020-__-__: [dev] init source file encoder for Data Matrix -2020-__-__: [dev] parameter preset - -Dev Planner: -============ +202_-__-__: [dmx] data matrix first run +202_-__-__: [dmx] ecc200 error correction code +202_-__-__: [svg] opcode for grids +202_-__-__: [pdf] opcode for grids +202_-__-__: [ga] ga new grid opcode +202_-__-__: [geo] grid vector object +202_-__-__: [dev] init source file encoder for Data Matrix + +Ongoing Scheduler: +================== +------------------------------------------------------------------------------- +202_-__-__: [milestone] version 0.1 +202_-__-__: [test] update test files with recent changes +202_-__-__: [dev][ean] fix the `ean:checksum()` to include ISBN and ISSN variant +202_-__-__: [dev] control the method call on the right class +202_-__-__: [code128] add human readeable text +202_-__-__: [breaking change] refactor Text libgeo object +202_-__-__: [project] adhere to semver specification +202_-__-__: [doc] API reference +202_-__-__: [doc] barcode symbologies reference: code39 + +------------------------------------------------------------------------------- +2022-06-22: [code128] fix a bug in the encoder (complete rewriting) ------------------------------------------------------------------------------- -2020-__-__: [milestone] version <v0.0.11> completed task/commit list -2020-__-__: [doc] barcode symbologies reference -2020-__-__: [doc] put ga-asm-spec together with the manual -2020-__-__: [dev][barcode] new `alias` feature -2020-__-__: [dev][barcode] new `preset` feature -2020-__-__: [dev][i2of5] human readeable text for i2of5 -2020-__-__: [dev][libgeo] new `Vbar_group` class -2020-__-__: [test] update test files with recent changes -2020-__-__: [dev][libgeo][breaking change] return `ok, err` instead of `err` +2020-05-03: [barcode] debug_bbox option +2020-05-03: [libgeo] optional tx, ty moving point for encode_<object> +2020-04-06: [driver] new methods for gaCanvas class and default style graphic +2020-03-20: [upc] new UPC-A barcode symbology +2020-03-13: [barcode] new method get_code() and get_hri() +2020-03-11: [breaking change][barcode] new `draw()` method +2020-03-07: [ga] new <dash-pattern> and <reset-pattern> opcodes +2020-03-06: [doc] new section explains `Vbar` +2020-03-02: [doc] add a chess example for `ga` stream + +[merge]<--------+ + | + 2020-03-02: [doc] put ga-asm-spec together with the manual + | +[doc-basic-ref]-+ + +2020-02-27:*[dev][i2of5] human readeable text for i2of5 and ITF14 + +[merge]<--------+ + | + 2020-02-26: [ean] guard text in EAN symbology + 2020-02-25: [libgeo][gaCanvas] Polyline object test file + 2020-02-25: [libgeo][gaCanvas] new Polyline object + | +[Polyline]------+ + +2020-02-22: [dev] new methods _process_char() and _process_digit() +2020-02-09: [dev] new constructor `Barcode:new()` + +[merge]<--------+ + | + 2020-02-17: [libgeo] delete `Vbar_archive` in favour of `Archive` + 2020-02-16: [libgeo] arithmetic of new object `Queue` + 2020-02-12: [libgeo] new class `Archive` + 2020-02-12: [dev][libgeo] add method `Vbar_archive:add_space()` + 2020-02-12: [dev][libgeo] refactor `Vbar_archive:push_queue()` method + 2020-02-12: [dev][ean] refactor ean to use `Vbar_archive` + 2020-02-11: [dev][i2to5] refactor i2of5 to use `Vbar_archive` + 2020-02-10: [dev][code128] refactor code128 to use `Vbar_archive` + 2020-02-09: [dev][libgeo] refactor code39 to use `Vbar_archive` + 2020-02-06: [dev][libgeo] new `Vbar_archive` class in libgeo + | +[vbar_archive]--+ + +2020-02-05: [dev][libgeo][breaking change] return `ok, err` instead of `err` for canvas methods -2020-__-__: [dev] new constructor `Barcode:new()` -2020-__-__: [project][build] make a Lua script to easily create the CTAN upload - : compressed files -2020-__-__: [dev][ean] fix the `ean:checksum()` to include ISBN and ISSN variant -2020-__-__: [dev][i2of5] `encoder:_init_parse_state()` adoption for ITF14 +2020-02-04: [dev][ean] new function `encoder:_init_parse_state()`, and EAN + : family adoption; + : [dev][i2of5] `encoder:_init_parse_state()` adoption for ITF14 : variant -2020-__-__: [dev][ean] new function `encoder:_init_parse_state()`, and EAN - : family adoption -2020-__-__: update version number in preparetion of the next version. + : [project] update version number in preparation of the next version ------------------------------------------------------------------------------- + ------------------------------------------------------------------------------- -2020-02-04: [milestone] version <v0.0.10> completed task/commit list +2020-02-04: [milestone] version <v0.0.10> completed task/commit list: ------------------------------------------------------------------------------- -2020-02-04:*[dev][ean] ISSN support +2020-02-04: [dev][ean] ISSN support 2020-02-03: [dev][ean] move out of `_config()` `finalize()` method as in i2of5 2020-02-02: [dev][i2of5] new ITF14 variant, plan for the next version 2020-02-01: [dev] new semantic for barcode parameter: alternative family @@ -83,8 +132,7 @@ Dev Planner: : [api][breaking change] new encoder naming convention : reuse or create a new encoder object in barracuda:hbox() and : barracuda:save() methods - -(*) this commit +------------------------------------------------------------------------------- Task history and previous version: ================================== diff --git a/macros/luatex/generic/barracuda/README.md b/macros/luatex/generic/barracuda/README.md index 49bab5cb24..d1880c3d2c 100644 --- a/macros/luatex/generic/barracuda/README.md +++ b/macros/luatex/generic/barracuda/README.md @@ -1,42 +1,41 @@ # `barracuda` project -This a pure Lua library is for drawing barcode symbols. The project components -are able to typeset barcode from within a LuaTeX document. Therefore is also -possible to use `barracuda` with a Lua standalone interpreter to draw barcodes -with different graphic format such as `SVG` (see an example below). This package -does not have dependences. +This is a pure Lua library for drawing barcode symbols. `barracuda` components' +are able to typeset barcode from within a LuaTeX document in order to produce a +PDF file, or is also possible to use a Lua standalone interpreter to draw +barcodes in different graphic format such as `SVG` (see an example below). ![a Code39 symbol in SVG format](/test/test-ga-svg/test-code39.svg) -Internal modules are structured to ensure good performance and to give a -complete user control over barcode symbol parameters :thumbsup: . +The internal modules are structured to ensure good performance beside of a +complete user control over barcode symbol parameters :thumbsup: Although development is in beta stage, `barracuda` has a good level of -stability. +stability. The package does not have any dependences. ## Current version -Version: v0.0.10 -Date: 2020-02-04 +Version: 0.0.12 - Date: 2022-06-23 ## Barcode symbologies list -So far, the barcode symbologies included in the package are: +So far, the barcode symbologies supported by the package are: - Code 39 - Code 128 -- Interleaved 2 of 5 +- Interleaved 2 of 5 (ITF14, i2of5 general) - EAN family (ISBN, ISSN, EAN8, EAN13, and the add-ons EAN5 and EAN2) +- UPC-A -Other 1D encoding symbology will be added to the project, then it will be the -turn of 2D barcode types like Datamatrix, QRCode or PDF417. +Other 1D encoding symbology will be eventually added to the project, then it +will be the turn of 2D barcode types like Datamatrix, QRCode or PDF417. ## A very simple LaTeX example The LaTeX package `barracuda.sty` under the cover uses Lua code so you need to compile your source files with LuaTeX or LuajitTeX with the LaTeX format. -For instance, here is a minimal working example for LuaLaTeX: +For instance, the follow is a minimal working example for LuaLaTeX: ```latex % !TeX program = LuaLaTeX @@ -71,7 +70,7 @@ releases can be found only at <https://github.com/robitex/barracuda> . TeX Live distribution or Lua interpreter executable are available for a very large number of Operating Systems so it is also for `barracuda`. -Step by step istruction can be found in the INSTALL.txt file. +Step by step instruction can be found in the INSTALL.txt file. ## Contribute @@ -91,4 +90,4 @@ program. Please, for more legal details refer to LICENSE.txt file or visit the web page <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html> -Copyright (C) 2020 Roberto Giacomelli +Copyright (C) 2019-2022 Roberto Giacomelli diff --git a/macros/luatex/generic/barracuda/barracuda.sty b/macros/luatex/generic/barracuda/barracuda.sty index 4366cbdd22..c0a830bb2e 100644 --- a/macros/luatex/generic/barracuda/barracuda.sty +++ b/macros/luatex/generic/barracuda/barracuda.sty @@ -1,6 +1,6 @@ % \NeedsTeXFormat{LaTeX2e}[2009/06/27] -\ProvidesPackage{barracuda}[2020/01/15 v0.0.10 a barcode typesetting package]% +\ProvidesPackage{barracuda}[2022/06/23 v0.0.12 a barcode typesetting package]% \newbox\barracudabox \newcommand\barracuda[3][_brcdempty_=true]{\directlua{ local barracuda = require "barracuda" diff --git a/macros/luatex/generic/barracuda/doc/barracuda.pdf b/macros/luatex/generic/barracuda/doc/barracuda.pdf Binary files differdeleted file mode 100644 index 99d8034ea3..0000000000 --- a/macros/luatex/generic/barracuda/doc/barracuda.pdf +++ /dev/null diff --git a/macros/luatex/generic/barracuda/doc/barracuda.tex b/macros/luatex/generic/barracuda/doc/barracuda.tex deleted file mode 100644 index 0fc6fbac28..0000000000 --- a/macros/luatex/generic/barracuda/doc/barracuda.tex +++ /dev/null @@ -1,413 +0,0 @@ -% !TeX program = LuaLaTeX -% Copyright (C) 2020 Roberto Giacomelli -% Barracuda manual, main TeX source file - -\documentclass[11pt,a4paper]{article} -\usepackage{fontspec} -\usepackage{geometry} -\usepackage{fancyvrb} -\usepackage{graphicx} -\usepackage{hyperref} - -% special macro for manual typesetting -\input{barracuda-manual-tool} - -\hypersetup{ -hidelinks, -linktoc = all, -pdfinfo={ - Title={the Barracuda manual}, - Subject={Barcode printing package}, - Author={Roberto Giacomelli}, - Keywords={Barcode EAN Code128 Lua} -}} - -\setmainfont{Libertinus Serif} -\setmonofont[Scale=0.82]{Fira Mono} -\fvset{ - fontsize=\small, - frame=single, - labelposition=topline, - framesep=5pt -} -\geometry{ - left=32mm, - right=40mm, - top=22mm, - bottom=28mm -} - -\author{Roberto Giacomelli\\\small email: \url{giaconet.mailbox@gmail.com}} -\title{the \code{barracuda} manual\\[1ex] -\small \url{https://github.com/robitex/barracuda}} -\date{\small Date \brcdkey{date} --- Version \brcdkey{version} --- Beta stage} - -\begin{document} -\maketitle - -\abstract{% -Welcome to the \brcd{} software project devoted to barcode printing. - -This manual shows you how to print barcodes in your \TeX{} documents and how to -export such graphic content to an external file, using \brcd{}. - -\brcd{} is written in Lua programming language and is free software released -under the GPL 2 License.% -} - -\tableofcontents -\newpage - - -\section{Getting started} -\label{secStart} - -\subsection{Introduction} -\label{secIntro} - -Barcode symbols are usually a sequence of vertical lines representing encoded -data that can be retrived with special laser scanner or more simpler with a -smartphone running dedicated apps. Almost every store item has a label with a -printed barcode for automatic identification purpose. - -So far, \brcd{} supported symbologies are as the following: -\begin{itemize} - \item Code 39, - \item Code 128, - \item EAN family (ISBN, ISSN, EAN 8, EAN 13, and the add-ons EAN 2 and EAN 5), - \item ITF 2of5, interleaved Two of Five. -\end{itemize} - -The package provides different output graphic format. At the moment they are: -\begin{itemize} - \item PDF Portable Document Format (a modern \TeX{} engine is required), - \item SVG Scalable Vector Graphic. -\end{itemize} - -The name \brcd{} is an assonance to the name Barcode. I started the project back -in 2016 for getting barcode in my \TeX{} generated PDF documents, studying the -Lua\TeX{} technology such as direct \emph{pdfliteral node} creation. - -At the moment \brcd{} is in \emph{beta} stage. In this phase the Lua API can -change respect to the result of development research. - - -\subsection{Manual Content} - -The manual is divided into five part. In part~\ref{secIntro} introduces the -package and gives to the user a proof of concept to how to use it. The next -parts present detailed information about option parameter of each barcode -symbology and methods description to change the \emph{module} width of a EAN-13 -barcode. It's also detailed how the Lua code works internally and how to -implement a barcode symbology not already included in the package. - -The plan of the manual is (but some sections are not completed yet): -\begin{description} -\item[Part 1:] Getting started -\begin{itemize} - \item general introduction \( \to \) \pageref{secIntro} - \item print your first barcode \( \to \) \pageref{secEnter} - \item installing \brcd{} on your system \( \to \) \pageref{secInstall} -\end{itemize} - -\item[Part 2:] \LaTeX{} packages -\begin{itemize} - \item \brcd{} \LaTeX{} package \( \to \) \pageref{secLaTeXPkg} -\end{itemize} - -\item[Part 3:] Barcode Reference and Parameters -\begin{itemize} - \item encoder identification rule \( \to \) \pageref{secEncName} - \item barcode symbologies reference \( \to \) \pageref{secBcRef} -\end{itemize} - -\item[Part 4:] Advanced Work with \brcd{} -\begin{itemize} - \item Lua framework description \( \to \) \pageref{secFramework} - \item API reference \( \to \) \pageref{secAPI} - \item \code{ga} specification \( \to \) \pageref{secGA} -\end{itemize} - -\item[Part 5:] Real examples -\begin{itemize} - \item working example and use cases \( \to \) \pageref{secExample} -\end{itemize} -\end{description} - - -\subsection{Required knowledge and useful resources} - -\brcd{} is a Lua package that can be executed by any Lua interpreter. To use it, -it's necessary a minimal knowledge of Lua programming language and a certain -ability with the terminal of your computer system in order to run command line -task or make software installation. - -It's also possible to run \brcd{} directly within a \TeX{} source file, and -compile it with a suitable typesetting engine like Lua\TeX{}. In this case a -minimal \TeX{} system knowledge is required. As an example of this workflow you -simply can look to this manual because itself is typesetted with LuaLa\TeX{}, -running \brcd{} to include barcodes as a vector graphic object. - -A third way is to use the \LaTeX{} package \code{barracuda.sty} with its high -level macros. A minimal knowledge of the \LaTeX{} format is obviously required. - -Here is a collection of useful learning resources: -\begin{description} -\item[Lua:] to learn Lua the main reference is the book called PIL, Programming -in Lua from one of the language's Author Roberto Ierusalimschy. -\item[\LaTeX:] \dots -\item[Lua\TeX:] \dots -\end{description} - - -\subsection{Running Barracuda} -\label{secEnter} - -The starting point to work with \brcd{} is always a plain text file with some -code processed by a command line program with a Lua interpreter. - -The paradigm of \brcd{} is the Object Oriented Programming. Generally speaking -every object must be created with a function called \emph{costructor} and every -action must be run calling a \emph{method} of it. - -In this section you'll take a taste of \brcd{} coding in three different -execution context: a Lua script, a Lua\TeX{} document and a \LaTeX{} source file -using the macro package \code{barracuda.sty} providing an high level interface -to Lua code. - -High level package like \code{barracuda.sty} make to write Lua code unnecessary. -It will be always possible return to Lua code in order to resolve complex -barcode requirements. - - -\subsubsection{A Lua script} - -As a practical example to produce an EAN~13 barcode, open a text editor of your -choice on an empty file and save it as \code{first-run.lua} with the content of -the following two lines of code: -\medskip -\begin{Verbatim}[label=\footnotesize\code{first-run.lua}] -local barracuda = require "barracuda" -barracuda:save("ean-13", "8006194056290", "my_barcode", "svg") -\end{Verbatim} - -What you have done is to write a \emph{script}. If you have installed a Lua -interpreter along with \brcd{}, open a terminal and run it with the command: -\begin{Verbatim} -$ lua first-run.lua -\end{Verbatim} - -You will see in the same directory of your script, appearing a new file called -\code{my\_barcode.svg} with the drawing: -\begin{center} -\includegraphics{image/8006194056290} -\end{center} - -Coming back to the script first of all, it's necessary to load the library -\brcd{} with the standard Lua function \code{require()} that returns an -object---more precisely a reference to a table where are stored all the -package machinery. - -With the second line of code, an EAN~13 barcode is saved as -\code{my\_barcode.svg} using the method \code{save()} of the \brcd{} object. The -\code{save()} method takes in order the barcode symbology identifier called -\emph{treename}, an argument as a string or as a whole number that represents -data to be encoded, the output file name and the optional output format. With a -fifth optional argument we can pass options to the barcode encoder as a Lua -table. - -Each encoder has an own identifier called treename explained at -section~\ref{secEncName}. In short, in \brcd{} we can build more encoders of the -same symbology with different parameters. - - -\subsubsection{A Lua\TeX{} source file} - -\brcd{} can also runs with Lua\TeX{} and any others Lua powered \TeX{} -engines. The source file is a bit difference respect to the previuos script: the -Lua code lives inside the argument of a \verb=\directlua= primitive, moreover we -must use an horizontal box register as output destination. -\begin{Verbatim} -% !TeX program = LuaTeX -\newbox\mybox -\directlua{ - local require "barracuda" - barracuda:hbox("ean-13", "8006194056290", "mybox") -}\leavevmode\box\mybox -\bye -\end{Verbatim} - -The method \code{hbox()} works only with Lua\TeX{}. It takes three\footnote{A -fourth argment is optional as a table with user defined barcode parameters.} -arguments: encoder \emph{treename}, encoding data as a string, the \TeX{} -horizontal box name. - - -\subsubsection{A Lua\LaTeX{} source file} - -\LaTeX{} working minimal example would be: -\begin{Verbatim} -% !TeX program = LuaLaTeX -\documentclass{article} -\usepackage{barracuda} -\begin{document} -\barracuda{ean-13}{8006194056290} -\end{document} -\end{Verbatim} - - -\subsection{A more deep look} - -\brcd{} is designed to be modular and flexible. For example it is possible to -draw different barcodes on the same canvas or tune barcode parameters. - -The main workflow to draw a barcode object reveals more details on internal -structure. In fact, to draw an EAN~13 barcode we must do at least the following -steps: -\begin{enumerate} -\item load the library, -\item get a reference to the \code{Barcode} abstract class, -\item build an \code{ean} encoder of the variant \code{13}, -\item build an EAN~13 symbol passing data to a costructor, -\item get a reference to a new canvas object, -\item draw barcode on the canvas object, -\item get a reference of the driver object, -\item print the graphic material saving an external \code{svg} file. -\end{enumerate} - -Following that step by step procedure the corresponding code is translated in -the next listing: -\begin{Verbatim} --- lua script -local barracuda = require "barracuda" -- step 1 -local barcode = barracuda:barcode() -- step 2 - -local ean13, err_enc = barcode:new_encoder("ean-13") -- step 3 -assert(ean13, err_enc) - -local symb, err_symb = ean13:from_string("8006194056290") -- step 4 -assert(symb, err_symb) - -local canvas = barracuda:new_canvas() -- step 5 -symb:append_ga(canvas) -- step 6 - -local driver = barracuda:get_driver() -- step 7 -local ok, err_out = driver:save("svg", canvas, "my_barcode") -- step 8 -assert(ok, err_out) -\end{Verbatim} - -Late the manual will give objects and methods references at -section~\ref{secAPI}. - - -\subsection{Installing} -\label{secInstall} - -\subsubsection{Installing for Lua} - -Manually copy \code{src} folder content to a suitable directory of your system -that is reachable to the system Lua interpreter. - -\subsubsection{Installing for TeX Live} - -If you have TeX Live installed from CTAN or from DVD TeX Collection, before any -modification to your system check if the package is already installed looking -for \emph{installed} key in the output of the command: -\begin{Verbatim} -$ tlmgr show barracuda -\end{Verbatim} - -If `barracuda` is not present, run the command: -\begin{Verbatim} -$ tlmgr install barracuda -\end{Verbatim} - -If you have installed TeX Live via Linux OS repository try your distribution's -package management system running a software update. - -It's also possible to install the package manually: -\begin{enumerate} -\item Grab the sources from CTAN or \url{https://github.com/robitex/barracuda}. -\item Unzip it at the root of one or your TDS trees (local or personal). -\item You may need to update some filename database after this, see your \TeX{} -distribution's manual for details. -\end{enumerate} - - -\section{Barracuda \LaTeX{} Package} -\label{secLaTeXPkg} - -The \LaTeX{} package delivered with \brcd{} is still under an early stage of -development. The only macro available is \verb=\barracuda{encoder}{data}=. -A simple example is the following source file for Lua\LaTeX{}: -\begin{Verbatim} -% !TeX program = LuaLaTeX -\documentclass{article} -\usepackage{barracuda} -\begin{document} -\leavevmode -\barracuda{code39}{123ABC}\\ -\barracuda{code128}{123ABC} -\end{document} -\end{Verbatim} - -Every macro \verb=\barracuda= typesets a barcode symbol with the encoder defined -in the first argument, encoding data defined by the second. - - -\section{Barcode parameters} -\label{secBarcodeReference} - -\subsection{Encoder treename} -\label{secEncName} - -TODO - -\subsection{Barcode Reference} -\label{secBcRef} - -TODO - -\section{Developer zone} - -\subsection{The Barracuda Framework} -\label{secFramework} - -The \brcd{} package framework consists in indipendent modules: a barcode class -hierarchy encoding a text into a barcode symbology; a geometrical library called -\code{libgeo} representing several graphic objects; an encoding library for the -\code{ga} format (graphic assembler) and several driver to \emph{print} a ga -stream into a file or a \TeX{} hbox register. - -To implement a barcode encoder you have to write a component called -\emph{encoder} defining every parameters and implementing the encoder builder, -while a driver must understand ga opcode stream and print the corresponding -graphic object. - -Every barcode encoder come with a set of parameters, some of them can be -reserved and can't be edit after the encoder was build. So, you can create many -instances of the same encoder for a single barcode type, with its own parameter -set. - -The basic idea is getting faster encoders, for which the user may set up -paramenters at any level: barcode abstract class, encoder globally, down to a -single symbol object. - -The Barcode class is completely indipendent from the ouput driver and viceversa. - -\subsection{Lua API reference} -\label{secAPI} - -TODO - -\subsection{\code{ga} specification} -\label{secGA} - -TODO - -\section{Example and use cases} -\label{secExample} - -TODO - -\end{document} diff --git a/macros/luatex/generic/barracuda/doc/barracuda-ga-asm.pdf b/macros/luatex/generic/barracuda/doc/ga-graphic-asm/barracuda-ga-asm.pdf Binary files differindex 18ba18b9c2..18ba18b9c2 100644 --- a/macros/luatex/generic/barracuda/doc/barracuda-ga-asm.pdf +++ b/macros/luatex/generic/barracuda/doc/ga-graphic-asm/barracuda-ga-asm.pdf diff --git a/macros/luatex/generic/barracuda/doc/barracuda-ga-asm.tex b/macros/luatex/generic/barracuda/doc/ga-graphic-asm/barracuda-ga-asm.tex index 014cb9d1c4..ff8d3e1ff4 100644 --- a/macros/luatex/generic/barracuda/doc/barracuda-ga-asm.tex +++ b/macros/luatex/generic/barracuda/doc/ga-graphic-asm/barracuda-ga-asm.tex @@ -1,5 +1,5 @@ % !TeX program = LuaLaTeX -% Copyright (C) 2020 Roberto Giacomelli +% Copyright (C) 2019-2022 Roberto Giacomelli \documentclass{article} @@ -60,8 +60,9 @@ OpCode & Mnemonic key & Graphic property & Operands\\ 3 & line\_join\_style & Line join style & <e: u8>\\ 8 & color & ... \\ \midrule -30 & start\_bbox\_group & Stop to check the bounding box & -\\ -31 & end\_bbox\_group & Set a bounding box and restart to check & <x1: DIM> <y1: DIM> <x2: DIM> <y2: DIM>\\ +29 & enable\_bbox & start to update the bounding box & -\\ +30 & disable\_bbox & Stop to check the bounding box & -\\ +31 & set\_bbox & Set a bounding box & <x1: DIM> <y1: DIM> <x2: DIM> <y2: DIM>\\ \bottomrule \end{tabular} @@ -100,7 +101,6 @@ OpCode & Mnemonic key & Graphic object & Operands\\ 49 & f\_rect & Filled rectangle & <x1: DIM> <y1: DIM> <x2: DIM> <y2: DIM>\\ 50 & rect\_size & Rectangle & <x1: DIM> <y1: DIM> <w: DIM> <h: DIM>\\ 51 & f\_rect\_size & Filled rectangle & <x1: DIM> <y1: DIM> <w: DIM> <h: DIM>\\ - \bottomrule \end{tabular} diff --git a/macros/luatex/generic/barracuda/doc/barracuda-manual-tool.tex b/macros/luatex/generic/barracuda/doc/manual/barracuda-manual-tool.tex index 8b00e1c2b5..3b19fd5ab5 100644 --- a/macros/luatex/generic/barracuda/doc/barracuda-manual-tool.tex +++ b/macros/luatex/generic/barracuda/doc/manual/barracuda-manual-tool.tex @@ -35,5 +35,15 @@ end }} +\newcommand{\brcdparametertab}[1]{\directlua{ + local enc_id = [=[#1]=] + local t = {} + tex.print() + local barcode = barracuda:barcode() + local info = barcode:info() + local param = info.param + +}} +\endinput diff --git a/macros/luatex/generic/barracuda/doc/manual/barracuda-manual.pdf b/macros/luatex/generic/barracuda/doc/manual/barracuda-manual.pdf Binary files differnew file mode 100644 index 0000000000..af224cc148 --- /dev/null +++ b/macros/luatex/generic/barracuda/doc/manual/barracuda-manual.pdf diff --git a/macros/luatex/generic/barracuda/doc/manual/barracuda-manual.tex b/macros/luatex/generic/barracuda/doc/manual/barracuda-manual.tex new file mode 100644 index 0000000000..971650e813 --- /dev/null +++ b/macros/luatex/generic/barracuda/doc/manual/barracuda-manual.tex @@ -0,0 +1,1312 @@ +% !TeX program = LuaLaTeX +% Copyright (C) 2019-2022 Roberto Giacomelli +% Barracuda manual, main TeX source file + +\documentclass[11pt,a4paper]{article} +\usepackage{fontspec} +\usepackage{geometry} +\usepackage{fancyvrb} +\usepackage{graphicx} +\usepackage{booktabs} +\usepackage{array} +\usepackage{tikz} +\usepackage{tcolorbox} +\usepackage{hyperref} + +\newcolumntype{C}{>{\ttfamily}c} +\newcolumntype{L}{>{\ttfamily}l} + +\usetikzlibrary{arrows.meta} + +% special macro for manual typesetting +\input{barracuda-manual-tool} + +\tcbuselibrary{skins} +\tcbset{ + sharpish corners, + drop shadow=gray!75, + halign lower=center, + left=5pt, + boxrule=1.2pt, + titlerule=0.8pt, + colback=green!10!white, + colbacktitle=green!10!white, + coltitle=black, + bicolor,colbacklower=white, + righthand width=80pt +} + +\hypersetup{ +hidelinks, +linktoc = all, +pdfinfo={ + Title={The Barracuda manual}, + Subject={Barcode printing package}, + Author={Roberto Giacomelli}, + Keywords={Barcode EAN UPC Code128 ITF14 Lua} +}} +\definecolor{CodeBlue}{rgb}{0.05,0.05,0.80} +\setmainfont{Libertinus Serif} +\setmonofont[Scale=0.82]{Fira Mono} +\fvset{ + fontsize=\small, + labelposition=topline, + formatcom=\color{black}, +} +\geometry{ + left=38mm, + right=28mm, + top=22mm, + bottom=28mm +} + +\author{Roberto Giacomelli\\\small email: \url{giaconet.mailbox@gmail.com}} +\title{the \code{barracuda} manual\\[1ex] +\small \url{https://github.com/robitex/barracuda}} +\date{\small Date \brcdkey{date} --- Version \brcdkey{version} --- Beta stage} + +\newbox\mybox + +\begin{document} +\maketitle + +\abstract{% +Welcome to the \brcd{} software project devoted to barcode printing. + +This manual shows you how to print barcodes in your \TeX{} documents and how to +export such graphic content to an external file. + +\brcd{} is written in Lua and is free software released under the GPL 2 License. +} + +\tableofcontents +\newpage + + +\section{Getting started} +\label{secStart} + +\subsection{Introduction} +\label{secIntro} + +Barcode symbols are usually a sequence of vertical lines representing encoded +data that can be retrived with special laser scanner or more simpler with a +smartphone running dedicated apps. Almost every store item has a label with a +printed barcode for automatic identification purpose. + +So far, \brcd{} supported symbologies are as the following: +\begin{itemize} +\item Code 39, +\item Code 128, +\item EAN family (ISBN, ISSN, EAN 8, EAN 13, and the add-ons EAN 2 and EAN 5), +\item ITF 2of5, interleaved Two of Five (ITF14, i2of5 in general), +\item UPC-A. +\end{itemize} + +The package provides different output graphic format. At the moment they are: +\begin{itemize} +\item PDF Portable Document Format (a modern \TeX{} engine is required), +\item SVG Scalable Vector Graphic. +\end{itemize} + +The name \brcd{} is an assonance to the name Barcode. I started the project back +in 2016 for getting barcode in my \TeX{} generated PDF documents, studying the +Lua\TeX{} technology such as direct \emph{pdfliteral} node creation. + +At the moment \brcd{} is in \emph{beta} stage. In this phase the Lua API may +change respect to the result of development activity. + + +\subsection{Manual Content} + +The manual is divided into five part. In part~\ref{secIntro} introduces the +package and gives to the user a proof of concept to how to use it. The next +parts present detailed information about option parameter of each barcode +symbology and methods description to change the \emph{module} width of a EAN-13 +barcode. It's also detailed how the Lua code works internally and how to +implement a barcode symbology not already included in the package. + +The manual plan is: +\begin{description} +\item[Part 1:] Getting started +\begin{itemize} + \item general introduction \( \to \) \pageref{secIntro} + \item print your first barcode \( \to \) \pageref{secEnter} + \item installing \brcd{} on your system \( \to \) \pageref{secInstall} +\end{itemize} + +\item[Part 2:] \LaTeX{} packages +\begin{itemize} + \item \brcd{} \LaTeX{} package \( \to \) \pageref{secLaTeXPkg} +\end{itemize} + +\item[Part 3:] Barcode Reference +\begin{itemize} + \item barcode symbologies reference \( \to \) \pageref{secBcRef} +\end{itemize} + +\item[Part 4:] Developer zone +\begin{itemize} + \item the Lua framework \( \to \) \pageref{secFramework} + \item encoder identification rule \( \to \) \pageref{secEncName} + \item API reference \( \to \) \pageref{secAPI} + \item \code{ga} specification \( \to \) \pageref{secGA} +\end{itemize} + +\item[Part 5:] Real examples +\begin{itemize} + \item working example and use cases \( \to \) \pageref{secExample} +\end{itemize} +\end{description} + + +\subsection{Required knowledge and useful resources} + +\brcd{} is a Lua package that can be executed by any Lua interpreter. To use it, +it's necessary a minimal knowledge of Lua programming language and a certain +ability with the terminal of your computer system in order to run command line +task or make software installation. + +It's also possible to run \brcd{} directly within a \TeX{} source file, and +compile it with a suitable typesetting engine like Lua\TeX{}. In this case a +minimal \TeX{} system knowledge is required. As an example of this workflow you +simply can look to this manual because itself is typesetted with LuaLa\TeX{}, +running \brcd{} to include barcodes as a vector graphic object. + +A third way is to use the \LaTeX{} package \code{barracuda.sty} with its high +level macros. A minimal knowledge of the \LaTeX{} format is obviously required. + +Here is a collection of useful learning resources: +\begin{description} +\item[Lua:] to learn Lua the main reference is the book called PIL that stands +for Programming in Lua from one of the language's Author Roberto Ierusalimschy. +\item[Lua\TeX:] the typesetting engine manual can be opened running the +\code{texdoc} utility in a terminal window of your system, typing the command: +\begin{Verbatim} +$ texdoc luatex +\end{Verbatim} +\end{description} + + +\subsection{Running Barracuda} +\label{secEnter} + +The starting point to work with \brcd{} is always a plain text file with some +code processed by a command line program with a Lua interpreter. + +In this section you'll take a taste of \brcd{} coding in three different +execution context: a Lua script, a Lua\TeX{} document and a \LaTeX{} source file +using the macro package \code{barracuda.sty} providing an high level interface +to the Lua library. + +High level package like \code{barracuda.sty} make to write Lua code unnecessary. +It will be always possible to return to Lua code in order to resolve complex +barcode requirements. + + +\subsubsection{A Lua script} + +The paradigm of \brcd{} is the Object Oriented Programming. Generally speaking +every library object must be created with a function called \emph{constructor} +and every action on it must be run calling an object \emph{method}. + +In Lua a constructor or even a method call syntax it's a little bit different +from the usual form because we have to use the \emph{colon notation}: +\begin{BVerbatim} +object:method(args) +\end{BVerbatim} + +As a practical example, to produce an EAN~13 barcode, open a text editor of your +choice on an empty file and save it as \code{first-run.lua} with the content of +the following two lines of code: +\begin{tcolorbox}[ + title={\code{first-run.lua}} +] +\begin{BVerbatim} +local barracuda = require "barracuda" +barracuda:save("ean-13", "8006194056290", "my_barcode", "svg") +\end{BVerbatim} +\end{tcolorbox} + +What you have done is to write a \emph{script}. If you have installed a Lua +interpreter along with \brcd{}, open a terminal and run it with the command: +\begin{BVerbatim} +$ lua first-run.lua +\end{BVerbatim} + +Into the same directory of your script you will see a new file called +\code{my\_barcode.svg} with the drawing: +\begin{center} +\includegraphics{image/8006194056290} +\end{center} + +Coming back to the script, the first statement loads the library \brcd{} with +the standard Lua function \code{require()} that returns an object---more +precisely a reference to a table where are stored all the package machinery. + +With the second line of code, an EAN~13 barcode is saved as +\code{my\_barcode.svg} using the method \code{save()} of the \brcd{} object. The +\code{save()} method takes four mandatory argumetns: the barcode symbology +identifier called \emph{treename}, an argument as a string or as a whole number +that represents data to be encoded, the output file name and the optional output +format. With a fifth optional argument we can pass options to the barcode +encoder as a Lua table in the \code{option=value} format. + +In more detail, thanks to treename identifier explained at +section~\ref{secEncName} is possible to build more encoders of the same +symbology each with a different set of parameters. + +It's also possible to run a Lua script with \code{texlua}, the Lua interpreter +improved with certain Lua\TeX{} libraries delivered by any modern \TeX{} +distribution. \code{texlua} saves you to install Lua if you are a \TeX{} user. + +The command to run \code{first-run.lua} is the same as before, just a +substitution of the name \code{lua} with \code{texlua}, but an adjustment is +required if we want to run the script with \TeX{} delivered \brcd{} library +leaving untouched the system outside \code{texmf}. + +An alternative path searching procedure consists to find the main file of +\brcd{} with an internal Lua\TeX{} library called \code{kpse}: +\begin{Verbatim} +-- texlua script +kpse.set_program_name("luatex") +local path_to_brcd = kpse.find_file("barracuda", "lua") +local barracuda = dofile(path_to_brcd) +barracuda:save("ean-13", "8006194056290", "my_barcode", "svg") +\end{Verbatim} + + +\subsubsection{A Lua\TeX{} source file} + +\brcd{} can also runs with Lua\TeX{} and any others Lua powered \TeX{} +engines. The source file is a bit difference respect to the previous script: the +Lua code lives inside the argument of a \verb=\directlua= primitive, moreover we +must use an horizontal box register as the output destination. +\begin{tcolorbox}[ + title={\code{first-run.tex}: Lua\TeX{} version} +] +\begin{BVerbatim} +% !TeX program = LuaTeX +\newbox\mybox +\directlua{ + local require "barracuda" + barracuda:hbox("ean-13", "8006194056290", "mybox") +}\leavevmode\box\mybox +\bye +\end{BVerbatim} +\end{tcolorbox} +The method \code{hbox()} works only with Lua\TeX{}. It takes three\footnote{A +fourth argment is optional as a table with user defined barcode parameters.} +arguments: encoder \emph{treename}, encoding data as a string, the \TeX{} +horizontal box name. + + +\subsubsection{A Lua\LaTeX{} source file} + +A \LaTeX{} working minimal example would be: +\begin{tcolorbox}[ + sidebyside, + title={\code{first-run.tex}: Lua\LaTeX{} version}, + righthand width=120pt +] +\begin{BVerbatim} +% !TeX program = LuaLaTeX +\documentclass{article} +\usepackage{barracuda} +\begin{document} +\barracuda{ean-13}{8006194056290} +\end{document} +\end{BVerbatim} +\tcblower\ttfamily +\hfill\barracuda{ean-13}{8006194056290}\hfill\hbox{} +\end{tcolorbox} + + +\subsection{A more deep look} + +\brcd{} is designed to be modular and flexible. For example it is possible to +draw different barcodes on the same canvas or tuning barcode parameters. + +The low level workflow to draw a barcode object reveals more details on the +internal architecture. In fact, we must do at least the following steps divided +into three phases: +\begin{description} +\item[a.1] load the library, +\item[a.2] get a reference to the \code{Barcode} abstract class, +\item[a.3] build an encoder, +\item[a.4] build a symbol passing data to an encoder's constructor, +\item[b.1] get a reference to a new canvas object, +\item[b.2] draw barcode on the canvas object, +\item[c.1] load the driver, +\item[c.2] print the figure as an external \code{svg} file. +\end{description} + +In the phase \textbf{a} a barcode symbols is created, then in phase \textbf{b} a +canvas object is filled with the graphic elements of the symbol, and finally in +the phase \textbf{c} the canvas is sent to the driver output channel. + +Following the procedure step by step, the resulting code is as the following +listing, where the encoder is EAN variant 13: +\begin{tcolorbox} +\begin{BVerbatim} +-- a lua script +local barracuda = require "barracuda" -- step a.1 +local barcode = barracuda:barcode() -- step a.2 +local ean13, err_enc = barcode:new_encoder("ean-13") -- step a.3 +assert(ean13, err_enc) +local symb, err_symb = ean13:from_string("8006194056290") -- step a.4 +assert(symb, err_symb) + +local canvas = barracuda:new_canvas() -- step b.1 +symb:draw(canvas) -- step b.2 + +local drv = barracuda:get_driver() -- step c.1 +local ok, err_out = drv:save("svg", canvas, "my_barcode") -- step c.2 +assert(ok, err_out) +\end{BVerbatim} +\end{tcolorbox} + +Anyway, more abstract methods allow the user to write a more compact code. For +instance, phase \textbf{b} can be fuse with \textbf{c}, thanks to a +a reference to the driver object included in the \code{canvas} object: +\begin{Verbatim} +-- phase b + c +local canvas = barracuda:new_canvas() -- step bc.1 +symb:draw(canvas) -- step bc.2 +local ok, err_out = canvas:save("svg", "my_barcode") -- step bc.3 +assert(ok, err_out) +\end{Verbatim} + +As we have been seen before an high level method provides a way to unify all the +phases: +\begin{Verbatim} +-- unique phase version +local require "barracuda" +barracuda:save("ean-13", "8006194056290", "my_barcode", "svg") +\end{Verbatim} + +Low level code offers more control while high level programming is quite +compact. Late in the manual you will find the objects and methods reference at +section~\ref{secAPI}. + + +\subsection{Installing \brcd} +\label{secInstall} + +\subsubsection{Installing for Lua} + +Manually copy \code{src} folder content to a suitable directory of your system +that is reachable to the system Lua interpreter. + + +\subsubsection{Installing for TeX Live} + +If you have TeX Live installed from CTAN or from DVD TeX Collection, before any +modification to your system check if the package is already installed looking +for \emph{installed} key in the output of the command: +\begin{Verbatim} +$ tlmgr show barracuda +\end{Verbatim} + +If \brcd{} is reported as not installed, run the command: +\begin{Verbatim} +$ tlmgr install barracuda +\end{Verbatim} + +If you have installed TeX Live via your Linux repository, try your +distribution's package manager an update or check for optional packages not yet +installed. + +It's also possible to install \brcd{} manually with these steps: +\begin{enumerate} +\item Grab the sources from CTAN or from the official repository +\url{https://github.com/robitex/barracuda}. +\item Unzip it at the root of one of your TDS trees (local or personal). +\item You may need to update some filename database after this, see your \TeX{} +distribution's manual for details. +\end{enumerate} + + +\section{Barracuda \LaTeX{} Package} +\label{secLaTeXPkg} + +The \LaTeX{} package delivered with \brcd{} is still under an early stage of +development. The only macro available is +\verb=\barracuda[option]{encoder}{data}=. A simple example is the following +source file for Lua\LaTeX{}: +\begin{tcolorbox}[sidebyside] +\begin{BVerbatim} +% !TeX program = LuaLaTeX +\documentclass{article} +\usepackage{barracuda} +\begin{document} +\leavevmode +\barracuda{code128}{123ABC}\\[2ex] +\barracuda[text_star=true]{code39}{123ABC} +\end{document} +\end{BVerbatim} +\tcblower +\leavevmode +\barracuda{code128}{123ABC}\\[2ex] +\barracuda[text_star=true]{code39}{123ABC} +\end{tcolorbox} + +Every macro \brcd{} typesets a barcode symbol with the encoder defined in the +first argument, encoding data defined by the second. + + +\section{Barcode Reference} +\label{secBcRef} + +\begin{figure} +\centering +\begin{tikzpicture} +\ttfamily +\draw (-20mm, -20mm) rectangle (20mm, 20mm); +\end{tikzpicture} +\caption{Barcode class hierarchy.} +\label{figBarcodeHierarchy} +\end{figure} + +\subsection{Common, Global and Local Barcode Options} + +Every barcode encoder inherits from \code{Barcode} abstract class methods and +options. If we change its option values, the changes will be global for all the +encoders except if the encoder has not an own local option overwritten before. + +The same schema applying also for encoder and the barcode symbols build apart +from it. Every symbol inherits methods and options from its encoder. + +Such three levels option system is designed to allow the user to set up option +not only in a certain point in the tree object, but also any time in the code. +When changes are accepted by an object they become valid for that time on. + +The architecture of barcode classes is shown in more details in +figure~\ref{figBarcodeHierarchy}. At the top of the hierarchy there is the +\code{Barcode} class. It's an abstract class in the sense that no symbols can be +printed by that class. + +At an intermediate level we found a \code{Builder} with an instance of one of +its \code{Encoder} class. When we call method \code{new\_encoder()} provided by +\code{Barcode} class, what really happen is the loading of the \code{Builder} if +not just loaded before, that is the actual library of the specific simbology, +and a linked \code{Encoder} object incorporates its own options. + +At the last level are placed the symbol instances derived both from the +\code{Builder} and \code{Encoder}, the first provides methods while the second +provides option values. Only these objects are printable in a barcode graphic. + +Common options of \code{Barcode} are the following: +\begin{center} +\begin{tabular}{@{}ccp{75mm}@{}} +\toprule +Option Id & Type/default & Description\\ +\midrule +\code{ax} & numeric/0 & Relative x-coordinate for insertion point of the barcode symbol\\ +\midrule +\code{ay} & numeric/0 & Relative y-coordinate for insertion point of the barcode symbol\\ +\midrule +\code{debug\_bbox} & enum/\code{none} & Draw symbol bounding box with a thin dashed line\\ + & \code{none} & \small do nothing\\ + & \code{symb} & \small draw the bbox of the symbol\\ + & \code{qz} & \small draw the bbox at quietzone border\\ + & \code{qzsymb} & \small draw symbol and quietzone bboxes\\ +\bottomrule +\end{tabular} +\end{center} + + +For each barcode symbologies the next section reports parameters and optional +methods of it. + +\subsection{Code39} +\label{secCode39} + +\code{Code39} is one of the oldest symbologies ever invented. It doesn't include +any checksum digit and the only encodable characters are digits, uppercase +letters and a few symbol like \code{+} or \code{\$}. + + + + + +\subsection{Code128} +\label{secCode128} + + + +% devzone color setup +\tcbset{ + colback=blue!10!white, + colbacktitle=blue!10!white, +} + +\section{Developer zone} + +\subsection{The Barracuda Framework} +\label{secFramework} + +The \brcd{} package framework consists in independent modules: a barcode class +hierarchy encoding a text into a barcode symbology; a geometrical library called +\code{libgeo} modeling several graphic objects; an encoding library for the +\code{ga} format (graphic assembler) and several driver to \emph{print} a +\code{ga} stream into a file or in a \TeX{} \code{hbox} register. + +To implement a barcode encoder you have to write a component called +\emph{encoder} defining every parameters and implementing the encoder builder, +while a driver must understand ga opcode stream and print the corresponding +graphic object. + +Every barcode encoder come with a set of parameters, some of them can be +reserved and can't be edit after the encoder was build. So, you can create many +instances of the same encoder for a single barcode type, with its own parameter +set. + +The basic idea is getting faster encoders, for which the user may set up +parameters at any level: barcode abstract class, encoder globally, down to a +single symbol object. + +The Barcode class is completely independent from the output driver and vice +versa. + + +\subsection{Error Management} + +Functions in Lua may return more than one parameters. \brcd{} methods takes +advantage by this feature for the error management. In fact, \brcd{} as a +library, remind the responsibility to the caller in order to choose what to do +in case an error is reported. + +When a method may fail depending on the correctness of the input, it returns two +parameters alternatively valid: the first is the expected result while the +second is the error description. + +This behavior perfectly match the arguments required by the \code{assert()} +built-in function. + + + + +\subsection{Encoder Treename} +\label{secEncName} + +In \brcd{} in order to draw a barcode symbol it's necessary to create an +\code{Encoder} object + + +\subsection{API reference of Lua modules} +\label{secAPI} + +TODO + +\subsection{\code{ga} specification} +\label{secGA} + +This section defines and explains with code examples the \code{ga} instruction +stream. \code{ga} stands for \emph{graphic assembler}, a sort of essential +language that describes geometrical object like lines and rectangles mainly for +a barcode drawing library on a cartesian plane \( (O, x, y) \). + +The major goal of any \brcd{} encoder is to create the \code{ga} stream +corresponding to a vector drawing of a barcode symbol. + +In details, a \code{ga} stream is a numeric sequence that like a program defines +what must be draw. It is not a fully binary sequence---which is a byte stream +and ideally is what a \code{ga} stream would really be---but a sequence of +integers or floating point numbers. + +In Lua this is very easy to implement. Simply append a numeric value to a table +that behave as an array. Anyway \code{ga} must be basically a binary format +almost ready to be sent or received by means of a network channel. + +In the Backus–Naur form a valid \code{ga} stream grammar is described by the +following code: +\begin{Verbatim} +<valid ga stream> ::= <instructions> +<instructions> ::= <instruction> + | <instruction> <instructions> +<instruction> ::= <opcode> + | <opcode> <operands> + +<opcode> ::= <state> + | <object> + | <func> +<state> ::= 1 .. 31; graphic properties +<object> ::= 32 .. 239; graphic objects +<func> ::= 240 .. 255; functions + +<operands> ::= <operand> + | <operand> <operands> +<operand> ::= <len> + | <coord> + | <qty> + | <char seq> + | <enum> + | <abs> + | <points> + | <bars> + +<len> ::= f64; unit measure scaled point sp = 1/65536pt +<coord> ::= f64; unit measure scaled point sp = 1/65536pt +<qty> ::= u64 +<char seq> ::= <chars> 0 +<chars> ::= <char> + | <char> <chars> +<char> ::= u64 +<enum> ::= u8 +<abs> ::= f64 +<points> ::= <point> + | <point> <points> +<point> ::= <x coord> <y coord> +<x coord> ::= <coord> +<y coord> ::= <coord> +<bars> ::= <bar> + | <bar> <bars> +<bar> := <coord> <len> + +; u8 unsigned 8 bit integer +; u64 unsigned 64 bit integer +; f64 floating point 64 bit number +\end{Verbatim} + + +Every \code{<instruction>} changes the graphic state---for instance the current +line width---or defines a graphic object, depending on the \code{opcode} value. +Coordinates or dimensions must be expressed as \emph{scaled point}, the +basic unit of measure of \TeX{} equivalent to \( 1/65536\, \)pt. + + +\subsubsection{Hard coded an horizontal line} + +The \code{opcode} for the \code{linewidth} operation is 1, while +for the \code{hline} operation is 33. An horizontal line 6pt width from the +point (0pt, 0pt) to the point (32pt, 0pt) is represented by this \code{ga} +stream: +\begin{Verbatim} +1 393216 33 0 2097152 0 +\end{Verbatim} + +Introducing \code{mnemonic opcode} in \code{opcode} places and separate the +operations in a multiline fashion, the same sequence become more readable and +more similar to an assembler listing: +\begin{Verbatim} +linewidth 393216 ; set line width to 393216sp +hline 0 2097152 0 ; draw hline x1 x2 y +\end{Verbatim} + +To prove and visualize the meaning of the stream, we can simply use the native +graphic driver of \brcd{} compiling this Lua\TeX{} source file: +\begin{Verbatim} +% !TeX program = LuaTeX +\newbox\mybox +\directlua{ + local barracuda = require "barracuda" + local ga = {1, 393216, 33, 0, 2097152, 0} + local drv = barracuda:get_driver() + drv:ga_to_hbox(ga, "mybox") +}\leavevmode\box\mybox +\bye +\end{Verbatim} + +The result is:\directlua{ +local ga = {1, 393216, 33, 0, 2097152, 0} +local drv = barracuda:get_driver() +drv:ga_to_hbox(ga, "mybox") +}\box\mybox + + +\subsubsection{Encoding \code{ga} with the \code{gaCanvas} class} + +A more abstract way to write a \code{ga} stream is provided by the +\code{gaCanvas} class of the \code{libgeo} module. Every operation with +identifier \code{opcode} is mapped to a method named \code{encode\_<opcode>()} +of a canvas object: +\begin{Verbatim} +% !TeX program = LuaTeX +\newbox\mybox +\directlua{ + local barracuda = require "barracuda" + local canvas = barracuda:new_canvas() + local pt = canvas.pt + canvas:encode_linewidth(6*pt) + canvas:encode_hline(0, 32*pt, 0) + local drv = barracuda:get_driver() + drv:ga_to_hbox(canvas, "mybox") + tex.print("[") + for _, n in ipairs(canvas:get_stream()) do + tex.print(tostring(n)) + end + tex.print("]") +} results in \box\mybox +\bye +\end{Verbatim} + +The stream is printed beside the drawing in the output PDF file. Therefore the +same \code{ga} stream can also generate a different output, for instance a SVG +file. For this purpose execute the \code{save()} method of the \code{Driver} +class (the drawing is showed side-by-side the listing): +\begin{tcolorbox}[sidebyside] +\begin{BVerbatim} +% !TeX program = LuaTeX +\newbox\mybox +\directlua{ + local barracuda = require "barracuda" + local canvas = barracuda:new_canvas() + local pt = canvas.pt + local side = 16*pt + local s = side/2 - 1.5*pt + local l = side/2 - 2*pt + local dim = 4 + canvas:encode_linewidth(1*pt) + canvas:encode_disable_bbox() + for c = 0, dim do + for r = 0, dim do + local x, y = c*side, r*side + canvas:encode_hline(x-l, x+l, y-s) + canvas:encode_hline(x-l, x+l, y+s) + canvas:encode_vline(y-l, y+l, x-s) + canvas:encode_vline(y-l, y+l, x+s) + end + end + local b1 = -s - 0.5*pt + local b2 = dim*side + s + 0.5*pt + canvas:encode_set_bbox(b1, b1, b2, b2) + canvas:ga_to_hbox("mybox") + canvas:save("svg", "grid") +}\leavevmode\box\mybox +\bye +\end{BVerbatim} +\tcblower +\directlua{ + local canvas = barracuda:new_canvas() + local pt = canvas.pt + local side = 16*pt + local s = side/2 - 1.5*pt + local l = side/2 - 2*pt + local dim = 4 + canvas:encode_linewidth(1*pt) + canvas:encode_disable_bbox() + for c = 0, dim do + for r = 0, dim do + local x, y = c*side, r*side + canvas:encode_hline(x-l, x+l, y-s) + canvas:encode_hline(x-l, x+l, y+s) + canvas:encode_vline(y-l, y+l, x-s) + canvas:encode_vline(y-l, y+l, x+s) + end + end + local b1 = -s - 0.5*pt + local b2 = dim*side + s + 0.5*pt + canvas:encode_set_bbox(b1, b1, b2, b2) + canvas:ga_to_hbox("mybox") +}\hfill\box\mybox\hfill{} +\end{tcolorbox} + +An automatic process updates the bounding box of the figure meanwhile the stream +is read instruction after instruction. The \code{disable\_bbox} operation +produces a more fast execution and the figure maintains the bounding box +computed until that point. The \code{set\_bbox} operation imposes a bounding box +in comparison to the current one of the figure. + +The initial bounding box is simply empty. As a consequence, different +strategies can be used to optimize runtime execution, such as in the previous +code example, where bounding box is always disabled and it is set up at the last +\code{canvas} method call. More often than not, we know the bounding box of the +barcode symbol including quiet zones. + +Every encoding method of \code{gaCanvas} class gives two output result: a +boolean value called \code{ok} plus an error \code{err}. If \code{ok} is +\code{true} then \code{err} is \code{nil} and, viceversa, when \code{ok} is +\code{false} then \code{err} is a string describing the error. + +The error management is a responsability of the caller. For instance, if we +decide to stop the execution this format is perfectly suitable for the Lua +function \code{assert()}, otherwise we can explicity check the output pair: +\begin{Verbatim} +local pt = 65536 +assert(canvas:encode_linewidth(6*pt)) --> true, nil +local ok, err = canvas:encode_hline(nil, 32*pt, 0) +-- ok = false +-- err = "[ArgErr] 'x1' number expected" +\end{Verbatim} + + +\subsubsection{\code{ga} reference} +\label{secGAtabref} + +\noindent +\begin{tabular}{CLlL} +\toprule +\multicolumn{4}{l}{\textbf{Properties of the graphic state}}\\ +OpCode & Mnemonic key & Graphic property & Operands\\ +\midrule + 1 & linewidth & Line width & w <len>\\ + 2 & linecap & Line cap style & e <enum>\\ + &&& 0: Butt cap\\ + &&& 1: Round cap\\ + &&& 2: Projecting square cap\\ + 3 & linejoin & Line join style & e <enum>\\ + &&& 0: Miter join\\ + &&& 1: Round join\\ + &&& 2: Bevel join\\ + 5 & dash\_pattern & Dash pattern line style & p <len> n <qty> [bi <len>]+\\ + &&& p: phase lenght\\ + &&& n: number of array element\\ + &&& bi: dash array lenght\\ + 6 & reset\_pattern & Set the solid line style & -\\ +\midrule +29 & enable\_bbox & Compute bounding box & -\\ +30 & disable\_bbox & Do not compute bounding box & -\\ +31 & set\_bbox & Overlap current bounding box & x1 y1 <point> x2 y2 <point>\\ +\bottomrule +\end{tabular} + +\bigskip +\noindent +\begin{tabular}{CLlL} +\toprule +\multicolumn{4}{l}{\textbf{Lines}}\\ +OpCode & Mnemonic key & Graphic object & Operands\\ +\midrule +32 & line & Line & x1 y1 <point> x2 y2 <point>\\ +33 & hline & Horizontal line & x1 x2 <point> y <coord>\\ +34 & vline & Vertical line & y1 y2 <point> x <coord>\\ +\bottomrule +\end{tabular} + +\bigskip +\noindent +\begin{tabular}{CLlL} +\toprule +\multicolumn{4}{l}{\textbf{Group of bars}}\\ +OpCode & Mnemonic key & Graphic object & Operands\\ +\midrule +36 & vbar & Vertical bars & y1 <coord> y2 <coord> b <qty> [xi wi <bars>]+\\ + & & & y1: bottom y-coord\\ + & & & y2: top y-coord\\ + & & & b: number of bars\\ + & & & xi: axis x-coord of bars number i\\ + & & & wi: width of bars number i\\ +37 & hbar & Horizontal bars & x1 <coord> x2 <coord> b <qty> [yi wi <bars>]+\\ + & & & unimplemented\\ +\midrule +38 & polyline & Opened polyline & n <qty> [xi yi <points>]+\\ + & & & n: number of points\\ + & & & xi: x-coord of point i\\ + & & & yi: y-coord of point i\\ +39 & c\_polyline & Closed polyline & n <qty> [xi yi <points>]\\ + & & & unimplemented\\ +\bottomrule +\end{tabular} + +\bigskip +\noindent +\begin{tabular}{CLlL} +\toprule +\multicolumn{4}{l}{\textbf{Rectangles}}\\ +OpCode & Mnemonic key & Graphic object & Operands\\ +\midrule +48 & rect & Rectangle & x1 y1 <point> x2 y2 <point>\\ +49 & f\_rect & Filled rectangle & x1 y1 <point> x2 y2 <point>\\ + &&& unimplemented\\ +50 & rect\_size & Rectangle & x1 y1 <point> w <len> h <len>\\ + &&& unimplemented\\ +51 & f\_rect\_size & Filled rectangle & x1 y1 <point> w <len> h <len>\\ + &&& unimplemented\\ +\bottomrule +\end{tabular} + +\bigskip +\noindent +\begin{tabular}{CLl} +\toprule +\multicolumn{3}{l}{\textbf{Text}}\\ +OpCode & Mnemonic key & Graphic object/Operands\\ +\midrule +130 & text & A text with several glyphs\\ + & & \ttfamily ax <abs> ay <abs> xpos ypos <point> [c <chars>]+\\ +\midrule +131 & text\_xspaced & A text with glyphs equally spaced on its vertical axis\\ + & & \ttfamily x1 <coord> xgap <len> ay <abs> ypos <coord> [c <chars>]+\\ +\midrule +132 & text\_xwidth & Glyphs equally spaced on vertical axis between two x coordinates\\ + & & \ttfamily ay <abs> x1 <coord> x2 <coord> y <coord> c <chars>\\ +\midrule +140 & \_text\_group & Texts on the same baseline\\ +& & \ttfamily ay <abs> y <coord> n <qty> [xi <coord> ai <abs> ci <chars>]+\\ +& & unimplemented\\ +\bottomrule +\end{tabular} + + +\subsection{\code{Vbar} class} + +This section show you how to draw a group of vertical lines, the main component +of every 1D barcode symbol. In the \brcd{} jargon a group of vertical lines is +called \code{Vbar} and is defined by a flat array of pair numbers sequence: the +first one is the x-coordinate of the bar while the second is its width. + +For instance, consider a \code{Vbar} of three bars for which width is a +multiple of the fixed length called \code{mod}, defined by the array and figure +showed below: +\begin{Verbatim} +-- { x1, w1, x2, w2, x3, w3} + {1.5*mod, 3*mod, 5.5*mod, 1*mod, 7.5*mod, 1*mod} +\end{Verbatim} +\directlua{ +local libgeo = barracuda:libgeo() +local Vbar = libgeo.Vbar +local drv = barracuda:get_driver() +local mm = drv.mm +local b = Vbar:from_int(32111, 2*mm) +local canvas = barracuda:new_canvas() +canvas:encode_vbar(b, 0, 0, 25*mm) +drv:ga_to_hbox(canvas, "mybox") +} +\begin{center} +\begin{tikzpicture} +\foreach \i in {0,2,...,16} +\draw[help lines] (\i mm, -2mm) -- (\i mm, 28mm); +\node at (8mm, 12.5mm) {\box\mybox}; +\draw[-{Latex[open]}] (0, 0) -- (20mm, 0); +\draw[-{Latex[open]}] (0, 0) -- (0, 30mm); +\draw[white, dashed] (3mm, 0) -- (3mm, 25mm); +\draw[white, dashed] (11mm, 0) -- (11mm, 25mm); +\draw[white, dashed] (15mm, 0) -- (15mm, 25mm); +\end{tikzpicture} +\end{center} + +For clearness, to the drawing were added a gray vertical grid stepping one +module and white dashed lines at every vbar axis. + +Spaces between bars can be seen as white bars. In fact, an integer number can +represents the sequence of black and white bars with the rule that the single +digit is the width module multiplier. So, the previous \code{Vbar} can be +defined by 32111 with module equals to 2 mm. + +The class \code{Vbar} of module \code{libgeo} has several constructors one of +which is \code{from\_int()}. Its arguments are the multiplier integer +\code{ngen}, the module length \code{mod} and the optional boolean flag +\code{is\_bar}, true if the first bar is black (default to true): +\begin{Verbatim} +b = Vbar:from_int(32111, 2*mm) +\end{Verbatim} + +A \code{Vbar} object has a local axis \( x \) and is unbounded. Constructors +place the axis origin at the left of the first bar. Bars are infinite vertical +straight lines. In order to draw a \code{Vbar} addition information must be +passed to \code{encode\_vbar()} method of the \code{gaCanvas} class: the global +position of the local origin \( x_0 \), and the bottom and top limit \( y_1 \) +\( y_2 \): +\begin{Verbatim} +canvas:encode_vbar(ovbar, x0, y1, y2) +\end{Verbatim} + +The following listing is the complete source code to draw the \code{Vbar} taken +as example in this section: +\begin{Verbatim} +% !TeX program = LuaTeX +\newbox\mybox +\directlua{ + local barracuda = require "barracuda" + local Vbar = barracuda:libgeo().Vbar + local drv = barracuda:get_driver() + local mm = drv.mm + local b = Vbar:from_int(32111, 2*mm) + local canvas = barracuda:new_canvas() + canvas:encode_vbar(b, 0, 0, 25*mm) + drv:ga_to_hbox(canvas, "mybox") +}\leavevmode\box\mybox +\bye +\end{Verbatim} + + +\subsubsection{\code{Vbar} class arithmetic} + +Can two \code{Vbar} objects be added? Yes, they can! And also with numbers. +Thanks to metamethod and metatable feature of Lua, \code{libgeo} module can +provide arithmetic for \code{Vbar}s. More in detail, to add two \code{Vbar}s +deploy them side by side while to add a number put a distance between the +previous or the next object, depending on the order of addends. + +Anyway, every sum creates or modifies a \code{VbarQueue} object that can be +encoded in a \code{ga} stream with the method \code{encode\_vbar\_queue()}. The +method arguments' are the same needed to encode a \code{Vbar}: an axis position +\( x_0 \) and the two y-coordinates bound \( y_1 \) and \( y_2 \). + +A \code{VbarQueue} code example is the following: +\begin{tcolorbox} +\begin{BVerbatim} +% !TeX program = LuaTeX +\newbox\mybox +\directlua{ + local barracuda = require "barracuda" + local Vbar = barracuda:libgeo().Vbar + local canvas = barracuda:new_canvas() + local mm = canvas.mm + local mod = 2 * mm + local queue = Vbar:from_int(32111, mod) + for _, ngen in ipairs {131, 21312, 11412} do + queue = queue + mod + Vbar:from_int(ngen, mod) + end + canvas:encode_vbar_queue(queue, 0, 0, 25*mm) + canvas:ga_to_hbox "mybox" +}\leavevmode\box\mybox +\bye +\end{BVerbatim} +\tcblower +\directlua{ + local Vbar = barracuda:libgeo().Vbar + local canvas = barracuda:new_canvas() + local mm = canvas.mm + local mod = 2 * mm + local queue = Vbar:from_int(32111, mod) + for _, ngen in ipairs {131, 21312, 11412} do + queue = queue + mod + Vbar:from_int(ngen, mod) + end + canvas:encode_vbar_queue(queue, 0, 0, 25*mm) + canvas:ga_to_hbox "mybox" +} +\hfill +\begin{tikzpicture} +\fill[orange!50!white] (16mm, -3mm) rectangle (18mm, 28mm); % +\fill[orange!50!white] (28mm, -3mm) rectangle (30mm, 28mm); % +\fill[orange!50!white] (48mm, -3mm) rectangle (50mm, 28mm); % +\foreach \i in {0,2,...,68} +\draw[help lines] (\i mm, -3mm) -- (\i mm, 28mm); +\node at (34mm, 12.5mm) {\box\mybox}; +\end{tikzpicture} +\hfill\hbox{} + +\footnote{Respect to the showed code some graphical helps has been added: a +vertical grid marks the module wide steps and light colored bars mark the +space added between two \code{Vbar}s.} +\end{tcolorbox} + +\subsection{\code{ga} programming} + +To provide a better learning experience several \code{ga} stream examples is +discussed, each of which must be compiled with Lua\TeX{}. + +\subsubsection{Example 1: a rectangle} + +Suppose we want to draw a simple rectangle. In the \code{ga} reference of +section~\ref{secGAtabref} there is a dedicated instruction \code{<rect>}. +Let's give it a try: + +\begin{tcolorbox}[ + title={Example 1: dealing with raw \code{ga} stream}, + sidebyside, +] +\begin{BVerbatim} +% !TeX program = LuaTeX +\newbox\mybox +\directlua{ + local barracuda = require "barracuda" + local pt = 65536 + local ga = {48, 0, 0, 72*pt, 36*pt} + local drv = barracuda:get_driver() + drv:ga_to_hbox(ga, "mybox") +}\leavevmode\box\mybox +\bye +\end{BVerbatim} +\tcblower +\directlua{ + local pt = 65536 + local side = 36*pt + local ga = {48, 0, 0, 2*side, side} + local drv = barracuda:get_driver() + drv:ga_to_hbox(ga, "mybox") +}\box\mybox +\end{tcolorbox} + +Dealing with low level \code{ga} stream is not necessary. We can use more safely +a \code{gaCanvas} object running its \code{encode\_rect()} method: +\begin{Verbatim} +... +local canvas = barracuda:new_canvas() +assert(canvas:encode_rect(0, 0, 2*side, side)) +assert(canvas:ga_to_hbox("mybox")) +... +\end{Verbatim} + + +\subsubsection{Example 2: a chessboard} + +A more complex drawing is a chessboard. Let's begin to draw a single cell with a +square 1cm wide: +\begin{Verbatim} +% !TeX program = LuaTeX +\newbox\mybox +\directlua{ + local barracuda = require "barracuda" + local canvas = barracuda:new_canvas() + local mm = canvas.mm + local s, t = 7.5*mm, 1.5*mm + canvas:encode_linewidth(t) + assert(canvas:encode_rect(t/2, t/2, s-t/2, s-t/2)) + assert(canvas:ga_to_hbox("mybox")) +}\leavevmode\box\mybox +\bye +\end{Verbatim} + +Then repeat the game for the entire grid: +\begin{tcolorbox} +\begin{BVerbatim} +% !TeX program = LuaTeX +\newbox\mybox +\directlua{ + local barracuda = require "barracuda" + local canvas = barracuda:new_canvas() + local mm = canvas.mm + local s, t = 6*mm, 1*mm + assert(canvas:encode_linewidth(t)) + for row = 1, 5 do + for col = 1, 5 do + local l = (row + col)/2 + if l == math.floor(l) then + local x = (col - 1)*s + local y = (row - 1)*s + local x1, y1 = x + t/2, y + t/2 + local x2, y2 = x + s - t/2, y + s - t/2 + assert(canvas:encode_rect(x1, y1, x2, y2)) + end + end + end + drv:ga_to_hbox(canvas, "mybox") +}\leavevmode\box\mybox +\bye +\end{BVerbatim} +\vspace*{-10pt} +\tcblower +\directlua{ + local barracuda = require "barracuda" + local canvas = barracuda:new_canvas() + local mm = canvas.mm + local s, t = 6*mm, 1*mm + assert(canvas:encode_linewidth(t)) + for row = 1, 5 do + for col = 1, 5 do + local l = (row + col)/2 + if l == math.floor(l) then + local x = (col - 1)*s + local y = (row - 1)*s + local x1, y1 = x + t/2, y + t/2 + local x2, y2 = x + s - t/2, y + s - t/2 + assert(canvas:encode_rect(x1, y1, x2, y2)) + end + end + end + canvas:ga_to_hbox("mybox") +}\hfill\box\mybox\hfill\hbox{} +\end{tcolorbox} + +\subsubsection{Example 3: a staircase} + +A drawing of a zig zag staircase can be represented by a \code{ga} stream with +a \code{<polyline>} operation. The \code{gaCanvas} method we have to call is +\code{encode\_polyline()} that accept a Lua table as a flat structure with the +coordinates of every point of the polyline: +\begin{BVerbatim} +{x1, y1, x2, y2, ..., xn, yn} +\end{BVerbatim} + +It is what we do with this code: +\begin{tcolorbox} +\begin{BVerbatim} +% !TeX program = LuaTeX +\newbox\mybox +\directlua{ + local barracuda = require "barracuda" + local pt = 65536 + local side = 16*pt + local dim = 5 + local x, y = 0, 0 + local point = {x, y} + local i = 3 + for _ = 1, dim do + y = y + side + point[i] = x; i = i + 1 + point[i] = y; i = i + 1 + x = x + side + point[i] = x; i = i + 1 + point[i] = y; i = i + 1 + end + local canvas = barracuda:new_canvas() + canvas:encode_linewidth(2.25*pt) + canvas:encode_polyline(point) + canvas:ga_to_hbox("mybox") +}\leavevmode\box\mybox +\bye +\end{BVerbatim} +\vspace*{-10pt} +\tcblower +\directlua{ + local pt = 65536 + local side = 16*pt + local dim = 5 + local x, y = 0, 0 + local point = {x, y} + local i = 3 + for _ = 1, dim do + y = y + side + point[i] = x; i = i + 1 + point[i] = y; i = i + 1 + x = x + side + point[i] = x; i = i + 1 + point[i] = y; i = i + 1 + end + local canvas = barracuda:new_canvas() + canvas:encode_linewidth(2.25*pt) + canvas:encode_polyline(point) + canvas:ga_to_hbox("mybox") +}\hfill\box\mybox\hfill\hbox{} +\end{tcolorbox} + +A feature of \code{encode\_<opcode>()} methods is their \emph{polymorphic} +behavior for their first argument. They accept different types as an object +of a geometric class or the raw geometric data. + +Method \code{encode\_polyline} is not an exception: it accepts a \code{Polyline} +object provided by the \code{libgeo} module, or instead a flat array of +coordinates. For instance the previous code may be re-implement as: +\begin{Verbatim} +% !TeX program = LuaTeX +\newbox\mybox +\directlua{ + local barracuda = require "barracuda" + local pt = 65536 + local side = 18*pt + local dim = 5 + local Polyline = barracuda:libgeo().Polyline + local pl = Polyline:new(0, 0) + for _ = 1, dim do + pl:add_relpoint(0, side) + pl:add_relpoint(side, 0) + end + local canvas = barracuda:new_canvas() + canvas:encode_linewidth(2.5*pt) + canvas:encode_polyline(pl) + canvas:ga_to_hbox("mybox") +}\leavevmode\box\mybox +\bye +\end{Verbatim} + +Pretty sure that this new version is more clear and intuitive. + + +%\subsubsection{Example 4: } + +% A polyline that represents a path of ... Hilbert curve +% Text pyramid + + +\section{Practical examples and use cases} +\label{secExample} + +Previous sections as shown how \brcd{} is capable to draw simple graphics. This +section is dedicated to barcode applications. + + + +\end{document} diff --git a/macros/luatex/generic/barracuda/doc/image/8006194056290.pdf b/macros/luatex/generic/barracuda/doc/manual/image/8006194056290.pdf Binary files differindex 8effe87846..8effe87846 100644 --- a/macros/luatex/generic/barracuda/doc/image/8006194056290.pdf +++ b/macros/luatex/generic/barracuda/doc/manual/image/8006194056290.pdf diff --git a/macros/luatex/generic/barracuda/src/barracuda.lua b/macros/luatex/generic/barracuda/src/barracuda.lua index d8eae35216..c854941d27 100644 --- a/macros/luatex/generic/barracuda/src/barracuda.lua +++ b/macros/luatex/generic/barracuda/src/barracuda.lua @@ -2,7 +2,7 @@ -- -- Encode a message into a barcode symbol, in Lua or within a LuaTeX source file -- --- Copyright (C) 2020 Roberto Giacomelli +-- Copyright (C) 2019-2022 Roberto Giacomelli -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -26,26 +26,36 @@ local Barracuda = { _NAME = "barracuda", - _VERSION = "barracuda v0.0.10", - _DATE = "2020-02-04", + _VERSION = "barracuda v0.0.12", + _DATE = "2022-06-23", _DESCRIPTION = "Lua library for barcode printing", _URL = "https://github.com/robitex/barracuda", _LICENSE = "GNU GENERAL PUBLIC LICENSE, Version 2, June 1991", } -- essential sub-module loading -Barracuda._libgeo = require "lib-geo.brcd-libgeo" -- basic vectorial objects +Barracuda._libgeo = require "lib-geo.brcd-libgeo" -- basic vector objects Barracuda._gacanvas = require "lib-geo.brcd-gacanvas" -- ga stream library Barracuda._barcode = require "lib-barcode.brcd-barcode" -- barcode abstract class +Barracuda._lib_driver = require "lib-driver.brcd-driver" -- abstract driver class local Barcode = Barracuda._barcode Barcode._libgeo = Barracuda._libgeo +-- a reference to Driver class for gaCancas class +local canvas = Barracuda._gacanvas +canvas._driver_class = Barracuda._lib_driver + -- return a reference of Barcode abstract class -function Barracuda:barcode() --> Barcode class object +function Barracuda:barcode() --> <Barcode class> return self._barcode end +-- return a reference to the libgeo library +function Barracuda:libgeo() --> <libgeo library> + return self._libgeo +end + -- encoder costructor (a bridge to Barcode class method) function Barracuda:new_encoder(treename, opt) --> object, err local barcode = self._barcode @@ -55,19 +65,15 @@ end -- where we place the output driver library function Barracuda:get_driver() --> Driver object - if not self._lib_driver then - self._lib_driver = require "lib-driver.brcd-driver" - end return self._lib_driver end -function Barracuda:new_canvas() --> driver +function Barracuda:new_canvas() --> canvas local gacanvas = self._gacanvas return gacanvas:new() end -- high level barcode functions --- only default options -- panic on error -- save barcode as a graphic external file @@ -104,7 +110,7 @@ function Barracuda:save(treename, data, filename, id_drv, opt) assert(ok, err) end local canvas = self:new_canvas() - symb:append_ga(canvas) + symb:draw(canvas) local driver = self:get_driver() id_drv = id_drv or "svg" local ok, err = driver:save(id_drv, canvas, filename) @@ -144,7 +150,7 @@ function Barracuda:hbox(treename, data, box_name, opt) assert(ok, err) end local canvas = self:new_canvas() - symb:append_ga(canvas) + symb:draw(canvas) local driver = self:get_driver() local ok, err = driver:ga_to_hbox(canvas, box_name) assert(ok, err) diff --git a/macros/luatex/generic/barracuda/src/lib-barcode/brcd-barcode.lua b/macros/luatex/generic/barracuda/src/lib-barcode/brcd-barcode.lua index b43bc511d7..1208adeb75 100644 --- a/macros/luatex/generic/barracuda/src/lib-barcode/brcd-barcode.lua +++ b/macros/luatex/generic/barracuda/src/lib-barcode/brcd-barcode.lua @@ -1,13 +1,8 @@ - -- Barcode Abstract Class --- Copyright (C) 2020 Roberto Giacomelli +-- Copyright (C) 2019-2022 Roberto Giacomelli -- Please see LICENSE.TXT for any legal information about present software -local Barcode = { - _VERSION = "Barcode v0.0.9", - _NAME = "Barcode", - _DESCRIPTION = "Barcode abstract class", -} +local Barcode = {_classname = "Barcode"} Barcode.__index = Barcode -- barcode_type/submodule name @@ -16,6 +11,7 @@ Barcode._available_enc = {-- keys must be lowercase code128 = "lib-barcode.brcd-code128", -- Code128 ean = "lib-barcode.brcd-ean", -- EAN family (ISBN, EAN8, etc) i2of5 = "lib-barcode.brcd-i2of5", -- Interleaved 2 of 5 + upc = "lib-barcode.brcd-upc", -- UPC } Barcode._builder_instances = {} -- encoder builder instances repository Barcode._encoder_instances = {} -- encoder instances repository @@ -24,6 +20,7 @@ Barcode._encoder_instances = {} -- encoder instances repository Barcode._super_par_order = { "ax", "ay", + "debug_bbox", } Barcode._super_par_def = {} local pardef = Barcode._super_par_def @@ -36,7 +33,7 @@ pardef.ax = { default = 0.0, unit = "sp", -- scaled point isReserved = false, - fncheck = function (self, ax, _) --> boolean, err + fncheck = function (_self, ax, _) --> boolean, err if ax >= 0.0 and ax <= 1.0 then return true, nil end return false, "[OutOfRange] 'ax' out of [0, 1] interval" end, @@ -46,13 +43,34 @@ pardef.ay = { default = 0.0, unit = "sp", -- scaled point isReserved = false, - fncheck = function (self, ay, _) --> boolean, err + fncheck = function (_self, ay, _) --> boolean, err if ay >= 0.0 and ay <= 1.0 then return true, nil end return false, "[OutOfRange] 'ay' out of [0, 1] interval" end, } --- Barcode.bbox_to_quietzone -- under assessment +-- debug only purpose +-- enable/disable bounding box drawing of symbols +Barcode.debug_bbox = "none" +pardef.debug_bbox = { + default = "none", + isReserved = false, + enum = { + none = true, -- do nothing + symb = true, -- draw bbox of the symbol + qz = true, -- draw a bbox at quietzone border + qzsymb = true, -- draw quietzone and symbol bboxes + }, + fncheck = function (self, e, _) --> boolean, err + if type(e) ~= "string" then return false, "[TypeError] not a string" end + local keys = self.enum + if keys[e] == true then + return true, nil + else + return false, "[Err] enumeration value '"..e.."' not found" + end + end, +} -- Barcode methods @@ -221,7 +239,7 @@ function Barcode:new_encoder(treename, opt) --> object, err -- argument checking local family, variant, enc_name, err = parse_treename(treename) if err then - return err + return nil, err end local av_enc = self._available_enc local mod_path = av_enc[family] @@ -254,7 +272,7 @@ function Barcode:new_encoder(treename, opt) --> object, err else return nil, "[ArgErr] provided 'opt' is not a table" end - local enc = {} -- the new encoder + local enc = {_classname = "Encoder"} -- the new encoder enc.__index = enc enc._variant = variant setmetatable(enc, { @@ -292,13 +310,14 @@ function Barcode:new_encoder(treename, opt) --> object, err end end if enc._config then -- this must be called after the parameter definition - enc:_config() + local ok, e = enc:_config() + if not ok then return nil, e end end return enc, nil end -- retrive an encoder object already created --- 'trename' is the special identifier of the encoder +-- 'treename' is the special identifier of the encoder function Barcode:enc_by_name(treename) --> <encoder object>, <err> -- argument checking local _family, _variant, _enc_name, err = parse_treename(treename) @@ -316,25 +335,36 @@ end -- base methods common to all the encoders -- for numeric only simbology -function Barcode:_check_char(c) --> elem, err +-- elem_code : encoded char +-- elem_text : human readable char +-- err : error description +function Barcode:_check_char(c, parse_state) --> elem_code, elem_text, err if type(c) ~= "string" or #c ~= 1 then - return nil, "[InternalErr] invalid char" + return nil, nil, "[InternalErr] invalid char" + end + local process_char = self._process_char + if process_char then + return process_char(self, c, parse_state) end local n = string.byte(c) - 48 if n < 0 or n > 9 then - return nil, "[ArgErr] found a not digit char" + return nil, nil, "[ArgErr] found a not digit char" end - return n, nil + return n, nil, nil end -- -function Barcode:_check_digit(n) --> elem, err +function Barcode:_check_digit(n, parse_state) --> elem_code, elem_text, err if type(n) ~= "number" then - return nil, "[ArgErr] not a number" + return nil, nil, "[ArgErr: n] not a number" + end + local process_digit = self._process_digit + if process_digit then + return process_digit(self, n, parse_state) end if n < 0 or n > 9 then - return nil, "[ArgErr] not a digit" + return nil, nil, "[ArgErr: n] not a digit" end - return n, nil + return n, nil, nil end -- not empty string --> Barcode object @@ -345,22 +375,33 @@ function Barcode:from_string(symb, opt) --> object, err if #symb == 0 then return nil, "[ArgErr] 'symb' is an empty string" end - local chars = {} - local len = 0 - local parse_state = {} + local chars_code = {} + local chars_text + local parse_state + if self._init_parse_state then + parse_state = self:_init_parse_state() + else + parse_state = {} + end for c in string.gmatch(symb, ".") do - local elem, err = self:_check_char(c, parse_state) + local elem_code, elem_text, err = self:_check_char(c, parse_state) if err then return nil, err - elseif elem then - chars[#chars+1] = elem - len = len + 1 + else + if elem_code then + chars_code[#chars_code + 1] = elem_code + end + if elem_text then + chars_text = chars_text or {} + chars_text[#chars_text + 1] = elem_text + end end end -- build the barcode object local o = { - _code_data = chars, -- array of chars - _code_len = len, -- symbol lenght + _classname = "BarcodeSymbol", + _code_data = chars_code, -- array of chars + _code_text = chars_text, } setmetatable(o, self) if opt ~= nil then @@ -394,42 +435,58 @@ function Barcode:from_uint(n, opt) --> object, err if opt ~= nil and type(opt) ~= "table" then return nil, "[ArgErr] 'opt' is not a table" end - local digits = {} - local parse_state = {} - local i = 0 + local digits_code = {} + local digits_text + local parse_state + if self._init_parse_state then + parse_state = self:_init_parse_state() + else + parse_state = {} + end if n == 0 then - local elem, err = self:_check_digit(0, parse_state) + local elem_code, elem_text, err = self:_check_digit(0, parse_state) if err then return nil, err end - if elem then - digits[1] = elem - i = 1 + if elem_code then + digits_code[1] = elem_code + end + if elem_text then + digits_text = {elem_text} end else while n > 0 do local d = n % 10 - local elem, err = self:_check_digit(d, parse_state) + local elem_code, elem_text, err = self:_check_digit(d, parse_state) if err then return nil, err end - if elem then - i = i + 1 - digits[i] = elem + if elem_code then + digits_code[#digits_code + 1] = elem_code + end + if elem_text then + digits_text = digits_text or {} + digits_text[#digits_text + 1] = elem_text end n = (n - d) / 10 end - for k = 1, i/2 do -- reverse the array - local d = digits[k] - local h = i - k + 1 - digits[k] = digits[h] - digits[h] = d + local rev_array = function (a) + local len = #a + for k = 1, len/2 do -- reverse the array + local h = len - k + 1 + a[k], a[h] = a[h], a[k] + end + end + rev_array(digits_code) + if digits_text then + rev_array(digits_text) end end -- build the barcode object local o = { - _code_data = digits, -- array of digits - _code_len = i, -- symbol lenght + _classname = "BarcodeSymbol", + _code_data = digits_code, -- array of digits + _code_text = digits_text, -- array of human readable information } setmetatable(o, self) if opt ~= nil then @@ -449,6 +506,26 @@ function Barcode:from_uint(n, opt) --> object, err return o, nil end +-- recursive general Barcode costructor +function Barcode:new(code) --> object, err + local t = type(code) + if t == "string" then + return self:from_string(code) + elseif t == "number" then + return self:from_uint(code) + elseif t == "table" then + local res = {} + for _, c in ipairs(code) do + local b, err = self:new(c) + if err then return nil, err end + res[#res + 1] = b + end + return res, nil + else + return nil, "[ArgErr] unsuitable type '"..t.."' for the input code" + end +end + -- check a parameter set -- this method check also reserved parameter -- argments: {k=v, ...}, "default" | "current" @@ -532,13 +609,13 @@ function Barcode:info() --> table description = self._DESCRIPTION, param = {}, } - local tpar = info.param + local tpar = info.param for _, pdef in self:param_ord_iter() do - local id = pdef.pname + local id = pdef.pname local def = pdef.pdef tpar[#tpar + 1] = { name = id, - descr = nil, -- TODO: + descr = def.descr, value = self[id], isReserved = def.isReserved, unit = def.unit, @@ -547,12 +624,32 @@ function Barcode:info() --> table return info end --- return the code being represented as a string --- or nil if the method is called from Barcode abstract class -function Barcode:get_code() --> string|nil - local code = self._code_data - if code then - return table.concat(code) +-- return internal code representation +function Barcode:get_code() --> array + if self._classname == "BarcodeSymbol" then + local code = self._code_data + local res = {} + for _, c in ipairs(code) do + res[#res + 1] = c + end + return res + else + error("[Err: OOP] 'BarcodeSymbol' only method") + end +end + +-- human readable interpretation hri or nil +function Barcode:get_hri() --> array|nil + if self._classname == "BarcodeSymbol" then + local code = self._code_text + if code == nil then return nil end + local res = {} + for _, c in ipairs(code) do + res[#res + 1] = c + end + return res + else + error("[Err: OOP] 'BarcodeSymbol' only method") end end @@ -562,8 +659,8 @@ function Barcode:get_param(id) --> value, err if type(id) ~= "string" then return nil, "[ArgErr] 'id' must be a string" end - local pardef = self._par_def - if not pardef[id] then + local par_def = self._par_def + if not par_def[id] then return nil, "[Err] Parameter '"..id.."' doesn't exist" end local res = assert(self[id], "[InternalErr] parameter value unreachable") @@ -622,6 +719,76 @@ function Barcode:set_param(arg1, arg2) --> boolean, err return true, nil end +-- canvas is a gaCanvas object +-- tx, ty is an optional point to place symbol local origin on the canvas plane +function Barcode:draw(canvas, tx, ty) --> canvas, err + local nclass = self._classname + if nclass == "Barcode" then + error("[ErrOOP:Barcode] method 'draw' must be called only on a Symbol object") + end + if nclass == "Encoder" then + error("[ErrOOP:Encoder] method 'draw' must be called only on a Symbol object") + end + assert(nclass == "BarcodeSymbol") + if canvas._classname ~= "gaCanvas" then + return nil, "[ErrOOP:canvas] object 'gaCanvas' expected" + end + local ga_fn = assert( + self._append_ga, + "[InternalErr] unimplemented '_append_ga' method" + ) + local bb_info = ga_fn(self, canvas, tx or 0, ty or 0) + local dbg_bbox = self.debug_bbox + if dbg_bbox == "none" then + -- do nothing + else + -- dashed style: phase = 3bp, dash pattern = 6bp 3bp + local bp = canvas.bp + local W = bp/10 -- 0.1bp + local w = W/2 + assert(canvas:encode_linewidth(W)) + assert(canvas:encode_dash_pattern(3*bp, 6*bp, 3*bp)) + local x1, y1, x2, y2 = bb_info[1], bb_info[2], bb_info[3], bb_info[4] + if dbg_bbox == "symb" then + assert(canvas:encode_rect(x1 + w, y1 + w, x2 - w, y2 - w)) + elseif dbg_bbox == "qz" then + local q1, q2, q3, q4 = bb_info[5], bb_info[6], bb_info[7], bb_info[8] + x1 = x1 - (q1 or 0) + w + y1 = y1 - (q2 or 0) + w + x2 = x2 + (q3 or 0) - w + y2 = y2 + (q4 or 0) - w + assert(canvas:encode_rect(x1, y1, x2, y2)) + elseif dbg_bbox == "qzsymb" then + local q1, q2, q3, q4 = bb_info[5], bb_info[6], bb_info[7], bb_info[8] + x1 = x1 + w + y1 = y1 + w + x2 = x2 - w + y2 = y2 - w + if q1 then + assert(canvas:encode_vline(y1, y2, x1)) + x1 = x1 - q1 + end + if q3 then + assert(canvas:encode_vline(y1, y2, x2)) + x2 = x2 + q3 + end + if q2 then + assert(canvas:encode_hline(x1, x2, y1)) + y1 = y1 - q2 + end + if q4 then + assert(canvas:encode_hline(x1, x2, y2)) + y2 = y2 + q4 + end + assert(canvas:encode_rect(x1, y1, x2, y2)) + else + error("[InternalErr:debug_bbox] unrecognized enum value") + end + assert(canvas:encode_reset_pattern()) + end + return canvas +end + return Barcode -- diff --git a/macros/luatex/generic/barracuda/src/lib-barcode/brcd-code128.lua b/macros/luatex/generic/barracuda/src/lib-barcode/brcd-code128.lua index 1ee1c98343..294162f6b6 100644 --- a/macros/luatex/generic/barracuda/src/lib-barcode/brcd-code128.lua +++ b/macros/luatex/generic/barracuda/src/lib-barcode/brcd-code128.lua @@ -1,11 +1,11 @@ -- Code128 barcode generator module --- Copyright (C) 2020 Roberto Giacomelli +-- Copyright (C) 2019-2022 Roberto Giacomelli -- -- All dimension must be in scaled point (sp) -- every fields that starts with an undercore sign are intended as private local Code128 = { - _VERSION = "code128 v0.0.5", + _VERSION = "code128 v0.0.6", _NAME = "Code128", _DESCRIPTION = "Code128 barcode encoder", } @@ -23,7 +23,7 @@ Code128._int_def_bar = {-- code bar definitions 111242, 121142, 121241, 114212, 124112, 124211, 411212, 421112, 421211, 212141, 214121, 412121, 111143, 111341, 131141, 114113, 114311, 411113, 411311, 113141, 114131, 311141, 411131, 211412, 211214, 211232, - 2331112, -- this is the stop char at index 106 + 2331112, -- the last number is the stop char at index 106 } Code128._codeset = { @@ -96,248 +96,308 @@ function Code128:_config() --> ok, err local mod = self.xdim local sc = self._codeset.stopChar -- build the stop char local n = self._int_def_bar[sc] - local Vbar = self._libgeo.Vbar -- Vbar class - self._vbar = {} - local b = self._vbar - b[sc] = Vbar:from_int(n, mod, true) + local repo = self._libgeo.Archive:new() + self._vbar_archive = repo + local Vbar = self._libgeo.Vbar + repo:insert(Vbar:from_int(n, mod, true), 106) return true, nil end -- utility functions --- the number of consecutive digits from the index 'i' in the code array -local function count_digits_from(arr, i) - local start = i - local dim = #arr - while i <= dim and (arr[i] > 47 and arr[i] < 58) do - i = i + 1 - end - return i - start -end - --- evaluate the check digit of the data representation +-- evaluate the check digit of encoded data local function check_digit(code) local sum = code[1] -- this is the start character for i = 2, #code do sum = sum + code[i]*(i-1) end - return sum % 103 + code[#code + 1] = sum % 103 +end + +local function isdigit(char) --> true/false + assert(char) + return (char > 47) and (char < 58) +end + +local function iscontrol(char) --> true/false + assert(char) + -- [0,31] control chars interval + return char < 32 +end + +local function islower(char) + assert(char) + -- [96, 127] lower case chars + return (char > 95) and (char < 128) end --- return a pair of boolean the first one is true --- if a control char and a lower case char occurs in the data --- and the second one is true if the control char occurs before --- the lower case char -local function ctrl_or_lowercase(pos, data) --> boolean, boolean|nil - local len = #data - local ctrl_occur, lower_occur = false, false - for i = pos, len do - local c = data[i] - if (not ctrl_occur) and (c >= 0 and c < 32) then - -- [0,31] control chars - if lower_occur then - return true, false -- lowercase char < ctrl char +-- count digits +local function digits_group(data, len) --> counting digits + local res = {} + local last = false + for i = len, 1, -1 do + local digit = isdigit(data[i]) + if last then + if digit then + res[i] = res[i+1] + 1 else - ctrl_occur = true + res[i] = 0 + last = false end - elseif (not lower_occur) and (c > 95 and c < 128) then - -- [96, 127] lower case chars - if ctrl_occur then - return true, true -- ctrl char < lowercase char + else + if digit then + res[i] = 1 + last = true else - lower_occur = true + res[i] = 0 end end end - return false -- no such data + return res end --- encode the provided char against a codeset --- in the future this function will consider FN data -local function encode_char(t, codesetAorB, char_code, codesetA) - local code - if codesetAorB == codesetA then -- codesetA - if char_code < 32 then - code = char_code + 64 - elseif char_code > 31 and char_code < 96 then - code = char_code - 32 - else - error("Not implemented or wrong code") - end - else -- codesetB - if char_code > 31 and char_code < 128 then - code = char_code - 32 - else - error("Not implemented or wrong code") +-- find the first char in the codeset that adhere +-- with the function argument 'filter' +local function indexof_char_by(filter, arr, counter) --> index or nil + counter = counter or 1 + local char = arr[counter] + while char do + if filter(char) then + return counter end + counter = counter + 1 + char = arr[counter] end - t[#t + 1] = code end --- encode the message in a sequence of Code128 symbol minimizing its lenght -local function encode128(arr, codeset, switch) --> data, err :TODO: - local res = {} -- the result array (the check character will be appended) - -- find the Start Character A, B, or C - local cur_codeset - local ndigit = count_digits_from(arr, 1) - local len = #arr - --local no_ctrl_lower_char - if (ndigit == 2 and len == 2) or ndigit > 3 then -- start char code C - cur_codeset = codeset.C +-- determine the Start character +local function start_codeset_char(codeset, arr, len) + assert(len>0) + local ctrl = indexof_char_by(iscontrol, arr) + local lowc = indexof_char_by(islower, arr) + local t_digits = digits_group(arr, len) + local first_digits = t_digits[1] + -- case 1 + if (len == 2) and (first_digits == 2) then + return lowc, ctrl, codeset.C, t_digits + end + -- case 2 + if first_digits >= 4 then + return lowc, ctrl, codeset.C, t_digits + end + -- case 3 + local cs = codeset.B + if (ctrl and lowc) and (ctrl < lowc) then + cs = codeset.A + end + -- case 4 + return lowc, ctrl, cs, t_digits +end + +-- codeset A char +local function encode_char_A(res, char) + local code + if char < 32 then + code = char + 64 + elseif char > 31 and char < 96 then + code = char - 32 else - local ok, ctrl_first = ctrl_or_lowercase(1, arr) - if ok and ctrl_first then - cur_codeset = codeset.A - else - cur_codeset = codeset.B - end + error("[InternalErr] Not implemented or wrong code" ) end - res[#res + 1] = cur_codeset - local pos = 1 -- symbol's index to encode - while pos <= len do - if cur_codeset == codeset.C then - if arr[pos] < 48 or arr[pos] > 57 then -- not numeric char - local ok, ctrl_first = ctrl_or_lowercase(pos, arr) - if ok and ctrl_first then - cur_codeset = codeset.A + res[#res + 1] = code +end +-- codeset B char +local function encode_char_B(res, char) + local code + if char > 31 and char < 128 then + code = char - 32 + else + error("[InternalErr] Not implemented or wrong code") + end + res[#res + 1] = code +end + +-- every function encodes a group of chars +-- A = 103, -- Start char for Codeset A +-- B = 104, -- Start char for Codeset B +-- C = 105, -- Start char for Codeset C +local encode_codeset = { + -- A + [103] = function (codeset, res, data, index, t_digits, i_low, _ctrl) + assert(t_digits[index] < 4, "[InternalErr] in codeset A digits must be less than 4") + while data[index] do + local char = data[index] + if i_low and islower(char) then -- ops a lower case char + local next = data[index + 1] + local next_next = data[index + 2] + if next and next_next then + -- case 5a + if iscontrol(char) and islower(next_next) then + res[#res+1] = codeset.shift + encode_char_B(res, char) + index = index + 1 + end else - cur_codeset = codeset.B + -- case 5b + return codeset.B, index end - res[#res + 1] = switch[codeset.C][cur_codeset] else - local imax = pos + 2*math.floor(ndigit/2) - 1 - for idx = pos, imax, 2 do - res[#res + 1] = (arr[idx] - 48)*10 + arr[idx+1] - 48 - end - pos = pos + imax - ndigit = ndigit - imax - if ndigit == 1 then - -- cur_codeset setup - local ok, ctrl_first = ctrl_or_lowercase(pos + 1, arr) - if ok and ctrl_first then - cur_codeset = codeset.A - else - cur_codeset = codeset.B + local digits = t_digits[index] + if digits > 3 then -- go to codeset C + if (digits % 2) == 1 then -- odd number of a group of digits + encode_char_A(res, char) + digits = digits - 1 + index = index + 1 end - res[#res + 1] = switch[codeset.C][cur_codeset] + return codeset.C, index end + encode_char_A(res, char) + index = index + 1 end - else --- current codeset is A or B - if ndigit > 3 then - if ndigit % 2 > 1 then -- odd number of digits - encode_char(res, cur_codeset, arr[pos], codeset.A) - pos = pos + 1 - ndigit = ndigit - 1 - end - res[#res + 1] = switch[cur_codeset][codeset.C] - cur_codeset = codeset.C - elseif (cur_codeset == codeset.B) and - (arr[pos] >= 0 and arr[pos] < 32) then -- ops a control char - local ok, ctrl_first = ctrl_or_lowercase(pos + 1, arr) - if ok and (not ctrl_first) then -- shift to codeset A - res[#res + 1] = codeset.shift - encode_char(res, codeset.A, arr[pos], codeset.A) - pos = pos + 1 - ndigit = count_digits_from(pos, arr) - else -- switch to code set A - res[#res + 1] = switch[cur_codeset][codeset.A] - cur_codeset = codeset.A - end - elseif (cur_codeset == codeset.A) and - (arr[pos] > 95 and arr[pos] < 128) then -- ops a lower case char - local ok, ctrl_first = ctrl_or_lowercase(pos+1, arr) - if ok and ctrl_first then -- shift to codeset B - res[#res + 1] = codeset.shift - encode_char(res, codeset.B, arr[pos], codeset.A) - pos = pos + 1 - ndigit = count_digits_from(arr, pos) - else -- switch to code set B - res[#res + 1] = switch[cur_codeset][codeset.B] - cur_codeset = codeset.B + end + return nil, index + end, + -- B + [104] = function (codeset, res, data, index, t_digits, _low, i_ctrl) + assert(t_digits[index] < 4, "[InternalErr] in codeset B digits must be less than 4") + while data[index] do + local char = data[index] + if i_ctrl and iscontrol(char) then -- ops a control char + local next = data[index + 1] + local next_next = data[index + 2] + if next and next_next then + -- case 4a + if islower(next) and iscontrol(next_next) then + res[#res+1] = codeset.shift + encode_char_A(res, char) + index = index + 1 + end + else + -- case 4b + return codeset.A, index end else - -- insert char - encode_char(res, cur_codeset, arr[pos], codeset.A) - pos = pos + 1 - ndigit = count_digits_from(arr, pos) + local digits = t_digits[index] + if digits > 3 then -- go to codeset C + if (digits % 2) == 1 then -- odd number of a group of digits + encode_char_B(res, char) + digits = digits - 1 + index = index + 1 + end + return codeset.C, index + end + encode_char_B(res, char) + index = index + 1 end end + return nil, index + end, + -- C + [105] = function (codeset, res, data, index, t_digits, i_low, i_ctrl) + local digits = t_digits[index] + assert(digits > 1, "[InternalErr] at least a pair of digit is required") + while digits > 1 do + local d1, d2 = data[index], data[index + 1] + res[#res + 1] = (d1 - 48)*10 + d2 - 48 + digits = digits - 2 + index = index + 2 + end + local res_codeset + if i_ctrl and i_low then + local ctrl = indexof_char_by(iscontrol, data, index) + local low = indexof_char_by(islower, data, index) + if low and (ctrl < low) then + res_codeset = codeset.A + end + else + res_codeset = codeset.B + end + return res_codeset, index + end, +} + +-- encode the message in a sequence of Code128 symbol minimizing the symbol width +local function encode128(arr, codeset, switch) --> data, err + local len = #arr + local i_low, i_ctrl, cur_codeset, t_digits = start_codeset_char(codeset, arr, len) + local res = {cur_codeset} -- the result array (the check character will be appended later) + local switch_codeset + local cur_index = 1 + while cur_index <= len do + if switch_codeset then + res[#res+1] = switch[cur_codeset][switch_codeset] + cur_codeset = switch_codeset + end + local fn = assert(encode_codeset[cur_codeset], "[InternalErr] cur_codeset is "..(cur_codeset or "nil")) + switch_codeset, cur_index = fn(codeset, res, arr, cur_index, t_digits, i_low, i_ctrl) end - res[#res + 1] = check_digit(res) - res[#res + 1] = codeset.stopChar - return res + check_digit(res) + return res, nil end -- Code 128 internal functions used by Barcode costructors -function Code128:_check_char(c) --> elem, err - if type(c) ~= "string" or #c ~= 1 then - return nil, "[InternalErr] invalid char" - end +function Code128:_process_char(c) --> char_code, char_text, err local b = string.byte(c) if b > 127 then local fmt = "[unimplemented] the '%d' is an ASCII extented char" return nil, string.format(fmt, c) end - return b, nil + return b, c, nil end -function Code128:_check_digit(n) --> elem, err - if type(n) ~= "number" then - return nil, "[InternalErr] invalid digit" - end - return n + 48, nil +function Code128:_process_digit(n) --> digit_code, char_text, err + local res = n + 48 + return res, string.char(res), nil end function Code128:_finalize() --> ok, err local chr = assert(self._code_data, "[InternalErr] '_code_data' field is nil") local data, err = encode128(chr, self._codeset, self._switch) if err then return false, err end - -- load dynamically required Vbar objects - local vbar = self._vbar - local oVbar = self._libgeo.Vbar + self._enc_data = data + -- dynamically load the required Vbar objects + local Repo = self._vbar_archive + local Vbar = self._libgeo.Vbar for _, c in ipairs(data) do - if not vbar[c] then + if not Repo:contains_key(c) then local n = self._int_def_bar[c] local mod = self.xdim - vbar[c] = oVbar:from_int(n, mod, true) + assert(Repo:insert(Vbar:from_int(n, mod, true), c)) end end - self._enc_data = data return true, nil end -- Drawing into the provided channel the geometrical barcode data -- tx, ty is the optional translator vector -- the function return the canvas reference to allow call chaining -function Code128:append_ga(canvas, tx, ty) --> canvas - local xdim, h = self.xdim, self.ydim - local sw = 11*xdim -- the width of a symbol +function Code128:_append_ga(canvas, tx, ty) --> bbox local data = self._enc_data - local w = #data * sw + 2 * xdim -- total symbol width + local Repo = self._vbar_archive + local queue = self._libgeo.Vbar_queue:new() + for _, c in ipairs(data) do + queue = queue + Repo:get(c) + end + local stop = self._codeset.stopChar + queue = queue + Repo:get(stop) + local xdim, h = self.xdim, self.ydim + local ns = #data + 1 + local w = (11*ns + 2) * xdim -- total symbol width local ax, ay = self.ax, self.ay - local x0 = (tx or 0) - ax * w - local y0 = (ty or 0) - ay * h + local x0 = tx - ax * w + local y0 = ty - ay * h local x1 = x0 + w local y1 = y0 + h - local xpos = x0 -- drawing the symbol - local err - err = canvas:start_bbox_group() - assert(not err, err) - for _, c in ipairs(data) do - local vb = self._vbar[c] - err = canvas:encode_Vbar(vb, xpos, y0, y1) - assert(not err, err) - xpos = xpos + sw - end + assert(canvas:encode_disable_bbox()) + assert(canvas:encode_vbar_queue(queue, x0, y0, y1)) -- bounding box setting local qz = self.quietzone_factor * xdim -- { xmin, ymin, xmax, ymax } - err = canvas:stop_bbox_group(x0 - qz, y0, x1 + qz, y1) - assert(not err, err) - return canvas + assert(canvas:encode_set_bbox(x0 - qz, y0, x1 + qz, y1)) + assert(canvas:encode_enable_bbox()) + return {x0, y0, x1, y1, qz, nil, qz, nil,} end return Code128 ---
\ No newline at end of file diff --git a/macros/luatex/generic/barracuda/src/lib-barcode/brcd-code39.lua b/macros/luatex/generic/barracuda/src/lib-barcode/brcd-code39.lua index 6d7f2ccea7..0768912987 100644 --- a/macros/luatex/generic/barracuda/src/lib-barcode/brcd-code39.lua +++ b/macros/luatex/generic/barracuda/src/lib-barcode/brcd-code39.lua @@ -1,31 +1,27 @@ -- Code39 barcode encoder implementation --- Copyright (C) 2020 Roberto Giacomelli +-- Copyright (C) 2019-2022 Roberto Giacomelli -- -- All dimensions must be in scaled point (sp) --- every fields that starts with an undercore sign are intended as private +-- every field that starts with an underscore sign are intended to be private local Code39 = { - _VERSION = "code39 v0.0.5", + _VERSION = "code39 v0.0.6", _NAME = "Code39", _DESCRIPTION = "Code39 barcode encoder", } Code39._symb_def = {-- symbol definition - ["0"] = 112122111, ["1"] = 211112112, ["2"] = 211112211, - ["3"] = 111112212, ["4"] = 211122111, ["5"] = 111122112, - ["6"] = 111122211, ["7"] = 212112111, ["8"] = 112112112, - ["9"] = 112112211, ["A"] = 211211112, ["B"] = 211211211, - ["C"] = 111211212, ["D"] = 211221111, ["E"] = 111221112, - ["F"] = 111221211, ["G"] = 212211111, ["H"] = 112211112, - ["I"] = 112211211, ["J"] = 112221111, ["K"] = 221111112, - ["L"] = 221111211, ["M"] = 121111212, ["N"] = 221121111, - ["O"] = 121121112, ["P"] = 121121211, ["Q"] = 222111111, - ["R"] = 122111112, ["S"] = 122111211, ["T"] = 122121111, - ["U"] = 211111122, ["V"] = 211111221, ["W"] = 111111222, - ["X"] = 211121121, ["Y"] = 111121122, ["Z"] = 111121221, - ["-"] = 212111121, ["."] = 112111122, [" "] = 112111221, - ["$"] = 111212121, ["/"] = 121112121, ["+"] = 121211121, - ["%"] = 121212111, + ["0"] = 112122111, ["1"] = 211112112, ["2"] = 211112211, ["3"] = 111112212, + ["4"] = 211122111, ["5"] = 111122112, ["6"] = 111122211, ["7"] = 212112111, + ["8"] = 112112112, ["9"] = 112112211, ["A"] = 211211112, ["B"] = 211211211, + ["C"] = 111211212, ["D"] = 211221111, ["E"] = 111221112, ["F"] = 111221211, + ["G"] = 212211111, ["H"] = 112211112, ["I"] = 112211211, ["J"] = 112221111, + ["K"] = 221111112, ["L"] = 221111211, ["M"] = 121111212, ["N"] = 221121111, + ["O"] = 121121112, ["P"] = 121121211, ["Q"] = 222111111, ["R"] = 122111112, + ["S"] = 122111211, ["T"] = 122121111, ["U"] = 211111122, ["V"] = 211111221, + ["W"] = 111111222, ["X"] = 211121121, ["Y"] = 111121122, ["Z"] = 111121221, + ["-"] = 212111121, ["."] = 112111122, [" "] = 112111221, ["$"] = 111212121, + ["/"] = 121112121, ["+"] = 121211121, ["%"] = 121212111, } Code39._star_def = 112121121 -- '*' start/stop character @@ -54,7 +50,7 @@ pardef.module = { -- with label or form design. -- The module width (width of narrow element) should be at least 7.5 mils -- or 0.1905mm (a mil is 1/1000 inch). - default = 7.5 * 0.0254 * 186467, -- 7.5 mils (sp) unit misure, + default = 10 * 0.0254 * 186467, -- 7.5 mils (sp) unit misure, unit = "sp", -- scaled point isReserved = true, fncheck = function (self, mod, _) --> boolean, err @@ -230,98 +226,83 @@ pardef.text_star = { -- configuration function function Code39:_config() --> ok, err + local Vbar = self._libgeo.Vbar -- Vbar class + local Archive = self._libgeo.Archive -- Archive class + local c39_vbars = Archive:new() + self._vbar_archive = c39_vbars -- build Vbar object for the start/stop symbol local mod, ratio = self.module, self.ratio local n_star = self._star_def - local Vbar = self._libgeo.Vbar -- Vbar class - self._vbar = {['*'] = Vbar:from_int_revpair(n_star, mod, mod*ratio)} + local star = Vbar:from_int_revpair(n_star, mod, mod*ratio) + c39_vbars:insert(star, "*") return true, nil end --- overriding Barcode method -function Code39:_check_char(c) --> elem, err - if type(c) ~= "string" or #c ~= 1 then - return nil, "[ArgErr] invalid char" - end - local symb_def = self._symb_def - local n = symb_def[c] - if not n then - local fmt = "[ArgErr] '%s' is not a valid Code 39 symbol" - return nil, string.format(fmt, c) +function Code39:_ensure_symbol(c) + local Archive = self._vbar_archive + if not Archive:contains_key(c) then + local Vbar = self._libgeo.Vbar + local mod, ratio = self.module, self.ratio + local symb_def = self._symb_def + local n_def = symb_def[c] + local v = Vbar:from_int_revpair(n_def, mod, mod*ratio) + Archive:insert(v, c) end - return c, nil end -- overriding Barcode method -function Code39:_check_digit(n) --> elem, err - if type(n) ~= "number" then - return nil, "[ArgErr] not a number" - end - if n < 0 or n > 9 then - return nil, "[ArgErr] not a digit" +function Code39:_process_char(c) --> elem_code, elem_text, err + local symb_def = self._symb_def + if not symb_def[c] then + local fmt = "[ArgErr] '%s' is not a valid Code 39 symbol" + return nil, nil, string.format(fmt, c) end - return string.char(n + 48), nil + self:_ensure_symbol(c) + return c, nil, nil end -function Code39:_finalize() --> ok, err - local v = assert(self._code_data, "[InternalErr] '_code_data' field is nil") - local vbar = self._vbar - local g_Vbar = self._libgeo.Vbar - local mod, ratio = self.module, self.ratio - local symb_def = self._symb_def - for _, c in ipairs(v) do - if not vbar[c] then - local n1 = symb_def[c] - vbar[c] = g_Vbar:from_int_revpair(n1, mod, mod*ratio) - end - end - return true, nil +-- overriding Barcode method +function Code39:_process_digit(n) --> elem_code, elem_text, err + local c = string.char(n + 48) + self:_ensure_symbol(c) + return c, nil, nil end -- tx, ty is an optional translator vector -function Code39:append_ga(canvas, tx, ty) --> canvas - local code = self._code_data - local ns = self._code_len -- number of chars inside the symbol - local mod = self.module - local ratio = self.ratio - local interspace = self.interspace - local h = self.height - local xs = mod*(6 + 3*ratio) - local xgap = xs + interspace - local w = xgap*(ns + 1) + xs -- (ns + 2)*xgap - interspace - local ax, ay = self.ax, self.ay - local x0 = (tx or 0) - ax * w - local y0 = (ty or 0) - ay * h - local x1 = x0 + w - local y1 = y0 + h - local xpos = x0 - local err - err = canvas:start_bbox_group() - assert(not err, err) - local vbar = self._vbar - -- start/stop symbol - local term_vbar = vbar['*'] - -- draw start symbol - err = canvas:encode_Vbar(term_vbar, xpos, y0, y1) - assert(not err, err) - for _, c in ipairs(code) do -- draw code symbols - xpos = xpos + xgap - local vb = vbar[c] - err = canvas:encode_Vbar(vb, xpos, y0, y1) - assert(not err, err) +function Code39:_append_ga(canvas, tx, ty) --> x1, y1, x2, y2 -- bbox + local code = self._code_data + local ns = #code -- number of chars inside the symbol + local archive = self._vbar_archive + local q = assert(archive:get("*")) -- form the vbar queue, actually it is just a Vbar + local dx = self.interspace + for _, c in ipairs(code) do + q = q + dx + assert(archive:get(c)) end - -- draw stop symbol - err = canvas:encode_Vbar(term_vbar, xpos + xgap, y0, y1) - assert(not err, err) + q = q + dx + assert(archive:get("*")) -- final stop char + assert(canvas:encode_disable_bbox()) + -- draw the symbol + local ax, ay = self.ax, self.ay + local mod = self.module + local ratio = self.ratio + local xs = mod*(6 + 3*ratio) + local xgap = xs + dx + local h = self.height + local w = xgap*(ns + 1) + xs -- (ns + 2)*xgap - interspace + -- + local x0 = tx - ax * w + local x1 = x0 + w + local y0 = ty - ay * h + local y1 = y0 + h + assert(canvas:encode_vbar_queue(q, x0, y0, y1)) -- bounding box setting local qz = self.quietzone - err = canvas:stop_bbox_group(x0 - qz, y0, x1 + qz, y1) - assert(not err, err) + assert(canvas:encode_set_bbox(x0 - qz, y0, x1 + qz, y1)) -- check height as the minimum of 15% of length -- TODO: message could warn the user -- if 0.15 * w > h then -- message("The height of the barcode is to small") -- end + assert(canvas:encode_enable_bbox()) if self.text_enabled then -- human readable text local chars; if self.text_star then chars = {"*"} @@ -356,8 +337,7 @@ function Code39:append_ga(canvas, tx, ty) --> canvas xaxis = xaxis + xgap end xaxis = xaxis + xs/2 - err = canvas:encode_Text_xspaced(txt, xaxis, xgap, ypos, tay) - assert(not err, err) + assert(canvas:encode_Text_xspaced(txt, xaxis, xgap, ypos, tay)) else local xpos, tax if txt_hpos == "left" then @@ -372,12 +352,10 @@ function Code39:append_ga(canvas, tx, ty) --> canvas else error("[InternalErr] wrong option for text_pos") end - err = canvas:encode_Text(txt, xpos, ypos, tax, tay) - assert(not err, err) + assert(canvas:encode_Text(txt, xpos, ypos, tax, tay)) end end - return canvas + return {x0, y0, x1, y1, qz, nil, qz, nil} end return Code39 ---
\ No newline at end of file diff --git a/macros/luatex/generic/barracuda/src/lib-barcode/brcd-ean.lua b/macros/luatex/generic/barracuda/src/lib-barcode/brcd-ean.lua index bddaa36103..d7f7733f3a 100644 --- a/macros/luatex/generic/barracuda/src/lib-barcode/brcd-ean.lua +++ b/macros/luatex/generic/barracuda/src/lib-barcode/brcd-ean.lua @@ -1,10 +1,10 @@ -- EAN family barcode generator -- --- Copyright (C) 2020 Roberto Giacomelli +-- Copyright (C) 2019-2022 Roberto Giacomelli -- see LICENSE.txt file local EAN = { - _VERSION = "ean v0.0.6", + _VERSION = "ean v0.0.8", _NAME = "ean", _DESCRIPTION = "EAN barcode encoder", } @@ -75,6 +75,7 @@ EAN._par_order = { "text_enabled", "text_ygap_factor", "text_xgap_factor", + "text_guard_enabled", } EAN._par_def = {} local pardef = EAN._par_def @@ -148,7 +149,7 @@ pardef.bars_depth_factor = { end, } --- enable/disable a text label upon the barcode symbol +-- enable/disable human readble text pardef.text_enabled = { -- boolean type default = true, isReserved = false, @@ -187,6 +188,30 @@ pardef.text_xgap_factor = { end, } +pardef.text_guard_enabled = { -- boolean type + default = false, + isReserved = false, + fncheck = function (_self, flag, _) --> boolean, err + if type(flag) == "boolean" then + return true, nil + else + return false, "[TypeErr] not a boolean value for text_guard_enabled" + end + end, +} + +EAN._par_def_8 = {} -- ean8 substitute parameters +local pardef8 = EAN._par_def_8 +pardef8.quietzone_left_factor = pardef.quietzone_right_factor + +EAN._par_def_5 = {} -- ean5 add-on substitute parameters +local pardef5 = EAN._par_def_5 +pardef5.quietzone_left_factor = pardef.quietzone_right_factor + +EAN._par_def_2 = {} -- ean2 add-on substitute parameters +local pardef2 = EAN._par_def_2 +pardef2.quietzone_left_factor = pardef.quietzone_right_factor + -- variant parameters EAN._par_variant_order = { ["13"] = {}, -- EAN13 @@ -337,101 +362,103 @@ par_def_var["issn"].text_issn_ygap_factor = text_ygap_factor -- utility for generic configuration of full symbol, add-on included -- n1 length of main symbol, 8 or 13 -- n2 length of add-on symbol, 2 or 5 -local function config_full(ean, Vbar, mod, n1, n2) +local function config_full(ean, n1, n2) local i1 = tostring(n1) local fn_1 = assert(ean._config_variant[i1]) - fn_1(ean, Vbar, mod) + fn_1(ean) local i2 = tostring(n2) local fn_2 = assert(ean._config_variant[i2]) - fn_2(ean, Vbar, mod) + fn_2(ean) ean._main_len = n1 ean._addon_len = n2 ean._is_last_checksum = true end local config_variant = { - ["13"] = function (ean13, Vbar, mod) + ["13"] = function (ean13) ean13._main_len = 13 ean13._is_last_checksum = true - local start = ean13._start + local Vbar = ean13._libgeo.Vbar -- Vbar class + local Vbar_archive = ean13._libgeo.Archive -- Archive class + local Codeset = Vbar_archive:new() + ean13._13_codeset_vbar = Codeset + local mod = ean13.mod local stop = ean13._stop - ean13._13_start_stop_vbar = Vbar:from_int(start[1], mod, start[2]) - ean13._13_ctrl_center_vbar = Vbar:from_int(stop[1], mod, stop[2]) - ean13._13_codeset_vbar = {} - local tvbar = ean13._13_codeset_vbar + local start = ean13._start + Codeset:insert(Vbar:from_int(start[1], mod, start[2]), "start_stop") + Codeset:insert(Vbar:from_int(stop[1], mod, stop[2]), "central") for i_cs, codetab in ipairs(ean13._symbol) do - tvbar[i_cs] = {} - local tv = tvbar[i_cs] local isbar = ean13._is_first_bar[i_cs] for i = 0, 9 do - tv[i] = Vbar:from_int(codetab[i], mod, isbar) + Codeset:insert(Vbar:from_int(codetab[i], mod, isbar), i_cs, i) end end end, - ["8"] = function (ean8, Vbar, mod) + ["8"] = function (ean8) ean8._main_len = 8 ean8._is_last_checksum = true + local Vbar = ean8._libgeo.Vbar + local Vbar_archive = ean8._libgeo.Archive local start = ean8._start local stop = ean8._stop - ean8._8_start_stop_vbar = Vbar:from_int(start[1], mod, start[2]) - ean8._8_ctrl_center_vbar = Vbar:from_int(stop[1], mod, stop[2]) - ean8._8_codeset_vbar = {} - local tvbar = ean8._8_codeset_vbar + local mod = ean8.mod + local Codeset = Vbar_archive:new() + ean8._8_codeset_vbar = Codeset + Codeset:insert(Vbar:from_int(start[1], mod, start[2]), "start_stop") + Codeset:insert(Vbar:from_int(stop[1], mod, stop[2]), "central") for k = 1, 3, 2 do -- only codeset A and C (k == 1, 3) - tvbar[k] = {} local codetab = ean8._symbol[k] local isbar = ean8._is_first_bar[k] - local tv = tvbar[k] for i = 0, 9 do - tv[i] = Vbar:from_int(codetab[i], mod, isbar) + Codeset:insert(Vbar:from_int(codetab[i], mod, isbar), k, i) end end end, - ["5"] = function (ean5, Vbar, mod) -- add-on EAN5 + ["5"] = function (ean5) -- add-on EAN5 ean5._main_len = 5 ean5._is_last_checksum = false - ean5._5_start_vbar = Vbar:from_int(112, mod, true) - ean5._5_sep_vbar = Vbar:from_int(11, mod, false) - ean5._5_codeset_vbar = {} - local tvbar = ean5._5_codeset_vbar + local mod = ean5.mod + local Vbar = ean5._libgeo.Vbar + local Vbar_archive = ean5._libgeo.Archive + local Codeset = Vbar_archive:new() + Codeset:insert(Vbar:from_int(112, mod, true), "start") + Codeset:insert(Vbar:from_int(11, mod, false), "sep") + ean5._5_codeset_vbar = Codeset local symbols = ean5._symbol for c = 1, 2 do - tvbar[c] = {} - local tcs = tvbar[c] - local sb = symbols[c] for i = 0, 9 do - tcs[i] = Vbar:from_int(sb[i], mod, false) + Codeset:insert(Vbar:from_int(symbols[c][i], mod, false), c, i) end end end, - ["2"] = function (ean2, Vbar, mod) -- add-on EAN2 + ["2"] = function (ean2) -- add-on EAN2 ean2._main_len = 2 ean2._is_last_checksum = false - ean2._2_start_vbar = Vbar:from_int(112, mod, true) - ean2._2_sep_vbar = Vbar:from_int(11, mod, false) - ean2._2_codeset_vbar = {} - local tvbar = ean2._2_codeset_vbar + local mod = ean2.mod + local Vbar = ean2._libgeo.Vbar + local Vbar_archive = ean2._libgeo.Archive + local Codeset = Vbar_archive:new() + ean2._2_codeset_vbar = Codeset + Codeset:insert(Vbar:from_int(112, mod, true), "start") + Codeset:insert(Vbar:from_int(11, mod, false), "sep") local symbols = ean2._symbol for c = 1, 2 do - tvbar[c] = {} - local tcs = tvbar[c] - local sb = symbols[c] for i = 0, 9 do - tcs[i] = Vbar:from_int(sb[i], mod, false) + Codeset:insert(Vbar:from_int(symbols[c][i], mod, false), c, i) end end end, ["13+5"] = function (ean, Vbar, mod) -- EAN13 with EAN5 add-on - config_full(ean, Vbar, mod, 13, 5) + config_full(ean, 13, 5) end, ["13+2"] = function(ean, Vbar, mod) -- EAN13 with EAN2 add-on - config_full(ean, Vbar, mod, 13, 2) + config_full(ean, 13, 2) end, ["8+5"] = function(ean, Vbar, mod) -- EAN8 with EAN5 add-on - config_full(ean, Vbar, mod, 8, 5) + config_full(ean, 8, 5) end, ["8+2"] = function(ean, Vbar, mod) -- EAN8 with EAN2 add-on - config_full(ean, Vbar, mod, 8, 2) + config_full(ean, 8, 2) end, } -- ISBN @@ -491,58 +518,58 @@ local function isbn_checksum(isbn) return sum % 11 end +local function isbn_parse_state() --> parse state + return { + is_space = false, + is_dash = false, + isbn_len = 0, + } +end + -- group char for readibility '-' or ' ' -- char won't be inserted in the top isbn code -local function isbn_check_char(_, c, parse_state) --> elem, err - if type(c) ~= "string" or #c ~= 1 then - return nil, "[InternalErr] invalid char" - end - if parse_state.isbncode == nil then parse_state.isbncode = {} end - local code = parse_state.isbncode - if parse_state.isspace == nil then parse_state.isspace = false end - if parse_state.isdash == nil then parse_state.isdash = false end - if parse_state.isbn_len == nil then parse_state.isbn_len = 0 end +local function isbn_process_char(_, c, parse_state) --> elem_code, elem_text, err local isbn_len = parse_state.isbn_len if c == "-" then if isbn_len == 0 then - return nil, "[ArgErr] an initial dash is not allowed" + return nil, nil, "[ArgErr] an initial dash is not allowed" end - if parse_state.isdash then - return nil, "[ArgErr] two consecutive dash char found" + if parse_state.is_dash then + return nil, nil, "[ArgErr] found two consecutive dash" end - parse_state.isdash = true - return nil, nil + parse_state.is_dash = true + return nil, c, nil elseif c == " " then if isbn_len == 0 then - return nil, "[ArgErr] an initial space is not allowed" + return nil, nil, "[ArgErr] an initial space is not allowed" + end + if parse_state.is_space then + return nil, nil, nil + else + parse_state.is_space = true + return nil, c, nil end - parse_state.isspace = true - return nil, nil elseif c == "X" then -- ISBN-10 checksum for 10 - code[#code + 1] = c isbn_len = isbn_len + 1 parse_state.isbn_len = isbn_len if isbn_len ~= 10 then - return nil, "[ArgErr] found a checksum 'X' in a wrong position" + return nil, nil, "[ArgErr] found a checksum 'X' in a wrong position" end - return 10, nil + return 10, c, nil else -- c is at this point eventually a digit local n = string.byte(c) - 48 if n < 0 or n > 9 then - return nil, "[ArgErr] found a not digit or a not grouping char" + return nil, nil, "[ArgErr] found a not digit or a not group char" end - if parse_state.isdash then -- close a group - code[#code + 1] = "-" - parse_state.isdash = false - parse_state.isspace = false - elseif parse_state.isspace then - code[#code + 1] = " " - parse_state.isspace = false + if parse_state.is_dash then -- close a group + parse_state.is_dash = false + parse_state.is_space = false + elseif parse_state.is_space then + parse_state.is_space = false end - code[#code + 1] = c isbn_len = isbn_len + 1 parse_state.isbn_len = isbn_len - return n, nil + return n, c, nil end end @@ -550,7 +577,8 @@ end -- parsed local function isbn_finalize(enc, parse_state) --> ok, err local var = enc._variant - local code_len = enc._code_len + local code_data = enc._code_data + local code_len = #code_data local isbn_len = parse_state.isbn_len local l1, l2 if var == "isbn" then @@ -559,7 +587,7 @@ local function isbn_finalize(enc, parse_state) --> ok, err elseif isbn_len == 13 then l1 = 13 else - return false, "[ArgErr] unsuitable ISBN code length" + return false, "[ArgErr] wrong ISBN code length of "..isbn_len end assert(l1 == code_len) elseif var == "isbn+5" then @@ -569,7 +597,7 @@ local function isbn_finalize(enc, parse_state) --> ok, err elseif isbn_len == 18 then l1, l2 = 13, 5 else - return false, "[ArgErr] unsuitable ISBN+5 code length" + return false, "[ArgErr] wrong ISBN+5 code length of "..isbn_len end assert(l1 + l2 == code_len) elseif var == "isbn+2" then @@ -579,13 +607,12 @@ local function isbn_finalize(enc, parse_state) --> ok, err elseif isbn_len == 15 then l1, l2 = 13, 2 else - return false, "[ArgErr] unsuitable ISBN+2 code length" + return false, "[ArgErr] wrong ISBN+2 code length of "..isbn_len end assert(l1 + l2 == code_len) else error("[InternalErr] unexpected ISBN variant code") end - local code_data = enc._code_data local isbn_auto = false if l1 == 10 then -- isbn 10 to 13 conversion local ck = isbn_checksum(code_data) @@ -606,7 +633,7 @@ local function isbn_finalize(enc, parse_state) --> ok, err return false, "[ArgErr] unmatched ISBN 13 checksum" end end - local isbncode = parse_state.isbncode + local isbncode = enc._code_text if l2 then -- nils the add-on digits local i = #isbncode while l2 > 0 do @@ -631,7 +658,6 @@ local function isbn_finalize(enc, parse_state) --> ok, err return false, "[ArgErr] too many groups found in the ISBN code" end if g > 0 then isbn_auto = true end - enc._isbncode = isbncode enc._isbntxt_on = isbn_auto return true, nil end @@ -660,84 +686,86 @@ local function to_n(c) --> n, err return n, false end +local function issn_parse_state() + return { + is_dash = false, + is_group_open = false, + is_group_close = false, + ed_var_len = 0, + ed_var_arr = {}, + code_len = 0, + addon_len = 0, + } +end + -- ISSN dddd-dddx[dd] or 13-long array -- spaces is always ignored -local function issn_check_char(enc, c, parse_state) --> elem, err - if (type(c) ~= "string") or (#c ~= 1) then - return nil, "[InternalErr] invalid char" - end - if parse_state.is_dash == nil then parse_state.is_dash = false end - if parse_state.is_group_open == nil then parse_state.is_group_open = false end - if parse_state.is_group_close == nil then parse_state.is_group_close = false end - if parse_state.ed_var_len == nil then parse_state.ed_var_len = 0 end - if parse_state.ed_var_arr == nil then parse_state.ed_var_arr = {} end - if parse_state.code_len == nil then parse_state.code_len = 0 end - if parse_state.addon_len == nil then parse_state.addon_len = 0 end +local function issn_process_char(enc, c, parse_state) --> e_data, e_txt, err local addon_len = enc._addon_len - -- edition variant part + -- `edition variant` input code part if c == " " then - return nil, nil -- ignore all spaces + return nil, nil, nil -- ignore all spaces end if parse_state.is_group_close then if addon_len then if parse_state.addon_len == enc._addon_len then - return nil, "[ArgErr] too many chars in the ISSN input code" + return nil, nil, "[ArgErr] too many chars in the ISSN input code" end local n, e = to_n(c) if e then - return nil, "[ArgErr] non digit char after a edition variant group" + return nil, nil, "[ArgErr] non digit char after an edition variant group" end parse_state.addon_len = parse_state.addon_len + 1 - return n, nil + return n, n, nil else - return nil, "[ArgErr] too many chars in the ISSN input code" + return nil, nil, "[ArgErr] too many chars in the ISSN input code" end end -- code part if c == "-" then if parse_state.is_dash then - return nil, "[ArgErr] two or more dash char in the input code" + return nil, nil, "[ArgErr] two or more dash chars in the input code" end if parse_state.code_len ~= 4 then - return nil, "[ArgErr] incorrect position for a dash sign" + return nil, nil, "[ArgErr] incorrect position for a dash sign" end parse_state.is_dash = true - return nil, nil + return nil, c, nil elseif c == "[" then -- two digits edition variant group opening if parse_state.code_len ~= 8 then - return nil, "[ArgErr] not a 8 digits long code for the ISSN input" + return nil, nil, "[ArgErr] not a 8-digits long code for the ISSN input" end parse_state.is_group_open = true - return nil, nil + return nil, nil, nil elseif c == "]" then -- two digits edition variant closing if not parse_state.is_group_open then - return nil, "[ArgErr] found a ']' without a '['" + return nil, nil, "[ArgErr] found a ']' without an opened '['" end if parse_state.ed_var_len ~= 2 then - return nil, "[ArgErr] edition variant group must be two digits long" + return nil, nil, "[ArgErr] edition variant group must be two digits long" end parse_state.is_group_open = false parse_state.is_group_close = true - return nil, nil + return nil, nil, nil elseif c == "X" then -- 8th ISSN checksum digit if parse_state.code_len ~= 7 then - return nil, "[ArgErr] incorrect position for checksum digit 'X'" + return nil, nil, "[ArgErr] incorrect position for checksum digit 'X'" end parse_state.code_len = 8 - return 10, nil - else -- at this point 'c' can be only a digit + return 10, c, nil + else -- at this point 'c' may be only a digit local n, e = to_n(c) if e then - return nil, "[ArgErr] found a non digit in code part" + return nil, nil, "[ArgErr] found a non digit in code part" end if parse_state.is_group_open then if parse_state.ed_var_len == 2 then - return nil, "[ArgErr] group digits are more than two" + return nil, nil, "[ArgErr] group digits are more than two" end parse_state.ed_var_len = parse_state.ed_var_len + 1 local t = parse_state.ed_var_arr t[#t + 1] = n - return nil, nil + return nil, c, nil end if parse_state.is_dash then if addon_len then @@ -745,29 +773,29 @@ local function issn_check_char(enc, c, parse_state) --> elem, err parse_state.code_len = parse_state.code_len + 1 else if parse_state.addon_len == addon_len then - return nil, "[ArgErr] too many digits for a 8 + "..addon_len.." ISSN input code" + return nil, nil, "[ArgErr] too many digits for a 8 + "..addon_len.." ISSN input code" end parse_state.addon_len = parse_state.addon_len + 1 end else if parse_state.code_len == 8 then - return nil, "[ArgErr] too many digits found for a 8 digits long ISSN input code" + return nil, nil, "[ArgErr] too many digits found for a 8 digits long ISSN input code" end parse_state.code_len = parse_state.code_len + 1 end else if addon_len then if parse_state.code_len == (13 + addon_len) then - return nil, "[ArgErr] too many digits in ISSN input code" + return nil, nil, "[ArgErr] too many digits in ISSN input code" end else if parse_state.code_len == 13 then - return nil, "[ArgErr] too many digits in a 13 digits long ISSN input code" + return nil, nil, "[ArgErr] too many digits in a 13 digits long ISSN input code" end end parse_state.code_len = parse_state.code_len + 1 end - return n, nil + return n, n, nil end end @@ -822,7 +850,7 @@ local function issn_finalize(enc, parse_state) --> ok, err return false, "[ArgErr] unclosed edition variant group in ISSN input code" end local data = enc._code_data - local code_len = enc._code_len + local code_len = #data local addon_len = enc._addon_len local main_len = code_len - (addon_len or 0) if main_len == 8 then @@ -862,12 +890,12 @@ local function basic_finalize(enc) --> ok, err local l1 = enc._main_len local l2 = enc._addon_len local ok_len = l1 + (l2 or 0) - local symb_len = enc._code_len + local data = enc._code_data + local symb_len = #data if symb_len ~= ok_len then return false, "[ArgErr] not a "..ok_len.."-digit long array" end if enc._is_last_checksum then -- is the last digit ok? - local data = enc._code_data local ck = checksum_8_13(data, l1 - 1) if ck ~= data[l1] then return false, "[Err] wrong checksum digit" @@ -881,7 +909,7 @@ end function EAN:_config() --> ok, err local variant = self._variant if not variant then - return false, "[Err] variant is mandatory for EAN family" + return false, "[Err] variant is mandatory for the EAN family" end local plus = variant:find("+") local v1 @@ -894,13 +922,13 @@ function EAN:_config() --> ok, err self._sub_variant_1 = v1 end local fnconfig = self._config_variant[variant] - local VbarClass = self._libgeo.Vbar -- Vbar class - local mod = self.mod - fnconfig(self, VbarClass, mod) + fnconfig(self) if v1 == "isbn" then - self._check_char = isbn_check_char + self._process_char = isbn_process_char + self._init_parse_state = isbn_parse_state elseif v1 == "issn" then - self._check_char = issn_check_char + self._process_char = issn_process_char + self._init_parse_state = issn_parse_state end return true, nil end @@ -987,51 +1015,39 @@ local fn_append_ga_variant = EAN._append_ga_variant -- draw EAN13 symbol fn_append_ga_variant["13"] = function (ean, canvas, tx, ty, ax, ay) - local code = ean._code_data - local mod = ean.mod - local bars_depth = mod * ean.bars_depth_factor - local w, h = 95*mod, ean.height + bars_depth - local x0 = (tx or 0) - ax * w - local y0 = (ty or 0) - ay * h - local x1 = x0 + w - local y1 = y0 + h - local xpos = x0 -- current insertion x-coord - local ys = y0 + bars_depth - local s_width = 7*mod - local code_seq = ean._codeset_seq[code[1]] - -- draw the start symbol - local err - err = canvas:start_bbox_group(); assert(not err, err) - local be = ean._13_start_stop_vbar - err = canvas:encode_Vbar(be, xpos, y0, y1); assert(not err, err) - xpos = xpos + 3*mod - -- draw the first 6 numbers + local Codeset = ean._13_codeset_vbar + local mod = ean.mod + local queue_0 = assert(Codeset:get("start_stop")) + + 42*mod + + assert(Codeset:get("central")) + + 42*mod + + assert(Codeset:get("start_stop")) + local code = ean._code_data + local code_seq = ean._codeset_seq[code[1]] + local queue_1 = ean._libgeo.Vbar_queue:new() for i = 2, 7 do - local codeset = code_seq[i-1] - local n = code[i] - local vbar = ean._13_codeset_vbar[codeset][n] - err = canvas:encode_Vbar(vbar, xpos, ys, y1); assert(not err, err) - xpos = xpos + s_width + queue_1 = queue_1 + assert(Codeset:get(code_seq[i-1], code[i])) end - -- draw the control symbol - local ctrl = ean._13_ctrl_center_vbar - err = canvas:encode_Vbar(ctrl, xpos, y0, y1); assert(not err, err) - xpos = xpos + 5*mod - -- draw the last 6 numbers + queue_1 = queue_1 + 5*mod for i = 8, 13 do - local codeset = code_seq[i-1] - local n = code[i] - local vbar = ean._13_codeset_vbar[codeset][n] - err = canvas:encode_Vbar(vbar, xpos, ys, y1); assert(not err, err) - xpos = xpos + s_width + queue_1 = queue_1 + assert(Codeset:get(code_seq[i-1], code[i])) end - -- draw the stop char - err = canvas:encode_Vbar(be, xpos, y0, y1); assert(not err, err) + local bars_depth = mod * ean.bars_depth_factor + local w, h = 95*mod, ean.height + bars_depth + local x0 = tx - ax * w + local y0 = ty - ay * h + local x1 = x0 + w + local y1 = y0 + h + local ys = y0 + bars_depth + -- draw the symbol + assert(canvas:encode_disable_bbox()) + assert(canvas:encode_vbar_queue(queue_0, x0, y0, y1)) + assert(canvas:encode_vbar_queue(queue_1, x0 + 3*mod, ys, y1)) -- bounding box set up local qzl = ean.quietzone_left_factor * mod local qzr = ean.quietzone_right_factor * mod - err = canvas:stop_bbox_group(x0 - qzl, y0, x1 + qzr, y1) - assert(not err, err) + assert(canvas:encode_set_bbox(x0 - qzl, y0, x1 + qzr, y1)) + assert(canvas:encode_enable_bbox()) if ean.text_enabled then -- human readable text local Text = ean._libgeo.Text local txt_1 = Text:from_digit_array(code, 1, 1) @@ -1039,16 +1055,30 @@ fn_append_ga_variant["13"] = function (ean, canvas, tx, ty, ax, ay) local txt_3 = Text:from_digit_array(code, 8, 13) local y_bl = ys - ean.text_ygap_factor * mod local mx = ean.text_xgap_factor - err = canvas:encode_Text(txt_1, x0 - qzl, y_bl, 0, 1) - assert(not err, err) + assert(canvas:encode_Text(txt_1, x0 - qzl, y_bl, 0, 1)) local x2_1 = x0 + (3+mx)*mod local x2_2 = x0 + (46-mx)*mod - err = canvas:encode_Text_xwidth(txt_2, x2_1, x2_2, y_bl, 1) - assert(not err, err) + assert(canvas:encode_Text_xwidth(txt_2, x2_1, x2_2, y_bl, 1)) local x3_1 = x0 + (49+mx)*mod local x3_2 = x0 + (92-mx)*mod - err = canvas:encode_Text_xwidth(txt_3, x3_1, x3_2, y_bl, 1) - assert(not err, err) + assert(canvas:encode_Text_xwidth(txt_3, x3_1, x3_2, y_bl, 1)) + if ean.text_guard_enabled and (not ean._addon_len) then + local Polyline = ean._libgeo.Polyline + local mm = 186467.98 + local alpha = 36 * math.pi/180 + local pw = 0.30*mm + local dx = pw/(2*math.sin(alpha)) + local dy = (pw/2) * math.cos(alpha) + local px = x1 + qzr - dx + local pb = 1.55*mm + local ph = pb * math.tan(alpha) + local p = Polyline:new() + p:add_point(px - pb, y_bl - 2*ph - dy) + p:add_point(px, y_bl - ph - dy) + p:add_point(px - pb, y_bl - dy) + assert(canvas:encode_linewidth(pw)) + assert(canvas:encode_polyline(p)) + end local istxt = false if ean.text_isbn_enabled then if ean.text_isbn_enabled == "auto" then @@ -1060,7 +1090,7 @@ fn_append_ga_variant["13"] = function (ean, canvas, tx, ty, ax, ay) end end if istxt then - local isbn = assert(ean._isbncode, "[InternalErr] ISBN text not found") + local isbn = assert(ean._code_text, "[InternalErr] ISBN text not found") local descr = {"I", "S", "B", "N", " ",} for _, d in ipairs(isbn) do descr[#descr + 1] = d @@ -1068,13 +1098,12 @@ fn_append_ga_variant["13"] = function (ean, canvas, tx, ty, ax, ay) local isbn_txt = Text:from_chars(descr) local x_isbn = x0 + 47.5 * mod local y_isbn = y1 + ean.text_isbn_ygap_factor * mod - err = canvas:encode_Text(isbn_txt, x_isbn, y_isbn, 0.5, 0) - assert(not err, err) + assert(canvas:encode_Text(isbn_txt, x_isbn, y_isbn, 0.5, 0)) end -- issn text if ean.text_issn_enabled then local hri = {"I", "S", "S", "N", " "} - local txt = assert(ean._code_text, "[IternalErr] _code_text not found") + local txt = assert(ean._code_text, "[InternalErr] _code_text not found") for i = 1, 4 do hri[i + 5] = txt[i] end @@ -1085,59 +1114,46 @@ fn_append_ga_variant["13"] = function (ean, canvas, tx, ty, ax, ay) local issn_txt = Text:from_chars(hri) local x_issn = x0 + 47.5 * mod local y_issn = y1 + ean.text_issn_ygap_factor * mod - err = canvas:encode_Text(issn_txt, x_issn, y_issn, 0.5, 0) - assert(not err, err) + assert(canvas:encode_Text(issn_txt, x_issn, y_issn, 0.5, 0)) end end + return {x0, y0, x1, y1, qzl, nil, qzr, nil,} end -- draw EAN8 symbol fn_append_ga_variant["8"] = function (ean, canvas, tx, ty, ax, ay) - local code = ean._code_data - local mod = ean.mod - local bars_depth = mod * ean.bars_depth_factor - local w, h = 67*mod, ean.height + bars_depth - local x0 = (tx or 0) - ax * w - local y0 = (ty or 0) - ay * h - local x1 = x0 + w - local y1 = y0 + h - local xpos = x0 -- current insertion x-coord - local ys = y0 + bars_depth - local s_width = 7*mod - -- draw the start symbol - local err - err = canvas:start_bbox_group(); assert(not err, err) - local be = ean._8_start_stop_vbar - err = canvas:encode_Vbar(be, xpos, y0, y1); assert(not err, err) - xpos = xpos + 3*mod - -- draw the first 4 numbers - local t_vbar = ean._8_codeset_vbar + local Codeset = ean._8_codeset_vbar + local mod = ean.mod + local q0 = assert(Codeset:get("start_stop")) + 28*mod + + assert(Codeset:get("central")) + 28*mod + + assert(Codeset:get("start_stop")) + local code = ean._code_data local cs14 = ean._codeset14_8 + local q1 = ean._libgeo.Vbar_queue:new() for i = 1, 4 do - local n = code[i] - local vbar = t_vbar[cs14][n] - err = canvas:encode_Vbar(vbar, xpos, ys, y1); assert(not err, err) - xpos = xpos + s_width + q1 = q1 + assert(Codeset:get(cs14, code[i])) end - -- draw the control symbol - local ctrl = ean._8_ctrl_center_vbar - err = canvas:encode_Vbar(ctrl, xpos, y0, y1); assert(not err, err) - xpos = xpos + 5*mod - -- draw the product code + q1 = q1 + 5*mod local cs58 = ean._codeset58_8 for i = 5, 8 do - local n = code[i] - local vbar = t_vbar[cs58][n] - err = canvas:encode_Vbar(vbar, xpos, ys, y1); assert(not err, err) - xpos = xpos + s_width + q1 = q1 + assert(Codeset:get(cs58, code[i])) end - -- draw the stop char - err = canvas:encode_Vbar(be, xpos, y0, y1); assert(not err, err) + local bars_depth = mod * ean.bars_depth_factor + local w, h = 67*mod, ean.height + bars_depth + local x0 = tx - ax * w + local y0 = ty - ay * h + local x1 = x0 + w + local y1 = y0 + h + local ys = y0 + bars_depth + -- draw the symbol + assert(canvas:encode_disable_bbox()) + assert(canvas:encode_vbar_queue(q0, x0, y0, y1)) + assert(canvas:encode_vbar_queue(q1, x0 + 3*mod, ys, y1)) -- bounding box set up local qzl = ean.quietzone_left_factor * mod local qzr = ean.quietzone_right_factor * mod - err = canvas:stop_bbox_group(x0 - qzl, y0, x1 + qzr, y1) - assert(not err, err) + assert(canvas:encode_set_bbox(x0 - qzl, y0, x1 + qzr, y1)) + assert(canvas:encode_enable_bbox()) if ean.text_enabled then -- human readable text local Text = ean._libgeo.Text local t_1 = Text:from_digit_array(code, 1, 4) @@ -1146,18 +1162,40 @@ fn_append_ga_variant["8"] = function (ean, canvas, tx, ty, ax, ay) local mx = ean.text_xgap_factor local x1_1 = x0 + ( 3 + mx)*mod local x1_2 = x0 + (32 - mx)*mod - err = canvas:encode_Text_xwidth(t_1, x1_1, x1_2, y_bl, 1) - assert(not err, err) + assert(canvas:encode_Text_xwidth(t_1, x1_1, x1_2, y_bl, 1)) local x2_1 = x0 + (35+mx)*mod local x2_2 = x0 + (64-mx)*mod - err = canvas:encode_Text_xwidth(t_2, x2_1, x2_2, y_bl, 1) - assert(not err, err) + assert(canvas:encode_Text_xwidth(t_2, x2_1, x2_2, y_bl, 1)) + if ean.text_guard_enabled and (not ean._addon_len) then + local Polyline = ean._libgeo.Polyline + local mm = 186467.98 + local alpha = 36 * math.pi/180 + local pw = 0.30*mm + local pb = 1.55*mm + local ph = pb * math.tan(alpha) + local dx = pw/(2*math.sin(alpha)) + local dy = (pw/2) * math.cos(alpha) + local px1, px2 = x0 - qzl + dx, x1 + qzr - dx + local p1 = Polyline:new() + p1:add_point(px1 + pb, y_bl - 2*ph - dy) + p1:add_point(px1, y_bl - ph - dy) + p1:add_point(px1 + pb, y_bl - dy) + local p2 = Polyline:new() + p2:add_point(px2 - pb, y_bl - 2*ph - dy) + p2:add_point(px2, y_bl - ph - dy) + p2:add_point(px2 - pb, y_bl - dy) + assert(canvas:encode_linewidth(pw)) + assert(canvas:encode_polyline(p1)) + assert(canvas:encode_polyline(p2)) + end end + return {x0, y0, x1, y1, qzl, nil, qzr, nil,} end -- draw EAN5 add-on symbol fn_append_ga_variant["5"] = function (ean, canvas, tx, ty, ax, ay, h) - local code = ean._code_data + local Codeset = ean._5_codeset_vbar + local queue = assert(Codeset:get("start")) local l1 = ean._main_len local i1; if l1 == 5 then i1 = 1 @@ -1165,81 +1203,70 @@ fn_append_ga_variant["5"] = function (ean, canvas, tx, ty, ax, ay, h) i1 = l1 + 1 end local i2 = i1 + 4 - local mod = ean.mod - local w = 47*mod - h = h or ean.height - local x0 = (tx or 0) - ax * w - local y0 = (ty or 0) - ay * h - local x1 = x0 + w - local y1 = y0 + h - local xpos = x0 -- current insertion x-coord - local sym_w = 7*mod - local sep_w = 2*mod - -- draw the start symbol - local err - err = canvas:start_bbox_group(); assert(not err, err) - local start = ean._5_start_vbar - err = canvas:encode_Vbar(start, xpos, y0, y1); assert(not err, err) - xpos = xpos + 4*mod - local ck = checksum_5_2(code, i1, 5) - local codeset = ean._codeset_5[ck] - local sep = ean._5_sep_vbar - local t_vbar = ean._5_codeset_vbar + local mod = ean.mod -- draw the five digits + local code = ean._code_data + local ck = checksum_5_2(code, i1, 5) + local cset = ean._codeset_5[ck] local k = 0 for i = i1, i2 do k = k + 1 - local cs = codeset[k] -- 1 or 2 - local d = code[i] - local vbar = t_vbar[cs][d] - err = canvas:encode_Vbar(vbar, xpos, y0, y1); assert(not err, err) - xpos = xpos + sym_w + queue = queue + assert(Codeset:get(cset[k], code[i])) if k < 5 then - err = canvas:encode_Vbar(sep, xpos, y0, y1); assert(not err, err) - xpos = xpos + sep_w + queue = queue + assert(Codeset:get("sep")) end end + local w = 47*mod + h = h or ean.height + local x0 = tx - ax * w + local y0 = ty - ay * h + local x1 = x0 + w + local y1 = y0 + h + -- draw the symbol + assert(canvas:encode_disable_bbox()) + assert(canvas:encode_vbar_queue(queue, x0, y0, y1)) -- bounding box set up local qzl = ean.quietzone_left_factor * mod local qzr = ean.quietzone_right_factor * mod - err = canvas:stop_bbox_group(x0 - qzl, y0, x1 + qzr, y1) - assert(not err, err) + assert(canvas:encode_set_bbox(x0 - qzl, y0, x1 + qzr, y1)) + assert(canvas:encode_enable_bbox()) if ean.text_enabled then -- human readable text local Text = ean._libgeo.Text local txt = Text:from_digit_array(code, i1, i2) local y_bl = y1 + ean.text_ygap_factor * mod local x1_1 = x0 + 3*mod local x1_2 = x1 - 3*mod - err = canvas:encode_Text_xwidth(txt, x1_1, x1_2, y_bl, 0) - assert(not err, err) + assert(canvas:encode_Text_xwidth(txt, x1_1, x1_2, y_bl, 0)) + if ean.text_guard_enabled then + local Polyline = ean._libgeo.Polyline + local mm = 186467.98 + local alpha = 36 * math.pi/180 + local pw = 0.30*mm + local dx = pw/(2*math.sin(alpha)) + local dy = (pw/2) * math.cos(alpha) + local px = x1 + qzr - dx + local pb = 1.55*mm + local ph = pb * math.tan(alpha) + local p = Polyline:new() + p:add_point(px - pb, y_bl + dy) + p:add_point(px, y_bl + ph + dy) + p:add_point(px - pb, y_bl + 2*ph + dy) + assert(canvas:encode_linewidth(pw)) + assert(canvas:encode_polyline(p)) + end end + return {x0, y0, x1, y1, qzl, nil, qzr, nil,} end -- draw EAN2 symbol fn_append_ga_variant["2"] = function (ean, canvas, tx, ty, ax, ay, h) - local code = ean._code_data local l1 = ean._main_len local i1; if l1 == 2 then i1 = 1 else i1 = l1 + 1 end - local mod = ean.mod - local w = 20*mod - h = h or ean.height - local x0 = (tx or 0.0) - ax * w - local y0 = (ty or 0.0) - ay * h - local x1 = x0 + w - local y1 = y0 + h - local xpos = x0 -- current insertion x-coord - local sym_w = 7*mod - local sep_w = 2*mod - -- draw the start symbol - local err - err = canvas:start_bbox_group(); assert(not err, err) - local start = ean._2_start_vbar - err = canvas:encode_Vbar(start, xpos, y0, y1); assert(not err, err) - xpos = xpos + 4*mod + local code = ean._code_data local r = checksum_5_2(code, i1, 2) local s1, s2 if r == 0 then -- LL scheme @@ -1251,31 +1278,52 @@ fn_append_ga_variant["2"] = function (ean, canvas, tx, ty, ax, ay, h) else -- r == 3 -- GG scheme s1, s2 = 2, 2 end - local t_vbar = ean._2_codeset_vbar - local d1 = code[i1] -- render the first digit - local vb1 = t_vbar[s1][d1] - err = canvas:encode_Vbar(vb1, xpos, y0, y1); assert(not err, err) - xpos = xpos + sym_w - local sep = ean._2_sep_vbar - err = canvas:encode_Vbar(sep, xpos, y0, y1); assert(not err, err) - xpos = xpos + sep_w - local d2 = code[i1 + 1] -- render the second digit - local vb2 = t_vbar[s2][d2] - err = canvas:encode_Vbar(vb2, xpos, y0, y1); assert(not err, err) + local Codeset = ean._2_codeset_vbar + local queue = assert(Codeset:get("start")) + + assert(Codeset:get(s1, code[i1])) + -- first digit + assert(Codeset:get("sep")) + + assert(Codeset:get(s2, code[i1 + 1])) -- second digit + -- draw the symbol + local mod = ean.mod + local w = 20*mod + h = h or ean.height + local x0 = tx - ax * w + local y0 = ty - ay * h + local x1 = x0 + w + local y1 = y0 + h + assert(canvas:encode_disable_bbox()) + assert(canvas:encode_vbar_queue(queue, x0, y0, y1)) -- bounding box set up local qzl = ean.quietzone_left_factor * mod local qzr = ean.quietzone_right_factor * mod - err = canvas:stop_bbox_group(x0 - qzl, y0, x1 + qzr, y1) - assert(not err, err) + assert(canvas:encode_set_bbox(x0 - qzl, y0, x1 + qzr, y1)) + assert(canvas:encode_enable_bbox()) if ean.text_enabled then -- human readable text local Text = ean._libgeo.Text local txt = Text:from_digit_array(code, i1, i1 + 1) local y_bl = y1 + ean.text_ygap_factor * mod local x1_1 = x0 + 3*mod local x1_2 = x1 - 3*mod - err = canvas:encode_Text_xwidth(txt, x1_1, x1_2, y_bl, 0) - assert(not err, err) + assert(canvas:encode_Text_xwidth(txt, x1_1, x1_2, y_bl, 0)) + if ean.text_guard_enabled then + local Polyline = ean._libgeo.Polyline + local mm = 186467.98 + local alpha = 36 * math.pi/180 + local pw = 0.30*mm + local dx = pw/(2*math.sin(alpha)) + local dy = (pw/2) * math.cos(alpha) + local px = x1 + qzr - dx + local pb = 1.55*mm + local ph = pb * math.tan(alpha) + local p = Polyline:new() + p:add_point(px - pb, y_bl + dy) + p:add_point(px, y_bl + ph + dy) + p:add_point(px - pb, y_bl + 2*ph + dy) + assert(canvas:encode_linewidth(pw)) + assert(canvas:encode_polyline(p)) + end end + return {x0, y0, x1, y1, qzl, nil, qzr, nil,} end fn_append_ga_variant["13+5"] = function (ean, canvas, tx, ty, ax, ay) @@ -1283,14 +1331,15 @@ fn_append_ga_variant["13+5"] = function (ean, canvas, tx, ty, ax, ay) local bars_depth = mod * ean.bars_depth_factor local h = ean.height + bars_depth local w = (142 + ean.addon_xgap_factor) * mod - local x0 = (tx or 0) - ax * w - local y0 = (ty or 0) - ay * h + local x0 = tx - ax * w + local y0 = ty - ay * h local x1 = x0 + w local fn_ga = ean._append_ga_variant local fn_1 = fn_ga["13"] local fn_2 = fn_ga["5"] - fn_1(ean, canvas, x0, y0, 0, 0) - fn_2(ean, canvas, x1, y0, 1, 0, 0.85 * h) + local b1 = fn_1(ean, canvas, x0, y0, 0, 0) + local b2 = fn_2(ean, canvas, x1, y0, 1, 0, 0.85 * h) + return {b1[1], b1[2], b2[3], b1[4], b1[5], nil, b2[7], nil,} end fn_append_ga_variant["13+2"] = function (ean, canvas, tx, ty, ax, ay) @@ -1298,14 +1347,15 @@ fn_append_ga_variant["13+2"] = function (ean, canvas, tx, ty, ax, ay) local bars_depth = mod * ean.bars_depth_factor local h = ean.height + bars_depth local w = (115 + ean.addon_xgap_factor) * mod - local x0 = (tx or 0) - ax * w - local y0 = (ty or 0) - ay * h + local x0 = tx - ax * w + local y0 = ty - ay * h local x1 = x0 + w local fn_ga = ean._append_ga_variant local fn_1 = fn_ga["13"] local fn_2 = fn_ga["2"] - fn_1(ean, canvas, x0, y0, 0, 0) - fn_2(ean, canvas, x1, y0, 1, 0, 0.85 * h) + local b1 = fn_1(ean, canvas, x0, y0, 0, 0) + local b2 = fn_2(ean, canvas, x1, y0, 1, 0, 0.85 * h) + return {b1[1], b1[2], b2[3], b1[4], b1[5], nil, b2[7], nil,} end fn_append_ga_variant["8+5"] = function (ean, canvas, tx, ty, ax, ay) @@ -1313,14 +1363,15 @@ fn_append_ga_variant["8+5"] = function (ean, canvas, tx, ty, ax, ay) local bars_depth = mod * ean.bars_depth_factor local h = ean.height + bars_depth local w = (114 + ean.addon_xgap_factor) * mod - local x0 = (tx or 0) - ax * w - local y0 = (ty or 0) - ay * h + local x0 = tx - ax * w + local y0 = ty - ay * h local x1 = x0 + w local fn_ga = ean._append_ga_variant local fn_1 = fn_ga["8"] local fn_2 = fn_ga["5"] - fn_1(ean, canvas, x0, y0, 0, 0) - fn_2(ean, canvas, x1, y0, 1, 0, 0.85 * h) + local b1 = fn_1(ean, canvas, x0, y0, 0, 0) + local b2 = fn_2(ean, canvas, x1, y0, 1, 0, 0.85 * h) + return {b1[1], b1[2], b2[3], b1[4], b1[5], nil, b2[7], nil,} end fn_append_ga_variant["8+2"] = function (ean, canvas, tx, ty, ax, ay) @@ -1328,14 +1379,15 @@ fn_append_ga_variant["8+2"] = function (ean, canvas, tx, ty, ax, ay) local bars_depth = mod * ean.bars_depth_factor local h = ean.height + bars_depth local w = (87 + ean.addon_xgap_factor) * mod - local x0 = (tx or 0) - ax * w - local y0 = (ty or 0) - ay * h + local x0 = tx - ax * w + local y0 = ty - ay * h local x1 = x0 + w local fn_ga = ean._append_ga_variant local fn_1 = fn_ga["8"] local fn_2 = fn_ga["2"] - fn_1(ean, canvas, x0, y0, 0, 0) - fn_2(ean, canvas, x1, y0, 1, 0, 0.85 * h) + local b1 = fn_1(ean, canvas, x0, y0, 0, 0) + local b2 = fn_2(ean, canvas, x1, y0, 1, 0, 0.85 * h) + return {b1[1], b1[2], b2[3], b1[4], b1[5], nil, b2[7], nil,} end -- ISBN @@ -1350,12 +1402,11 @@ fn_append_ga_variant["issn+2"] = fn_append_ga_variant["13+2"] -- Drawing into the provided channel geometrical data -- tx, ty is the optional translation vector -- the function return the canvas reference to allow call chaining -function EAN:append_ga(canvas, tx, ty) --> canvas +function EAN:_append_ga(canvas, tx, ty) --> bbox local var = self._variant local fn_append_ga = assert(self._append_ga_variant[var]) local ax, ay = self.ax, self.ay - fn_append_ga(self, canvas, tx, ty, ax, ay) - return canvas + return fn_append_ga(self, canvas, tx, ty, ax, ay) end return EAN diff --git a/macros/luatex/generic/barracuda/src/lib-barcode/brcd-i2of5.lua b/macros/luatex/generic/barracuda/src/lib-barcode/brcd-i2of5.lua index 2e1dcd4a02..f029263930 100644 --- a/macros/luatex/generic/barracuda/src/lib-barcode/brcd-i2of5.lua +++ b/macros/luatex/generic/barracuda/src/lib-barcode/brcd-i2of5.lua @@ -1,6 +1,6 @@ -- Interleaved 2 of 5 (ITF) barcode generator -- --- Copyright (C) 2020 Roberto Giacomelli +-- Copyright (C) 2019-2022 Roberto Giacomelli -- see LICENSE.txt file local ITF = { -- main container @@ -13,7 +13,7 @@ ITF._id_variant = { ITF14 = true, -- ITF 14 GS1 specification } -ITF._start = 111 -- nnnn +ITF._start = 1111 -- nnnn ITF._stop = 112 -- Wnn (integer must be in reverse order) ITF._pattern = { -- true -> narrow, false -> Wide @@ -40,6 +40,7 @@ ITF._par_order = { "bearer_bars_enabled", "bearer_bars_thickness", "bearer_bars_layout", + "text_enabled", } ITF._par_def = {} local pardef = ITF._par_def @@ -194,6 +195,19 @@ pardef.bearer_bars_layout = { -- enumeration end, } +-- human readable information +pardef.text_enabled = { -- boolean type + default = true, + isReserved = false, + fncheck = function (self, flag, _) --> boolean, err + if type(flag) == "boolean" then + return true, nil + else + return false, "[TypeErr] option 'text_enabled' is not a boolean value" + end + end, +} + -- ITF14: variant based on GS1 specification, see -- https://www.gs1.org/sites/default/files/docs/barcodes/GS1_General_Specifications.pdf -- GS1 ITF14 parameters vary in range and preferred value on the specific @@ -300,7 +314,7 @@ itf14_pdef.bearer_bars_enabled = { -- boolean type -- SHALL be a minimum of twice the width of a narrow bar (dark bar) and need -- only appear at the top and bottom of the symbol, butting directly against -- the top and bottom of the symbol bars (dark bars). -pardef.bearer_bars_thickness = { -- dimension +itf14_pdef.bearer_bars_thickness = { -- dimension default = 5 * 0.495 * 186467, -- 5 modules unit = "sp", -- scaled point isReserved = false, @@ -388,51 +402,50 @@ local function checkdigit(t, last, method) end end +local function itf14_parse_state() + return { + is_space = false, + is_popen = false, + itf14_len = 0, + } +end + -- group char for readibility '(' or ')' or ' ' -local function itf14_check_char(enc, c, parse_state) --> elem, err - if type(c) ~= "string" or #c ~= 1 then - return nil, "[InternalErr] invalid char" - end - if parse_state.itf14_code == nil then parse_state.itf14_code = {} end - local code = parse_state.itf14_code - if parse_state.is_space == nil then parse_state.is_space = false end - if parse_state.is_popen == nil then parse_state.is_popen = false end - if parse_state.itf14_len == nil then parse_state.itf14_len = 0 end - local itf14_len = parse_state.itf14_len +local function itf14_process_char(_, c, parse_state) --> e_data, e_text, err + local len14 = parse_state.itf14_len -- parsing if c == " " then - if itf14_len == 0 then -- ignore initial spaces - return nil, nil + if (len14 == 0) or (len14 == 14) then -- ignore initial or final spaces + return nil, nil, nil + end + if parse_state.is_space then -- ignore more than one consecutive space + return nil, nil, nil + else + parse_state.is_space = true + return nil, c, nil end - parse_state.is_space = true - return nil, nil elseif c == "(" then if parse_state.is_popen then - return nil, "[Err] a parenthesis group is already open" + return nil, nil, "[Err] a parenthesis is already opened" end parse_state.is_popen = true - code[#code + 1] = c - return nil, nil + return nil, c, nil elseif c == ")" then if not parse_state.is_popen then - return nil, "[Err] found a closing parenthesis without an opening one" + return nil, nil, "[Err] found a closing parenthesis without an opening one" end parse_state.is_popen = false - code[#code + 1] = c - return nil, nil + return nil, c, nil else -- c is at this point eventually a digit local n = string.byte(c) - 48 if n < 0 or n > 9 then return nil, "[ArgErr] found a not digit or a not grouping char" end if parse_state.is_space then - code[#code + 1] = " " parse_state.is_space = false end - code[#code + 1] = c - itf14_len = itf14_len + 1 - parse_state.itf14_len = itf14_len - return n, nil + parse_state.itf14_len = len14 + 1 + return n, c, nil end end @@ -443,23 +456,25 @@ function ITF:_config() --> ok, err local wide = narrow * self.ratio -- start symbol local Vbar = self._libgeo.Vbar -- Vbar class - self._vbar_start = Vbar:from_int_revpair(self._start, narrow, wide) - self._vbar_stop = Vbar:from_int_revpair(self._stop, narrow, wide) + local archive = self._libgeo.Archive -- Vbar_archive class + local Repo = archive:new() + self._vbar_data = Repo + Repo:insert(Vbar:from_int_revpair(self._start, narrow, wide), "start") + Repo:insert(Vbar:from_int_revpair(self._stop, narrow, wide), "stop") -- build every possible pair of digits from 00 to 99 - self._vbar_data = {} - local vbar = self._vbar_data local pattern = self._pattern for dec = 0, 9 do for unit = 0, 9 do local t1 = pattern[dec] local t2 = pattern[unit] local n = dec*10 + unit - vbar[n] = Vbar:from_two_tab(t1, t2, narrow, wide) + Repo:insert(Vbar:from_two_tab(t1, t2, narrow, wide), n) end end local variant = self._variant if variant == "ITF14" then - self._check_char = itf14_check_char + self._process_char = itf14_process_char + self._init_parse_state = itf14_parse_state end return true, nil end @@ -467,21 +482,24 @@ end -- internal methods for constructors -- input code post processing for ITF14 variant -local function itf14_finalize(enc) --> ok, err +local function itf14_finalize(enc, parse_state) --> ok, err + if parse_state.is_popen then + return false, "[ArgErr] unclosed group in input code" + end -- check digit action local policy = enc.check_digit_policy - local slen = enc._code_len local digits = enc._code_data + local slen = #digits local is_add if policy == "verify" then if slen ~= 14 then - return nil, "[DataErr] incorrect input lenght of "..slen.. + return false, "[DataErr] incorrect input lenght of "..slen.. " respect to 14 (checksum policy 'verify')" end is_add = false elseif policy == "add" then if slen ~= 13 then - return nil, "[DataErr] incorrect input lenght of "..slen.. + return false, "[DataErr] incorrect input lenght of "..slen.. " respect to 13 (checksum policy 'add')" end is_add = true @@ -491,18 +509,27 @@ local function itf14_finalize(enc) --> ok, err elseif slen == 13 then is_add = true else - return nil, "[DataErr] incorrect input lenght of "..slen.. - " respect to the policy '"..policy.."'" + return false, "[DataErr] incorrect input lenght of "..slen.. + " respect to the current policy '"..policy.."'" end else return false, "[InternalErr] incorrect policy enum value '"..policy.."'" end assert(type(is_add) == "boolean") local cs = checkdigit(digits, 13, enc.check_digit_method) - if is_add then + if is_add then -- add the final checkdigit digits[14] = cs - enc._code_len = 14 - else + local dtxt = enc._code_text + if dtxt then + local len = #dtxt + local last = dtxt[len] + if last == " " then + dtxt[len] = cs + else + dtxt[len + 1] = cs + end + end + else -- check only the final digit if cs ~= digits[14] then return false, "[DataErr] last digit is not equal to checksum" end @@ -514,13 +541,13 @@ end local function basic_finalize(enc) --> ok, err -- check digit action local policy = enc.check_digit_policy - local slen = enc._code_len - local is_even = (slen % 2 == 0) local digits = enc._code_data + local slen = #digits + local is_even = (slen % 2 == 0) + if policy == "none" then if not is_even then rshift(digits) -- add a heading zero for padding - slen = slen + 1 end elseif policy == "add" then if is_even then @@ -541,16 +568,15 @@ local function basic_finalize(enc) --> ok, err else return false, "[InternalError] wrong enum value" end - enc._code_len = slen return true, nil end -- input code post processing -function ITF:_finalize() --> ok, err +function ITF:_finalize(parse_state) --> ok, err local var = self._variant if var then assert(var == "ITF14") - return itf14_finalize(self) + return itf14_finalize(self, parse_state) else return basic_finalize(self) end @@ -569,59 +595,74 @@ end -- drawing function -- tx, ty is an optional translator vector -function ITF:append_ga(canvas, tx, ty) --> canvas - local err = canvas:start_bbox_group(); assert(not err, err) - -- draw the start symbol - local xdim = self.module - local ratio = self.ratio - local symb_len = 2 * xdim * (3 + 2*ratio) - local x0 = tx or 0 - local xpos = x0 - local y0 = ty or 0 - local y1 = y0 + self.height - local start = self._vbar_start - local err - err = canvas:encode_Vbar(start, xpos, y0, y1); assert(not err, err) - xpos = xpos + 4 * xdim - -- draw the code symbol +function ITF:_append_ga(canvas, tx, ty) --> bbox + local Repo = self._vbar_data + local queue = assert(Repo:get("start")) -- build the vbars queue local digits = self._code_data - local vbars = self._vbar_data - for i = 1, #digits, 2 do + local n = #digits + for i = 1, n, 2 do local index = 10 * digits[i] + digits[i+1] - local b = vbars[index] - err = canvas:encode_Vbar(b, xpos, y0, y1); assert(not err, err) - xpos = xpos + symb_len + queue = queue + assert(Repo:get(index)) end - -- draw the stop symbol - local stop = self._vbar_stop - err = canvas:encode_Vbar(stop, xpos, y0, y1); assert(not err, err) + queue = queue + assert(Repo:get("stop")) + -- draw the start symbol + local xdim = self.module + local ratio = self.ratio + local w = xdim * (6 + ratio + n * (3 + 2 * ratio)) + local ax, ay = self.ax, self.ay + local h = self.height + local x0 = tx - w * ax + local y0 = ty - h * ay + local y1 = y0 + h + assert(canvas:encode_disable_bbox()) + assert(canvas:encode_vbar_queue(queue, x0, y0, y1)) -- bounding box setting - local x1 = xpos + (2 + ratio)*xdim + local x1 = x0 + w local qz = self.quietzone - if self._variant then + if self._variant == "ITF14" then -- "ITF14" qz = qz * xdim end - local b1x, b1y = x0 - qz, y0 - local b2x, b2y = x1 + qz, y1 + local b1x, b1y = x0 - qz, y0 + local b2x, b2y = x1 + qz, y1 + local bq1, bq3 = qz, qz + local bq2, bq4 if self.bearer_bars_enabled then - local w = self.bearer_bars_thickness - err = canvas:encode_linethick(w); assert(not err, err) - b1y, b2y = b1y - w, b2y + w + local t = self.bearer_bars_thickness + local t2 = t/2 + assert(canvas:encode_linewidth(t)) + b1y, b2y = b1y - t, b2y + t + bq2, bq4 = t, t local layout = self.bearer_bars_layout if layout == "hbar" then - err = canvas:encode_hline(b1x, b2x, y0 - w/2); assert(not err, err) - err = canvas:encode_hline(b1x, b2x, y1 + w/2); assert(not err, err) + assert(canvas:encode_hline(b1x, b2x, y0 - t2)) + assert(canvas:encode_hline(b1x, b2x, y1 + t2)) elseif layout == "frame" then - err = canvas:encode_rectangle(b1x - w/2, y0 - w/2, b2x + w/2, y1 + w/2) - assert(not err, err) - b1x, b2x = b1x - w, b2x + w + assert(canvas:encode_rect(b1x - t2, y0 - t2, b2x + t2, y1 + t2)) + b1x, b2x = b1x - t, b2x + t + bq1, bq3 = bq1 + t, bq3 + t + else + error("[InternalErr] unexpected bearer bars layout option value") + end + end + assert(canvas:encode_set_bbox(b1x, b1y, b2x, b2y)) + assert(canvas:encode_enable_bbox()) + if self.text_enabled then + local Text = self._libgeo.Text + local t + if self._variant == "ITF14" then + local code = self._code_text + if code == nil then + code = self._code_data + end + t = Text:from_chars(code) else - error("[IntenalErr] bearer bars layout option is wrong") + t = Text:from_digit_array(self._code_data) end + local y_top = b1y - 0.6 * 186467 -- mm + local x_top = (b1x + b2x)/2 + assert(canvas:encode_Text(t, x_top, y_top, 0.50, 1)) end - local err = canvas:stop_bbox_group(b1x, b1y, b2x, b2y) - assert(not err, err) - return canvas + return {x0, y0, x1, y1, bq1, bq2, bq3, bq4,} end return ITF diff --git a/macros/luatex/generic/barracuda/src/lib-barcode/brcd-upc.lua b/macros/luatex/generic/barracuda/src/lib-barcode/brcd-upc.lua new file mode 100644 index 0000000000..99bfd4349e --- /dev/null +++ b/macros/luatex/generic/barracuda/src/lib-barcode/brcd-upc.lua @@ -0,0 +1,251 @@ +-- Universal Product Code +-- UPC family barcode generator +-- +-- Copyright (C) 2019-2022 Roberto Giacomelli +-- see LICENSE.txt file + +local UPC = { + _VERSION = "upc v0.0.2", + _NAME = "upc", + _DESCRIPTION = "UPC barcode encoder", +} + +UPC._pattern = {[0] = 3211, 2221, 2122, 1411, 1132, 1231, 1114, 1312, 1213, 3112,} +UPC._sepbar = 111 + +UPC._id_variant = { + A = true, -- UPC-A +} + +-- common family parameters +UPC._par_order = { + "mod", + "height", + "bars_depth_factor", + "quietzone_factor", + "text_enabled", + "text_ygap_factor", + "text_xgap_factor", +} +UPC._par_def = {} +local pardef = UPC._par_def + +-- from Wikipedia https://en.wikipedia.org/wiki/Universal_Product_Code +-- The x-dimension for the UPC-A at the nominal size is 0.33 mm (0.013"). +-- UPC-A can be reduced or magnified anywhere from 80% to 200%. +-- standard module is 0.33 mm but it may vary from 0.264 to 0.66mm +pardef.mod = { + default = 0.33 * 186467, -- (mm to sp) X dimension (original value 0.33) + unit = "sp", -- scaled point + isReserved = true, + fncheck = function (_self, x, _) --> boolean, err + local mm = 186467 + local min, max = 0.264*mm, 0.660*mm + if x < min then + return false, "[OutOfRange] too small value for mod" + elseif x > max then + return false, "[OutOfRange] too big value for mod" + end + return true, nil + end, +} + +-- Nominal symbol height for UPC-A is 25.9 mm (1.02") +pardef.height = { + default = 25.9 * 186467, + unit = "sp", + isReserved = false, + fncheck = function (self, h, _enc) --> boolean, err + if h > 0 then + return true, nil + else + return false, "[OutOfRange] non positive value for height" + end + end, +} + +-- The bars forming the S (start), M (middle), and E (end) guard patterns, are +-- extended downwards by 5 times x-dimension, with a resulting nominal symbol +-- height of 27.55 mm (1.08") +pardef.bars_depth_factor = { + default = 5, + unit = "absolute-number", + isReserved = false, + fncheck = function (_self, b, _) --> boolean, err + if b >= 0 then + return true, nil + else + return false, "[OutOfRange] non positive value for bars_depth_factor" + end + end, +} + +-- A quiet zone, with a width of at least 9 times the x-dimension, must be +-- present on each side of the scannable area of the UPC-A barcode. +pardef.quietzone_factor = { + default = 9, + unit = "absolute-number", + isReserved = false, + fncheck = function (_self, qzf, _) --> boolean, err + if qzf > 0 then + return true, nil + else + return false, "[OutOfRange] non positive value for quietzone_right_factor" + end + end, +} + +-- enable/disable human readble text +pardef.text_enabled = { -- boolean type + default = true, + isReserved = false, + fncheck = function (_self, flag, _) --> boolean, err + if type(flag) == "boolean" then + return true, nil + else + return false, "[TypeErr] not a boolean value for text_enabled" + end + end, +} + +-- vertical gap from text and symbol baseline +pardef.text_ygap_factor = { + default = 1.0, + unit = "absolute-number", + isReserved = false, + fncheck = function (_self, t, _) --> boolean, err + if t >= 0 then + return true, nil + else + return false, "[OutOfRange] non positive value for text_ygap_factor" + end + end, +} + +-- horizontal gap from text and symbol bars +pardef.text_xgap_factor = { + default = 0.75, + unit = "absolute-number", + isReserved = false, + fncheck = function (_self, t, _) --> boolean, err + if t >= 0 then + return true, nil + else + return false, "[OutOfRange] non positive value for text_xgap_factor" + end + end, +} + +-- utility function + +-- the checksum of UPC-A +-- 'data' is an array of digits +local function checkdigit_A(data) --> checksum, ok + local s = 0 + for i = 1, 11, 2 do + s = s + data[i] + end + s = 3*s + for i = 2, 10, 2 do + s = s + data[i] + end + local res = s % 10 + if res > 0 then + res = 10 - res + end + return res, data[12] == res +end + +-- internal methods for Barcode costructors + +-- config function called at the moment of encoder construction +function UPC:_config() --> ok, err + local variant = self._variant + if not variant then + return false, "[Err] variant is mandatory for the UPC family" + end + local Vbar = self._libgeo.Vbar -- Vbar class + local Vbar_archive = self._libgeo.Archive -- Archive class + local Codeset = Vbar_archive:new() + self._upca_codeset = Codeset + local mod = self.mod + local sepbar = self._sepbar + Codeset:insert(Vbar:from_int(sepbar, mod), "sepbar") + local symb = self._pattern + for i = 0, 9 do + Codeset:insert(Vbar:from_int(symb[i], mod, false), 0, i) + Codeset:insert(Vbar:from_int(symb[i], mod, true), 1, i) + end + return true, nil +end + +-- function called every time an input UPC-A code has been completely parsed +function UPC:_finalize() --> ok, err + local data = self._code_data + local symb_len = #data + if symb_len ~= 12 then + return false, "[ArgErr] not a 12-digit long array" + end + local ck, ok = checkdigit_A(data) + if not ok then -- is the last digit ok? + return false, + "[Err] incorrect last digit "..data[12]..", the checksum is "..ck + end + return true, nil +end + +-- Drawing into the provided channel geometrical data +-- tx, ty is the optional translation vector +-- the function return the canvas reference to allow call chaining +function UPC:_append_ga(canvas, tx, ty) --> bbox + local Codeset = self._upca_codeset + local code = self._code_data + local mod = self.mod + local sepbar = assert(Codeset:get("sepbar")) + local queue_0 = sepbar + assert(Codeset:get(0, code[1])) + + 36*mod + sepbar + 36*mod + + assert(Codeset:get(1, code[12])) + sepbar + local queue_1 = 10*mod + for i = 2, 6 do + queue_1 = queue_1 + assert(Codeset:get(0, code[i])) + end + queue_1 = queue_1 + 5*mod + for i = 7, 11 do + queue_1 = queue_1 + assert(Codeset:get(1, code[i])) + end + local bars_depth = mod * self.bars_depth_factor + local w, h = 95*mod, self.height + bars_depth + local x0 = tx - self.ax * w + local y0 = ty - self.ay * h + local x1 = x0 + w + local y1 = y0 + h + local ys = y0 + bars_depth + -- draw the symbol + assert(canvas:encode_disable_bbox()) + assert(canvas:encode_vbar_queue(queue_0, x0, y0, y1)) + assert(canvas:encode_vbar_queue(queue_1, x0, ys, y1)) + -- bounding box set up + local qz = self.quietzone_factor * mod + assert(canvas:encode_set_bbox(x0 - qz, y0, x1 + qz, y1)) + assert(canvas:encode_enable_bbox()) + if self.text_enabled then -- human readable text + local Text = self._libgeo.Text + local txt_1 = Text:from_digit_array(code, 1, 1) + local txt_2 = Text:from_digit_array(code, 2, 6) + local txt_3 = Text:from_digit_array(code, 7, 11) + local txt_4 = Text:from_digit_array(code, 12, 12) + local y_bl = ys - self.text_ygap_factor * mod + assert(canvas:encode_Text(txt_1, x0 - qz, y_bl, 0, 1)) + local mx = self.text_xgap_factor + local x2_1 = x0 + (10+mx)*mod + local x2_2 = x0 + (46-mx)*mod + assert(canvas:encode_Text_xwidth(txt_2, x2_1, x2_2, y_bl, 1)) + local x3_1 = x0 + (49+mx)*mod + local x3_2 = x0 + (85-mx)*mod + assert(canvas:encode_Text_xwidth(txt_3, x3_1, x3_2, y_bl, 1)) + assert(canvas:encode_Text(txt_4, x1 + qz, y_bl, 1, 1)) + end + return {x0, y0, x1, y1, qz, nil, qz, nil,} +end + +return UPC diff --git a/macros/luatex/generic/barracuda/src/lib-driver/brcd-driver.lua b/macros/luatex/generic/barracuda/src/lib-driver/brcd-driver.lua index 045a23e9d6..d2d86720ae 100644 --- a/macros/luatex/generic/barracuda/src/lib-driver/brcd-driver.lua +++ b/macros/luatex/generic/barracuda/src/lib-driver/brcd-driver.lua @@ -1,19 +1,16 @@ -- -- ga Intermediate Graphic Language for barcode drawing --- Copyright (C) 2020 Roberto Giacomelli +-- Copyright (C) 2019-2022 Roberto Giacomelli -- -- Basic driver interface --- drawing elementary vector shape +-- drawing elementary vector graphic -- All dimensions are in scaled point (sp) -local Driver = { - _VERSION = "Driver v0.0.9", - _NAME = "Driver", - _DESCRIPTION = "Driver for ga graphic assembler stream", -} - +local Driver = {_classname = "Driver"} Driver.__index = Driver Driver._drv_instance = {} -- driver instances repository +Driver.mm = 186467.98110236 -- conversion factor sp -> mm (millimeter) +Driver.bp = 65781.76 -- conversion factor sp -> bp (big point) -- driver_type/submodule name Driver._drv_available_drv = { -- lowercase keys please @@ -21,12 +18,13 @@ Driver._drv_available_drv = { -- lowercase keys please svg = "lib-driver.brcd-drv-svg", } +-- id_drv is specific driver identifier as a string function Driver:_get_driver(id_drv) --> object, err if type(id_drv) ~= "string" then - return nil, "[ArgErr] 'id_drv' is not a string" + return nil, "[ArgErr: id_drv] string expected" end if not self._drv_available_drv[id_drv] then - return nil, "[ArgErr] driver '"..id_drv.."' not found" + return nil, "[ArgErr: id_drv] driver '"..id_drv.."' not found" end local t_drv = self._drv_instance if t_drv[id_drv] then -- is the repo already loaded? @@ -39,47 +37,87 @@ function Driver:_get_driver(id_drv) --> object, err end end -function Driver:_new_state() --> a new state +function Driver:default_style() --> new table as default graphic init state return { - line_width = 65781.76, -- line width 1bp (in scaled point sp) - line_cap = 0, -- line cap style - line_join = 0, -- line join style - gtext = false, -- text group off - bb_on = true, -- bounding box checking activation - bb_x1 = nil, -- bounding box coordinates in sp (nil means no data) - bb_y1 = nil, - bb_x2 = nil, - bb_y2 = nil, - mm = 186467.98110236, -- conversion factor sp -> mm (millimeter) - bp = 65781.76, -- conversion factor sp -> bp (big point) + linewidth = 65781.76, -- line width 1bp (in scaled point sp) + linecap = 0, -- line cap style + linejoin = 0, -- line join style + dashpattern = nil, -- dash definition + dashphase = nil, -- dash phase definition } end -function Driver:_ga_process(drv, ga, st, bf, xt) +function Driver:_new_state() --> a new state + local st = self:default_style() + st.bb_on = true -- bounding box checking is active + st.gtext = false -- text group off + st.bb_x1 = nil -- bounding box coordinates in sp (nil means no data) + st.bb_y1 = nil + st.bb_x2 = nil + st.bb_y2 = nil + st.mm = self.mm -- conversion factor sp -> mm (millimeter) + st.bp = self.bp -- conversion factor sp -> bp (big point) + return st +end + +function Driver:_ga_init_style(drv, st, bf, xt) + local op_fn = self._opcode_v001 + -- linewidth + if not drv.append_001 then + error("[InternalErr] unimplemented opcode 1 for "..drv._drvname) + end + local w = st.linewidth + drv.append_001(st, bf, xt, w) + -- linecap + if not drv.append_002 then + error("[InternalErr] unimplemented opcode 2 for "..drv._drvname) + end + local linecap = st.linecap + drv.append_002(st, bf, xt, linecap) + -- line join style + if not drv.append_003 then + error("[InternalErr] unimplemented opcode 3 for "..drv._drvname) + end + local join = st.linejoin + drv.append_003(st, bf, xt, join) + -- dash pattern (reset) + if not drv.append_006 then + error("[InternalErr] unimplemented opcode 6 for "..drv._drvname) + end + drv.append_006(st, bf, xt) +end + +function Driver:_ga_process(drv, ga_stream, st, bf, xt) local op_fn = self._opcode_v001 local pc = 1 -- program counter - local data = ga._data - while data[pc] do -- stream processing - local opcode = data[pc] + while ga_stream[pc] do -- stream processing + local opcode = ga_stream[pc] local fn = assert(op_fn[opcode], "[InternalErr] unimpl opcode ".. opcode) - pc = fn(drv, st, pc + 1, data, bf, xt) + pc = fn(drv, st, pc + 1, ga_stream, bf, xt) end end -- save graphic data in an external file with the 'id_drv' format --- id_drv: specific driver output --- ga: ga object --- filename: file name --- ext: file extension (optional) +-- id_drv: specific driver output identifier +-- ga ::= gaCanvas class | ga stream table array +-- filename ::= string, file name +-- ext ::= string, file extension (optional, default SVG) function Driver:save(id_drv, ga, filename, ext) --> ok, err -- retrive the output library local drv, err = self:_get_driver(id_drv) if err then return false, err end + local ga_stream; if ga._classname == "gaCanvas" then + ga_stream = ga:get_stream() + else + ga_stream = ga + end -- init local state = self:_new_state() local buf, txt_buf = drv.init_buffer(state) -- a new buffer and text_buffer + -- send every defualt style parameter to the special driver + self:_ga_init_style(drv, state, buf, txt_buf) -- processing - self:_ga_process(drv, ga, state, buf, txt_buf) + self:_ga_process(drv, ga_stream, state, buf, txt_buf) -- buffer finalizing drv.close_buffer(state, buf, txt_buf) -- finalize the istruction -- file saving @@ -91,9 +129,19 @@ function Driver:save(id_drv, ga, filename, ext) --> ok, err return true, nil end --- insert a ga drawing in a TeX box +-- insert a ga drawing in a TeX hbox -- PDFnative only function +-- ga ::= gaCanvas class | ga stream table array +-- boxname ::= string function Driver:ga_to_hbox(ga, boxname) --> ok, err + if type(ga) ~= "table" then + return false, "[ArgErr: ga] table expected" + end + local ga_stream; if ga._classname == "gaCanvas" then + ga_stream = ga:get_stream() + else + ga_stream = ga + end -- retrive the output library local id_drv = "native" local drv, err = self:_get_driver(id_drv) @@ -101,13 +149,14 @@ function Driver:ga_to_hbox(ga, boxname) --> ok, err -- init process local state = self:_new_state() local buf, txt_buf = drv.init_buffer(state) -- a new buffer and text_buffer + -- send every defualt style parameter to the special driver + self:_ga_init_style(drv, state, buf, txt_buf) -- processing - self:_ga_process(drv, ga, state, buf, txt_buf) + self:_ga_process(drv, ga_stream, state, buf, txt_buf) -- finalizing drv.close_buffer(state, buf, txt_buf) -- finalize the istruction sequence -- build hbox - local ok, err = drv.hboxcreate(boxname, state, buf, txt_buf) - return ok, err + return drv.hboxcreate(boxname, state, buf, txt_buf) end @@ -124,38 +173,62 @@ end Driver._opcode_v001 = { [1] = function (drv, st, pc, ga, bf, xt) -- 1 <W: dim>; set line width local w = ga[pc] - st.line_width = w - if not drv.append_001 then - error("[InternalErr] unimplemented opcode 1 for "..drv._NAME) - end + st.linewidth = w drv.append_001(st, bf, xt, w) return pc + 1 end, [2] = function (drv, st, pc, ga, bf, xt) -- 2 <e: u8>; set line cap style local style = ga[pc] - st.line_cap = style + st.linecap = style if not drv.append_002 then - error("[InternalErr] unimplemented opcode 2 for "..drv._NAME) + error("[InternalErr] unimplemented opcode 2 for "..drv._drvname) end drv.append_002(st, bf, xt, style) return pc + 1 end, [3] = function (drv, st, pc, ga, bf, xt) -- 3 <e: u8>; set line join style local join = ga[pc] - if not drv.append_003 then - error("[InternalErr] unimplemented opcode 3 for "..drv._NAME) - end + st.linejoin = join drv.append_003(st, bf, xt, join) return pc + 1 end, - [30] = function (drv, st, pc, ga, bf, xt) -- start_bbox_group - assert(st.bb_on) - st.bb_on = false + -- 5 <dash_pattern>, Dash pattern line style + -- phase <len> n <qty> [bi <len>]+ + [5] = function (drv, st, pc, ga, bf, xt) + if not drv.append_005 then + error("[InternalErr] unimplemented opcode 5 for "..drv._drvname) + end + local phase = ga[pc]; pc = pc + 1 + local n = ga[pc]; pc = pc + 1 + assert(n > 0, "[Err] dash pattern needs one length or more ("..n..")") + st.dashphase = phase + local dash = {} + for i = pc, pc + n - 1 do + local v = ga[i] + dash[#dash + 1] = v + end + st.dashpattern = dash + drv.append_005(st, bf, xt, phase, dash) + return pc + n + end, + [6] = function (drv, st, pc, ga, bf, xt) -- 6 <reset_pattern> + if not drv.append_006 then + error("[InternalErr] unimplemented opcode 6 for "..drv._drvname) + end + st.dashpattern = nil -- reset dash pattern array and phase + st.dashphase = nil + drv.append_006(st, bf, xt) return pc end, - [31] = function (drv, st, pc, ga, bf, xt) -- end_bbox_group - assert(st.bb_on == false) + [29] = function (drv, st, pc, ga, bf, xt) -- enable_bbox st.bb_on = true + return pc + end, + [30] = function (drv, st, pc, ga, bf, xt) -- disable_bbox + st.bb_on = false + return pc + end, + [31] = function (drv, st, pc, ga, bf, xt) -- set_bbox local x1 = ga[pc]; pc = pc + 1 local y1 = ga[pc]; pc = pc + 1 local x2 = ga[pc]; pc = pc + 1 @@ -180,7 +253,7 @@ Driver._opcode_v001 = { local x2 = ga[pc]; pc = pc + 1 local y = ga[pc]; pc = pc + 1 if st.bb_on then -- eventually update bbox - local hw = st.line_width/2 + local hw = st.linewidth/2 local by1 = y - hw local by2 = y + hw if st.bb_x1 == nil then @@ -196,7 +269,7 @@ Driver._opcode_v001 = { end end if not drv.append_033 then - error("[InternalErr] unimplemented opcode 33 for "..drv._NAME) + error("[InternalErr] unimplemented opcode 33 for "..drv._drvname) end drv.append_033(st, bf, xt, x1, x2, y) return pc @@ -206,8 +279,8 @@ Driver._opcode_v001 = { local y1 = ga[pc]; pc = pc + 1 local y2 = ga[pc]; pc = pc + 1 local x = ga[pc]; pc = pc + 1 - if st.bb_on then -- eventually update the figure bounding box - local hw = st.line_width/2 + if st.bb_on then -- eventually update the figure's bounding box + local hw = st.linewidth/2 local bx1 = x - hw local bx2 = x + hw if st.bb_x1 == nil then @@ -223,7 +296,7 @@ Driver._opcode_v001 = { end end if not drv.append_034 then - error("[InternalErr] unimplemented opcode 34 for "..drv._NAME) + error("[InternalErr] unimplemented opcode 34 for "..drv._drvname) end drv.append_034(st, bf, xt, y1, y2, x) return pc @@ -277,16 +350,64 @@ Driver._opcode_v001 = { end return pc_next end, + -- draw a polyline + -- 38 <n> <x1: DIM> <y1: DIM> ... <xn: DIM> <yn: DIM> + -- basic support for bounding box calculation + [38] = function(drv, st, pc, ga, bf, xt) -- polyline + local n = ga[pc]; pc = pc + 1; assert(n > 1) + local x1 = ga[pc]; pc = pc + 1 + local y1 = ga[pc]; pc = pc + 1 + if drv.append_038_start then + drv.append_038_start(st, bf, xt, n, x1, y1) + end + local pc_next = pc + 2*(n - 1) + local bx1, bx2, by1, by2 = x1, x1, y1, y1 -- simplified bb vertex + for i = pc, pc_next - 1, 2 do -- reading coordinates <x> <y> + local x = assert(ga[i], "[InternalErr] ga prematurely reached the end") + local y = assert(ga[i+1], "[InternalErr] ga prematurely reached the end") + drv.append_038_point(st, bf, xt, x, y) + -- check the bounding box only if the corresponding flag is true + if st.bb_on then + if x > bx2 then + bx2 = x + elseif x < bx1 then + bx1 = x + end + if y > by2 then + by2 = y + elseif y < by1 then + by1 = y + end + end + end + if drv.append_038_stop then + drv.append_038_stop(st, bf, xt) + end + if st.bb_on then -- eventually update bbox + if st.bb_x1 == nil then + st.bb_x1 = bx1 + st.bb_x2 = bx2 + st.bb_y1 = by1 + st.bb_y2 = by2 + else + if bx1 < st.bb_x1 then st.bb_x1 = bx1 end + if bx2 > st.bb_x2 then st.bb_x2 = bx2 end + if by1 < st.bb_y1 then st.bb_y1 = by1 end + if by2 > st.bb_y2 then st.bb_y2 = by2 end + end + end + return pc_next + end, -- draw a rectangle -- 48 <x1: DIM> <y1: DIM> <x2: DIM> <y2: DIM> [48] = function(drv, st, pc, ga, bf, xt) - local x1 = ga[pc]; pc = pc + 1 - local y1 = ga[pc]; pc = pc + 1 - local x2 = ga[pc]; pc = pc + 1 - local y2 = ga[pc]; pc = pc + 1 + local x1 = ga[pc]; pc = pc + 1 + local y1 = ga[pc]; pc = pc + 1 + local x2 = ga[pc]; pc = pc + 1 + local y2 = ga[pc]; pc = pc + 1 -- check the bounding box only if the flag is true if st.bb_on then - local hw = st.line_width/2 + local hw = st.linewidth/2 local bx1, bx2 = x1 - hw, x2 + hw local by1, by2 = y1 - hw, y2 + hw if st.bb_x1 == nil then @@ -302,7 +423,7 @@ Driver._opcode_v001 = { end end if not drv.append_048 then - error("[InternalErr] unimplemented opcode 48 for "..drv._NAME) + error("[InternalErr] unimplemented opcode 48 for "..drv._drvname) end drv.append_048(st, bf, xt, x1, y1, x2, y2) return pc diff --git a/macros/luatex/generic/barracuda/src/lib-driver/brcd-drv-pdfliteral.lua b/macros/luatex/generic/barracuda/src/lib-driver/brcd-drv-pdfliteral.lua index b36021f9b6..a5cfccf4cb 100644 --- a/macros/luatex/generic/barracuda/src/lib-driver/brcd-drv-pdfliteral.lua +++ b/macros/luatex/generic/barracuda/src/lib-driver/brcd-drv-pdfliteral.lua @@ -1,22 +1,17 @@ -- -- ga graphic assembler or -- Intermediate Graphic Language for barcode drawing --- Copyright (C) 2020 Roberto Giacomelli +-- Copyright (C) 2019-2022 Roberto Giacomelli -- -- All dimensions are in scaled point (sp) -- ga LuaTeX Driver (native implementation node+pdfliteral) --- class for drawing elementary geometric elements -local PDFnative = { - _VERSION = "PDFnative v0.0.4", - _NAME = "PDFnative", - _DESCRIPTION = "A LuaTeX native pdfliteral driver for ga graphic stream", -} - local tex = assert(tex, "This require a Lua powered TeX engine") local node = assert(node, "This require a Lua powered TeX engine") local font = assert(font, "This require a Lua powered TeX engine") +-- class for drawing elementary geometric elements +local PDFnative = {_drvname = "PDFnative"} PDFnative.ext = "txt" -- file extension PDFnative.buf_sep = "\n" -- separation string for buffer concat @@ -24,6 +19,7 @@ function PDFnative.init_buffer(st) --> buffer, text buffer st.head = nil -- addition for text processing (to remember purpose) st.last = nil st.hbox = nil + st.dash_array = nil st.cw = nil st.x_hbox = nil st.char_counter = nil @@ -126,12 +122,27 @@ function PDFnative.append_003(st, bf, xt, j) bf[#bf + 1] = string.format("%d j", j) end +-- 5 dash_pattern +function PDFnative.append_005(st, bf, xt, phase, dash_array) + local bp = st.bp -- conversion factor bp -> sp + local t = {} + for _, d in ipairs(dash_array) do + t[#t + 1] = string.format("%0.6f", d/bp) + end + bf[#bf + 1] = string.format("[%s] %0.6f d",table.concat(t, " "), phase/bp) +end + +-- 6 reset_pattern +function PDFnative.append_006(st, bf, xt) + bf[#bf + 1] = string.format("[] 0 d") +end + -- draw an horizontal line -- 33 <x1: DIM> <x2: DIM> <y: DIM> function PDFnative.append_033(st, bf, xt, x1, x2, y) local bp = st.bp -- conversion factor bp -> sp - bf[#bf + 1] = string.format("% 0.6f %0.6f m", x1/bp, y/bp) - bf[#bf + 1] = string.format("% 0.6f %0.6f l", x2/bp, y/bp) + bf[#bf + 1] = string.format("%0.6f %0.6f m", x1/bp, y/bp) + bf[#bf + 1] = string.format("%0.6f %0.6f l", x2/bp, y/bp) bf[#bf + 1] = "S" -- stroke end @@ -140,8 +151,8 @@ end -- 34 <y1: DIM> <y2: DIM> <x: DIM> function PDFnative.append_034(st, bf, xt, y1, y2, x) local bp = st.bp -- conversion factor bp -> sp - bf[#bf + 1] = string.format("% 0.6f %0.6f m", x/bp, y1/bp) - bf[#bf + 1] = string.format("% 0.6f %0.6f l", x/bp, y2/bp) + bf[#bf + 1] = string.format("%0.6f %0.6f m", x/bp, y1/bp) + bf[#bf + 1] = string.format("%0.6f %0.6f l", x/bp, y2/bp) bf[#bf + 1] = "S" -- stroke end @@ -161,6 +172,21 @@ function PDFnative.append_036_stop(st, bf, xt, nbar, y1, y2) bf[#bf + 1] = "S" -- stroke end +-- Polyline +-- draw a polyline +-- 38 <n> <x1: DIM> <y1: DIM> ... <xn: DIM> <yn: DIM> +function PDFnative.append_038_start(st, bf, xt, n, x1, y1) + local bp = st.bp -- conversion factor bp -> sp + bf[#bf + 1] = string.format("%0.6f %0.6f m", x1/bp, y1/bp) +end +function PDFnative.append_038_point(st, bf, xt, x, y) + local bp = st.bp -- conversion factor bp -> sp + bf[#bf + 1] = string.format("%0.6f %0.6f l", x/bp, y/bp) +end +function PDFnative.append_038_stop(st, bf, xt) + bf[#bf + 1] = "S" -- stroke +end + -- draw a rectangle -- 48 <x1: DIM> <y1: DIM> <x2: DIM> <y2: DIM> function PDFnative.append_048(st, bf, xt, x1, y1, x2, y2) diff --git a/macros/luatex/generic/barracuda/src/lib-driver/brcd-drv-svg.lua b/macros/luatex/generic/barracuda/src/lib-driver/brcd-drv-svg.lua index ce1f5bffbc..df5ae0e366 100644 --- a/macros/luatex/generic/barracuda/src/lib-driver/brcd-drv-svg.lua +++ b/macros/luatex/generic/barracuda/src/lib-driver/brcd-drv-svg.lua @@ -1,18 +1,13 @@ -- -- ga Intermediate Graphic Language for barcode drawing --- SVG library --- Copyright (C) 2020 Roberto Giacomelli +-- SVG driver for the ga graphic stream +-- Copyright (C) 2019-2022 Roberto Giacomelli -- -- All dimension in the ga stream are scaled point (sp) -- 1 pt = 65536 sp -- class for drawing elementary geometric elements -local SVG = { - _VERSION = "SVGdriver v0.0.1", - _NAME = "SVGdriver", - _DESCRIPTION = "A SVG driver for the ga graphic stream", -} - +local SVG = {_drvname = "SVG"} SVG.ext = "svg" -- file extension SVG.buf_sep = nil -- separation string for buffer concat @@ -30,10 +25,10 @@ function SVG.init_buffer(st) --> buffer, text buffer } -- additions for SVG driver to 'state' st.ident_lvl = 1 -- identation level - st.char_buf = nil + st.char_buf = nil -- character buffer local mm = st.mm st.h_char = 2.1 * mm -- char height (mm) - st.w_char = st.h_char / 1.303 -- avg char width (mm) + st.w_char = st.h_char / 1.303 -- average char width (mm) st.d_char = st.h_char / 3.7 -- char deep (mm) return bf, {} end @@ -42,7 +37,7 @@ function SVG.close_buffer(st, bf, xt) bf[#bf + 1] = '</svg>\n' -- close svg xml element bf[#bf + 1] = '\n' -- a last empty line local mm = st.mm - local x1, y1, x2, y2 = st.bb_x1, st.bb_y1, st.bb_x2, st.bb_y2 + local x1, y1, x2, y2 = st.bb_x1 or 0, st.bb_y1 or 0, st.bb_x2 or 0, st.bb_y2 or 0 local w = (x2 - x1)/mm local h = (y2 - y1)/mm local fmt_wh = bf[7] @@ -55,25 +50,55 @@ end -- SVG encoding functions -- 1 <W: dim>; set line width -function SVG.append_001(st, bf, xt, w) - -- nothing to do +function SVG.append_001(st, bf, xt, w) -- nothing to do +end + +-- 2 <enum: u8>; set line cap style +function SVG.append_002(st, bf, xt, cap) -- nothing to do +end + +-- 3 <enum: u8>; set line join style +function SVG.append_003(st, bf, xt, j) -- nothing to do +end + +-- 5 <dash_pattern> +function SVG.append_005(st, bf, xt) -- nothing to do +end + +-- 6 <reset_pattern> +function SVG.append_006(st, bf, xt) -- nothing to do end --- draw an horizontal line +-- draw an horizontal line <hline> opcode -- 33 <x1: DIM> <x2: DIM> <y: DIM> function SVG.append_033(st, bf, xt, x1, x2, y) local lvl = st.ident_lvl local ident = string.rep(" ", lvl) -- a couple of spaces as indentation local mm = st.mm -- conversion ratio sp -> bp bf[#bf + 1] = string.format( -- <path> element - '%s<path d="M%0.6f %0.6fH%0.6f"\n', - ident, x1/mm, -y/mm, x2/mm + '%s<path d="M%0.6f %0.6fH %0.6f"\n', ident, x1/mm, -y/mm, x2/mm ) - local lw = st.line_width + local lw = st.linewidth bf[#bf + 1] = string.format( - '%s style="stroke:#000000;stroke-width:%0.6f"\n', - ident, lw/mm + '%s stroke="black" stroke-width="%0.6f"\n', ident, lw/mm ) + local dash = st.dashpattern + if dash then + local t = {} + for _, d in ipairs(dash) do + t[#t + 1] = string.format("%0.6f", d/mm) + end + bf[#bf + 1] = string.format( + '%s stroke-dasharray="%s"\n', ident, table.concat(t, " ") + ) + local phase = st.dashphase + assert(phase >= 0) + if phase > 0 then + bf[#bf + 1] = string.format( + '%s stroke-dashoffset="%0.6f"\n', ident, phase/mm + ) + end + end bf[#bf + 1] = ident..'/>\n' end @@ -83,14 +108,29 @@ function SVG.append_034(st, bf, xt, y1, y2, x) local ident = string.rep(" ", lvl) -- a couple of spaces as indentation local mm = st.mm -- conversion ratio sp -> mm bf[#bf + 1] = string.format( -- <path> element - '%s<path d="M%0.6f %0.6fV%0.6f"\n', - ident, x/mm, -y2/mm, -y1/mm + '%s<path d="M%0.6f %0.6f V%0.6f"\n', ident, x/mm, -y2/mm, -y1/mm ) - local lw = st.line_width + local lw = st.linewidth bf[#bf + 1] = string.format( - '%s style="stroke:#000000;stroke-width:%0.6f"\n', - ident, lw/mm + '%s stroke="black" stroke-width="%0.6f"\n', ident, lw/mm ) + local dash = st.dashpattern + if dash then + local t = {} + for _, d in ipairs(dash) do + t[#t + 1] = string.format("%0.6f", d/mm) + end + bf[#bf + 1] = string.format( + '%s stroke-dasharray="%s"\n', ident, table.concat(t, " ") + ) + local phase = st.dashphase + assert(phase >= 0) + if phase > 0 then + bf[#bf + 1] = string.format( + '%s stroke-dashoffset="%0.6f"\n', ident, phase/mm + ) + end + end bf[#bf + 1] = ident..'/>\n' end @@ -118,6 +158,91 @@ function SVG.append_036_stop(st, bf, xt, nbar, y1, y2) bf[#bf + 1] = ident..'</g>\n' -- end group end +-- Polyline +-- draw a polyline +-- 38 <n> <x1: DIM> <y1: DIM> ... <xn: DIM> <yn: DIM> +function SVG.append_038_start(st, bf, xt, n, x1, y1) + local lvl = st.ident_lvl + local ident = string.rep(" ", lvl) + local mm = st.mm -- conversion factor mm -> sp + local style = string.format( + '%s<g stroke="black" stroke-width="%0.6f" fill="none"', + ident, st.linewidth/mm + ) + local dash = st.dashpattern + if dash then + local t = {} + for _, d in ipairs(dash) do + t[#t + 1] = string.format("%0.6f", d/mm) + end + style = string.format( + '%s stroke-dasharray="%s"', style, table.concat(t, " ") + ) + local phase = st.dashphase + assert(phase >= 0) + if phase > 0 then + style = string.format( + '%s stroke-dashoffset="%0.6f"', style, phase/mm + ) + end + end + bf[#bf + 1] = style..'>\n' + ident = ident .. " " + bf[#bf + 1] = string.format('%s<polyline points="%0.6f,%0.6f', + ident, x1/mm, -y1/mm + ) + st.ident_lvl = lvl + 1 +end +function SVG.append_038_point(st, bf, xt, x, y) + local lvl = st.ident_lvl + local ident = string.rep(" ", lvl) + local mm = st.mm -- conversion factor mm -> sp + bf[#bf + 1] = string.format('\n%s%0.6f,%0.6f', ident, x/mm, -y/mm) +end +function SVG.append_038_stop(st, bf, xt) + bf[#bf + 1] = '"/>\n' -- closing tag + local lvl = st.ident_lvl - 1 + local ident = string.rep(" ", lvl) + st.ident_lvl = lvl + bf[#bf + 1] = ident..'</g>\n' -- close the group +end + +-- draw a rectangle +-- 48 <x1: DIM> <y1: DIM> <x2: DIM> <y2: DIM> +function SVG.append_048(st, bf, xt, x1, y1, x2, y2) + local w = x2 - x1 -- rectangle width + assert(w > 0) + local h = y2 - y1 -- rectangle height + assert(h > 0) + local mm = st.mm -- conversion factor mm -> sp + local lvl = st.ident_lvl + local ident = string.rep(" ", lvl) + local fmt = '%s<rect x="%0.6f" y="%0.6f" width="%0.6f" height="%0.6f"' + bf[#bf + 1] = string.format(fmt, ident, x1/mm, -y2/mm, w/mm, h/mm) + local lw = st.linewidth + bf[#bf + 1] = string.format( + '%s fill="none" stroke="black" stroke-width="%0.6f"\n', ident, lw/mm + ) + local dash = st.dashpattern + if dash then + local t = {} + for _, d in ipairs(dash) do + t[#t + 1] = string.format("%0.6f", d/mm) + end + bf[#bf + 1] = string.format( + '%s stroke-dasharray="%s"\n', ident, table.concat(t, " ") + ) + local phase = st.dashphase + assert(phase >= 0) + if phase > 0 then + bf[#bf + 1] = string.format( + '%s stroke-dashoffset="%0.6f"\n', ident, phase/mm + ) + end + end + bf[#bf + 1] = ident..'/>\n' +end + -- Text -- 130 <text> Text with several glyphs -- 130 <ax: FLOAT> <ay: FLOAT> <xpos: DIM> <ypos: DIM> <c: CHARS> diff --git a/macros/luatex/generic/barracuda/src/lib-geo/brcd-gacanvas.lua b/macros/luatex/generic/barracuda/src/lib-geo/brcd-gacanvas.lua index 86eba659d1..fc58a85b7b 100644 --- a/macros/luatex/generic/barracuda/src/lib-geo/brcd-gacanvas.lua +++ b/macros/luatex/generic/barracuda/src/lib-geo/brcd-gacanvas.lua @@ -1,86 +1,208 @@ -- class gaCanvas --- Copyright (C) 2020 Roberto Giacomelli +-- Copyright (C) 2019-2022 Roberto Giacomelli +-- <ga> encoding functions (see barracuda-manual.pdf) --- ga -- basic function - -local gaCanvas = { - _VERSION = "gacanvas v0.0.4", - _NAME = "gaCanvas", - _DESCRIPTION = "A library for dealing with ga stream", -} +local gaCanvas = {_classname = "gaCanvas"} gaCanvas.__index = gaCanvas +gaCanvas.mm = 186467.98110236 -- conversion factor sp -> mm (millimeter) +gaCanvas.bp = 65781.76 -- conversion factor sp -> bp (big point) +gaCanvas.pt = 65536 -- sp -> pt -- ga specification: see the file ga-grammar.pdf in the doc directory -- gaCanvas constructor function gaCanvas:new() --> object - local o = { - _data = {}, - _v = 100, -- version of the ga format - } + local drv = assert(self._driver_class) + -- graphic state fields returned by Driver:default_style() method + -- linewidth + -- linecap + -- linejoin + -- dashpattern + -- dashphase + local o = assert(drv:default_style()) -- initial graphic state + o._version = 100 -- version of the ga format + o._data = {} -- ga stream array + o.bb_on = true setmetatable(o, self) return o end --- Ipothetical another constructor +-- save graphic data in an external file with the 'id_drv' format +-- id_drv::= string, specific driver output identifier +-- filename ::= string, file name +-- ext ::= string, file extension (optional, default SVG) +function gaCanvas:save(id_drv, filename, ext) --> ok, err + local driver = self._driver_class + return driver:save(id_drv, self, filename, ext) +end + +-- insert a ga drawing in a TeX hbox +-- PDFnative only function +-- boxname ::= string +function gaCanvas:ga_to_hbox(boxname) --> ok, err + local driver = self._driver_class + return driver:ga_to_hbox(self, boxname) +end + +-- return a clone of the <ga> stream array +function gaCanvas:get_stream() --> table (as a flat array) + local data = self._data + local t = {} + for _, v in ipairs(data) do + t[#t + 1] = v + end + return t +end + +-- Ipothetical further constructor -- function gaCanvas:from_tcp_server() --> err -- end +-- function gaCanvas:get_bbox() +-- end + +-- function gaCanvas:check() --> ok, err +-- end + -- line width: opcode <1> <w: DIM> -function gaCanvas:encode_linethick(w) --> err - if type(w) ~= "number" then return "[ArgErr] 'w' number expected" end - if w < 0 then return "[ArgErr] negative value for 'w'" end +function gaCanvas:encode_linewidth(w) --> ok, err + if type(w) ~= "number" then + return false, "[ArgErr 'w'] number expected" + end + if w < 0 then return false, "[ArgErr: w] negative number not allowed" end + self.linewidth = w local data = self._data data[#data + 1] = 1 -- opcode for line thickness data[#data + 1] = w + return true, nil end --- line cap style: opcode <2> <cap: u8> --- 0 Butt cap --- 1 Round cap --- 2 Projecting square cap -function gaCanvas:encode_linecap(cap) --> err - if type(cap) ~= "number" then return "[ArgErr] 'cap' arg number expected" end - if cap == 0 or cap == 1 or cap == 2 then - local data = self._data - data[#data + 1] = 2 -- opcode for line cap style - data[#data + 1] = cap +-- line cap style: opcode <2> cap <u8>|<enum> +-- 0 | "butt": Butt cap +-- 1 | "round": Round cap +-- 2 | "proj": Projecting square cap +function gaCanvas:encode_linecap(cap) --> ok, err + local tcap = type(cap) + local cap_res + if tcap == "number" then + if cap == 0 or cap == 1 or cap == 2 then + cap_res = cap + else + return false, "[ArgErr: cap] 0, 1 or 2 expected" + end + elseif tcap == "string" then + if cap == "butt" then + cap_res = 0 + elseif cap == "round" then + cap_res = 1 + elseif cap == "proj" then + cap_res = 2 + else + return false, "[ArgErr: cap] 'butt', 'round' or 'proj' expected" + end else - return "[ArgErr] invalid value for 'cap'" + return false, "[ArgErr: cap] number or string expected" end + self.linecap = cap_res + local data = self._data + data[#data + 1] = 2 -- opcode for line cap style + data[#data + 1] = cap_res + return true, nil end --- line cap style: opcode <3> <join: u8> --- 0 Miter join --- 1 Round join --- 2 Bevel join -function gaCanvas:encode_linejoin(join) --> err - if type(join) ~= "number" then return "[ArgErr] 'join' arg number expected" end - if join == 0 or join == 1 or join == 2 then - local data = self._data - data[#data + 1] = 3 -- opcode for line join style - data[#data + 1] = join +-- line join style: opcode <3> join <u8>|<enum> +-- 0 | "miter" : Miter join +-- 1 | "round" : Round join +-- 2 | "bevel" : Bevel join +function gaCanvas:encode_linejoin(join) --> ok, err + local tjoin = type(join) + local join_res + if tjoin == "number" then + if join == 0 or join == 1 or join == 2 then + join_res = join + else + return false, "[ArgErr: join] 0, 1 or 2 integer expected" + end + elseif tjoin == "string" then + if join == "miter" then + join_res = 0 + elseif join == "round" then + join_res = 1 + elseif join == "bevel" then + join_res = 2 + else + return false, "[ArgErr: join] '"..join.."' join style not found" + end else - return "[ArgErr] invalid value for 'join'" + return false, "[ArgErr: join] number or string expected" + end + self.linejoin = join_res + local data = self._data + data[#data + 1] = 3 -- opcode for line join style + data[#data + 1] = join_res + return true, nil +end + +-- 5 <dash_pattern>, Dash pattern line style, p <len> n <qty> bi <len> +-- p: phase lenght +-- n: number of array element +-- [bi]: dash array of dash and gap lenghts +function gaCanvas:encode_dash_pattern(p, ...) --> ok, err + if type(p) ~= "number" then return false, "[ArgErr: phase] number expected" end + local t = {...} + for i, v in ipairs(t) do + if type(v) ~= "number" then + return false, "[ArgErr: array] found a not number value at index " .. i + end + end + self.dash_pattern = t + self.dash_phase = p + local n = #t + local d = self._data + d[#d + 1] = 5 + d[#d + 1] = p + d[#d + 1] = n + for _, b in ipairs(t) do + d[#d + 1] = b end + return true, nil +end + +-- 6 <reset_pattern>, set the continous line style +function gaCanvas:encode_reset_pattern() --> ok, err + self.dash_pattern = nil + self.dash_phase = nil + local d = self._data + d[#d + 1] = 6 + return true, nil +end + +-- checking the bounding box from now on +-- opcode: <29> +function gaCanvas:encode_enable_bbox() --> ok, err + self.bb_on = true + local data = self._data + data[#data + 1] = 29 + return true, nil end -- Stop checking the bounding box -- opcode: <30> -function gaCanvas:start_bbox_group() --> err +function gaCanvas:encode_disable_bbox() --> ok, err + self.bb_on = false local data = self._data data[#data + 1] = 30 + return true, nil end --- restart checking the bounding box --- and insert the specified bb for the entire object group +-- insert a figure bbox -- code: <31> x1 y1 x2 y2 -function gaCanvas:stop_bbox_group(x1, y1, x2, y2) --> err - if type(x1) ~= "number" then return "[ArgErr] 'x1' number expected" end - if type(y1) ~= "number" then return "[ArgErr] 'y1' number expected" end - if type(x2) ~= "number" then return "[ArgErr] 'x2' number expected" end - if type(y2) ~= "number" then return "[ArgErr] 'y2' number expected" end - if x1 > x2 then x1, x2 = x2, x1 end -- reorder coordinates +function gaCanvas:encode_set_bbox(x1, y1, x2, y2) --> ok, err + if type(x1) ~= "number" then return false, "[ArgErr: x1] number expected" end + if type(y1) ~= "number" then return false, "[ArgErr: y1] number expected" end + if type(x2) ~= "number" then return false, "[ArgErr: x2] number expected" end + if type(y2) ~= "number" then return false, "[ArgErr: y2] number expected" end + if x1 > x2 then x1, x2 = x2, x1 end -- re-order coordinates if y1 > y2 then y1, y2 = y2, y1 end local data = self._data data[#data + 1] = 31 -- bounding box of the object group @@ -88,174 +210,368 @@ function gaCanvas:stop_bbox_group(x1, y1, x2, y2) --> err data[#data + 1] = y1 data[#data + 1] = x2 data[#data + 1] = y2 + return true, nil end -- insert a line from point (x1, y1) to the point (x2, y2) +-- tx optional translator x-vector +-- ty optional translator y-vector -- <32> x1 y1 x2 y2 -function gaCanvas:encode_line(x1, y1, x2, y2) --> err - if type(x1) ~= "number" then return "[ArgErr] 'x1' number expected" end - if type(y1) ~= "number" then return "[ArgErr] 'y1' number expected" end - if type(x2) ~= "number" then return "[ArgErr] 'x2' number expected" end - if type(y2) ~= "number" then return "[ArgErr] 'y2' number expected" end +function gaCanvas:encode_line(x1, y1, x2, y2, tx, ty) --> ok, err + if type(x1) ~= "number" then return false, "[ArgErr: x1] number expected" end + if type(y1) ~= "number" then return false, "[ArgErr: y1] number expected" end + if type(x2) ~= "number" then return false, "[ArgErr: x2] number expected" end + if type(y2) ~= "number" then return false, "[ArgErr: y2] number expected" end + if tx ~= nil then + if type(tx) ~= "number" then return false, "[ArgErr: tx] number expected" end + x1 = x1 + tx + x2 = x2 + tx + end + if ty ~= nil then + if type(ty) ~= "number" then return false, "[ArgErr: ty] number expected" end + y1 = y1 + ty + y2 = y2 + ty + end local data = self._data data[#data + 1] = 32 -- append line data data[#data + 1] = x1 data[#data + 1] = y1 data[#data + 1] = x2 data[#data + 1] = y2 + return true, nil end -- insert an horizontal line from point (x1, y) to point (x2, y) +-- tx optional translator x-vector +-- ty optional translator y-vector -- <33> x1 x2 y -function gaCanvas:encode_hline(x1, x2, y) --> err - if type(x1) ~= "number" then return "[ArgErr] 'x1' number expected" end - if type(x2) ~= "number" then return "[ArgErr] 'x2' number expected" end - if type(y) ~= "number" then return "[ArgErr] 'y2' number expected" end +function gaCanvas:encode_hline(x1, x2, y, tx, ty) --> ok, err + if type(x1) ~= "number" then return false, "[ArgErr: x1] number expected" end + if type(x2) ~= "number" then return false, "[ArgErr: x2] number expected" end + if type(y) ~= "number" then return false, "[ArgErr: y] number expected" end + if tx ~= nil then + if type(tx) ~= "number" then return false, "[ArgErr: tx] number expected" end + x1 = x1 + tx + x2 = x2 + tx + end + if ty ~= nil then + if type(ty) ~= "number" then return false, "[ArgErr: ty] number expected" end + y = y + ty + end local data = self._data data[#data + 1] = 33 -- append hline data data[#data + 1] = x1 data[#data + 1] = x2 data[#data + 1] = y + return true, nil +end + +-- vline, Vertical line, from point (x, y1) to point (x, y2) +-- tx optional translator x-vector +-- ty optional translator y-vector +-- <34> y1 y2 x +function gaCanvas:encode_vline(y1, y2, x, tx, ty) --> ok, err + if type(y1) ~= "number" then return false, "[ArgErr] 'y1' number expected" end + if type(y2) ~= "number" then return false, "[ArgErr] 'y2' number expected" end + if type(x) ~= "number" then return false, "[ArgErr] 'x' number expected" end + if tx ~= nil then + if type(tx) ~= "number" then return false, "[ArgErr: tx] number expected" end + x = x + tx + end + if ty ~= nil then + if type(ty) ~= "number" then return false, "[ArgErr: ty] number expected" end + y1 = y1 + ty + y2 = y2 + ty + end + local data = self._data + data[#data + 1] = 34 -- append vline data + data[#data + 1] = y1 + data[#data + 1] = y2 + data[#data + 1] = x + return true, nil +end + +-- insert an open polyline +-- tx optional translator x-vector +-- ty optional translator y-vector +-- <38> <n> x1 y1 x2, y2, ... , xn, yn +function gaCanvas:encode_polyline(point, tx, ty) --> ok, err + if type(point) ~= "table" then + return false, "[ArgErr: point] table expected" + end + local n, p + if point._classname == "Polyline" then + n, p = point:get_points() + else + local len = #point + if len == 0 then return false, "[Err] 'point' is an empty table" end + if (len % 2) ~= 0 then + return false, "[Err] 'point' is not an even long array" + end + n = len/2 + for _, coord in ipairs(point) do + if type(coord) ~= "number" then + return false, "[Err] found a non-number in the 'point' array" + end + end + p = point + end + if n < 2 then return + false, "[Err] a polyline must have at least two points" + end + if tx ~= nil then + if type(tx) ~= "number" then return false, "[ArgErr: tx] number expected" end + else + tx = 0 + end + if ty ~= nil then + if type(ty) ~= "number" then return false, "[ArgErr: ty] number expected" end + else + ty = 0 + end + local data = self._data + data[#data + 1] = 38 + data[#data + 1] = n + for i = 1, 2*n, 2 do + data[#data + 1] = p[i] + tx + data[#data + 1] = p[i + 1] + ty + end + return true, nil end -- insert a rectangle from point (x1, x2) to (x2, y2) +-- tx optional translator x-vector +-- ty optional translator y-vector -- <48> <x1: DIM> <y1: DIM> <x2: DIM> <y2: DIM> -function gaCanvas:encode_rectangle(x1, y1, x2, y2) --> err - if type(x1) ~= "number" then return "[ArgErr] 'x1' number expected" end - if type(y1) ~= "number" then return "[ArgErr] 'y1' number expected" end - if type(x2) ~= "number" then return "[ArgErr] 'x2' number expected" end - if type(y2) ~= "number" then return "[ArgErr] 'y2' number expected" end +function gaCanvas:encode_rect(x1, y1, x2, y2, tx, ty) --> ok, err + if type(x1) ~= "number" then return false, "[ArgErr] 'x1' number expected" end + if type(y1) ~= "number" then return false, "[ArgErr] 'y1' number expected" end + if type(x2) ~= "number" then return false, "[ArgErr] 'x2' number expected" end + if type(y2) ~= "number" then return false, "[ArgErr] 'y2' number expected" end + if tx ~= nil then + if type(tx) ~= "number" then return false, "[ArgErr: tx] number expected" end + x1 = x1 + tx + x2 = x2 + tx + end + if ty ~= nil then + if type(ty) ~= "number" then return false, "[ArgErr: ty] number expected" end + y1 = y1 + ty + y2 = y2 + ty + end local d = self._data d[#d + 1] = 48 -- append rectangle data d[#d + 1] = x1 d[#d + 1] = y1 d[#d + 1] = x2 d[#d + 1] = y2 + return true, nil end -- Vbar object: opcode <36> +-- tx optional translator x-vector +-- ty optional translator y-vector -- x0, y1, y2 ordinates -function gaCanvas:encode_Vbar(vbar, x0, y1, y2) --> err +function gaCanvas:encode_vbar(vbar, x0, y1, y2, tx, ty) --> ok, err if type(vbar) ~= "table" then - return "[ArgErr] table expected for 'vbar'" + return false, "[ArgErr: vbar] table expected" end if x0 == nil then x0 = 0 elseif type(x0) ~= "number" then - return "[ArgErr] 'x0' number expected" + return false, "[ArgErr: x0] number expected" end - if type(y1) ~= "number" then return "[ArgErr] 'y1' number expected" end - if type(y2) ~= "number" then return "[ArgErr] 'y2' number expected" end + if type(y1) ~= "number" then return false, "[ArgErr: y1] number expected" end + if type(y2) ~= "number" then return false, "[ArgErr: y2] number expected" end -- ordinates - if y1 == y2 then return "[ArgErr] 'y1' 'y2' are the same value" end + if y1 == y2 then return false, "[ArgErr: y1, y2] same value" end if y1 > y2 then y1, y2 = y2, y1 end - local bars = assert(vbar._yline, "[InternalErr] no '_yline' field") - local bdim = #bars - if bdim == 0 then return "[InternalErr] number of bars is zero" end - if bdim % 2 ~= 0 then - return "[InternalErr] '_yline' does not have an even number of elements" + local bdim, bars + if vbar._classname == "Vbar" then + bdim, bars = vbar:get_bars() + bdim = 2*bdim + else + bdim = #vbar + if bdim % 2 ~= 0 then -- bdim must be even + return false, "[Err: vbar] found an odd array of elements" + end + bars = vbar + end + if bdim == 0 then return false, "[Err: vbar] the number of bars is zero" end + if tx ~= nil then + if type(tx) ~= "number" then return false, "[ArgErr: tx] number expected" end + x0 = x0 + tx + end + if ty ~= nil then + if type(ty) ~= "number" then return false, "[ArgErr: ty] number expected" end + y1 = y1 + ty + y2 = y2 + ty end local data = self._data data[#data + 1] = 36 -- vbar sequence start data[#data + 1] = y1 data[#data + 1] = y2 - data[#data + 1] = bdim / 2 -- the number of bars <x_i t_i> + data[#data + 1] = bdim/2 -- the number of bars, pair <x_i, w_i> for i = 1, bdim, 2 do local coord = bars[i] local width = bars[i + 1] if type(coord) ~= "number" then - return "[Err] a coordinates is not a number" + return false, "[Err] a coordinates is not a number" end if type(width) ~= "number" then - return "[Err] a width is not a number" + return false, "[Err] a width is not a number" end data[#data + 1] = coord + x0 data[#data + 1] = width end + return true, nil end --- [text] <130> ax ay x y chars -function gaCanvas:encode_Text(txt, xpos, ypos, ax, ay) --> err +-- print a Vbar queue starting at x position 'xpos', between the horizontal line +-- tx optional translator x-vector +-- ty optional translator y-vector +-- at y0 and y1 y-coordinates +function gaCanvas:encode_vbar_queue(queue, xpos, y0, y1, tx, ty) --> ok, err + -- check arg + if type(queue) ~= "table" then + return false, "[ArgErr: queue] table expected" + end + if type(xpos) ~= "number" then + return false, "[ArgErr: xpos] number expected" + end + if type(y0) ~= "number" then + return false, "[ArgErr: y0] number expected" + end + if type(y1) ~= "number" then + return false, "[ArgErr: y1] number expected" + end + local i = 2 + while queue[i] do + local x = queue[i - 1] + xpos + local vbar = queue[i] + local _, err = self:encode_vbar(vbar, x, y0, y1, tx, ty) + if err then return false, err end + i = i + 2 + end + return true, nil +end + +-- tx optional translator x-vector +-- ty optional translator y-vector +-- [text] <130> ax ay xpos ypos chars +function gaCanvas:encode_Text(txt, xpos, ypos, ax, ay, tx, ty) --> ok, err if type(txt) ~= "table" then - return "[ArgErr] 'txt' object table expected" + return false, "[ArgErr: txt] object table expected" end if type(xpos) ~= "number" then - return "[ArgErr] 'xpos' number expected" + return false, "[ArgErr: xpos] number expected" end if type(ypos) ~= "number" then - return "[ArgErr] 'ypos' number expected" + return false, "[ArgErr: ypos] number expected" end if ax == nil then ax = 0 elseif type(ax) ~= "number" then - return "[ArgErr] 'ax' number expected" + return false, "[ArgErr: ax] number expected" end if ay == nil then ay = 0 elseif type(ay) ~= "number" then - return "[ArgErr] 'ay' number expected" + return false, "[ArgErr: ay] number expected" end + if tx ~= nil then + if type(tx) ~= "number" then return false, "[ArgErr: tx] number expected" end + xpos = xpos + tx + end + if ty ~= nil then + if type(ty) ~= "number" then return false, "[ArgErr: ty] number expected" end + ypos = ypos + ty + end + local chars = assert(txt.codepoint, "[InternalErr: txt] no 'codepoint' found") + if #chars == 0 then return false, "[InternalErr: txt] no chars found" end local data = self._data data[#data + 1] = 130 data[#data + 1] = ax -- relative anchor x-coordinate data[#data + 1] = ay -- relative anchor y-coordinate data[#data + 1] = xpos -- text x-coordinate data[#data + 1] = ypos -- text y-coordinate - local chars = assert(txt.codepoint, "[InternalErr] no 'codepoint' field in txt") - if #chars == 0 then return "[InternalErr] 'txt' has no chars" end for _, c in ipairs(chars) do data[#data + 1] = c end data[#data + 1] = 0 -- end string signal + return true, nil end -- glyphs equally spaced along the baseline +-- tx optional translator x-vector +-- ty optional translator y-vector -- [text_xspaced] <131> x1 xgap ay ypos chars -function gaCanvas:encode_Text_xspaced(txt, x1, xgap, ypos, ay) --> err - if type(txt)~= "table" then return "[ArgErr] 'txt' object table expected" end - local chars = assert(txt.codepoint, "[InternalErr] no 'codepoint' field in txt") - if #chars == 0 then return "[InternalErr] 'txt' has no chars" end - if type(x1) ~= "number" then return "[ArgErr] 'x1' number expected" end - if type(xgap) ~= "number" then return "[ArgErr] 'xgap' number expected" end +function gaCanvas:encode_Text_xspaced(txt, x1, xgap, ypos, ay, tx, ty) --> ok, err + if type(txt)~= "table" then return false, "[ArgErr: txt] object table expected" end + local chars = assert(txt.codepoint, "[InternalErr: txt] no 'codepoint' found") + local n = #chars + if n == 0 then return false, "[InternalErr: txt] no chars found" end + if type(x1) ~= "number" then return false, "[ArgErr: x1] number expected" end + if type(xgap) ~= "number" then return false, "[ArgErr: xgap] number expected" end if xgap < 0 then local n = #chars x1 = x1 + (n - 1) * xgap xgap = -xgap end - if type(ypos) ~= "number" then return "[ArgErr] 'ypos' number expected" end + if type(ypos) ~= "number" then return false, "[ArgErr: ypos] number expected" end if ay == nil then ay = 0 elseif type(ay) ~= "number" then - return "[ArgErr] 'ay' number expected" + return false, "[ArgErr: ay] number expected" + end + if tx ~= nil then + if type(tx) ~= "number" then return false, "[ArgErr: tx] number expected" end + x1 = x1 + tx + end + if ty ~= nil then + if type(ty) ~= "number" then return false, "[ArgErr: ty] number expected" end + ypos = ypos + ty end local data = self._data data[#data + 1] = 131 data[#data + 1] = x1 -- x-coordinate of the first axis from left to right - data[#data + 1] = xgap -- axial distance among gliphs + data[#data + 1] = xgap -- axial distance between gliphs data[#data + 1] = ay -- anchor relative y-coordinate data[#data + 1] = ypos -- text y-coordinate for _, c in ipairs(chars) do data[#data + 1] = c end data[#data + 1] = 0 -- end string signal + return true, nil end -- text_xwidth +-- tx optional translator x-vector +-- ty optional translator y-vector -- text equally spaced but within [x1, x2] coordinate interval -- <132> <ay: FLOAT> <x1: DIM> <x2: DIM> <y: DIM> <c: CHARS> -function gaCanvas:encode_Text_xwidth(txt, x1, x2, ypos, ay) --> err - if type(txt)~= "table" then return "[ArgErr] 'txt' object table expected" end - if type(x1) ~= "number" then return "[ArgErr] 'x1' number expected" end - if type(x2) ~= "number" then return "[ArgErr] 'x2' number expected" end - if type(ypos) ~= "number" then return "[ArgErr] 'ypos' number expected" end +function gaCanvas:encode_Text_xwidth(txt, x1, x2, ypos, ay, tx, ty) --> ok, err + if type(txt)~= "table" then return false, "[ArgErr: txt] object table expected" end + if type(x1) ~= "number" then return false, "[ArgErr: x1] number expected" end + if type(x2) ~= "number" then return false, "[ArgErr: x2] number expected" end + if type(ypos) ~= "number" then return false, "[ArgErr: ypos] number expected" end if ay == nil then ay = 0 elseif type(ay) ~= "number" then - return "[ArgErr] 'ay' number expected" + return false, "[ArgErr: ay] number expected" end - local chars = assert(txt.codepoint, "[InternalErr] no 'codepoint' field in txt") - if #chars == 0 then return "[InternalErr] 'txt' has no chars" end + local chars = assert(txt.codepoint, "[InternalErr: txt] no 'codepoint' found") + if #chars == 0 then return false, "[InternalErr: txt] no chars found" end if x1 > x2 then x1, x2 = x2, x1 end -- reorder coordinates + + if tx ~= nil then + if type(tx) ~= "number" then return false, "[ArgErr: tx] number expected" end + x1 = x1 + tx + x2 = x2 + tx + end + if ty ~= nil then + if type(ty) ~= "number" then return false, "[ArgErr: ty] number expected" end + ypos = ypos + ty + end local data = self._data data[#data + 1] = 132 data[#data + 1] = ay -- anchor relative y-coordinate @@ -266,32 +582,35 @@ function gaCanvas:encode_Text_xwidth(txt, x1, x2, ypos, ay) --> err data[#data + 1] = c end data[#data + 1] = 0 -- end string signal + return true, nil end -- experimental code section -- new opcodes under assessment -- [start_text_group] 140 -function gaCanvas:start_text_group() --> err +function gaCanvas:start_text_group() --> ok, err local data = self._data data[#data + 1] = 140 + return true, nil end -- [gtext] 141 -function gaCanvas:gtext(chars) --> err - if type(chars) ~= "table" then return "[ArgErr] 'chars' table expected" end +function gaCanvas:gtext(chars) --> ok, err + if type(chars) ~= "table" then return false, "[ArgErr: chars] table expected" end local data = self._data data[#data + 1] = 141 for _, c in ipairs(chars) do data[#data + 1] = c end data[#data + 1] = 0 -- end string signal + return true, nil end -- [gtext_spaced] 142 gap string -function gaCanvas:gtext_spaced(gap, chars) --> err - if type(gap) ~= "number" then return "[ArgErr] 'gap' number expected" end - if type(chars) ~= "table" then return "[ArgErr] 'chars' table expected" end +function gaCanvas:gtext_spaced(gap, chars) --> ok, err + if type(gap) ~= "number" then return false, "[ArgErr: gap] number expected" end + if type(chars) ~= "table" then return false, "[ArgErr: chars] table expected" end local data = self._data data[#data + 1] = 142 data[#data + 1] = gap @@ -299,42 +618,32 @@ function gaCanvas:gtext_spaced(gap, chars) --> err data[#data + 1] = c end data[#data + 1] = 0 -- end string signal + return true, nil end -- [gtext_space] 143 gap -function gaCanvas:gtext_gap(gap) --> err - if type(gap) ~= "number" then return "[ArgErr] 'gap' number expected" end +function gaCanvas:gtext_gap(gap) --> ok, err + if type(gap) ~= "number" then return false, "[ArgErr: gap] number expected" end local data = self._data data[#data + 1] = 143 data[#data + 1] = gap + return true, nil end -- [end_text_group] 149 ax ay x y -function gaCanvas:end_text_group(xpos, ypos, ax, ay) --> err - if type(xpos) ~= "number" then return "[ArgErr] 'xpos' number expected" end - if type(ypos) ~= "number" then return "[ArgErr] 'ypos' number expected" end - if type(ax) ~= "number" then return "[ArgErr] 'ax' number expected" end - if type(ay) ~= "number" then return "[ArgErr] 'ay' number expected" end +function gaCanvas:end_text_group(xpos, ypos, ax, ay) --> ok, err + if type(xpos) ~= "number" then return false, "[ArgErr: xpos] '' number expected" end + if type(ypos) ~= "number" then return false, "[ArgErr: ypos] number expected" end + if type(ax) ~= "number" then return false, "[ArgErr: ax] number expected" end + if type(ay) ~= "number" then return false, "[ArgErr: ay] number expected" end local data = self._data data[#data + 1] = 149 data[#data + 1] = ax -- anchor relative x-coordinate data[#data + 1] = ay -- anchor relative y-coordinate data[#data + 1] = xpos -- text x-coordinate data[#data + 1] = ypos -- text y-coordinate -end - --- amazing... -function gaCanvas:to_string() --> string - -end - -function gaCanvas:get_bbox() - -end - -function gaCanvas:check() --> boolean, err - + return true, nil end return gaCanvas diff --git a/macros/luatex/generic/barracuda/src/lib-geo/brcd-libgeo.lua b/macros/luatex/generic/barracuda/src/lib-geo/brcd-libgeo.lua index 630ed91b43..1e76ba1c67 100644 --- a/macros/luatex/generic/barracuda/src/lib-geo/brcd-libgeo.lua +++ b/macros/luatex/generic/barracuda/src/lib-geo/brcd-libgeo.lua @@ -1,20 +1,137 @@ - +-- this file is part of barracuda project +-- Copyright (C) 2019-2022 Roberto Giacomelli +-- see https://github.com/robitex/barracuda +-- -- libgeo simple Geometric Library --- Copyright (C) 2018 Roberto Giacomelli - --- All dimension must be in scaled point (sp) +-- All dimension must be in scaled point (sp) a TeX unit equal to 1/65536pt local libgeo = { - _VERSION = "libgeo v0.0.3", + _VERSION = "libgeo v0.0.6", _NAME = "libgeo", _DESCRIPTION = "simple geometric library", } --- VBar class +-- a simple tree structured Archive class +libgeo.Archive = {_classname = "Archive"} +local Archive = libgeo.Archive +Archive.__index = Archive + +function Archive:new() --> object + local o = { + _archive = {} + } + setmetatable(o, self) + return o +end + +function Archive:insert(o, ...) --> ok, err + if type(o) ~= "table" then + return false, "[Err] " + end + local a = self._archive + local keys = {...} + for i = 1, (#keys - 1) do -- dive into the tree + local k = keys[i] + local leaf = a[k] + if not leaf then + a[k] = {} + leaf = a[k] + end + a = leaf + end + local k = keys[#keys] + if a[k] ~= nil then + return false, "[Err] an object " + end + a[k] = o + return true, nil +end + +function Archive:contains_key(...) --> boolean + local a = self._archive + for _, k in ipairs{...} do + local leaf = a[k] + if leaf == nil then + return false + end + a = leaf + end + return true +end + +function Archive:get(...) --> object, err + local a = self._archive + for _, k in ipairs{...} do + local leaf = a[k] + if leaf == nil then + return nil, "[Err] key '"..k.."' not found" + end + a = leaf + end + return a, nil +end + +-- Queue Class +local VbarQueue = {_classname = "VbarQueue"} +libgeo.Vbar_queue = VbarQueue +VbarQueue.__index = VbarQueue + +function VbarQueue:new() + local o = { 0 } + setmetatable(o, self) + return o +end + +VbarQueue.__add = function (lhs, rhs) + if type(lhs) == "number" then -- dist + queue + local i = 1 + while rhs[i] do + rhs[i] = rhs[i] + lhs + i = i + 2 + end + return rhs + else -- queue + object + if type(rhs) == "number" then + lhs[#lhs] = lhs[#lhs] + rhs + return lhs + elseif type(rhs) == "table" then + if rhs._classname == "VbarQueue" then -- queue + queue + local q = {} + for _, v in ipairs(lhs) do + q[#q + 1] = v + end + local w = lhs[#lhs] + for i = 1, #rhs/2 do + q[#q + 1] = rhs[i] + w + q[#q + 1] = rhs[i + 1] + end + return q + elseif rhs._classname == "Vbar" then -- queue + vbar + local w = lhs[#lhs] + lhs[#lhs + 1] = rhs + lhs[#lhs + 1] = w + rhs._x_lim + return lhs + else + error("[Err] unsupported object type for queue operation") + end + else + error("[Err] unsupported type for queue operation") + end + end +end + +function VbarQueue:width() + return self[#self] - self[1] +end + +-- Vbar class -- a pure geometric entity of several infinite vertical lines -libgeo.Vbar = {} +libgeo.Vbar = {_classname = "Vbar"} local Vbar = libgeo.Vbar Vbar.__index = Vbar +Vbar.__add = function (lhs, rhs) + return VbarQueue:new() + lhs + rhs +end -- Vbar costructors @@ -23,6 +140,7 @@ function Vbar:from_array(yl_arr) --> <vbar object> assert(type(yl_arr) == "table", "'yline_array' is a mandatory arg") -- stream scanning local i = 1 + local nbars = 0 local xlim = 0.0 while yl_arr[i] do local x = yl_arr[i]; i = i + 1 @@ -30,12 +148,14 @@ function Vbar:from_array(yl_arr) --> <vbar object> assert(type(x) == "number", "[InternalErr] not a number") assert(type(w) == "number", "[InternalErr] not a number") xlim = x + w/2 + nbars = nbars + 1 end assert(i % 2 == 0, "[InternalErr] the index is not even") - assert(i > 0, "[InternalErr] empty array") + assert(nbars > 0, "[InternalErr] empty array") local o = { _yline = yl_arr, -- [<xcenter>, <width>, ...] flat array _x_lim = xlim, -- right external bounding box coordinates + _nbars = nbars, -- number of bars } setmetatable(o, self) return o @@ -57,6 +177,7 @@ function Vbar:from_int(ngen, mod, is_bar) --> <vbar object> digits[#digits + 1] = d ngen = (ngen - d)/10 end + local nbars = 0 local x0 = 0.0 -- axis reference local yl = {} for k = #digits, 1, -1 do @@ -65,13 +186,16 @@ function Vbar:from_int(ngen, mod, is_bar) --> <vbar object> if is_bar then -- bar yl[#yl + 1] = x0 + w/2 yl[#yl + 1] = w + nbars = nbars + 1 end x0 = x0 + w is_bar = not is_bar end + assert(nbars > 0, "[InternalErr] no bars") local o = { _yline = yl, -- [<xcenter>, <width>, ...] flat array _x_lim = x0, -- right external coordinate + _nbars = nbars, -- number of bars } setmetatable(o, self) return o @@ -86,7 +210,8 @@ function Vbar:from_int_revstep(ngen, mod, is_bar) --> <vbar object> if is_bar == nil then is_bar = true else assert(type(is_bar) == "boolean", "Invalid argument for is_bar") end - -- + -- + local nbars = 0 local x0 = 0.0 -- axis reference local i = 0 local yl = {} @@ -96,15 +221,18 @@ function Vbar:from_int_revstep(ngen, mod, is_bar) --> <vbar object> if is_bar then -- bar i = i + 1; yl[i] = x0 + w/2 i = i + 1; yl[i] = w + nbars = nbars + 1 end x0 = x0 + w is_bar = not is_bar ngen = (ngen - d)/10 end assert(not is_bar, "[InternalErr] the last element in not a bar") + assert(nbars > 0, "[InternalErr] no bars") local o = { _yline = yl, -- [<xcenter>, <width>, ...] flat array _x_lim = x0, -- right external coordinate + _nbars = nbars, -- number of bars } setmetatable(o, self) return o @@ -126,8 +254,9 @@ function Vbar:from_int_revpair(ngen, mod, MOD, is_bar) --> <vbar object> else assert(type(is_bar) == "boolean", "Invalid argument for 'is_bar'") end + local nbars = 0 local yl = {} - local x0 = 0.0 + local x0 = 0.0 local k = 0 while ngen > 0 do local d = ngen % 10 -- digit @@ -140,14 +269,16 @@ function Vbar:from_int_revpair(ngen, mod, MOD, is_bar) --> <vbar object> if is_bar then -- bars k = k + 1; yl[k] = x0 + w/2 -- xcenter k = k + 1; yl[k] = w -- width + nbars = nbars + 1 end is_bar = not is_bar x0 = x0 + w end - assert(not is_bar, "[InternalErr] the last element is not a bar") + assert(nbars > 0, "[InternalErr] no bars") local o = { _yline = yl, -- [<xcenter>, <width>, ...] flat array _x_lim = x0, -- external x coordinate + _nbars = nbars, -- number of bars } setmetatable(o, self) return o @@ -162,6 +293,7 @@ function Vbar:from_two_tab(tbar, tspace, mod, MOD) --> <vbar object> assert(type(mod) == "number", "Invalid argument for narrow module width") assert(type(MOD) == "number", "Invalid argument for wide module width") assert(mod < MOD, "Not ordered narrow/Wide values") + local nbars = 0 local x0 = 0.0 -- x-coordinate local yl = {} for i = 1, #tbar do @@ -176,6 +308,7 @@ function Vbar:from_two_tab(tbar, tspace, mod, MOD) --> <vbar object> yl[#yl + 1] = MOD -- bar width x0 = x0 + MOD end + nbars = nbars + 1 local is_narrow_space = tspace[i] assert(type(is_narrow_space) == "boolean", "[InternalErr] found a not boolean value") if is_narrow_space then @@ -184,17 +317,76 @@ function Vbar:from_two_tab(tbar, tspace, mod, MOD) --> <vbar object> x0 = x0 + MOD end end + assert(nbars > 0, "[InternalErr] no bars") local o = { _yline = yl, -- [<xcenter>, <width>, ...] flat array _x_lim = x0, -- external x coordinate + _nbars = nbars, -- number of bars + } + setmetatable(o, self) + return o +end + +function Vbar:get_bars() --> nbars, <coordinates flat array> + return self._nbars, self._yline +end + +-- Polyline class +local Polyline = {_classname = "Polyline"} +Polyline.__index = Polyline +libgeo.Polyline = Polyline + +-- optional argument a first point (x, y) +function Polyline:new(x, y) --> <Polyline> + local o = { + _point = {}, + _n = 0, } setmetatable(o, self) + if x ~= nil then + assert(type(x) == "number", "[Polyline:new()] Invalid type for x-coordinate") + assert(type(y) == "number", "[Polyline:new()] Invalid type for y-coordinate") + self:add_point(x, y) + end return o end +-- get a clone of points' coordinates +function Polyline:get_points() + local res = {} + local p = self._point + for i, c in ipairs(p) do + res[i] = c + end + return self._n, res +end + +-- append a new point with absolute coordinates +function Polyline:add_point(x, y) + assert(type(x) == "number", "[Polyline:add_point()] Invalid type for x-coordinate") + assert(type(y) == "number", "[Polyline:add_point()] Invalid type for y-coordinate") + local point = self._point + point[#point + 1] = x + point[#point + 1] = y + self._n = self._n + 1 +end + +-- append a new point with relative coordinates respect to the last one +function Polyline:add_relpoint(x, y) + assert(type(x) == "number", "Invalid type for x-coordinate") + assert(type(y) == "number", "Invalid type for y-coordinate") + local point = self._point + local n = self._n + assert(n > 0, "Attempt to add a relative point to an empty polyline") + local i = 2 * n + point[#point + 1] = point[i - 1] + x + point[#point + 1] = point[i] + y + self._n = n + 1 +end + -- Text class -libgeo.Text = {} +libgeo.Text = {_classname="Text"} local Text = libgeo.Text Text.__index = Text diff --git a/macros/luatex/generic/barracuda/test/test-barracuda-package/01-barracuda-latex-test.pdf b/macros/luatex/generic/barracuda/test/test-barracuda-package/01-barracuda-latex-test.pdf Binary files differindex b05ed417eb..9da41b5c50 100644 --- a/macros/luatex/generic/barracuda/test/test-barracuda-package/01-barracuda-latex-test.pdf +++ b/macros/luatex/generic/barracuda/test/test-barracuda-package/01-barracuda-latex-test.pdf diff --git a/macros/luatex/generic/barracuda/test/test-barracuda-package/01-barracuda-latex-test.tex b/macros/luatex/generic/barracuda/test/test-barracuda-package/01-barracuda-latex-test.tex index 8932f9eaaf..ba055eb9d5 100644 --- a/macros/luatex/generic/barracuda/test/test-barracuda-package/01-barracuda-latex-test.tex +++ b/macros/luatex/generic/barracuda/test/test-barracuda-package/01-barracuda-latex-test.tex @@ -1,7 +1,7 @@ % !TeX program = LuaLaTeX -% Copyright (C) 2020 Roberto Giacomelli +% Copyright (C) 2019-2022 Roberto Giacomelli -% test file: make a Code39 barcodes in a LaTeX document +% test file: make Code39 barcodes in a LaTeX document \documentclass{article} \usepackage{barracuda} @@ -10,6 +10,17 @@ A\barracuda{code39}{123QWE}A B\barracuda[text_vpos='top']{code39}{123QWE}B -\end{document} +%\barracudasetup[option]{ treename } + +\directlua{ +local barracuda = require "barracuda" +local barcode = barracuda:barcode() +local code39 = assert(barcode:enc_by_name("code39")) +assert(code39:set_param{debug_bbox = "qz"}) +}\bigskip + +A\barracuda{code39}{123QWE}A +B\barracuda[text_vpos='top']{code39}{123QWE}B +\end{document} diff --git a/macros/luatex/generic/barracuda/test/test-barracuda-package/02-ord_iter-test.tex b/macros/luatex/generic/barracuda/test/test-barracuda-package/02-ord_iter-test.tex index 1b5d6509d4..89236a8bfc 100644 --- a/macros/luatex/generic/barracuda/test/test-barracuda-package/02-ord_iter-test.tex +++ b/macros/luatex/generic/barracuda/test/test-barracuda-package/02-ord_iter-test.tex @@ -1,5 +1,5 @@ % !TeX program = LuaTeX -% Copyright (C) 2020 Roberto Giacomelli +% Copyright (C) 2019-2022 Roberto Giacomelli \directlua{ local barracuda = require "barracuda" diff --git a/macros/luatex/generic/barracuda/test/test-code128/001-code128-test.lua b/macros/luatex/generic/barracuda/test/test-code128/001-code128-test.tex index 33dd927dc7..335b880d5b 100644 --- a/macros/luatex/generic/barracuda/test/test-code128/001-code128-test.lua +++ b/macros/luatex/generic/barracuda/test/test-code128/001-code128-test.tex @@ -1,10 +1,11 @@ --- Copyright (C) 2020 Roberto Giacomelli +% !TeX program = LuaTeX +% Copyright (C) 2019-2022 Roberto Giacomelli +\directlua{ local barracuda = require "barracuda" local barcode = barracuda:barcode() -local c128, err = barcode:new_encoder("code128") -assert(not err, err) - +local c128 = assert(barcode:new_encoder("code128")) +print() print(c128._NAME) print(c128._VERSION) @@ -15,18 +16,24 @@ for k, tp in ipairs(info.param) do print(k, tp.name, tp.value) end -local symb = c128:from_string("123") +local symb = c128:new("123") print("Symbol char list:") -for _, c in ipairs(symb._code_data) do +for _, c in ipairs(symb:get_code()) do + print(c) +end +print("Symbol hri char list:") +for _, c in ipairs(symb:get_hri()) do print(c) end + local canvas = barracuda:new_canvas() -symb:append_ga(canvas) +symb:draw(canvas) --- driver library +% driver library local drv = barracuda:get_driver() drv:save("svg", canvas, "c128-123") - +} +\bye diff --git a/macros/luatex/generic/barracuda/test/test-code128/002-code128-test.pdf b/macros/luatex/generic/barracuda/test/test-code128/002-code128-test.pdf Binary files differindex 4cf993a396..731c7ca279 100644 --- a/macros/luatex/generic/barracuda/test/test-code128/002-code128-test.pdf +++ b/macros/luatex/generic/barracuda/test/test-code128/002-code128-test.pdf diff --git a/macros/luatex/generic/barracuda/test/test-code128/002-code128-test.tex b/macros/luatex/generic/barracuda/test/test-code128/002-code128-test.tex index b5c081659e..9bb3915908 100644 --- a/macros/luatex/generic/barracuda/test/test-code128/002-code128-test.tex +++ b/macros/luatex/generic/barracuda/test/test-code128/002-code128-test.tex @@ -1,12 +1,12 @@ % !TeX program = LuaTeX -% Copyright (C) 2020 Roberto Giacomelli +% Copyright (C) 2019-2022 Roberto Giacomelli \newbox\mybox \nopagenumbers Code 128 encoder test. -Test 1: one simple barcode with default parameter: +Test 1: one simple barcode with default parameters: \directlua{ barracuda = require "barracuda" @@ -14,7 +14,7 @@ barracuda = require "barracuda" \directlua{ local barcode = barracuda:barcode() - +barcode:set_param{debug_bbox="symb"} local c128, err = barcode:new_encoder("code128") assert(not err, err) @@ -22,7 +22,7 @@ local symbo, err = c128:from_string("5465468132546812") assert(not err, err) local canvas = barracuda:new_canvas() -symbo:append_ga(canvas) +symbo:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") @@ -51,8 +51,8 @@ local s2_ax = s2:get_param("ax") assert(s2.ax == 0, "0 ax is "..tostring(s2.ax)) local canvas = barracuda:new_canvas() -s1:append_ga(canvas) -s2:append_ga(canvas) +s1:draw(canvas) +s2:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") @@ -69,13 +69,13 @@ assert(c128, err) local s, err = c128:from_string("123456"); assert(s, err) local canvas = barracuda:new_canvas() -s:append_ga(canvas) +s:draw(canvas) local ok, err = s:set_param("ydim", tex.sp "30mm") -s:append_ga(canvas, tex.sp "20mm") +s:draw(canvas, tex.sp "20mm") local ok, err = s:set_param("ydim", tex.sp "60mm") -s:append_ga(canvas, tex.sp "40mm") +s:draw(canvas, tex.sp "40mm") local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") @@ -93,14 +93,14 @@ local c128, err = barcode:enc_by_name "code128"; assert(c128, err) local s, err = c128:from_string("ABCDEFGHI"); assert(s, err) local canvas = barracuda:new_canvas() -local _, err = s:append_ga(canvas); assert(not err, err) +local _, err = s:draw(canvas); assert(not err, err) % set ay to 0.5 for the encoder local ok, err = c128:set_param("ay", 0.5); assert(ok, err) -local _, err = s:append_ga(canvas, tex.sp "30mm"); assert(not err, err) +local _, err = s:draw(canvas, tex.sp "30mm"); assert(not err, err) % set locally to the symbol ay to 1.0 local ok, err = s:set_param("ay", 1) -local _, err = s:append_ga(canvas, tex.sp "60mm"); assert(not err, err) +local _, err = s:draw(canvas, tex.sp "60mm"); assert(not err, err) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") @@ -114,14 +114,96 @@ local c128, err = barcode:enc_by_name("code128"); assert(c128, err) local s, e = c128:from_uint(1234567890); assert(s, e) local canvas = barracuda:new_canvas() -local _, errc = s:append_ga(canvas); assert(not errc, errc) +local _, errc = s:draw(canvas); assert(not errc, errc) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") drv:save("native", canvas, "02-05-pdfliteral") }\box\mybox -That's all folks! +Test 6: encode ABC123: -\bye +\directlua{ +local barcode = barracuda:barcode() +local c128, err = barcode:enc_by_name "code128"; assert(c128, err) +local s, err = c128:from_string("ABC123"); assert(s, err) + +local canvas = barracuda:new_canvas() +local _, err = s:draw(canvas); assert(not err, err) + +local drv = barracuda:get_driver() +drv:ga_to_hbox(canvas, "mybox") +}\box\mybox + +Test 7: encode ABC123999: + +\directlua{ +local barcode = barracuda:barcode() +local c128, err = barcode:enc_by_name "code128"; assert(c128, err) +local s, err = c128:from_string("ABC123999"); assert(s, err) + +local canvas = barracuda:new_canvas() +local _, err = s:draw(canvas); assert(not err, err) + +local drv = barracuda:get_driver() +drv:ga_to_hbox(canvas, "mybox") +}\box\mybox + +Test 8: encode ABC123456789: + +\directlua{ +local barcode = barracuda:barcode() +local c128, err = barcode:enc_by_name "code128"; assert(c128, err) +local s, err = c128:from_string("ABC123456789"); assert(s, err) + +local canvas = barracuda:new_canvas() +local _, err = s:draw(canvas); assert(not err, err) + +local drv = barracuda:get_driver() +drv:ga_to_hbox(canvas, "mybox") +}\box\mybox + +Test 9: encode A1B2C3D999: -function Driver:save(id_drv, ga, filename, ext) --> ok, err
\ No newline at end of file +\directlua{ +local barcode = barracuda:barcode() +local c128, err = barcode:enc_by_name "code128"; assert(c128, err) +local s, err = c128:from_string("A1B2C3D999"); assert(s, err) + +local canvas = barracuda:new_canvas() +local _, err = s:draw(canvas); assert(not err, err) + +local drv = barracuda:get_driver() +drv:ga_to_hbox(canvas, "mybox") +}\box\mybox + +Test 10: encode 123abcedfg: + +\directlua{ +local barcode = barracuda:barcode() +local c128, err = barcode:enc_by_name "code128"; assert(c128, err) +local s, err = c128:from_string("123abcedfg"); assert(s, err) + +local canvas = barracuda:new_canvas() +local _, err = s:draw(canvas); assert(not err, err) + +local drv = barracuda:get_driver() +drv:ga_to_hbox(canvas, "mybox") +}\box\mybox + +Test 11: encode 999Aaaa: + +\directlua{ +local barcode = barracuda:barcode() +barcode:set_param{debug_bbox="none"} +local c128, err = barcode:enc_by_name "code128"; assert(c128, err) +local s, err = c128:from_string("999Aaaa"); assert(s, err) + +local canvas = barracuda:new_canvas() +local _, err = s:draw(canvas); assert(not err, err) + +local drv = barracuda:get_driver() +drv:ga_to_hbox(canvas, "mybox") +}\box\mybox + +That's all folks! +\bye diff --git a/macros/luatex/generic/barracuda/test/test-code128/02-05-pdfliteral.txt b/macros/luatex/generic/barracuda/test/test-code128/02-05-pdfliteral.txt index fe16d33c50..894b9f1d4a 100644 --- a/macros/luatex/generic/barracuda/test/test-code128/02-05-pdfliteral.txt +++ b/macros/luatex/generic/barracuda/test/test-code128/02-05-pdfliteral.txt @@ -1,4 +1,8 @@ q +1.000000 w +0 J +0 j +[] 0 d -53.574521 -14.173154 1.190545 28.346308 re -51.788704 -14.173154 0.595272 28.346308 re -50.002887 -14.173154 1.785817 28.346308 re @@ -40,4 +44,8 @@ S -1.190545 -14.173154 1.190545 28.346308 re f S +0.100000 w +[6.000000 3.000000] 3.000000 d +-53.524521 -14.123154 53.474521 28.246308 re S +[] 0 d Q
\ No newline at end of file diff --git a/macros/luatex/generic/barracuda/test/test-code39/001-code39-test.lua b/macros/luatex/generic/barracuda/test/test-code39/001-code39-test.tex index a9d8894ba0..c08e1f242a 100644 --- a/macros/luatex/generic/barracuda/test/test-code39/001-code39-test.lua +++ b/macros/luatex/generic/barracuda/test/test-code39/001-code39-test.tex @@ -1,10 +1,12 @@ --- Copyright (C) 2020 Roberto Giacomelli --- test Code 39 encoder +% !TeX program = LuaTeX +% Copyright (C) 2019-2022 Roberto Giacomelli +% test Code 39 encoder +\directlua{ local barracuda = require "barracuda" for k, v in pairs(barracuda) do - print(k,v) + print(k, v) end local barcode = barracuda:barcode() @@ -19,7 +21,6 @@ local info = c39:info() print("encoder name = ", info.name) print("description = ", info.description) - for k, tp in ipairs(info.param) do print(k, tp.name, tp.value) end @@ -27,15 +28,12 @@ end local symb = c39:from_string("123") print("print internal representation of chars") -for _, c in ipairs(symb._code_data) do - print(c) -end -print() +print(table.concat(symb:get_code(), " ")) +print("end") +assert(symb:get_hri() == nil) local canvas = barracuda:new_canvas() -symb:append_ga(canvas) - --- native driver -local drv = barracuda:get_driver() - -for _, code in ipairs(canvas._data) do print(code) end +symb:draw(canvas) +% canvas:prettyprint_ga() +} +\bye diff --git a/macros/luatex/generic/barracuda/test/test-code39/002-code39-test.pdf b/macros/luatex/generic/barracuda/test/test-code39/002-code39-test.pdf Binary files differindex 63ced9a342..c114e9339f 100644 --- a/macros/luatex/generic/barracuda/test/test-code39/002-code39-test.pdf +++ b/macros/luatex/generic/barracuda/test/test-code39/002-code39-test.pdf diff --git a/macros/luatex/generic/barracuda/test/test-code39/002-code39-test.tex b/macros/luatex/generic/barracuda/test/test-code39/002-code39-test.tex index eb1693b5ba..f242fafa4d 100644 --- a/macros/luatex/generic/barracuda/test/test-code39/002-code39-test.tex +++ b/macros/luatex/generic/barracuda/test/test-code39/002-code39-test.tex @@ -1,5 +1,5 @@ % !TeX program = LuaTeX -% Copyright (C) 2020 Roberto Giacomelli +% Copyright (C) 2019-2022 Roberto Giacomelli \newbox\mybox \nopagenumbers @@ -19,10 +19,10 @@ local symbol, err = c39:from_string("ABC12QJ31") assert(not err, err) local canvas = barracuda:new_canvas() -symbol:append_ga(canvas) +symbol:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") -}\box\mybox +}\leavevmode\box\mybox Test 2: get the reference of the previous encoder and typeset two Code 39 symbols on the same canvas, one above to the other: @@ -36,13 +36,13 @@ local s1, err = c39:from_string("ZKPQJ31"); assert(s1, err) local s2, err = c39:from_string("RTFG746", {text_vpos="top"}); assert(s2, err) local canvas = barracuda:new_canvas() -s1:append_ga(canvas) +s1:draw(canvas) local h2 = s2:get_param("height") -s2:append_ga(canvas, 0.0, h2 + tex.sp "5pt") +s2:draw(canvas, 0.0, h2 + tex.sp "5pt") local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") -}\box\mybox +}\leavevmode\box\mybox Test 3: with the same encoder print a symbol, change globally the height, and reprint the same symbol again on the same canvas: @@ -55,17 +55,17 @@ assert(c39, err) local s1, err = c39:from_string("ZKPQJ31"); assert(s1, err) local canvas = barracuda:new_canvas() -s1:append_ga(canvas) +s1:draw(canvas) local h = s1:get_param("height") c39:set_param("height", 2*h) c39:set_param {text_vpos = "top"} -s1:append_ga(canvas, 0.0, h + tex.sp "5pt") +s1:draw(canvas, 0.0, h + tex.sp "5pt") local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") -}\box\mybox +}\leavevmode\box\mybox Test 4: do the same in test 3 but change locally parameters as height and text properties: @@ -78,7 +78,7 @@ assert(c39, err) local s1, err = c39:from_string("0123456789"); assert(s1, err) local canvas = barracuda:new_canvas() -s1:append_ga(canvas) +s1:draw(canvas) local h, err = s1:get_param("height"); assert(h, err) local ok, err = s1:set_param{ height = h/2, @@ -88,27 +88,30 @@ local ok, err = s1:set_param{ text_star = true, ay = 1, }; assert(ok, err) -s1:append_ga(canvas, 0.0, - tex.sp "5pt") +s1:draw(canvas, 0.0, - tex.sp "5pt") local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") -}\box\mybox +}\leavevmode\box\mybox -Test 5: create a new encoder with a large module value: +Test 5: create a new encoder with a large module value. +It's also activeted the debug\_bbox\_on option. + +\bigskip \directlua{ local barcode = barracuda:barcode() -local c39, err = barcode:new_encoder("code39:e2", {module = tex.sp "0.5mm"}) +local c39, err = barcode:new_encoder("code39:e2", {module = tex.sp "0.5mm", debug_bbox_on = true}) assert(c39, err) local s1, err = c39:from_string("02040608"); assert(s1, err) local canvas = barracuda:new_canvas() -s1:append_ga(canvas) +s1:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") -}\box\mybox +}\leavevmode\box\mybox \bye diff --git a/macros/luatex/generic/barracuda/test/test-code39/003-code39-test.pdf b/macros/luatex/generic/barracuda/test/test-code39/003-code39-test.pdf Binary files differindex 544a4b34ff..3dcd314a4a 100644 --- a/macros/luatex/generic/barracuda/test/test-code39/003-code39-test.pdf +++ b/macros/luatex/generic/barracuda/test/test-code39/003-code39-test.pdf diff --git a/macros/luatex/generic/barracuda/test/test-code39/003-code39-test.tex b/macros/luatex/generic/barracuda/test/test-code39/003-code39-test.tex index 884cdd0df4..d9df0e8110 100644 --- a/macros/luatex/generic/barracuda/test/test-code39/003-code39-test.tex +++ b/macros/luatex/generic/barracuda/test/test-code39/003-code39-test.tex @@ -1,5 +1,5 @@ % !TeX program = LuaTeX -% Copyright (C) 2020 Roberto Giacomelli +% Copyright (C) 2019-2022 Roberto Giacomelli \newbox\mybox \nopagenumbers @@ -18,33 +18,35 @@ local ok, err = c39:set_param("text_vpos", "top") assert(ok, err) local canvas = barracuda:new_canvas() -symbol:append_ga(canvas) +symbol:draw(canvas) local ok, err = symbol:set_param("text_hpos", "center") assert(ok, err) -symbol:append_ga(canvas, tex.sp "4.5cm") +symbol:draw(canvas, tex.sp "4.5cm") local ok, err = symbol:set_param("text_hpos", "right") assert(ok, err) -symbol:append_ga(canvas, tex.sp "9.0cm") +symbol:draw(canvas, tex.sp "9.0cm") local ok, err = c39:set_param("text_vpos", "bottom") assert(ok, err) local ok, err = symbol:set_param("text_hpos", "left") -symbol:append_ga(canvas, 0, tex.sp "-2.0cm") +symbol:draw(canvas, 0, tex.sp "-2.0cm") local ok, err = symbol:set_param("text_hpos", "center") assert(ok, err) -symbol:append_ga(canvas, tex.sp "4.5cm", tex.sp "-2.0cm") +symbol:draw(canvas, tex.sp "4.5cm", tex.sp "-2.0cm") local ok, err = symbol:set_param("text_hpos", "right") assert(ok, err) -symbol:append_ga(canvas, tex.sp "9.0cm", tex.sp "-2.0cm") +symbol:draw(canvas, tex.sp "9.0cm", tex.sp "-2.0cm") local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") -}\box\mybox +} +\bigskip +\leavevmode\box\mybox \bye diff --git a/macros/luatex/generic/barracuda/test/test-code39/004-code39-test.pdf b/macros/luatex/generic/barracuda/test/test-code39/004-code39-test.pdf Binary files differindex 0e5bfa42d0..660dd4a1fa 100644 --- a/macros/luatex/generic/barracuda/test/test-code39/004-code39-test.pdf +++ b/macros/luatex/generic/barracuda/test/test-code39/004-code39-test.pdf diff --git a/macros/luatex/generic/barracuda/test/test-code39/004-code39-test.tex b/macros/luatex/generic/barracuda/test/test-code39/004-code39-test.tex index 9066d4dee8..1af5fdaaa0 100644 --- a/macros/luatex/generic/barracuda/test/test-code39/004-code39-test.tex +++ b/macros/luatex/generic/barracuda/test/test-code39/004-code39-test.tex @@ -1,5 +1,5 @@ % !TeX program = LuaTeX -% Copyright (C) 2020 Roberto Giacomelli +% Copyright (C) 2019-2022 Roberto Giacomelli \newbox\mybox \nopagenumbers @@ -17,11 +17,11 @@ symbol, err = c39:from_uint(0, {text_hpos="center"}) assert(not err, err) local canvas = barracuda:new_canvas() -symbol:append_ga(canvas) +symbol:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") -}\box\mybox +}\bigskip\leavevmode\box\mybox \directlua{ local c39, err = barracuda:barcode() @@ -33,10 +33,9 @@ symbol, e = c39:from_uint(0123456789, {text_hpos="spaced",text_star=true}) assert(not e, e) local canvas = barracuda:new_canvas() -symbol:append_ga(canvas) +symbol:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") -}\box\mybox - +}\bigskip\leavevmode\box\mybox \bye diff --git a/macros/luatex/generic/barracuda/test/test-code39/006-code39-test.lua b/macros/luatex/generic/barracuda/test/test-code39/006-code39-test.lua index 1b8ee9f4a1..0ad6169fca 100644 --- a/macros/luatex/generic/barracuda/test/test-code39/006-code39-test.lua +++ b/macros/luatex/generic/barracuda/test/test-code39/006-code39-test.lua @@ -14,29 +14,29 @@ local ok, err = c39:set_param("text_vpos", "top") assert(ok, err) local canvas = barracuda:new_canvas() -symbol:append_ga(canvas) +symbol:draw(canvas) local ok, err = symbol:set_param("text_hpos", "center") assert(ok, err) -symbol:append_ga(canvas, 4.5*cm) +symbol:draw(canvas, 4.5*cm) local ok, err = symbol:set_param("text_hpos", "right") assert(ok, err) -symbol:append_ga(canvas, 9.0*cm) +symbol:draw(canvas, 9.0*cm) local ok, err = c39:set_param("text_vpos", "bottom") assert(ok, err) local ok, err = symbol:set_param("text_hpos", "left") -symbol:append_ga(canvas, 0, -2.0*cm) +symbol:draw(canvas, 0, -2.0*cm) local ok, err = symbol:set_param("text_hpos", "center") assert(ok, err) -symbol:append_ga(canvas, 4.5*cm, -2.0*cm) +symbol:draw(canvas, 4.5*cm, -2.0*cm) local ok, err = symbol:set_param("text_hpos", "right") assert(ok, err) -symbol:append_ga(canvas, 9.0*cm, -2.0*cm) +symbol:draw(canvas, 9.0*cm, -2.0*cm) local drv = barracuda:get_driver() drv:save("svg", canvas, "006-six") diff --git a/macros/luatex/generic/barracuda/test/test-code39/007-code39-test.pdf b/macros/luatex/generic/barracuda/test/test-code39/007-code39-test.pdf Binary files differnew file mode 100644 index 0000000000..e49b38b256 --- /dev/null +++ b/macros/luatex/generic/barracuda/test/test-code39/007-code39-test.pdf diff --git a/macros/luatex/generic/barracuda/test/test-code39/007-code39-test.tex b/macros/luatex/generic/barracuda/test/test-code39/007-code39-test.tex new file mode 100644 index 0000000000..5090e54058 --- /dev/null +++ b/macros/luatex/generic/barracuda/test/test-code39/007-code39-test.tex @@ -0,0 +1,39 @@ +% !TeX program = LuaTeX +% Copyright (C) 2019-2022 Roberto Giacomelli + +\newbox\mybox +\nopagenumbers + +\directlua{ +barracuda = require "barracuda" +local c39 = assert( + barracuda:barcode() + :new_encoder("code39", {debug_bbox_on = true}) +) + +local bars = c39:new { + 123456, + "123456", + "ABCDEF", + 87429, + 982398, + "HDUHBE" +} + +local canvas = barracuda:new_canvas() +local tx, ty = 0, 0 +local dh = tex.sp "40pt" +for _, b in ipairs(bars) do + b:draw(canvas, tx, ty) + ty = ty + dh +end + +local drv = barracuda:get_driver() +drv:ga_to_hbox(canvas, "mybox") +} + +Test 1: check Barcode recursive costructor new(): +\bigskip +\leavevmode\box\mybox +\bye + diff --git a/macros/luatex/generic/barracuda/test/test-ean/001-13-ean-test.pdf b/macros/luatex/generic/barracuda/test/test-ean/001-13-ean-test.pdf Binary files differindex 12eac36ba1..bc9d8f894b 100644 --- a/macros/luatex/generic/barracuda/test/test-ean/001-13-ean-test.pdf +++ b/macros/luatex/generic/barracuda/test/test-ean/001-13-ean-test.pdf diff --git a/macros/luatex/generic/barracuda/test/test-ean/001-13-ean-test.tex b/macros/luatex/generic/barracuda/test/test-ean/001-13-ean-test.tex index 7c7b373a6c..42850bcd13 100644 --- a/macros/luatex/generic/barracuda/test/test-ean/001-13-ean-test.tex +++ b/macros/luatex/generic/barracuda/test/test-ean/001-13-ean-test.tex @@ -1,5 +1,5 @@ % !TeX program = LuaTeX -% Copyright (C) 2020 Roberto Giacomelli +% Copyright (C) 2019-2022 Roberto Giacomelli \newbox\mybox \nopagenumbers @@ -11,6 +11,7 @@ Test 1: one simple barcode EAN13 with default parameter: \directlua{ barracuda = require "barracuda" local barcode = barracuda:barcode() +barcode:set_param{debug_bbox="qz"} local ean13, err = barcode:new_encoder("ean-13") assert(not err, err) @@ -19,7 +20,7 @@ local symbo, err = ean13:from_string("8006194056290") assert(not err, err) local canvas = barracuda:new_canvas() -symbo:append_ga(canvas) +symbo:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") @@ -39,7 +40,7 @@ local symbo, err = ean8:from_string("96385074") assert(not err, err) local canvas = barracuda:new_canvas() -symbo:append_ga(canvas) +symbo:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") @@ -56,7 +57,7 @@ assert(not err, err) local symbo, err = ean5:from_string("54495") assert(not err, err) local canvas = barracuda:new_canvas() -symbo:append_ga(canvas) +symbo:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") } @@ -72,7 +73,7 @@ assert(not err, err) local symbo, err = ean2:from_string("53") assert(not err, err) local canvas = barracuda:new_canvas() -symbo:append_ga(canvas) +symbo:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") } @@ -89,7 +90,7 @@ local c = assert(ean:checksum(n)) local symbo, err = ean:from_string(n..c.."12345") assert(not err, err) local canvas = barracuda:new_canvas() -symbo:append_ga(canvas) +symbo:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") } @@ -107,7 +108,7 @@ local s = n .. c local symbo, err = ean:from_string(s.."12") assert(not err, err) local canvas = barracuda:new_canvas() -symbo:append_ga(canvas) +symbo:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") } @@ -125,7 +126,7 @@ local s = n .. c local symbo, err = ean:from_string(s.."12345") assert(not err, err) local canvas = barracuda:new_canvas() -symbo:append_ga(canvas) +symbo:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") } @@ -143,7 +144,7 @@ local s = n .. c local symbo, err = ean:from_string(s.."88") assert(not err, err) local canvas = barracuda:new_canvas() -symbo:append_ga(canvas) +symbo:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") } @@ -167,10 +168,10 @@ local s = n .. c local symbo, err = ean:from_string(s); assert(not err, err) local ok, err = symbo:set_param("height", tex.sp "5mm"); assert(ok, err) local canvas = barracuda:new_canvas() -symbo:append_ga(canvas) +symbo:draw(canvas) local s2, err = ean:from_uint(8001120972163); assert(not err, err) -s2:append_ga(canvas, tex.sp "45mm", 0) +s2:draw(canvas, tex.sp "45mm", 0) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") @@ -191,12 +192,12 @@ local ok, err = ean:set_param("height", tex.sp "5mm"); assert(ok, err) local n = 758458535897; local c = ean:checksum(n); local s = n .. c local s1, err = ean:from_string(s); assert(not err, err) local canvas = barracuda:new_canvas() -s1:append_ga(canvas) +s1:draw(canvas) local s2, err = ean:from_uint(8001120972163); assert(not err, err) -s2:append_ga(canvas, tex.sp "40mm", 0) +s2:draw(canvas, tex.sp "40mm", 0) local s3, err = ean:from_uint(8000570000310); assert(not err, err) local ok, e = s3:set_param{height = tex.sp "10mm"}; assert(ok, e) -s3:append_ga(canvas, tex.sp "90mm", 0) +s3:draw(canvas, tex.sp "90mm", 0) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") } diff --git a/macros/luatex/generic/barracuda/test/test-ean/002-ean-test.pdf b/macros/luatex/generic/barracuda/test/test-ean/002-ean-test.pdf Binary files differindex 796ad29ab0..54762d4dfc 100644 --- a/macros/luatex/generic/barracuda/test/test-ean/002-ean-test.pdf +++ b/macros/luatex/generic/barracuda/test/test-ean/002-ean-test.pdf diff --git a/macros/luatex/generic/barracuda/test/test-ean/003-ean-test.pdf b/macros/luatex/generic/barracuda/test/test-ean/003-ean-test.pdf Binary files differindex c52c77a847..cfeea7167f 100644 --- a/macros/luatex/generic/barracuda/test/test-ean/003-ean-test.pdf +++ b/macros/luatex/generic/barracuda/test/test-ean/003-ean-test.pdf diff --git a/macros/luatex/generic/barracuda/test/test-ean/004-ean-test.lua b/macros/luatex/generic/barracuda/test/test-ean/004-ean-test.tex index 017e0725b8..4d9b5208e9 100644 --- a/macros/luatex/generic/barracuda/test/test-ean/004-ean-test.lua +++ b/macros/luatex/generic/barracuda/test/test-ean/004-ean-test.tex @@ -1,9 +1,6 @@ - +% !TeX program = LuaTeX +\directlua{ local barracuda = require "barracuda" barracuda:save("ean-13", "8006194056290", "8006194056290") - - - - - - +} +\bye diff --git a/macros/luatex/generic/barracuda/test/test-ean/005-isbn-test.pdf b/macros/luatex/generic/barracuda/test/test-ean/005-isbn-test.pdf Binary files differindex d71e87141d..ad4028750c 100644 --- a/macros/luatex/generic/barracuda/test/test-ean/005-isbn-test.pdf +++ b/macros/luatex/generic/barracuda/test/test-ean/005-isbn-test.pdf diff --git a/macros/luatex/generic/barracuda/test/test-ean/006-issn-test.pdf b/macros/luatex/generic/barracuda/test/test-ean/006-issn-test.pdf Binary files differindex 57f3739fb7..a40f50669e 100644 --- a/macros/luatex/generic/barracuda/test/test-ean/006-issn-test.pdf +++ b/macros/luatex/generic/barracuda/test/test-ean/006-issn-test.pdf diff --git a/macros/luatex/generic/barracuda/test/test-ean/006-issn-test.tex b/macros/luatex/generic/barracuda/test/test-ean/006-issn-test.tex index 576963bd81..61148b0b70 100644 --- a/macros/luatex/generic/barracuda/test/test-ean/006-issn-test.tex +++ b/macros/luatex/generic/barracuda/test/test-ean/006-issn-test.tex @@ -30,28 +30,30 @@ barracuda:hbox("ean-issn+5", ars_issn.online.."00028", "mybox") \vskip10pt \leavevmode -\directlua{barracuda:hbox("ean-issn", "1828-2350", "mybox")} +\directlua{ +local barcode = barracuda:barcode() +barcode:set_param("debug_bbox_on", true) +barracuda:hbox("ean-issn", "1828-2350", "mybox") +} \box\mybox \vskip10pt \leavevmode -\directlua{barracuda:hbox("ean-issn", "1828-2350 [01]", "mybox")} +\directlua{ +barracuda:hbox("ean-issn+2", "1828-2350 [01] 22", "mybox") +barracuda:save("ean-issn+2", "1828-2350 [01] 22", "ars") +} \box\mybox \vskip10pt \leavevmode -\directlua{barracuda:hbox("ean-issn+5", "1828-2350 [01] 00028", "mybox")} +\directlua{barracuda:hbox("ean-issn", "1828-2350 [01]", "mybox")} \box\mybox \vskip10pt \leavevmode -\directlua{ -barracuda:hbox("ean-issn+2", "1828-2350 [01] 22", "mybox") -barracuda:save("ean-issn+2", "1828-2350 [01] 22", "ars") -} +\directlua{barracuda:hbox("ean-issn+5", "1828-2350 [01] 00028", "mybox")} \box\mybox - \bye - diff --git a/macros/luatex/generic/barracuda/test/test-ean/8006194056290.svg b/macros/luatex/generic/barracuda/test/test-ean/8006194056290.svg index f7965e94d4..e553800370 100644 --- a/macros/luatex/generic/barracuda/test/test-ean/8006194056290.svg +++ b/macros/luatex/generic/barracuda/test/test-ean/8006194056290.svg @@ -12,6 +12,14 @@ <path d="M0.824996 -24.499871V-0.000000" style="stroke-width:0.329998"/> </g> <g stroke="black"> + <path d="M15.344919 -24.499871V-0.000000" style="stroke-width:0.329998"/> + <path d="M16.004916 -24.499871V-0.000000" style="stroke-width:0.329998"/> + </g> + <g stroke="black"> + <path d="M30.524839 -24.499871V-0.000000" style="stroke-width:0.329998"/> + <path d="M31.184836 -24.499871V-0.000000" style="stroke-width:0.329998"/> + </g> + <g stroke="black"> <path d="M2.309988 -24.499871V-1.649991" style="stroke-width:0.659997"/> <path d="M3.134984 -24.499871V-1.649991" style="stroke-width:0.329998"/> </g> @@ -36,10 +44,6 @@ <path d="M14.519924 -24.499871V-1.649991" style="stroke-width:0.659997"/> </g> <g stroke="black"> - <path d="M15.344919 -24.499871V-0.000000" style="stroke-width:0.329998"/> - <path d="M16.004916 -24.499871V-0.000000" style="stroke-width:0.329998"/> - </g> - <g stroke="black"> <path d="M16.994911 -24.499871V-1.649991" style="stroke-width:0.989995"/> <path d="M18.314904 -24.499871V-1.649991" style="stroke-width:0.329998"/> </g> @@ -63,10 +67,6 @@ <path d="M28.544850 -24.499871V-1.649991" style="stroke-width:0.989995"/> <path d="M29.864843 -24.499871V-1.649991" style="stroke-width:0.329998"/> </g> - <g stroke="black"> - <path d="M30.524839 -24.499871V-0.000000" style="stroke-width:0.329998"/> - <path d="M31.184836 -24.499871V-0.000000" style="stroke-width:0.329998"/> - </g> <text x="-3.629981" y="0.780007" font-family="Verdana" font-size="2.877000"> 8 </text> <text y="0.780007" font-family="Verdana" font-size="2.877000" text-anchor="middle"> diff --git a/macros/luatex/generic/barracuda/test/test-ean/ars.svg b/macros/luatex/generic/barracuda/test/test-ean/ars.svg index 5bfc01d0f3..8f48c1054e 100644 --- a/macros/luatex/generic/barracuda/test/test-ean/ars.svg +++ b/macros/luatex/generic/barracuda/test/test-ean/ars.svg @@ -12,6 +12,14 @@ <path d="M0.824996 -24.499871V-0.000000" style="stroke-width:0.329998"/> </g> <g stroke="black"> + <path d="M15.344919 -24.499871V-0.000000" style="stroke-width:0.329998"/> + <path d="M16.004916 -24.499871V-0.000000" style="stroke-width:0.329998"/> + </g> + <g stroke="black"> + <path d="M30.524839 -24.499871V-0.000000" style="stroke-width:0.329998"/> + <path d="M31.184836 -24.499871V-0.000000" style="stroke-width:0.329998"/> + </g> + <g stroke="black"> <path d="M1.814990 -24.499871V-1.649991" style="stroke-width:0.989995"/> <path d="M2.969984 -24.499871V-1.649991" style="stroke-width:0.659997"/> </g> @@ -36,10 +44,6 @@ <path d="M14.354924 -24.499871V-1.649991" style="stroke-width:0.989995"/> </g> <g stroke="black"> - <path d="M15.344919 -24.499871V-0.000000" style="stroke-width:0.329998"/> - <path d="M16.004916 -24.499871V-0.000000" style="stroke-width:0.329998"/> - </g> - <g stroke="black"> <path d="M16.829911 -24.499871V-1.649991" style="stroke-width:0.659997"/> <path d="M17.819906 -24.499871V-1.649991" style="stroke-width:0.659997"/> </g> @@ -63,10 +67,6 @@ <path d="M28.379851 -24.499871V-1.649991" style="stroke-width:0.659997"/> <path d="M29.699844 -24.499871V-1.649991" style="stroke-width:0.659997"/> </g> - <g stroke="black"> - <path d="M30.524839 -24.499871V-0.000000" style="stroke-width:0.329998"/> - <path d="M31.184836 -24.499871V-0.000000" style="stroke-width:0.329998"/> - </g> <text x="-3.629981" y="0.780007" font-family="Verdana" font-size="2.877000"> 9 </text> <text y="0.780007" font-family="Verdana" font-size="2.877000" text-anchor="middle"> diff --git a/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/001-ga-pdfliteral-test.pdf b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/001-ga-pdfliteral-test.pdf Binary files differindex b3f3336f43..d741453c5b 100644 --- a/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/001-ga-pdfliteral-test.pdf +++ b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/001-ga-pdfliteral-test.pdf diff --git a/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/001-ga-pdfliteral-test.tex b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/001-ga-pdfliteral-test.tex index c51fa3dfb0..a40ba4ec8b 100644 --- a/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/001-ga-pdfliteral-test.tex +++ b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/001-ga-pdfliteral-test.tex @@ -1,7 +1,7 @@ % !TeX program = LuaTeX % test for ga-canvas pdfliteral driver % -% Copyright (C) 2020 Roberto Giacomelli +% Copyright (C) 2019-2022 Roberto Giacomelli % see LICENSE.txt file ---ga--- is a binary format as an istruction set similar to @@ -28,35 +28,36 @@ the PDF output file. \newbox\mybox \directlua{ - driver = require [[lib-driver.brcd-driver]] % global Lua variables + brcd = require "barracuda" + driver = brcd:get_driver() % global Lua variables pt = tex.sp [[1pt]] % 1pt = 65536sp } Let's start drawing an horizontal line 100pt long: \directlua{ - local ga = {_data = {33, 0*pt, 100*pt, 0*pt}} + local ga = {33, 0*pt, 100*pt, 0*pt} driver:ga_to_hbox(ga, [[mybox]]) }\box\mybox or two different parallel lines 24pt long: \directlua{ - local ga = {_data = {33, 0*pt, 24*pt, 0*pt, 33, 0*pt, 24*pt, 5*pt}} + local ga = {33, 0*pt, 24*pt, 0*pt, 33, 0*pt, 24*pt, 5*pt} driver:ga_to_hbox(ga, [[mybox]]) }\box\mybox and again two horizontal lines 10pt thick, touching a corner: \directlua{ - local ga = {_data = { + local ga = { 1, 10*pt, 33, -24*pt, 0*pt, -5*pt, 33, 0*pt, 24*pt, 5*pt, - }} + } driver:ga_to_hbox(ga, [[mybox]]) }\box\mybox Several vertical lines with its horizontal limits: \directlua{ - local ga = { _data = { + local ga = { 34, -20*pt, 20*pt, 0*pt, 34, -15*pt, 15*pt, 5*pt, 34, -10*pt, 10*pt, 10*pt, @@ -69,16 +70,16 @@ Several vertical lines with its horizontal limits: 1, .05*pt, 33, 0*pt, 40*pt, -20*pt, 33, 0*pt, 40*pt, 20*pt, - }} + } driver:ga_to_hbox(ga, [[mybox]]) }\box\mybox Finally a little rectangle: \directlua{ - local ga = {_data = { + local ga = { 1, 5*pt, 48, 0*pt, 0*pt, 15*pt, 10*pt, - }} + } driver:ga_to_hbox(ga, [[mybox]]) }\box\mybox @@ -86,7 +87,7 @@ Finally a little rectangle: Test number 1: a vbar 2pt width, 20pt height: \directlua{ % vbar: <36> y1 y2 <nbars> x1 w1 x2 w2 ... xn wn - local ga = {_data = {36, 0, 20*pt, 1, 0.0, 2*pt}} + local ga = {36, 0, 20*pt, 1, 0.0, 2*pt} driver:ga_to_hbox(ga, [[mybox]]) }\box\mybox @@ -98,7 +99,7 @@ Test number 2: ten vbars in a row equally spaced by 10pt: ga[i*2 + 5] = 5*pt + i*20*pt ga[i*2 + 6] = 10*pt end - driver:ga_to_hbox({_data = ga}, [[mybox]]) + driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule \bigskip @@ -117,7 +118,7 @@ Test number 3: two series of vbars 10pt and 5pt large: ga[i*2 + 29] = 15*pt + i*20*pt ga[i*2 + 30] = 5*pt end - driver:ga_to_hbox({_data = ga}, [[mybox]]) + driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule \bigskip @@ -132,7 +133,7 @@ Test number 4: a bunch of thin vertical bars (25): ga[i*2 + 5] = 1*pt + i*4*pt ga[i*2 + 6] = 2*pt end - driver:ga_to_hbox({_data = ga}, [[mybox]]) + driver:ga_to_hbox(ga, [[mybox]]) }\vrule A\box\mybox A\vrule \bigskip @@ -155,7 +156,7 @@ Test number 5: two rows of a bunch of thin bars: ga[i*2 + 59] = 3*pt + i*4*pt ga[i*2 + 60] = 2*pt end - driver:ga_to_hbox({_data = ga}, [[mybox]]) + driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule \bigskip @@ -181,7 +182,7 @@ Test number 6: staircase of Vbars (manually data definition): 25*pt, % x 10*pt, % w } - driver:ga_to_hbox({_data = ga}, [[mybox]]) + driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule \bigskip @@ -219,7 +220,7 @@ Test number 7: vbars with spaced text, in three different rows: ga[52] = 71 % G ga[53] = 72 % H ga[54] = 0 - driver:ga_to_hbox({_data = ga}, [[mybox]]) + driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule \bigskip @@ -271,7 +272,7 @@ Test number 8: spaced text (checking the correct vertical alignment): ga[66] = 55 % 7 ga[67] = 56 % 8 ga[68] = 0 - driver:ga_to_hbox({_data = ga}, [[mybox]]) + driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule \bigskip @@ -323,7 +324,7 @@ Test number 9: spaced text, check correct vertical alignment: ga[66] = 55 % 7 ga[67] = 56 % 8 ga[68] = 0 - driver:ga_to_hbox({_data = ga}, [[mybox]]) + driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule \bigskip @@ -356,11 +357,11 @@ Test number 10: two centered texts aligned to the baseline: ga[23] = 56 % 8 ga[24] = 57 % 9 ga[25] = 0 - driver:ga_to_hbox({_data = ga}, [[mybox]]) + driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule \bigskip -So far, we have manually build data for ga stream. Next we are going to +So far, we have manually build data for ga stream. For now on, we are going to use the ga-canvas library. \bigskip @@ -368,26 +369,22 @@ In fact, all the previous tests are rebuild with the ga-canvas library. Test 1: a vbar 2pt width, 20pt height: \directlua{ - gacanvas = require "lib-geo.brcd-gacanvas" - local ga = gacanvas:new() - local vbar = {_yline = {0.0, 2*pt}} - local err = ga:encode_Vbar(vbar, 0.0, 0.0, 20*pt) % x, w - assert(not err, err) + local ga = brcd:new_canvas() + local vbar = {0.0, 2*pt} + assert(ga:encode_vbar(vbar, 0.0, 0.0, 20*pt)) % x, w driver:ga_to_hbox(ga, [[mybox]]) }\box\mybox \bigskip Test 2: ten vbars equally spaced by 10pt: \directlua{ - local ga = gacanvas:new() - local data = {} + local ga = brcd:new_canvas() + local bars = {} for i = 0, 9 do - data[i*2 + 1] = 5*pt + i*20*pt % x - data[i*2 + 2] = 10*pt % w + bars[i*2 + 1] = 5*pt + i*20*pt % x + bars[i*2 + 2] = 10*pt % w end - local bars = {_yline = data} - local err = ga:encode_Vbar(bars, 0.0, 0.0, 10*pt) - assert(not err, err) + assert(ga:encode_vbar(bars, 0.0, 0.0, 10*pt)) driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule @@ -404,11 +401,9 @@ Test 3: two series of vbars 10pt and 5pt large: b2[i*2 + 1] = i*20*pt b2[i*2 + 2] = 5*pt end - local ga = gacanvas:new() - local err = ga:encode_Vbar({_yline=b1}, 0.0, 0.0, 10*pt) - assert(not err, err) - err = ga:encode_Vbar({_yline=b2}, 10.0*pt, 2.5*pt, 7.5*pt) - assert(not err, err) + local ga = brcd:new_canvas() + assert(ga:encode_vbar(b1, 0.0, 0.0, 10*pt)) + assert(ga:encode_vbar(b2, 10.0*pt, 2.5*pt, 7.5*pt)) driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule @@ -420,9 +415,8 @@ Test 4: a bunch of thin bars: b[i*2 + 1] = 1*pt + i*4*pt b[i*2 + 2] = 2*pt end - local ga = gacanvas:new() - local err = ga:encode_Vbar({_yline=b}, 0.0, 5*pt, 25*pt) - assert(not err, err) + local ga = brcd:new_canvas() + assert(ga:encode_vbar(b, 0.0, 5*pt, 25*pt)) driver:ga_to_hbox(ga, [[mybox]]) }\vrule{ }\box\mybox{ }\vrule @@ -434,42 +428,34 @@ Test 5: two levels of a bunch of thin bars: b[i*2 + 1] = i*4*pt b[i*2 + 2] = 2*pt end - local b = {_yline=b} - local ga = gacanvas:new() - local err = ga:encode_Vbar(b, 0.0, 5*pt, 25*pt) - assert(not err, err) - err = ga:encode_Vbar(b, 2*pt, 25*pt, 45*pt, b) + local ga = brcd:new_canvas() + assert(ga:encode_vbar(b, 0.0, 5*pt, 25*pt)) + assert(ga:encode_vbar(b, 2*pt, 25*pt, 45*pt, b)) driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule \bigskip Test number 6: staircase of bars (manual insertion of data): \directlua{ - local b = {_yline={0.0, 10*pt}} - local ga = gacanvas:new() - local err = ga:encode_Vbar(b, 0.0, 0.0, 20*pt) - assert(not err, err) - err = ga:encode_Vbar(b, 10*pt, 20*pt, 40*pt) - assert(not err, err) - err = ga:encode_Vbar(b, 20*pt, 40*pt, 60*pt) - assert(not err, err) + local b = {0.0, 10*pt} + local ga = brcd:new_canvas() + assert(ga:encode_vbar(b, 0.0, 0.0, 20*pt)) + assert(ga:encode_vbar(b, 10*pt, 20*pt, 40*pt)) + assert(ga:encode_vbar(b, 20*pt, 40*pt, 60*pt)) driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule \bigskip Test number 7: vbars with spaced text, all in three rows: \directlua{ - local b = {} + local vb = {} for i = 0,7 do - b[i*2+1] = i*10*pt - b[i*2+2] = 5*pt + vb[i*2+1] = i*10*pt + vb[i*2+2] = 5*pt end - local vb = {_yline=b} - local ga = gacanvas:new() - local err = ga:encode_Vbar(vb, 0.0, 0.0, 20*pt) - assert(not err, err) - local err = ga:encode_Vbar(vb, 0.0, 30*pt, 50*pt) - assert(not err, err) + local ga = brcd:new_canvas() + assert(ga:encode_vbar(vb, 0.0, 0.0, 20*pt)) + assert(ga:encode_vbar(vb, 0.0, 30*pt, 50*pt)) local txt = {codepoint = { 65, % A 66, % B @@ -480,8 +466,7 @@ Test number 7: vbars with spaced text, all in three rows: 71, % G 72, % H }} - err = ga:encode_Text_xspaced(txt, 0.0, 10*pt, 25*pt, 0.5) - assert(not err, err) + assert(ga:encode_Text_xspaced(txt, 0.0, 10*pt, 25*pt, 0.5)) driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule @@ -493,12 +478,9 @@ Test 8: spaced text, check correct vertical alignment: b[i*2+1] = i*10*pt b[i*2+2] = 2*pt end - b = {_yline=b} - local ga = gacanvas:new() - local err = ga:encode_Vbar(b, 0.0, 0.0, 20*pt) - assert(not err, err) - local err = ga:encode_Vbar(b, 0.0, 40*pt, 60*pt) - assert(not err, err) + local ga = brcd:new_canvas() + assert(ga:encode_vbar(b, 0.0, 0.0, 20*pt)) + assert(ga:encode_vbar(b, 0.0, 40*pt, 60*pt)) local c = { codepoint = { 65, % A 66, % B @@ -509,8 +491,7 @@ Test 8: spaced text, check correct vertical alignment: 71, % G 72, % H }} - err = ga:encode_Text_xspaced(c, 0.0, 10*pt, 30*pt, 0.0) - assert(not err, err) + assert(ga:encode_Text_xspaced(c, 0.0, 10*pt, 30*pt, 0.0)) local n = { codepoint = { 49, % 1 50, % 2 @@ -521,8 +502,7 @@ Test 8: spaced text, check correct vertical alignment: 55, % 7 56, % 8 }} - err = ga:encode_Text_xspaced(n, 0.0, 10*pt, 30*pt, 1.0) - assert(not err, err) + assert(ga:encode_Text_xspaced(n, 0.0, 10*pt, 30*pt, 1.0)) driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule @@ -534,12 +514,9 @@ Test number 9: spaced text, check correct vertical alignment: b[i*2+1] = i*10*pt b[i*2+2] = 8*pt end - b = {_yline = b} - local ga = gacanvas:new() - local err = ga:encode_Vbar(b, 0.0, 0.0, 20*pt) - assert(not err, err) - local err = ga:encode_Vbar(b, 0.0, 40*pt, 60*pt) - assert(not err, err) + local ga = brcd:new_canvas() + assert(ga:encode_vbar(b, 0.0, 0.0, 20*pt)) + assert(ga:encode_vbar(b, 0.0, 40*pt, 60*pt)) local c = { codepoint = { 65, % A 66, % B @@ -550,8 +527,7 @@ Test number 9: spaced text, check correct vertical alignment: 71, % G 72, % H }} - err = ga:encode_Text_xspaced(c, 0.0, 10*pt, 20*pt, 0.0) - assert(not err, err) + assert(ga:encode_Text_xspaced(c, 0.0, 10*pt, 20*pt, 0.0)) local n = { codepoint = { 49, % 1 50, % 2 @@ -562,8 +538,7 @@ Test number 9: spaced text, check correct vertical alignment: 55, % 7 56, % 8 }} - err = ga:encode_Text_xspaced(n, 0.0, 10*pt, 40*pt, 1.0) - assert(not err, err) + assert(ga:encode_Text_xspaced(n, 0.0, 10*pt, 40*pt, 1.0)) driver:ga_to_hbox(ga, [[mybox]]) }\vrule{ }\box\mybox{ }\vrule @@ -582,16 +557,14 @@ Test number 10: two centered texts and baseline aligned: 56, % 8 57, % 9 }} - local ga = gacanvas:new() - local err = ga:encode_Text(n, 0, 0, 0.5, 0) - assert(not err, err) + local ga = brcd:new_canvas() + assert(ga:encode_Text(n, 0, 0, 0.5, 0)) local a = { codepoint = { 65, % A string.byte("Q"), % Q 67, % C }} - err = ga:encode_Text(a, 0, 0, 0.5, 1) - assert(not err, err) + assert(ga:encode_Text(a, 0, 0, 0.5, 1)) driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule @@ -610,16 +583,14 @@ Test number 11: two centered texts aligned: 56, % 8 57, % 9 }} - local ga = gacanvas:new() - local err = ga:encode_Text(n, 0, 0, 0.5, 1) - assert(not err, err) + local ga = brcd:new_canvas() + assert(ga:encode_Text(n, 0, 0, 0.5, 1)) local a = { codepoint = { 65, % A string.byte("Q"), % Q 67, % C }} - err = ga:encode_Text(a, 0, 0, 0.5, 0) - assert(not err, err) + assert(ga:encode_Text(a, 0, 0, 0.5, 0)) driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule @@ -639,9 +610,8 @@ Test number 12: text\_xwidth opcode: 56, % 8 57, % 9 }} - local ga = gacanvas:new() - local err = ga:encode_Text_xwidth(n, 0, tex.sp "5cm", 0, 0) - assert(not err, err) + local ga = brcd:new_canvas() + assert(ga:encode_Text_xwidth(n, 0, tex.sp "5cm", 0, 0)) driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule @@ -664,20 +634,14 @@ Test number 13: text\_xwidth with different size: 56, % 8 57, % 9 }} - local ga = gacanvas:new() - % (txt, x1, x2, ypos, ay) --> err - local err = ga:encode_Text_xwidth(n, tex.sp "0mm", tex.sp "50mm", 0, 0) - assert(not err, err) - local err = ga:encode_Text_xwidth(n, tex.sp "5mm", tex.sp "45mm", tex.sp "3mm", 0) - assert(not err, err) - local err = ga:encode_Text_xwidth(n, tex.sp "10mm", tex.sp "40mm", tex.sp "6mm", 0) - assert(not err, err) - local err = ga:encode_Text_xwidth(n, tex.sp "15mm", tex.sp "35mm", tex.sp "9mm", 0) - assert(not err, err) - local err = ga:encode_Text_xwidth(n, tex.sp "20mm", tex.sp "30mm", tex.sp "12mm", 0) - assert(not err, err) - local err = ga:encode_Text_xwidth(n, tex.sp "24mm", tex.sp "26mm", tex.sp "15mm", 0) - assert(not err, err) + local ga = brcd:new_canvas() + % (txt, x1, x2, ypos, ay) --> ok, err + assert(ga:encode_Text_xwidth(n, tex.sp "0mm", tex.sp "50mm", 0, 0)) + assert(ga:encode_Text_xwidth(n, tex.sp "5mm", tex.sp "45mm", tex.sp "3mm", 0)) + assert(ga:encode_Text_xwidth(n, tex.sp "10mm", tex.sp "40mm", tex.sp "6mm", 0)) + assert(ga:encode_Text_xwidth(n, tex.sp "15mm", tex.sp "35mm", tex.sp "9mm", 0)) + assert(ga:encode_Text_xwidth(n, tex.sp "20mm", tex.sp "30mm", tex.sp "12mm", 0)) + assert(ga:encode_Text_xwidth(n, tex.sp "24mm", tex.sp "26mm", tex.sp "15mm", 0)) driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule @@ -691,16 +655,12 @@ Test number 14: place bars and text as text\_xwidth: b[i*2 + 1] = i*12*pt b[i*2 + 2] = 0.4*pt end - b = {_yline = b} local n = {codepoint = { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,}} - local ga = gacanvas:new() - % (vbar, x0, y1, y2) --> err - local err = ga:encode_Vbar(b, 0.0, 0*pt, 25*pt) - local err = ga:encode_Vbar(b, 0.0, 32*pt, 42*pt) - assert(not err, err) - % (txt, x1, x2, ypos, ay) --> err - local err = ga:encode_Text_xwidth(n, 0*pt, 108*pt, 25*pt, 0) - assert(not err, err) + local ga = brcd:new_canvas() + % (vbar, x0, y1, y2) --> ok, err + assert(ga:encode_vbar(b, 0.0, 0*pt, 25*pt)) + % (txt, x1, x2, ypos, ay) --> ok, err + assert(ga:encode_Text_xwidth(n, 0*pt, 108*pt, 25*pt, 0)) driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule @@ -711,17 +671,14 @@ Test number 14: place bars and text as text\_xwidth: b[i*2 + 1] = i*12*pt b[i*2 + 2] = 0.2*pt end - b = {_yline = b} local n = { 48, 49, 50, 51, string.byte([[x]]), 53, 54, 55, 56,} n = {codepoint = n} - local ga = gacanvas:new() + local ga = brcd:new_canvas() % x0, y1, y2, bars - local err = ga:encode_Vbar(b, 0.0, 0*pt, 25*pt) - local err = ga:encode_Vbar(b, 0.0, 32*pt, 42*pt) - assert(not err, err) - % (txt, x1, x2, ypos, ay) --> err - local err = ga:encode_Text_xwidth(n, 0*pt, 96*pt, 25*pt, 0) - assert(not err, err) + assert(ga:encode_vbar(b, 0.0, 0*pt, 25*pt)) + assert(ga:encode_vbar(b, 0.0, 32*pt, 42*pt)) + % (txt, x1, x2, ypos, ay) --> ok, err + assert(ga:encode_Text_xwidth(n, 0*pt, 96*pt, 25*pt, 0)) driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule @@ -730,10 +687,9 @@ Test number 15: place text\_xwidth when text is only two chars long: \directlua{ local n = {codepoint = { 48, 56,}} % 0 and 8 - local ga = gacanvas:new() - % (txt, x1, x2, ypos, ay) --> err - local err = ga:encode_Text_xwidth(n, 0*pt, 32*pt, 25*pt, 0) - assert(not err, err) + local ga = brcd:new_canvas() + % (txt, x1, x2, ypos, ay) --> ok, err + assert(ga:encode_Text_xwidth(n, 0*pt, 32*pt, 25*pt, 0)) driver:ga_to_hbox(ga, [[mybox]]) }\vrule\box\mybox\vrule diff --git a/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/002-polyline.pdf b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/002-polyline.pdf Binary files differnew file mode 100644 index 0000000000..72d4eddc05 --- /dev/null +++ b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/002-polyline.pdf diff --git a/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/002-polyline.tex b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/002-polyline.tex new file mode 100644 index 0000000000..14a713dee9 --- /dev/null +++ b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/002-polyline.tex @@ -0,0 +1,69 @@ +% !TeX program = LuaTeX + +\directlua{ + brcd = require "barracuda" +} +\newbox\mybox + +Test 1: a simple polyline: +\directlua{ + local Polyline = brcd._libgeo.Polyline + local p = Polyline:new() + p:add_point(0, 0) + p:add_point(tex.sp "32pt", 0) + p:add_relpoint(tex.sp "16pt", tex.sp "16pt") + + local gaCanvas = brcd._gacanvas + local ga = gaCanvas:new() + assert(ga:encode_polyline(p)) + + local driver = brcd:get_driver() + driver:ga_to_hbox(ga, [[mybox]]) +}\vrule\box\mybox\vrule + + +Test 2: a staircase: +\directlua{ + local h = tex.sp "18pt" + local b = tex.sp "36pt" + local Polyline = brcd._libgeo.Polyline + local p = Polyline:new() + p:add_point(0, 0) + for _ = 1, 5 do + p:add_relpoint(0, h) + p:add_relpoint(b, 0) + end + + local gaCanvas = brcd._gacanvas + local ga = gaCanvas:new() + assert(ga:encode_polyline(p)) + + local driver = brcd:get_driver() + driver:ga_to_hbox(ga, [[mybox]]) +}\vrule\box\mybox\vrule + +Test 3: several regular polygons: +\directlua{ + local Polyline = brcd._libgeo.Polyline + local l = tex.sp "36pt" % side length + local gaCanvas = brcd._gacanvas + local ga = gaCanvas:new() + ga:encode_linewidth(tex.sp "0.4pt") + for n = 3, 13 do + local p = Polyline:new() + p:add_point(0, 0) + local alpha = 2*math.pi/n % angle + local a = alpha/2 % regular angles sum + for _ = 1, n do + local x, y = l * math.cos(a), l * math.sin(a) + a = a + alpha + p:add_relpoint(x, y) + end + assert(ga:encode_polyline(p)) + end + local driver = brcd:get_driver() + driver:ga_to_hbox(ga, [[mybox]]) + driver:save("svg", ga, "polygon") +}\vrule\box\mybox\vrule + +\bye diff --git a/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/polygon.svg b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/polygon.svg new file mode 100644 index 0000000000..fd00ed2912 --- /dev/null +++ b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/polygon.svg @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Barracuda package (https://github.com/robitex/barracuda) --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" + "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg xmlns="http://www.w3.org/2000/svg" + version="1.1" + width="52.484243mm" height="52.101574mm" + viewBox="-26.242122 -52.101574 52.484243 52.101574" +> + <g stroke="black" stroke-width="0.140582" fill="none"> + <polyline points="0.000000,-0.000000 + 6.326276,-10.957432 + -6.326276,-10.957432 + -0.000000,0.000000"/> + </g> + <g stroke="black" stroke-width="0.140582" fill="none"> + <polyline points="0.000000,-0.000000 + 8.946706,-8.946706 + 0.000000,-17.893412 + -8.946706,-8.946706 + -0.000000,0.000000"/> + </g> + <g stroke="black" stroke-width="0.140582" fill="none"> + <polyline points="0.000000,-0.000000 + 10.236130,-7.436984 + 6.326276,-19.470277 + -6.326276,-19.470277 + -10.236130,-7.436984 + -0.000000,-0.000000"/> + </g> + <g stroke="black" stroke-width="0.140582" fill="none"> + <polyline points="0.000000,-0.000000 + 10.957432,-6.326276 + 10.957432,-18.978829 + 0.000000,-25.305106 + -10.957432,-18.978829 + -10.957432,-6.326276 + -0.000000,0.000000"/> + </g> + <g stroke="black" stroke-width="0.140582" fill="none"> + <polyline points="0.000000,-0.000000 + 11.399556,-5.489737 + 14.215014,-17.825064 + 6.326276,-27.717228 + -6.326276,-27.717228 + -14.215014,-17.825064 + -11.399556,-5.489737 + -0.000000,0.000000"/> + </g> + <g stroke="black" stroke-width="0.140582" fill="none"> + <polyline points="0.000000,-0.000000 + 11.689435,-4.841922 + 16.531357,-16.531357 + 11.689435,-28.220792 + 0.000000,-33.062714 + -11.689435,-28.220792 + -16.531357,-16.531357 + -11.689435,-4.841922 + -0.000000,0.000000"/> + </g> + <g stroke="black" stroke-width="0.140582" fill="none"> + <polyline points="0.000000,-0.000000 + 11.889511,-4.327428 + 18.215787,-15.284860 + 16.018694,-27.745192 + 6.326276,-35.878097 + -6.326276,-35.878097 + -16.018694,-27.745192 + -18.215787,-15.284860 + -11.889511,-4.327428 + 0.000000,-0.000000"/> + </g> + <g stroke="black" stroke-width="0.140582" fill="none"> + <polyline points="0.000000,-0.000000 + 12.033293,-3.909854 + 19.470277,-14.145984 + 19.470277,-26.798537 + 12.033293,-37.034667 + 0.000000,-40.944521 + -12.033293,-37.034667 + -19.470277,-26.798537 + -19.470277,-14.145984 + -12.033293,-3.909854 + -0.000000,0.000000"/> + </g> + <g stroke="black" stroke-width="0.140582" fill="none"> + <polyline points="0.000000,-0.000000 + 12.140036,-3.564636 + 20.425696,-13.126798 + 22.226342,-25.650566 + 16.970281,-37.159733 + 6.326276,-44.000219 + -6.326276,-44.000219 + -16.970281,-37.159733 + -22.226342,-25.650566 + -20.425696,-13.126798 + -12.140036,-3.564636 + -0.000000,0.000000"/> + </g> + <g stroke="black" stroke-width="0.140582" fill="none"> + <polyline points="0.000000,-0.000000 + 12.221428,-3.274722 + 21.168134,-12.221428 + 24.442855,-24.442855 + 21.168134,-36.664283 + 12.221428,-45.610989 + 0.000000,-48.885711 + -12.221428,-45.610989 + -21.168134,-36.664283 + -24.442855,-24.442855 + -21.168134,-12.221428 + -12.221428,-3.274722 + -0.000000,-0.000000"/> + </g> + <g stroke="black" stroke-width="0.140582" fill="none"> + <polyline points="0.000000,-0.000000 + 12.284893,-3.027954 + 21.755465,-11.418149 + 26.242122,-23.248491 + 24.717025,-35.808793 + 17.529556,-46.221640 + 6.326276,-52.101574 + -6.326276,-52.101574 + -17.529556,-46.221640 + -24.717025,-35.808793 + -26.242122,-23.248491 + -21.755465,-11.418149 + -12.284893,-3.027954 + -0.000000,0.000000"/> + </g> +</svg> + diff --git a/macros/luatex/generic/barracuda/test/test-ga-svg/002-ga-svg-test.lua b/macros/luatex/generic/barracuda/test/test-ga-svg/002-ga-svg-test.lua index b5a2e3c4ae..e116fe75f4 100644 --- a/macros/luatex/generic/barracuda/test/test-ga-svg/002-ga-svg-test.lua +++ b/macros/luatex/generic/barracuda/test/test-ga-svg/002-ga-svg-test.lua @@ -13,6 +13,6 @@ local symbol, err = c39:from_string("ABC000Z") assert(not err, err) local canvas = barracuda:new_canvas() -symbol:append_ga(canvas) +symbol:draw(canvas) driver:save("svg", canvas, "test-code39")
\ No newline at end of file diff --git a/macros/luatex/generic/barracuda/test/test-i2of5/001-i2of5-test.pdf b/macros/luatex/generic/barracuda/test/test-i2of5/001-i2of5-test.pdf Binary files differindex f2dbd6f9ea..5bf43e574b 100644 --- a/macros/luatex/generic/barracuda/test/test-i2of5/001-i2of5-test.pdf +++ b/macros/luatex/generic/barracuda/test/test-i2of5/001-i2of5-test.pdf diff --git a/macros/luatex/generic/barracuda/test/test-i2of5/001-i2of5-test.tex b/macros/luatex/generic/barracuda/test/test-i2of5/001-i2of5-test.tex index 0062b74d3e..3f5a4dff75 100644 --- a/macros/luatex/generic/barracuda/test/test-i2of5/001-i2of5-test.tex +++ b/macros/luatex/generic/barracuda/test/test-i2of5/001-i2of5-test.tex @@ -1,10 +1,14 @@ % !TeX program = LuaTeX -% Copyright (C) 2020 Roberto Giacomelli +% Copyright (C) 2019-2022 Roberto Giacomelli \newbox\mybox \nopagenumbers -\directlua{barracuda = require "barracuda"} +\directlua{ +barracuda = require "barracuda" +local barcode = barracuda:barcode() +barcode:set_param("debug_bbox", "symb") +} Interleaved 2 of 5 encoder test. @@ -12,14 +16,13 @@ Test 1: one simple barcode with default parameters: \directlua{ local barcode = barracuda:barcode() - local enc, err = barcode:new_encoder("i2of5"); assert(not err, err) local symbo, err = enc:from_uint(54654681); assert(not err, err) -local canvas = barracuda:new_canvas(); symbo:append_ga(canvas) +local canvas = barracuda:new_canvas(); symbo:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") -} -\vrule A\vrule\box\mybox \vrule A\vrule +}% +input code 54654681: \vrule A\vrule\box\mybox \vrule A\vrule \bigskip Test 2: one simple barcode with default parameter: @@ -28,11 +31,11 @@ Test 2: one simple barcode with default parameter: local barcode = barracuda:barcode() local enc, err = barcode:enc_by_name("i2of5"); assert(not err, err) local symbo, err = enc:from_uint(1234567895); assert(not err, err) -local canvas = barracuda:new_canvas(); symbo:append_ga(canvas) +local canvas = barracuda:new_canvas(); symbo:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") -} -\vrule A\vrule\box\mybox \vrule A\vrule +}% +input code 1234567895: \vrule A\vrule\box\mybox \vrule A\vrule % check digit tests @@ -104,11 +107,11 @@ local barcode = barracuda:barcode() local enc, err = barcode:enc_by_name("i2of5"); assert(not err, err) local symbo, err = enc:from_uint(454473, {check_digit_policy="add"}) assert(not err, err) -local canvas = barracuda:new_canvas(); symbo:append_ga(canvas) +local canvas = barracuda:new_canvas(); symbo:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") -} -\vrule A\vrule\box\mybox \vrule A\vrule +}% +input code 454473: \vrule A\vrule\box\mybox \vrule A\vrule \bigskip Test 4: a second simple barcode with check digit automatically added: @@ -118,11 +121,11 @@ local barcode = barracuda:barcode() local enc, err = barcode:enc_by_name("i2of5"); assert(not err, err) local symbo, err = enc:from_uint(74223, {check_digit_policy="add"}) assert(not err, err) -local canvas = barracuda:new_canvas(); symbo:append_ga(canvas) +local canvas = barracuda:new_canvas(); symbo:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") -} -\vrule A\vrule\box\mybox \vrule A\vrule +}% +input code 74223: \vrule A\vrule\box\mybox \vrule A\vrule \bigskip Test 5: a symbol with native check digits: @@ -132,11 +135,11 @@ local barcode = barracuda:barcode() local enc, err = barcode:enc_by_name("i2of5"); assert(not err, err) local symbo, err = enc:from_uint(121891259, {check_digit_policy="verify"}) assert(not err, err) -local canvas = barracuda:new_canvas(); symbo:append_ga(canvas) +local canvas = barracuda:new_canvas(); symbo:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") -} -\vrule A\vrule\box\mybox \vrule A\vrule +}% +input code 121891259: \vrule A\vrule\box\mybox \vrule A\vrule \bigskip Test 6: bearer bars please: @@ -144,13 +147,13 @@ Test 6: bearer bars please: \directlua{ local barcode = barracuda:barcode() local enc, err = barcode:enc_by_name("i2of5"); assert(not err, err) -local symbo, err = enc:from_uint(747867239, {bearer_bars_enabled = true}) +local symbo, err = enc:from_string("747867239", {bearer_bars_enabled = true}) assert(not err, err) -local canvas = barracuda:new_canvas(); symbo:append_ga(canvas) +local canvas = barracuda:new_canvas(); symbo:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") -} -\vrule A\vrule\box\mybox \vrule A\vrule +}% +input string "747867239": \vrule A\vrule\box\mybox \vrule A\vrule \bigskip Test 7: bearer bars all around the symbol: @@ -160,11 +163,11 @@ local barcode = barracuda:barcode() local enc, err = barcode:enc_by_name("i2of5"); assert(not err, err) local symbo, err = enc:from_uint(986790868, {bearer_bars_enabled = true, bearer_bars_layout="frame"}) assert(not err, err) -local canvas = barracuda:new_canvas(); symbo:append_ga(canvas) +local canvas = barracuda:new_canvas(); symbo:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") -} -\vrule A\vrule\box\mybox \vrule A\vrule +}% +input code 986790868: \vrule A\vrule\box\mybox \vrule A\vrule \bigskip Test 8: bearer bars all around the symbol (with string costructor): @@ -174,11 +177,11 @@ local barcode = barracuda:barcode() local enc, err = barcode:enc_by_name("i2of5"); assert(not err, err) local symbo, err = enc:from_string("986790868", {bearer_bars_enabled = true, bearer_bars_layout="frame"}) assert(not err, err) -local canvas = barracuda:new_canvas(); symbo:append_ga(canvas) +local canvas = barracuda:new_canvas(); symbo:draw(canvas) local drv = barracuda:get_driver() drv:ga_to_hbox(canvas, "mybox") -} -\vrule A\vrule\box\mybox \vrule A\vrule +}% +input string "986790868": \vrule A\vrule\box\mybox \vrule A\vrule That's all folks! diff --git a/macros/luatex/generic/barracuda/test/test-i2of5/002-ITF14-test.pdf b/macros/luatex/generic/barracuda/test/test-i2of5/002-ITF14-test.pdf Binary files differindex 79a05eca42..449a7b63a8 100644 --- a/macros/luatex/generic/barracuda/test/test-i2of5/002-ITF14-test.pdf +++ b/macros/luatex/generic/barracuda/test/test-i2of5/002-ITF14-test.pdf diff --git a/macros/luatex/generic/barracuda/test/test-i2of5/002-ITF14-test.tex b/macros/luatex/generic/barracuda/test/test-i2of5/002-ITF14-test.tex index 52784b66bb..7b6229b483 100644 --- a/macros/luatex/generic/barracuda/test/test-i2of5/002-ITF14-test.tex +++ b/macros/luatex/generic/barracuda/test/test-i2of5/002-ITF14-test.tex @@ -1,5 +1,5 @@ % !TeX program = LuaTeX -% Copyright (C) 2020 Roberto Giacomelli +% Copyright (C) 2019-2022 Roberto Giacomelli \newbox\mybox \nopagenumbers @@ -15,9 +15,8 @@ local enc = assert(barcode:new_encoder("i2of5-ITF14")) local s1 = assert(enc:from_uint(1234567890123)) local canvas = barracuda:new_canvas() -s1:append_ga(canvas) -local drv = barracuda:get_driver() -drv:ga_to_hbox(canvas, "mybox") +s1:draw(canvas) +canvas:ga_to_hbox("mybox") } \vskip 10pt 12345678901231 is \vrule A\vrule\box\mybox \vrule A\vrule @@ -28,9 +27,8 @@ local enc = assert(barcode:enc_by_name("i2of5-ITF14")) local s1 = assert(enc:from_string("1234567890123")) local canvas = barracuda:new_canvas() -s1:append_ga(canvas) -local drv = barracuda:get_driver() -drv:ga_to_hbox(canvas, "mybox") +s1:draw(canvas) +canvas:ga_to_hbox("mybox") } \vskip 10pt 12345678901231 is \vrule A\vrule\box\mybox \vrule A\vrule @@ -39,15 +37,12 @@ drv:ga_to_hbox(canvas, "mybox") local barcode = barracuda:barcode() local enc = assert(barcode:enc_by_name("i2of5-ITF14")) local s1 = assert(enc:from_string("(12) 34 56 78 90 12 3")) - +s1:set_param("debug_bbox_on", true) local canvas = barracuda:new_canvas() -s1:append_ga(canvas) -local drv = barracuda:get_driver() -drv:ga_to_hbox(canvas, "mybox") +s1:draw(canvas) +canvas:ga_to_hbox("mybox") +canvas:save("svg", "02-itf14") } \vskip 10pt 12345678901231 is \vrule A\vrule\box\mybox \vrule A\vrule - \bye - - diff --git a/macros/luatex/generic/barracuda/test/test-i2of5/02-itf14.svg b/macros/luatex/generic/barracuda/test/test-i2of5/02-itf14.svg new file mode 100644 index 0000000000..2f8ee06996 --- /dev/null +++ b/macros/luatex/generic/barracuda/test/test-i2of5/02-itf14.svg @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Barracuda package (https://github.com/robitex/barracuda) --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" + "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg xmlns="http://www.w3.org/2000/svg" + version="1.1" + width="74.497108mm" height="20.349904mm" + viewBox="-7.424961 -15.174920 74.497108 20.349904" +> + <g stroke="black"> + <path d="M0.247499 -12.699933V-0.000000" style="stroke-width:0.494997"/> + <path d="M1.237493 -12.699933V-0.000000" style="stroke-width:0.494997"/> + </g> + <g stroke="black"> + <path d="M2.598736 -12.699933V-0.000000" style="stroke-width:1.237493"/> + <path d="M3.959979 -12.699933V-0.000000" style="stroke-width:0.494997"/> + <path d="M5.692470 -12.699933V-0.000000" style="stroke-width:0.494997"/> + <path d="M6.682465 -12.699933V-0.000000" style="stroke-width:0.494997"/> + <path d="M8.043708 -12.699933V-0.000000" style="stroke-width:1.237493"/> + </g> + <g stroke="black"> + <path d="M10.518695 -12.699933V-0.000000" style="stroke-width:1.237493"/> + <path d="M12.251186 -12.699933V-0.000000" style="stroke-width:1.237493"/> + <path d="M13.612428 -12.699933V-0.000000" style="stroke-width:0.494997"/> + <path d="M15.344919 -12.699933V-0.000000" style="stroke-width:0.494997"/> + <path d="M16.334914 -12.699933V-0.000000" style="stroke-width:0.494997"/> + </g> + <g stroke="black"> + <path d="M18.438653 -12.699933V-0.000000" style="stroke-width:1.237493"/> + <path d="M19.799896 -12.699933V-0.000000" style="stroke-width:0.494997"/> + <path d="M21.903635 -12.699933V-0.000000" style="stroke-width:1.237493"/> + <path d="M24.007374 -12.699933V-0.000000" style="stroke-width:0.494997"/> + <path d="M24.997368 -12.699933V-0.000000" style="stroke-width:0.494997"/> + </g> + <g stroke="black"> + <path d="M25.987363 -12.699933V-0.000000" style="stroke-width:0.494997"/> + <path d="M27.719854 -12.699933V-0.000000" style="stroke-width:0.494997"/> + <path d="M28.709849 -12.699933V-0.000000" style="stroke-width:0.494997"/> + <path d="M30.071092 -12.699933V-0.000000" style="stroke-width:1.237493"/> + <path d="M32.546079 -12.699933V-0.000000" style="stroke-width:1.237493"/> + </g> + <g stroke="black"> + <path d="M33.907322 -12.699933V-0.000000" style="stroke-width:0.494997"/> + <path d="M35.268564 -12.699933V-0.000000" style="stroke-width:1.237493"/> + <path d="M36.629807 -12.699933V-0.000000" style="stroke-width:0.494997"/> + <path d="M38.733546 -12.699933V-0.000000" style="stroke-width:1.237493"/> + <path d="M40.837285 -12.699933V-0.000000" style="stroke-width:0.494997"/> + </g> + <g stroke="black"> + <path d="M42.198528 -12.699933V-0.000000" style="stroke-width:1.237493"/> + <path d="M43.559771 -12.699933V-0.000000" style="stroke-width:0.494997"/> + <path d="M45.292262 -12.699933V-0.000000" style="stroke-width:0.494997"/> + <path d="M46.282256 -12.699933V-0.000000" style="stroke-width:0.494997"/> + <path d="M47.643499 -12.699933V-0.000000" style="stroke-width:1.237493"/> + </g> + <g stroke="black"> + <path d="M50.118486 -12.699933V-0.000000" style="stroke-width:1.237493"/> + <path d="M52.593473 -12.699933V-0.000000" style="stroke-width:1.237493"/> + <path d="M53.954716 -12.699933V-0.000000" style="stroke-width:0.494997"/> + <path d="M54.944711 -12.699933V-0.000000" style="stroke-width:0.494997"/> + <path d="M55.934706 -12.699933V-0.000000" style="stroke-width:0.494997"/> + </g> + <g stroke="black"> + <path d="M58.038445 -12.699933V-0.000000" style="stroke-width:1.237493"/> + <path d="M59.399687 -12.699933V-0.000000" style="stroke-width:0.494997"/> + </g> + <rect x="-6.187467" y="-13.937427" width="72.022121" height="15.174920" fill="none" stroke="black" stroke-width="2.474987" + /> + <text x="29.823593" y="5.174984" font-family="Verdana" font-size="2.877000" text-anchor="middle"> + (12) 34 56 78 90 12 31 </text> + <rect x="-7.407322" y="-15.157281" width="74.461830" height="17.614629" fill="none" stroke="black" stroke-width="0.035278" + stroke-dasharray="2.116667 1.058333" + stroke-dashoffset="1.058333" + /> +</svg> + diff --git a/macros/luatex/generic/barracuda/test/test-libgeo/001-libgeo-test.pdf b/macros/luatex/generic/barracuda/test/test-libgeo/001-libgeo-test.pdf Binary files differnew file mode 100644 index 0000000000..46c326513a --- /dev/null +++ b/macros/luatex/generic/barracuda/test/test-libgeo/001-libgeo-test.pdf diff --git a/macros/luatex/generic/barracuda/test/test-libgeo/001-libgeo-test.tex b/macros/luatex/generic/barracuda/test/test-libgeo/001-libgeo-test.tex new file mode 100644 index 0000000000..ec43ad0091 --- /dev/null +++ b/macros/luatex/generic/barracuda/test/test-libgeo/001-libgeo-test.tex @@ -0,0 +1,48 @@ +% !TeX program = LuaTeX +% test for ga-canvas pdfliteral driver +% +% Copyright (C) 2019-2022 Roberto Giacomelli +% see LICENSE.txt file + +\newbox\mybox +\directlua{ + barracuda = require [[barracuda]] + pt = tex.sp [[1pt]] % 1pt = 65536sp +} + +Test 1: test Archive class and Vbar arithmetic: + +\medskip +\directlua{ + % retrive the Vbar class + local libgeo = barracuda:libgeo() + local Vbar = libgeo.Vbar + % create three Vbar objects + local b1 = Vbar:from_int(22556, 2*pt) + local b2 = Vbar:from_int(3134563, 2*pt) + local b3 = Vbar:from_int(1111111, 2*pt) + % retrive the Archive class + local Archive = libgeo.Archive + % create a new instance of an archive and insert vbars + local archive = Archive:new() + assert(archive:insert(b1, 1)) + assert(archive:insert(b2, 2)) + assert(archive:insert(b3, 3)) + % fill a queue (an array) two times + local queue = assert(archive:get(1)) + 20*pt + queue = queue + assert(archive:get(2)) + 20*pt + queue = queue + assert(archive:get(3)) + 20*pt + queue = queue + assert(archive:get(1)) + 20*pt + queue = queue + assert(archive:get(2)) + 20*pt + queue = queue + assert(archive:get(3)) + % retrive a canvas instance + local ga = barracuda:new_canvas() + % draw the canvas with the driver component + assert(ga:encode_vbar_queue(queue, 0, 0, 30*pt)) + local driver = barracuda:get_driver() + driver:ga_to_hbox(ga, [[mybox]]) +}A\box\mybox A + +\bye + +
\ No newline at end of file diff --git a/macros/luatex/generic/barracuda/test/test-libgeo/003-ga-svg-test.pdf b/macros/luatex/generic/barracuda/test/test-libgeo/003-ga-svg-test.pdf Binary files differnew file mode 100644 index 0000000000..1465413c8a --- /dev/null +++ b/macros/luatex/generic/barracuda/test/test-libgeo/003-ga-svg-test.pdf diff --git a/macros/luatex/generic/barracuda/test/test-libgeo/003-ga-svg-test.tex b/macros/luatex/generic/barracuda/test/test-libgeo/003-ga-svg-test.tex new file mode 100644 index 0000000000..c3692c282e --- /dev/null +++ b/macros/luatex/generic/barracuda/test/test-libgeo/003-ga-svg-test.tex @@ -0,0 +1,41 @@ +% !TeX program = LuaTeX + +\newbox\mybox +\nopagenumbers +\directlua{ +local barracuda = require "barracuda" +local barcode = barracuda:barcode() +local driver = barracuda:get_driver() +local mm = driver.mm + +local canvas = barracuda:new_canvas() +canvas:encode_linewidth(1*mm) + +canvas:encode_dash_pattern(0, 2*mm) +canvas:encode_hline(0, 30*mm, 5*mm) + +canvas:encode_dash_pattern(0, 2*mm, 4*mm) +canvas:encode_hline(0, 30*mm, 10*mm) + +canvas:encode_dash_pattern(1*mm, 2*mm, 2*mm, 4*mm) +canvas:encode_hline(0, 30*mm, 15*mm) + +canvas:encode_linewidth(0.05*mm) +canvas:encode_reset_pattern() +for i=0, 15 do + canvas:encode_vline(0, 20*mm, i*2*mm) +end + +canvas:encode_dash_pattern(0.5*mm, 1*mm) +canvas:encode_polyline{ + 1*mm, 1*mm, + 29*mm, 1*mm, + 29*mm, 19*mm, + 1*mm, 19*mm, + 1*mm, 1*mm +} + +driver:save("svg", canvas, "test") +assert(driver:ga_to_hbox(canvas, [[mybox]])) +}\leavevmode\box\mybox +\bye
\ No newline at end of file diff --git a/macros/luatex/generic/barracuda/test/test-libgeo/test.svg b/macros/luatex/generic/barracuda/test/test-libgeo/test.svg new file mode 100644 index 0000000000..d9614096c4 --- /dev/null +++ b/macros/luatex/generic/barracuda/test/test-libgeo/test.svg @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Barracuda package (https://github.com/robitex/barracuda) --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" + "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg xmlns="http://www.w3.org/2000/svg" + version="1.1" + width="30.050000mm" height="20.000000mm" + viewBox="-0.025000 -20.000000 30.050000 20.000000" +> + <path d="M0.000000 -5.000000H30.000000" + stroke="black" stroke-width="1.000000" + stroke-dasharray="2.000000" + /> + <path d="M0.000000 -10.000000H30.000000" + stroke="black" stroke-width="1.000000" + stroke-dasharray="2.000000 4.000000" + /> + <path d="M0.000000 -15.000000H30.000000" + stroke="black" stroke-width="1.000000" + stroke-dasharray="2.000000 2.000000 4.000000" + stroke-dashoffset="1.000000" + /> + <path d="M0.000000 -20.000000V-0.000000" + stroke="black" stroke-width="0.050000" + /> + <path d="M2.000000 -20.000000V-0.000000" + stroke="black" stroke-width="0.050000" + /> + <path d="M4.000000 -20.000000V-0.000000" + stroke="black" stroke-width="0.050000" + /> + <path d="M6.000000 -20.000000V-0.000000" + stroke="black" stroke-width="0.050000" + /> + <path d="M8.000000 -20.000000V-0.000000" + stroke="black" stroke-width="0.050000" + /> + <path d="M10.000000 -20.000000V-0.000000" + stroke="black" stroke-width="0.050000" + /> + <path d="M12.000000 -20.000000V-0.000000" + stroke="black" stroke-width="0.050000" + /> + <path d="M14.000000 -20.000000V-0.000000" + stroke="black" stroke-width="0.050000" + /> + <path d="M16.000000 -20.000000V-0.000000" + stroke="black" stroke-width="0.050000" + /> + <path d="M18.000000 -20.000000V-0.000000" + stroke="black" stroke-width="0.050000" + /> + <path d="M20.000000 -20.000000V-0.000000" + stroke="black" stroke-width="0.050000" + /> + <path d="M22.000000 -20.000000V-0.000000" + stroke="black" stroke-width="0.050000" + /> + <path d="M24.000000 -20.000000V-0.000000" + stroke="black" stroke-width="0.050000" + /> + <path d="M26.000000 -20.000000V-0.000000" + stroke="black" stroke-width="0.050000" + /> + <path d="M28.000000 -20.000000V-0.000000" + stroke="black" stroke-width="0.050000" + /> + <path d="M30.000000 -20.000000V-0.000000" + stroke="black" stroke-width="0.050000" + /> + <g stroke="black" stroke-width="0.050000" fill="none" stroke-dasharray="1.000000" stroke-dashoffset="0.500000"> + <polyline points="1.000000,-1.000000 + 29.000000,-1.000000 + 29.000000,-19.000000 + 1.000000,-19.000000 + 1.000000,-1.000000"/> + </g> +</svg> + diff --git a/macros/luatex/generic/barracuda/test/test-upc/001-upca-test.pdf b/macros/luatex/generic/barracuda/test/test-upc/001-upca-test.pdf Binary files differnew file mode 100644 index 0000000000..c4637e681a --- /dev/null +++ b/macros/luatex/generic/barracuda/test/test-upc/001-upca-test.pdf diff --git a/macros/luatex/generic/barracuda/test/test-upc/001-upca-test.tex b/macros/luatex/generic/barracuda/test/test-upc/001-upca-test.tex new file mode 100644 index 0000000000..3be12aa502 --- /dev/null +++ b/macros/luatex/generic/barracuda/test/test-upc/001-upca-test.tex @@ -0,0 +1,41 @@ +% !TeX program = LuaTeX +% Copyright (C) 2019-2022 Roberto Giacomelli + +\newbox\mybox +\nopagenumbers + +UPC encoder test. + +Test 1: one simple barcode UPC-A with default parameter: + +\directlua{ +barracuda = require "barracuda" +local barcode = barracuda:barcode() +barcode:set_param("debug_bbox", "qz") +local upca, err = barcode:new_encoder("upc-A") +assert(not err, err) + +local symbo, err = upca:from_string("042100005264") +assert(not err, err) + +local canvas = barracuda:new_canvas() +symbo:draw(canvas) + +local drv = barracuda:get_driver() +drv:ga_to_hbox(canvas, "mybox") +} +\vrule A\box\mybox A\vrule + +\bigskip\directlua{ +local barcode = barracuda:barcode() +barcode:set_param("debug_bbox", "none") +local upca = assert(barcode:enc_by_name("upc-A")) + +local symbo = assert(upca:new("012345678905")) +local canvas = barracuda:new_canvas() +symbo:draw(canvas) + +local drv = barracuda:get_driver() +drv:ga_to_hbox(canvas, "mybox") +}\leavevmode\box\mybox +\bye diff --git a/macros/luatex/generic/barracuda/test/test-upc/002-upca.pdf b/macros/luatex/generic/barracuda/test/test-upc/002-upca.pdf Binary files differnew file mode 100644 index 0000000000..ed5363d1de --- /dev/null +++ b/macros/luatex/generic/barracuda/test/test-upc/002-upca.pdf diff --git a/macros/luatex/generic/barracuda/test/test-upc/002-upca.tex b/macros/luatex/generic/barracuda/test/test-upc/002-upca.tex new file mode 100644 index 0000000000..5196ecbc7a --- /dev/null +++ b/macros/luatex/generic/barracuda/test/test-upc/002-upca.tex @@ -0,0 +1,9 @@ +% !TeX program = LuaLaTeX +% Copyright (C) 2019-2022 Roberto Giacomelli + +\documentclass[border=5pt]{standalone} +\usepackage{barracuda} + +\begin{document} +\barracuda[debug_bbox="qz"]{upc-A}{121212343430} +\end{document}
\ No newline at end of file |