I am using the authoryear style and I would like my bib entries for articles to match the following pattern:
author lastname, initial author firstname: title of article, in: title of journal, Jg. volume, Heft issue/two digit year, pages
Example:
Mock, T. (2006): Was ist ein Medium?, in: Publizistik, Jg. 51, Heft 2/06, S. 183-200
I am trying to achive this with the following two lines of code:
\DeclareFieldFormat*{volume}{Jg.\adddot\space#1\addcomma}
\DeclareFieldFormat*{number}{\space Heft\space#1\addslash\printfield{year}}
The problem is, that \printfield{year} prints of course the four-digit year from the entry in the .bib file.
Is there any way to shorten the year to only priot the last two digits?
Thanks a lot in advance.
Cheers.
EDIT: I saw the question Show only the last two year digits in Biblatex citation, but after trying a few things it seemed to me that the proposed solution only works within the text, but not in DeclareFieldFormat.
I tried to use
\DeclareFieldFormat{shortyear}{\mkbibshortyear#1}
\def\mkbibshortyear#1#2#3#4{#3#4}
\newrobustcmd*{\shortyear}{%
\AtNextCite{\DeclareFieldAlias{year}{shortyear}}%
\printfield{year}}
first and then
\DeclareFieldFormat*{number}{\space Heft\space#1\addslash\printfield{\shortyear{year}}}
but it did not work.
MWE:
\documentclass[ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=authoryear-icomp,%
dashed=false,%
sorting=nyvt,%
autocite=footnote,%
autopunct=true,%
backrefstyle=three+,%
isbn=false,%
doi=false,%
pagetracker=true,%
useprefix=true,%
uniquename=init,%
firstinits=true,%
maxcitenames=2,%
]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{art.2015,
author = {Some Author},
year = {2015},
journaltitle = {Some Journal},
title = {Some Article},
volume = {51},
number = {2}
pages = {123-456}
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\renewcommand*{\nameyeardelim}{\addcomma\space}
\renewcommand*{\labelnamepunct}{\addcolon\space}
\renewcommand*{\multinamedelim}{\addsemicolon\space}
\renewcommand*{\finalnamedelim}{\multinamedelim}
\DeclareNameAlias{sortname}{last-first}
\DeclareNameAlias{labelname}{last-first}
\DeclareFieldFormat{title}{#1}
\DeclareFieldFormat[article]{title}{#1}
\DeclareFieldFormat{journaltitle}{#1}
\DeclareFieldFormat{shortyear}{\mkbibshortyear#1}
\def\mkbibshortyear#1#2#3#4{#3#4}
\newrobustcmd*{\shortyear}{%
\AtNextCite{\DeclareFieldAlias{year}{shortyear}}%
\printfield{year}}
\DeclareFieldFormat*{number}{\space Heft\space#1\addslash\shortyear{year}}
\begin{document}
Some Text \autocite{art.2015}
\printbibliography
\end{document}
\DeclareFieldFormat{year}{\mkbibshortyear#1}and in thenumberfield format, just\printfield{year}. Adding a field format doesn't create a command. Alternatively, use theshortyeardeclaration and change yourprintfieldcommand to\printfield[shortyear]{year}. – ig0774 Sep 06 '15 at 12:42\newrobustcmd*{\shortyear}{% \AtNextCite{\DeclareFieldAlias{year}{shortyear}}% \printfield{year}}in my source code. Second:\printfield[shortyear]{year}did the trick! Read that after adding my - rather huge - MWE ... – Wrstkpp Sep 06 '15 at 12:54