Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scope of \DeclareExtradate and <datetype>date option #1383

Open
matteofg opened this issue Sep 17, 2024 · 19 comments
Open

Scope of \DeclareExtradate and <datetype>date option #1383

matteofg opened this issue Sep 17, 2024 · 19 comments

Comments

@matteofg
Copy link

matteofg commented Sep 17, 2024

Is there a reason why \DeclareExtradate is not settable on a per-type scope?

Correctly, biblatex manual says:

Care should therefore be taken to synchronise the printed information with the extradate disambiguation settings.

Therefore, it would be appropriate to be able to set both the command \DeclareExtradate and the global options date, labeldate, <datetype>date, alldates on a per-type scope.

@plk
Copy link
Owner

plk commented Sep 22, 2024

A few reasons - firstly, nobody has every asked for it, secondly, it would likely cause more issues that it solves as the generation of extradate wouldn't be obviously related to fields in all entries. Thirdly, people tend to use the sourcemapping feature to ensure that every entry has the required date for extradate so that type-specific settings aren't required ....

@matteofg
Copy link
Author

matteofg commented Sep 23, 2024

The utility is evident when you need:

  • different labeldates for different entrytypes (currently configurable via \DeclareLabeldate);
  • different labeldates in different formats.

Below is an example:

\begin{filecontents}[overwrite]{\jobname.bib}
@customa{test1,
  author = {Doe, John},
  title = {Title of the custom entrytype},
  date = {2023},
  eventdate = {2024-02-01},
}
@customa{test2,
  author = {Doe, John},
  title = {Title of the custom entrytype},
  date = {2024},
  eventdate = {2024-01-01},
}
@article{test3,
  author = {Smith, Arthur},
  title = {Title},
  journaltitle = {Journaltitle},
  date = {2022},
}
@article{test4,
  author = {Smith, Arthur},
  title = {Title},
  journaltitle = {Journaltitle},
  date = {2022-03},
}
\end{filecontents}

\documentclass{article}
\usepackage[style=authoryear]{biblatex}
\ExecuteBibliographyOptions{dashed=false,labeldate=long}
\addbibresource{\jobname.bib}

\DeclareLabeldate[customa]{%
  \field{eventdate}
  \field{date}
  \field{year}
  \field{origdate}
  \field{urldate}
  \literal{nodate}
}

\DeclareExtradate{%
  \scope{
    \field{labelyear}
    \field{year}
  }
  \scope{
    \field{labelmonth}
  }
  \scope{
    \field{labelday}
  }
}

\DeclareBibliographyDriver{customa}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \usebibmacro{title}%
  \setunit{\addspace}%
  \usebibmacro{issue+date}%
  \newunit\newblock
  \printeventdate%
  \usebibmacro{finentry}}

\begin{document}
\textcite{test1,test2,test3,test4}
\printbibliography
\end{document}

In this case, the following would be appropriate:

  • labeldate of customa entrytype (that is eventdate) to be displayed in the 'full-date' format (labeldate=long);
  • labeldate of article entrytype (that is date) to be displayed in the 'year-only' format (labeldate=year).

plk added a commit to plk/biber that referenced this issue Sep 30, 2024
plk added a commit that referenced this issue Sep 30, 2024
plk added a commit that referenced this issue Sep 30, 2024
@plk
Copy link
Owner

plk commented Sep 30, 2024

Please try biblatex 3.21 and biber 2.21 from Sourceforge. This should now be possible per-entrytype.

@matteofg
Copy link
Author

matteofg commented Oct 1, 2024

Sorry, but I'm having problems with installing biber on macOS.

Typing shasum -a 1 biber I get a different SHA1 than on sourceforge.net

@plk
Copy link
Owner

plk commented Oct 1, 2024

SHA sum won't really work due to the way biber is packaged. Best to just download the dev version and run it. You'll also need the 3.21 dev version of biblatex.

@matteofg
Copy link
Author

matteofg commented Oct 4, 2024

So... I installed biber (2.21 beta) from terminal and biblatex (3.21) via l3build install.

There seems to be a problem in biblatex.

Running the following mwe...

\documentclass{article}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}

\begin{document}
\cite{angenendt}
\printbibliography
\end{document}

... I get the error

! Missing = inserted for \ifnum.
<to be read again> 
                   D
l.3 \addbibresource
                   {biblatex-examples.bib} 

I'm typesetting on macos 15.0 (Sequoia, latest version).

@plk
Copy link
Owner

plk commented Oct 4, 2024

Works fine for me but I don't install biblatex dev versions with l3build, I have my own routine. You can just place the 3.21 biblatex.sty in your local texmf tree to override the main install for testing.

