# Turning off \DeclareSourceMap for bibliography

I am wondering if it is possible to turn off the effects of \DeclareSourceMap part way through a tex document. Any tips on how to do this?

Here is some more information on the situation I am in. I am trying to get a unique citation style to work, which is based around biblatex:

\usepackage[backend=biber,bibstyle=nature,citestyle=authoryear,maxcitenames=2,maxbibnames=99,uniquelist=false,sorting=ydnt]{biblatex}


I use the following to add the journal name to the authoryear cite style:

% add journal name to inline citation
\renewbibmacro*{cite}{%
\iffieldundef{shorthand}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\usebibmacro{cite:label}%
\setunit{\printdelim{nonameyeardelim}}}
{\printnames{labelname}%
\setunit{\printdelim{nameyeardelim}}}%
\usebibmacro{journal}
{\usebibmacro{cite:shorthand}}}


Finally, I use \DeclareSourceMap to shorted journal titles in the text. The result is as desired, which is references showing up as [Doe RSI 2006] when cited in the text.

HOWEVER, I would like to turn off the shortening of journal titles when I actually print the bibliography at the end of the document using \printbibliography. At the moment, my bibliography looks like:

Doe, A. B. & Smith, J. S. A journal article with a cool title. RSI (2006).

I would like the bibliography to look like this:

Doe, A. B. & Smith, J. S. A journal article with a cool title. Review of Scientific Instruments (2006).

But I need to preserve the citation formatting in the text as explained above.

Is there a way to turn off the effects of \DeclareSourceMap directly before the \printbibliography call?

A MWE is included below:

\documentclass{article}

\usepackage[backend=biber,bibstyle=nature,citestyle=authoryear,maxcitenames=2,maxbibnames=99,uniquelist=false,sorting=ydnt]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{mybibfile.bib}
@article{file,
author = {Doe, A. B. and Smith, J. S. and Author, G. B.},
title = {A journal article with a cool title},
journal = {Review of Scientific Instruments},
year = {2006}
}
\end{filecontents}

% add journal name to inline citation
\renewbibmacro*{cite}{%
\iffieldundef{shorthand}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\usebibmacro{cite:label}%
\setunit{\printdelim{nonameyeardelim}}}
{\printnames{labelname}%
\setunit{\printdelim{nameyeardelim}}}%
\usebibmacro{journal}
{\usebibmacro{cite:shorthand}}}

% abbreviate journal names
\DeclareSourcemap{
\maps[datatype=bibtex,overwrite=true]{
\map{
\step[fieldsource=journal,
match=\regexp{Review\sof\sScientific\sInstruments},
replace={RSI}]
}
}
}

\begin{document}

This works as intended: \parencite{file}

This does not work as intended:
\printbibliography
\end{document}

• Generally speaking, a sourcemap directly manipulates the data when it is read from the .bib file. Any changes you make are as if you made them yourself directly in the .bib file. If you shorten the journaltitle field and don't save the original field value there is no way to get them back on the biblatex side. Nov 15, 2020 at 7:10
• It would be much, much easier to help you if you could embed the code snippets shown so far into a fully compilable example document (ideally with one or two example .bib entries). At the moment we have to rebuild a lot of stuff to get started helping you. Please consider adding a so-called MWE to your question (tex.meta.stackexchange.com/q/228/35864, tex.meta.stackexchange.com/q/4407/35864). Nov 15, 2020 at 7:13
• Hi @moewe, thanks for responding to the question! I've added a MWE to the main text. Is there a convenient way to store the original field value with \DeclareSourceMap so that it can recovered later? Nov 15, 2020 at 23:33

biblatex ojffers the field shortjournal (not used by standard style), so what you can do is to set the value of the shortjournal and use shortjournal in the citation. This can be achieved by using \printfield{shortjournal} instead of \usebibmacro{journal} in the definition of \cite

\renewbibmacro*{cite}{%
\iffieldundef{shorthand}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\usebibmacro{cite:label}%
\setunit{\printdelim{nonameyeardelim}}}
{\printnames{labelname}%
\setunit{\printdelim{nameyeardelim}}}%
\printfield{shortjournal} % changed line
{\usebibmacro{cite:shorthand}}}


and a \DeclareSourceMap that add a value for shortjournal

\DeclareSourcemap{
\maps[datatype=bibtex,overwrite=true]{
\map{
\step[fieldsource=journal,
match=\regexp{Review\sof\sScientific\sInstruments},
fieldset=shortjournal,
fieldvalue={RSI}]
}
}
}


The two changes above yield:

• Thanks this is great! There is a small type in your answer - it should be \printfield{shortjournal}. With this correction it works great! Nov 16, 2020 at 3:24