修改 Biblatex 中报纸文章的引用样式

修改 Biblatex 中报纸文章的引用样式

详细说明例如,我有这样的代码:

\documentclass[ngerman]{article}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{filecontents}
\begin{filecontents}{bibliographie.bib}
@newspaper{SZ.23.06.2014,
 author = {Gammelin, Cerstin and Hulverscheidt, Claus},
 year = {2014},
 title = {Sozialisten nennen Preis für Juncker},
 pages = {1},
 pagination = {page},
 journal = {Süddeutsche Zeitung},
 month = {23.06.}
}
\end{filecontents}

\usepackage[style=authoryear-luh-ipw,datelabel=terse]{biblatex}
\DeclareBibliographyAlias{newspaper}{article}
\addbibresource{bibliographie.bib}

\renewbibmacro*{cite:labelyear+extrayear}{%
  \iffieldundef{labelyear}
    {}
    {%
     \ifentrytype{newspaper}%
         {%
          \printtext[bibhyperref]{\printfield{month}\printfield{year}}%
         }%
        {%
         \printtext[bibhyperref]{\printfield{labelyear}\printfield{extrayear}}%
        }%
   }%
}

\begin{document}

\parencite{SZ.23.06.2014}

\printbibliography

\end{document}

这给了我以下输出(请注意括号内的额外空格):

在此处输入图片描述

我想要做的是引用报纸(而不是实际作者)的报纸文章,如下所示:

(《南德意志报》2014 年 6 月 23 日第 11 页)

文学

南德意志报(2014 年 6 月 23 日)= Gammelin、Cerstin 和 Claus Hulverscheidt:社会主义者连续获得容克奖。引自:《南德意志报》2014 年 6 月 23 日,第 11 页。

我确实看过 Biblatex 文档,但我对 Biblatex 的宏结构有点困惑。有人能帮我吗?

答案1

您只调整了引文的格式,而没有调整参考书目中的印刷日期。此外,您还误用了格式month,日期应该放在单独的day字段中。下面是一个包含文章条目的示例,以表明我们只更改了报纸条目的格式。

更新为了解决这些条目的引用格式,我添加了代码来修改标准citeauthoryear-icomp.cbx,首先测试条目的类型是否为newspaper,然后应用适当的格式。

示例输出

\documentclass[ngerman]{article}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{filecontents}
\begin{filecontents}{bibliographie.bib}
@newspaper{SZ.23.06.2014,
 author = {Gammelin, Cerstin and Hulverscheidt, Claus},
 year = 2014,
 title = {Sozialisten nennen Preis für Juncker},
 pages = {1},
 pagination = {page},
 journal = {Süddeutsche Zeitung},
 month = 6,
 day=23
}
@Article{test-art,
  author =   {Author, A. N.},
  title =    {Title},
  journal =  {J. Jour.},
  year =     2014,
  volume =   4,
  number =   2,
  pages =    {1--20},
  month =    6,
  day =      20
}
\end{filecontents}

\usepackage[style=authoryear-luh-ipw,datelabel=terse]{biblatex}
\DeclareBibliographyAlias{newspaper}{article}
\addbibresource{bibliographie.bib}

\renewbibmacro*{cite:labelyear+extrayear}{%
  \iffieldundef{labelyear}
    {}
    {%
     \ifentrytype{newspaper}%
         {%
         \printtext[bibhyperref]{\mkdatezeros{\thefield{day}}\adddot
         \mkdatezeros{\thefield{month}}\adddot\printfield{year}}%
         }%
        {%
         \printtext[bibhyperref]{\printfield{labelyear}\printfield{extrayear}}%
        }%
   }%
}

\DeclareFieldFormat[newspaper]{date}{\mkdatezeros{\thefield{day}}\adddot
         \mkdatezeros{\thefield{month}}\adddot\printfield{year}}

\makeatletter
\renewbibmacro*{cite}{% Modified from authoryear-icomp.cbx
  \ifentrytype{newspaper}{\printtext{\printfield{journaltitle}\addspace\usebibmacro{cite:labelyear+extrayear}\addcomma\addspace \printfield{pages}}%
  }
  {\iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:ibid}}
       {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
          {\usebibmacro{cite:label}%
           \setunit{\addspace}%
           \usebibmacro{cite:labelyear+extrayear}%
           \usebibmacro{cite:reinit}}
          {\iffieldequals{namehash}{\cbx@lasthash}
             {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND
                          \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
                {\setunit{\addcomma}%
                 \usebibmacro{cite:extrayear}}
                {\setunit{\compcitedelim}%
                 \usebibmacro{cite:labelyear+extrayear}%
                 \savefield{labelyear}{\cbx@lastyear}}}
             {\printnames{labelname}%
              \setunit{\nameyeardelim}%
              \usebibmacro{cite:labelyear+extrayear}%
              \savefield{namehash}{\cbx@lasthash}%
              \savefield{labelyear}{\cbx@lastyear}}}}}
    {\usebibmacro{cite:shorthand}%
     \usebibmacro{cite:reinit}}}%
  \setunit{\multicitedelim}}
\makeatother

\begin{document}

\parencite{SZ.23.06.2014} and \parencite{test-art}

\printbibliography

\end{document}

相关内容