0

I'm using Biblatex' DeclareSourceMap and a shortjournal field in my .bib file to get abbreviated journal titles in citations. Here's a MWE:

\documentclass{article} 
\usepackage[style=oscola]{biblatex}  
 \addbibresource{mwe.bib}  

  \DeclareBibliographyDriver{shortjournal}{%                                                
 \printfield{journaltitle}} 
   
\DeclareSourcemap{% 
\maps[datatype=bibtex]{ 
 \map[overwrite]{ 
 \step[fieldsource=shortjournal] 
 \step[fieldset=journaltitle,origfieldval] 
} } } 
\begin{document} 
   
 \section{First Section} 
 
 Here is a reference to an article with an abbreviated journal name\autocite{Herlin2008aa} 
 
 
\printbiblist[title={Journal Shorthands}]{shortjournal} 
\end{document}

Put this in mwe.bib:

@article{Herlin2008aa,
    author = {Herlin-Karnell, Ester},
    number = {10},
    pages = {1115 -- 1130},
    title = {What Principles Drive (or Should Drive) European Criminal Law?},
    volume = {11},
    date = {2008},
    journaltitle = {Common Market Law Review},
    shortjournal = {CMLRev.}
    }

This works, and what is particularly nice about it is that my bibliography style (oscola) takes this the value of shortjournal and strips any periods from it, exactly like it would do with the journaltitle string.

However, when printing a list of abbreviations, one column has the shortjournal value with periods and the other column has the shortjournal value without. What I want, of course, is for the second column to show the full journal title, in other words, the original value of journaltitle before it is affected by DeclareSourceMap.

From what I understand (complete novice...), DeclareSourceMap is applied first (see section 3.1.2. of the Biber manual). As a result, when I put

\DeclareBibliographyDriver{shortjournal}{%
\printfield{journaltitle}}

in my preamble, the journaltitle has already been remapped.

So, how can I print the original value of journaltitle for the purposes of this list?

If this can't be done, wouldn't this mean that you can never create a list of journal abbreviations? After all, isn't DeclareSoureMap the standard way to use journal abbreviations in biblatex?

3
  • Questions like this are much, much easier to answer if they contain a small, yet fully compilable example document that shows a complete picture instead of just a few code snippets. (A so-called MWE: tex.meta.stackexchange.com/q/228/35864.) Such an example document ensures we are all on the same page. From what I can tell so far I think what is going on is that the sourcemap irrevocably (at least from a biblatex perspective) overwrites the journaltitle with shortjournal. There is no way of getting it back. ...
    – moewe
    Commented Feb 17, 2021 at 22:31
  • ... You'd have to store journaltitle in another field or use a different approach altogether.
    – moewe
    Commented Feb 17, 2021 at 22:31
  • What kind of different approach? Commented Feb 18, 2021 at 11:48

1 Answer 1

1

With a sourcemap you essentially manipulate your entry data just when it is read from the .bib file. This means that for all intents and purposes overwriting journaltitle with shortjournal with a sourcemap means that journaltitle now contains the contents of the shortjournal field and that the old field value cannot be recovered on the biblatex side.

One solution would be to save the original journaltitle in a different field (say longjournaltitle, we need to declare this new field in a datamodel file) and use that when required in the list of journal shorthands.

\documentclass{article}

\begin{filecontents}{longjournaltitle.dbx}
\DeclareDatamodelFields[type=field, datatype=literal]{longjournaltitle}

\DeclareDatamodelEntryfields[article,perioduical]{longjournaltitle}
\end{filecontents}

\usepackage[style=oscola, datamodel=longjournaltitle]{biblatex}

\DeclareBibliographyDriver{shortjournal}{%
  \printfield{longjournaltitle}}

\DeclareSourcemap{%
  \maps[datatype=bibtex]{
    \map[overwrite]{
      \step[fieldsource=shortjournal, final]
      \step[fieldsource=journaltitle]
      \step[fieldset=longjournaltitle, origfieldval]
      \step[fieldsource=shortjournal]
      \step[fieldset=journaltitle, origfieldval] 
    }
  }
}


\begin{filecontents}{\jobname.bib}
@article{Herlin2008aa,
  author       = {Herlin-Karnell, Ester},
  number       = {10},
  pages        = {1115 -- 1130},
  title        = {What Principles Drive (or Should Drive) European Criminal Law?},
  volume       = {11},
  date         = {2008},
  journaltitle = {Common Market Law Review},
  shortjournal = {CMLRev.},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\null\vfill % just for the MWE
Here is a reference to an article with an abbreviated journal name\autocite{Herlin2008aa}

\printbiblist[title={Journal Shorthands}]{shortjournal}
\end{document}

CMLRev. Common Market Law Review


Another solution would be not to remap the fields at all. Instead we instruct your style to print the shortjournal if available.

This is done by redefining the journal bibmacro from biblatex.def.

The sourcemap does not remap any fields any more, it just removes .s from the field (this is a copy of the sourcemap for journaltitle from oscola.bbx).

\documentclass{article}
\usepackage[style=oscola]{biblatex}

\DeclareBibliographyDriver{shortjournal}{%
  \printfield{journaltitle}}

\DeclareSourcemap{%
  \maps[datatype=bibtex]{
    \map[overwrite]{
     \step[fieldsource=shortjournal,
           match=\regexp{(\d)\.(\d)},
           replace=\regexp{$1.$2}]
     \step[fieldsource=shortjournal,
           match=\regexp{(\D)\.(\d)},
           replace=\regexp{$1 $2}]
     \step[fieldsource=shortjournal,
            match=\regexp{\.(\D)},
            replace=\regexp{$1}]
     \step [fieldsource=shortjournal,
            match=\regexp{(\D)\.},
            replace=\regexp{$1}]
    }
  }
}

\renewbibmacro*{journal}{%
  \iffieldundef{shortjournal}
    {\ifboolexpr{
       test {\iffieldundef{journaltitle}}
       and
       test {\iffieldundef{journalsubtitle}}
     }
       {}
       {\printtext[journaltitle]{%
          \printfield[titlecase]{journaltitle}%
          \setunit{\subtitlepunct}%
          \printfield[titlecase]{journalsubtitle}}%
        \newunit}}
    {\printtext[journaltitle]{\printfield[titlecase]{shortjournal}}}%
  \iffieldundef{journaltitleaddon}
    {}
    {\printfield{journaltitleaddon}}}

\begin{filecontents}{\jobname.bib}
@article{Herlin2008aa,
  author       = {Herlin-Karnell, Ester},
  number       = {10},
  pages        = {1115 -- 1130},
  title        = {What Principles Drive (or Should Drive) European Criminal Law?},
  volume       = {11},
  date         = {2008},
  journaltitle = {Common Market Law Review},
  shortjournal = {CMLRev.},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\null\vfill % just for the MWE
Here is a reference to an article with an abbreviated journal name\autocite{Herlin2008aa}

\printbiblist[title={Journal Shorthands}]{shortjournal}
\end{document}

CMLRev Common Market Law Review

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .