5

I use Zotero to get references from the web, and then export them into LaTeX using biblatex format using this workflow.

I am fine with the style of bibliography and its output as shown below, but I want to switch to short journal names using the same style now, as they are provided in the exported database from Zotero. I made sure that all references do have a short journal name in Zotero database, but it would be nice if the code will fall back to long names otherwise (not elegant, though, to have both in the bibliography list, but as a last resort and this can be fixed from within Zotero later on). I checked this post, but couldn't achieve my goal.

I would be very grateful also, if someone can suggest a better way than writing all this code to achieve the same style or a similar one. There are no specific regulations for the PhD bibliography in my university.

So my questions are:

  1. How to show short journal names when available?
  2. How to achieve the same output (see below), but with short journal names writing less code?
  3. I couldn't find the explanation of the chem-acs style in BibLaTeX manual, what does this style entail?

MWE Code

\documentclass{scrartcl} 
\usepackage[backend=biber,style=chem-acs,terseinits=true,sorting=none,isbn=false,doi=false,backref=true]{biblatex}  \renewcommand*{\bibfont}{\small} % smaller font for bibliography list
\ExecuteBibliographyOptions{%
  citetracker=true,
  sorting=none,
  alldates=long,
  articletitle=true,
  maxcitenames=1
}
% remove brackets around the number of each bibliography entry
\DeclareFieldFormat{labelnumberwidth}{#1\addperiod}
% Suppress article title, doi, url, etc. in citations
\AtEveryCitekey{%
  \ifentrytype{article}
    {\clearfield{title}}
    {}%
  \clearfield{doi}%
  \clearfield{url}%
  \clearlist{publisher}%
  \clearlist{location}%
  \clearfield{note}%
}

% Print year instead of date, when available; make use of urldate
\DeclareFieldFormat{urldate}{\bibstring{urlseen}\space#1}
\renewbibmacro*{date}{% Based on date bib macro from chem-acs.bbx
  \iffieldundef{year}
    {\ifentrytype{online}
       {\printtext[urldate]{\printurldate}}
       {\printtext[date]{\printdate}}}
    {\printfield[date]{year}}}

% Remove period from titles
\DeclareFieldFormat*{title}{#1}
\DeclareFieldFormat[book]{date}{\textbf{#1}} % 
\DeclareFieldFormat[report]{date}{\textbf{#1}} % 
\DeclareFieldFormat[software]{date}{\textbf{#1}} % 
\DeclareFieldFormat[inproceedings]{date}{\textbf{#1}} % 

% Embed doi and url in titles, when available
\renewbibmacro*{title}{% Based on title bib macro from biblatex.def
  \ifboolexpr{ test {\iffieldundef{title}}
               and test {\iffieldundef{subtitle}} }
    {}
    {\ifboolexpr{ test {\ifhyperref}
                  and not test {\iffieldundef{doi}} }
       {\href{http://dx.doi.org/\thefield{doi}}
          {\printtext[title]{%
             \printfield[titlecase]{title}%
             \setunit{\subtitlepunct}%
             \printfield[titlecase]{subtitle}}}}
       {\ifboolexpr{ test {\ifhyperref}
                     and not test {\iffieldundef{url}} }
         {\href{\thefield{url}}
            {\printtext[title]{%
               \printfield[titlecase]{title}%
               \setunit{\subtitlepunct}%
               \printfield[titlecase]{subtitle}}}}
         {\printtext[title]{%
            \printfield[titlecase]{title}%
            \setunit{\subtitlepunct}%
            \printfield[titlecase]{subtitle}}}}%
     \newunit}%
  \printfield{titleaddon}%
  \clearfield{doi}%
  \clearfield{url}%
  \clearlist{language}%
  \clearfield{note}%
  \ifentrytype{article}% Delimit article and journal titles with a period
    {\adddot}
    {}}
\renewbibmacro*{name:andothers}{% Based on name:andothers from biblatex.def
  \ifboolexpr{
    test {\ifnumequal{\value{listcount}}{\value{liststop}}}
    and
    test \ifmorenames
  }
    {\ifnumgreater{\value{liststop}}{1}
       {\finalandcomma}
       {}%
     \andothersdelim\bibstring[\emph]{andothers}}
    {}}



\usepackage{filecontents}
\begin{filecontents}{jobname.bib}
@article{rand_objective_1971,
    title = {Objective criteria for the evaluation of clustering methods},
    volume = {66},
    issn = {01621459},
    url = {http://www.jstor.org/discover/10.2307/2284239?uid=3737864&uid=2&uid=4&sid=21103234673533},
    doi = {10.2307/2284239},
    pages = {846},
    number = {336},
    journaltitle = {Journal of the American Statistical Association},
    shortjournal = {J Amer Statist Assoc},
    author = {Rand, William M.},
    urldate = {2013-12-18},
    date = {1971-12},
    keywords = {Comparing partitions, Rand, statistics}
}

@article{hubert_comparing_1985,
    title = {Comparing partitions},
    volume = {2},
    issn = {0176-4268, 1432-1343},
    url = {http://link.springer.com/article/10.1007/BF01908075},
    doi = {10.1007/BF01908075},
    pages = {193-218},
    number = {1},
    journaltitle = {Journal of Classification},
    shortjournal = {J Classif},
    author = {Hubert, Lawrence and Arabie, Phipps},
    urldate = {2013-12-18},
    date = {1985-12-01},
    langid = {english},
    keywords = {{ARI}, Comparing partitions, Consensus indices, Measures of agreement, Measures of association, statistics, Statistics, general}
}   
\end{filecontents}
\addbibresource{jobname.bib}
\usepackage{xcolor}
\usepackage{hyperref} 
\hypersetup{ % 
    colorlinks, linkcolor={magenta},
    citecolor={black}, urlcolor={blue}
}

\begin{document}
This is the main text citing~\parencite{hubert_comparing_1985} and~\parencite{rand_objective_1971}
\printbibliography[title={References}] 
\end{document}

MWE Output
enter image description here

  • The chem-acs style is not in the biblatex manual as it's not a 'generic' style: you'll find the documentation in the biblatex-chem bundle (texdoc -l biblatex-chem at the Command Line/Terminal). The style follows the requirements of the American Chemical Society: it's entirely focussed on reproducing the requirements of that journal. – Joseph Wright May 13 '14 at 11:44
6

You can transfer data from one field to another using the Biber source map feature:

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map[overwrite]{ % Notice the overwrite: replace one field with another
      \step[fieldsource=shortjournal,fieldtarget=journaltitle]
    }
  }  
}

See for example \DeclareSourcemap in biblatex for more on this feature. Mappings only apply if the source is available, so this is 'safe' for cases where there is no short title.

| improve this answer | |
  • is it possible that this solution isn't working any more with biblatex v3.4? (It worked some time ago which I think was v3.3. If I am wrong I'll happily delete my comment.) – Stefan Pinnow Mar 31 '16 at 12:11
  • I am using biblatex v3.7. Using this command, my latex compiles, but it seems like the journaltitle field is left empty in my bibliography. – ning Jan 30 at 3:17
  • @ning The following minimised example works perfectly fine for me with current biblatex 3.14/Biber 2.14. gist.github.com/moewew/27384a6c5f73d202653260236f375a1f Your version 3.7 is more than three years old now. Maybe it's time for an update. Note that the solution can only work if a shortjournal field is present. – moewe Jan 30 at 6:34
  • @moewe Might just be a bug, then. Re updating: I'll get right to that, once I catch a break from all this work... – ning Jan 30 at 6:37
1

As Joseph Wright noted in his comment, the accepted answer using DeclareSourcemap doesn't seem to work any more with newer versions of biblatex. (If anyone can get it to work, do reply in that comment thread.)

Instead, this comment on the biblatex Github repository recommends the combined use of biblatex's DeclareFieldInputHandler and a separate package jabbrv which automatically generates abbreviated journal titles:

\usepackage{jabbrv}

\DeclareFieldInputHandler{journaltitle}{%
  \def\NewValue{\JournalTitle{#1}}}

At the minimum, you will need to download the files jabbrv.sty, jabbrv-ltwa-all.ldf, and jabbrv-ltwa-en.ldf into your working directory, from the jabbrv repostiory linked above.


Edit: user @moewe has kindly pointed out that I am mistaken in thinking that the accepted solution would not work on newer versions of biblatex. It's probably just a bug on my outdated version of biblatex.

Then, I present this solution as alternative to the accepted one, where short journal abbreviations are automatically inferred from the journal title; and also as a workaround for those of you who have a similarly bugged version of biblatex.

| improve this answer | |
  • In principle Joseph's answer does work with a current biblatex/Biber combination, see gist.github.com/moewew/27384a6c5f73d202653260236f375a1f. (I also commented under his answer, but I couldn't let the statement that the answer doesn't work go unchallenged here.) – moewe Jan 30 at 6:37
  • @moewe Fair enough! – ning Jan 30 at 6:37

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.