@matteofg
Copy link
Author

matteofg commented Oct 4, 2024

I manually copied biblatex.sty both into the local texmf tree and into the directory of the file to be compiled, but the error remains. I also updated TexLive2024. I don’t know what to say... Did you check if it works on a macOS system?

@plk
Copy link
Owner

plk commented Oct 5, 2024

Yes, this is all on MacOs. Try the following command in the terminal. It should return something. If it doesn't, then your TeX installation is not picking up the updated biblatex.sty.

fgrep 'blx@ed@type' `kpsewhich biblatex.sty`

@matteofg
Copy link
Author

matteofg commented Oct 5, 2024

Typing the fgrep command I get the following:

\dolistloop\blx@ed@type
\ifdef\blx@ed@type
  {\ifinlist{#2}\blx@ed@type
    {\listgadd\blx@ed@type{#2}%
  {\listgadd\blx@ed@type{#2}%
The log file of the mwe above
This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024) (preloaded format=pdflatex 2024.9.24)  5 OCT 2024 12:45
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**biblatex.tex
(./biblatex.tex
LaTeX2e <2024-06-01> patch level 2
L3 programming layer <2024-09-10>
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/article.cls
Document Class: article 2024/02/08 v1.4n Standard LaTeX document class
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2024/02/08 v1.4n Standard LaTeX file (size option)
)
\c@part=\count194
\c@section=\count195
\c@subsection=\count196
\c@subsubsection=\count197
\c@paragraph=\count198
\c@subparagraph=\count199
\c@figure=\count266
\c@table=\count267
\abovecaptionskip=\skip49
\belowcaptionskip=\skip50
\bibindent=\dimen141
)
(/Users/matteo/Library/texmf/tex/latex/biblatex/biblatex.sty
Package: biblatex DATE vVERSION programmable bibliographies (PK/MW)

(/usr/local/texlive/2024/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty
Package: pdftexcmds 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO
)

(/usr/local/texlive/2024/texmf-dist/tex/generic/infwarerr/infwarerr.sty
Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO)
)
(/usr/local/texlive/2024/texmf-dist/tex/generic/iftex/iftex.sty
Package: iftex 2022/02/03 v1.0f TeX engine tests
)
(/usr/local/texlive/2024/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty
Package: ltxcmds 2023-12-04 v1.26 LaTeX kernel commands for general use (HO)
)
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.
)
(/usr/local/texlive/2024/texmf-dist/tex/latex/etoolbox/etoolbox.sty
Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count268
)
(/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2022/05/29 v1.15 key=value parser (DPC)
\KV@toks@=\toks17
)
(/usr/local/texlive/2024/texmf-dist/tex/latex/kvoptions/kvoptions.sty
Package: kvoptions 2022-06-15 v3.15 Key value format for package options (HO)

(/usr/local/texlive/2024/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty
Package: kvsetkeys 2022-10-05 v1.19 Key value parser (HO)
))
(/usr/local/texlive/2024/texmf-dist/tex/latex/logreq/logreq.sty
Package: logreq 2010/08/04 v1.0 xml request logger
\lrq@indent=\count269

(/usr/local/texlive/2024/texmf-dist/tex/latex/logreq/logreq.def
File: logreq.def 2010/08/04 v1.0 logreq spec v1.0
))
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/ifthen.sty
Package: ifthen 2024/03/16 v1.1e Standard LaTeX ifthen package (DPC)
)
(/usr/local/texlive/2024/texmf-dist/tex/latex/url/url.sty
\Urlmuskip=\muskip17
Package: url 2013/09/16  ver 3.4  Verb mode for urls, etc.
)
\c@tabx@nest=\count270
\c@listtotal=\count271
\c@listcount=\count272
\c@liststart=\count273
\c@liststop=\count274
\c@citecount=\count275
\c@citetotal=\count276
\c@multicitecount=\count277
\c@multicitetotal=\count278
\c@instcount=\count279
\c@maxnames=\count280
\c@minnames=\count281
\c@maxitems=\count282
\c@minitems=\count283
\c@citecounter=\count284
\c@maxcitecounter=\count285
\c@savedcitecounter=\count286
\c@uniquelist=\count287
\c@uniquename=\count288
\c@refsection=\count289
\c@refsegment=\count290
\c@maxextratitle=\count291
\c@maxextratitleyear=\count292
\c@maxextraname=\count293
\c@maxextradate=\count294
\c@maxextraalpha=\count295
\c@abbrvpenalty=\count296
\c@highnamepenalty=\count297
\c@lownamepenalty=\count298
\c@maxparens=\count299
\c@parenlevel=\count300
\blx@tempcnta=\count301
\blx@tempcntb=\count302
\blx@tempcntc=\count303
\c@blx@maxsection=\count304
\blx@maxsegment@0=\count305
\blx@notetype=\count306
\blx@parenlevel@text=\count307
\blx@parenlevel@foot=\count308
\blx@sectionciteorder@0=\count309
\blx@sectionciteorderinternal@0=\count310
\blx@entrysetcounter=\count311
\blx@biblioinstance=\count312
\labelnumberwidth=\skip51
\labelalphawidth=\skip52
\biblabelsep=\skip53
\bibitemsep=\skip54
\bibnamesep=\skip55
\bibinitsep=\skip56
\bibparsep=\skip57
\bibhang=\skip58
\blx@bcfin=\read2
\blx@bcfout=\write3
\blx@langwohyphens=\language89
\c@mincomprange=\count313
\c@maxcomprange=\count314
\c@mincompwidth=\count315
Package biblatex Info: Trying to load biblatex default data model...
Package biblatex Info: ... file 'blx-dm.def' found.

(/Users/matteo/Library/texmf/tex/latex/biblatex/blx-dm.def
File: blx-dm.def DATE vVERSION biblatex datamodel (PK/MW)
)
Package biblatex Info: Trying to load biblatex custom data model...
Package biblatex Info: ... file 'biblatex-dm.cfg' not found.
\c@afterword=\count316
\c@savedafterword=\count317
\c@annotator=\count318
\c@savedannotator=\count319
\c@author=\count320
\c@savedauthor=\count321
\c@bookauthor=\count322
\c@savedbookauthor=\count323
\c@commentator=\count324
\c@savedcommentator=\count325
\c@editor=\count326
\c@savededitor=\count327
\c@editora=\count328
\c@savededitora=\count329
\c@editorb=\count330
\c@savededitorb=\count331
\c@editorc=\count332
\c@savededitorc=\count333
\c@foreword=\count334
\c@savedforeword=\count335
\c@holder=\count336
\c@savedholder=\count337
\c@introduction=\count338
\c@savedintroduction=\count339
\c@namea=\count340
\c@savednamea=\count341
\c@nameb=\count342
\c@savednameb=\count343
\c@namec=\count344
\c@savednamec=\count345
\c@translator=\count346
\c@savedtranslator=\count347
\c@shortauthor=\count348
\c@savedshortauthor=\count349
\c@shorteditor=\count350
\c@savedshorteditor=\count351
\c@labelname=\count352
\c@savedlabelname=\count353
\c@institution=\count354
\c@savedinstitution=\count355
\c@lista=\count356
\c@savedlista=\count357
\c@listb=\count358
\c@savedlistb=\count359
\c@listc=\count360
\c@savedlistc=\count361
\c@listd=\count362
\c@savedlistd=\count363
\c@liste=\count364
\c@savedliste=\count365
\c@listf=\count366
\c@savedlistf=\count367
\c@location=\count368
\c@savedlocation=\count369
\c@organization=\count370
\c@savedorganization=\count371
\c@origlocation=\count372
\c@savedoriglocation=\count373
\c@origpublisher=\count374
\c@savedorigpublisher=\count375
\c@publisher=\count376
\c@savedpublisher=\count377
\c@language=\count378
\c@savedlanguage=\count379
\c@origlanguage=\count380
\c@savedoriglanguage=\count381
\c@pageref=\count382
\c@savedpageref=\count383
\shorthandwidth=\skip59
\shortjournalwidth=\skip60
\shortserieswidth=\skip61
\shorttitlewidth=\skip62
\shortauthorwidth=\skip63
\shorteditorwidth=\skip64
\locallabelnumberwidth=\skip65
\locallabelalphawidth=\skip66
\localshorthandwidth=\skip67
\localshortjournalwidth=\skip68
\localshortserieswidth=\skip69
\localshorttitlewidth=\skip70
\localshortauthorwidth=\skip71
\localshorteditorwidth=\skip72
Package biblatex Info: Trying to load compatibility code...
Package biblatex Info: ... file 'blx-compat.def' found.

(/Users/matteo/Library/texmf/tex/latex/biblatex/blx-compat.def
File: blx-compat.def DATE vVERSION biblatex compatibility (PK/MW)
)
Package biblatex Info: Trying to load generic definitions...
Package biblatex Info: ... file 'biblatex.def' found.

(/Users/matteo/Library/texmf/tex/latex/biblatex/biblatex.def
File: biblatex.def DATE vVERSION biblatex compatibility (PK/MW)
\c@textcitecount=\count384
\c@textcitetotal=\count385
\c@textcitemaxnames=\count386
\c@biburlbigbreakpenalty=\count387
\c@biburlbreakpenalty=\count388
\c@biburlnumpenalty=\count389
\c@biburlucpenalty=\count390
\c@biburllcpenalty=\count391
\biburlbigskip=\muskip18
\biburlnumskip=\muskip19
\biburlucskip=\muskip20
\biburllcskip=\muskip21
\c@smartand=\count392
)
Package biblatex Info: Trying to load bibliography style 'numeric'...
Package biblatex Info: ... file 'numeric.bbx' found.

(/Users/matteo/Library/texmf/tex/latex/biblatex/bbx/numeric.bbx
File: numeric.bbx DATE vVERSION biblatex bibliography style (PK/MW)
Package biblatex Info: Trying to load bibliography style 'standard'...
Package biblatex Info: ... file 'standard.bbx' found.

(/Users/matteo/Library/texmf/tex/latex/biblatex/bbx/standard.bbx
File: standard.bbx DATE vVERSION biblatex bibliography style (PK/MW)
\c@bbx:relatedcount=\count393
\c@bbx:relatedtotal=\count394
))
Package biblatex Info: Trying to load citation style 'numeric'...
Package biblatex Info: ... file 'numeric.cbx' found.

(/Users/matteo/Library/texmf/tex/latex/biblatex/cbx/numeric.cbx
File: numeric.cbx DATE vVERSION biblatex citation style (PK/MW)
Package biblatex Info: Redefining '\cite'.
Package biblatex Info: Redefining '\parencite'.
Package biblatex Info: Redefining '\footcite'.
Package biblatex Info: Redefining '\footcitetext'.
Package biblatex Info: Redefining '\smartcite'.
Package biblatex Info: Redefining '\supercite'.
Package biblatex Info: Redefining '\textcite'.
Package biblatex Info: Redefining '\textcites'.
Package biblatex Info: Redefining '\cites'.
Package biblatex Info: Redefining '\parencites'.
Package biblatex Info: Redefining '\smartcites'.
)
Package biblatex Info: Trying to load configuration file...
Package biblatex Info: ... file 'biblatex.cfg' found.

(/Users/matteo/Library/texmf/tex/latex/biblatex/biblatex.cfg
File: biblatex.cfg 
)
Package biblatex Info: Input encoding 'utf8' detected.
Package biblatex Info: Document encoding is UTF8 ....

(/usr/local/texlive/2024/texmf-dist/tex/latex/l3kernel/expl3.sty
Package: expl3 2024-09-10 L3 programming layer (loader) 

(/usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def
File: l3backend-pdftex.def 2024-05-08 L3 backend support: PDF output (pdfTeX)
\l__color_backend_stack_int=\count395
\l__pdf_internal_box=\box52
))
Package biblatex Info: ... and expl3
(biblatex)             2024-09-10 L3 programming layer (loader) 
(biblatex)             is new enough (at least 2020/04/06),
(biblatex)             setting 'casechanger=expl3'.

(/Users/matteo/Library/texmf/tex/latex/biblatex/blx-case-expl3.sty
(/usr/local/texlive/2024/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
Package: xparse 2024-08-16 L3 Experimental document command parser
)
Package: blx-case-expl3 DATE vVERSION expl3 case changing code for biblatex
))
! Missing = inserted for \ifnum.
<to be read again> 
                   D
l.3 \addbibresource
                   {biblatex-examples.bib} 
Here is how much of TeX's memory you used:
 7484 strings out of 473579
 147967 string characters out of 5728228
 719449 words of memory out of 5000000
 30389 multiletter control sequences out of 15000+600000
 558069 words of font info for 36 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191
 66i,0n,81p,410b,196s stack positions out of 10000i,1000n,20000p,200000b,200000s

!  ==> Fatal error occurred, no output PDF file produced!

@plk
Copy link
Owner

plk commented Oct 5, 2024

From the log file, looks like that l3build install doesn't work - the date/version in the files are still the placeholders:

Package: biblatex DATE vVERSION programmable bibliographies (PK/MW)

Best would be to reinstall 3.20 and then drop the DEV 3.21 .sty in manually.

@matteofg
Copy link
Author

matteofg commented Oct 6, 2024

Okay, now I understand why it wasn't working: I was downloading biblatex-dev from GitHub (I thought only Biber was on SourceForge). Sorry for the noise.

Now I can test the new features.

@matteofg
Copy link
Author

matteofg commented Oct 6, 2024

Unfortunately, it doesn't work as I expected.
Below is a mwe (simpler than the previous) with the settings I wish had been implemented:

\begin{filecontents}[overwrite]{\jobname.bib}
@customa{test1,
  author = {Doe, John},
  title = {Title of the custom entrytype},
  date = {2024-01-01},
}
@customa{test2,
  author = {Doe, John},
  title = {Title of the custom entrytype},
  date = {2024-01-02},
}
@article{test3,
  author = {Smith, Arthur},
  title = {Title},
  date = {2022},
}
@article{test4,
  author = {Smith, Arthur},
  title = {Title},
  date = {2022-03},
}
\end{filecontents}

\documentclass{article}
\usepackage[style=authoryear]{biblatex}
\ExecuteBibliographyOptions{dashed=false}
\ExecuteBibliographyOptions[customa]{labeldate=long} % per-type scope
\addbibresource{\jobname.bib}

\DeclareBibliographyAlias{customa}{article}

\DeclareExtradate[customa]{% per-type scope
  \scope{
    \field{labelyear}
    \field{year}
  }
  \scope{
    \field{labelmonth}
  }
  \scope{
    \field{labelday}
  }
}

\begin{document}
\textcite{test1}

\textcite{test2}

\textcite{test3}

\textcite{test4}

\printbibliography
\end{document}
  1. The labeldate option cannot yet be set on per-type scope. LaTeX return the error Package keyval Error: labeldate undefined.
  2. Leaving aside the labeldate option, the \DeclareExtradate command does absolutely nothing when set per-type. It prints

Doe, John (Jan. 1, 2024a). Title of the custom entrytype. In.
Doe, John (Jan. 2, 2024b). Title of the custom entrytype. In.
Smith, Arthur (2022a). “Title”. In.
Smith, Arthur (Mar. 2022b). “Title”. In.

instead of

Doe, John (Jan. 1, 2024). Title of the custom entrytype. In.
Doe, John (Jan. 2, 2024). Title of the custom entrytype. In.
Smith, Arthur (2022a). “Title”. In.
Smith, Arthur (Mar. 2022b). “Title”. In.

Obviously, when the labeldate option works correctly, the bibliography should be printed as shown below:

Doe, John (Jan. 1, 2024). Title of the custom entrytype. In.
Doe, John (Jan. 2, 2024). Title of the custom entrytype. In.
Smith, Arthur (2022a). “Title”. In.
Smith, Arthur (2022b). “Title”. In.

@plk
Copy link
Owner

plk commented Oct 7, 2024

See \DeclareLabeldate on p. 240 which can be defined per-type ...

@matteofg
Copy link
Author

matteofg commented Oct 8, 2024

See \DeclareLabeldate on p. 240 which can be defined per-type ...

Sorry, but how is that related to this problem?
I am referring to the global options date, labeldate, <datetype>date, alldates (described on pp. 56-57) that are currently not settable per-type.

To recap, I would like the following implementations:

  1. \DeclareExtradate settable per-type, through the syntax \DeclareExtradate[<entrytype>]{...} ==> biblatex 3.21 dev does not implement it correctly (see previous emc)
  2. global options date, labeldate, <datetype>date, alldates settable per-type, through the syntax \ExecuteBibliographyOptions[<entrytype>]{<datetype>=<format>} ==> biblatex 3.21 dev returns an error (see previous emc)

@moewew
Copy link
Collaborator

moewew commented Oct 8, 2024

Date formats aren't supported at per-entry level yet. Last time I looked, it was really tricky: #863 (I lost track of that, so I don't exactly remember at the moment where I left this, but it can't have been trivial).

@matteofg matteofg changed the title Scope of \DeclareExtradate and labeldate option Scope of \DeclareExtradate and <datetype>date option Oct 9, 2024
@matteofg
Copy link
Author

matteofg commented Oct 9, 2024

Date formats aren't supported at per-entry level yet. Last time I looked, it was really tricky: #863

I see that quite a bit of work had been done on this back in the day.
I hope we can pick up where we left off.

@matteofg
Copy link
Author

matteofg commented Oct 9, 2024

@plk If you're okay with it, I'd delete all the messages regarding the (supposed) installation issues with biber/biblatex dev. Let's cut down on the noise.

plk added a commit to plk/biber that referenced this issue Oct 10, 2024
plk added a commit that referenced this issue Oct 10, 2024
This reverts commit 9becacf.
plk added a commit that referenced this issue Oct 10, 2024
This reverts commit 762bdd3.
@plk
Copy link
Owner

plk commented Oct 10, 2024

I'm going to revert the changes at the moment as I had forgotten all about that discussion which really does need a lot of work and thinking about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants