1

I am attempting to clear a BibLaTeX field via the usual \DeclareSourcemap construct, as explained in §4.5.3.

Specifically, the following works correctly for me in most cases, resulting in pubstate being cleared:

\DeclareSourcemap{
  \maps[datatype=bibtex, overwrite]{
      \step[fieldset=pubstate, null]
  }
}

I want, however, for entries containing the particular pubstate, \bibstring{submitted}, to not get cleared, but for all others (e.g. those with pubstate = {\bibstring{prepublished}}) to indeed be cleared.

Ignoring the bibstring complexity for now (though I have also attempted when including it and in my present case it simply becomes "Submitted"), I have tried the following, without success:

\step[fieldset=pubstate, notmatch=\regexp{[Ss]ubmitted}, null]

Adding .* prefixes and suffixes to the above regular expression, or adding and removing groupings, also appears ineffective. I also tried to get this to work with various combinations of match and replace, with and without multiple \step commands, or instead working via fieldsource.

Might someone please suggest how I can best accomplish this?

4

match is documented in the biblatex manual, p. 178, as

If match is defined but replace is not, only apply the step if the fieldsource <entryfield> matches the match regular expression (logic is reversed if you use notmatch instead).

So a match needs a fieldsource and not a fieldset. That means that your one-liner can't work and needs to be expanded to a two-liner

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=authoryear, backend=biber]{biblatex}

\DeclareSourcemap{
  \maps[datatype=bibtex, overwrite]{
    \map{
      \step[fieldsource=pubstate, notmatch={[sS]ubmitted}, final]
      \step[fieldset=pubstate, null]
    }
  }
}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{appleby,
  author   = {Humphrey Appleby},
  title    = {On the Importance of the Civil Service},
  date     = {1980},
  pubstate = {prepublished},
}
@book{elk,
  author    = {Anne Elk},
  title     = {A Theory on Brontosauruses},
  year      = {1972},
  pubstate  = {submitted},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
\cite{elk,appleby}
\printbibliography
\end{document}

Appleby, Humphrey (1980). On the Importance of the Civil Service.//Elk, Anne (1972). A Theory on Brontosauruses. Submitted.

Future versions of biblatex and Biber will have a case-insensitive notmatchi that avoids the [sS]: https://github.com/plk/biber/issues/235

Note that it is not necessary to use \bibstring within the pubstate field, it will be added automatically if necessary by biblatex when the field is printed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.