TransWikia.com

List of journal abbreviations prints abbreviation instead of long journal title

TeX - LaTeX Asked by Timothy Roes on July 27, 2021

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 nameautocite{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?

One Answer

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}
nullvfill % just for the MWE
Here is a reference to an article with an abbreviated journal nameautocite{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}
nullvfill % just for the MWE
Here is a reference to an article with an abbreviated journal nameautocite{Herlin2008aa}

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

CMLRev Common Market Law Review

Correct answer by moewe on July 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP