使用 natbib 包格式化/搜索特殊书目样式

使用 natbib 包格式化/搜索特殊书目样式

我正在寻找一种特殊的书目样式来满足以下要求(我发布了一个示例):

LÜTKEPOHL H.,KRÄTZIG M.(2004 年)。

应用时间序列计量经济学.剑桥大学出版社,剑桥。

因此,名字应该大写;格式:姓氏,然后是名字的首字母(带或不带后面的点),年份放在括号中(带或不带后面的点),后面跟着换行符,标题应该以斜体显示。

我使用该natbib包是因为我想在文本中包含作者年份引用(例如 Lütkepohl 和 Krätzig (2004)),该包已经运行良好。

顺便说一下,参考文献列表中的条目应该直接以作者的姓氏开头,即前面没有编号或缩写(我认为这将通过使用 natbib 包自动实现?)。

我正在使用\documentclass[a4paper]{article}JabRef 作为参考管理器。

如果有人能帮助我,我会非常高兴!非常感谢!

答案1

这可以很容易地完成biblatex

只需使用和加载biblatexstyle=authoryear 后者firstinits=true是 - 你猜对了,只显示首字母),然后将以下内容添加到你的序言中。对于以下一些补丁,你将需要 awesomexpatch

\DeclareNameAlias{sortname}{last-first}
\DeclareFieldFormat[incollection,article]{title}{\mkbibemph{#1}}
\DeclareFieldFormat[incollection,article]{citetitle}{\mkbibemph{#1}}

\renewbibmacro{in:}{%
  \ifentrytype{article}{}{%
  \printtext{\bibstring{in}\intitlepunct}}}

\DefineBibliographyStrings{german}{%
  bibliography     = {Literaturverzeichnis},
  references       = {Literaturverzeichnis},
}

\AtBeginBibliography{%
  \renewcommand*{\mkbibnamelast}[1]{\textsc{#1}}%
  \renewcommand*{\labelnamepunct}{\\}%
  \renewbibmacro*{title}{%
    \ifboolexpr{
      test {\iffieldundef{title}}
      and
      test {\iffieldundef{subtitle}}
    }
      {}
      {\printtext[title]{%
         \printfield[titlecase]{title}%
         \setunit{\subtitlepunct}%
         \printfield[titlecase]{subtitle}}%
       \newunit}%
    \printfield{titleaddon}%
    \printunit{\newunitpunct\\}}%
}

\newbibmacro*{ineditor+others}{%
  \ifboolexpr{
    test \ifuseeditor
    and
    not test {\ifnameundef{editor}}
  }
    {\printnames{editor}%
     \setunit{\addspace}%
     \usebibmacro{editor+othersstrg}%
     \clearname{editor}}
    {}}

\xpatchbibdriver{incollection}
  {\usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}%
  }
  {\usebibmacro{ineditor+others}%
   \setunit{\addcolon\space}\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}%
  }%
  {\typeout{replaced \usebibmacro{byeditor+others} by \usebibmacro{ineditor+others} in BibliographyDriver{incollection}}}
  {\typeout{failed to replace \usebibmacro{byeditor+others} by \usebibmacro{ineditor+others} in BibliographyDriver{incollection}}}%


\xpatchbibdriver{inbook}
  {\usebibmacro{bybookauthor}%
   \setunit{\labelnamepunct}\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}%
  }
  {\usebibmacro{ineditor+others}%
   \setunit{\addcolon\space}\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}%
  }%
  {\typeout{replaced \usebibmacro{byeditor+others} by \usebibmacro{ineditor+others} in BibliographyDriver{inbook}}}
  {\typeout{failed to replace \usebibmacro{byeditor+others} by \usebibmacro{ineditor+others} in BibliographyDriver{inbook}}}%

\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\xpatchbibmacro{editor}%
  {\setunit{\addcomma\space}%
  }
  {\setunit{\addspace}%
  }
  {\typeout{patched bibmacro{editor}}}
  {\typeout{failed to patch bibmacro{editor}. Note that this is not necessarily bad if bibmacro{bbx:editor} was succesfully patched}}

% bibmacro{bbx:editor} is specially defined by authortitle and friends for some internal fun
\xpatchbibmacro{bbx:editor}%
  {\setunit{\addcomma\space}%
  }
  {\setunit{\addspace}%
  }
  {\typeout{patched bibmacro{bbx:editor}}}
  {\typeout{failed to patch bibmacro{bbx:editor}, note that this is not necessarily bad if bibmacro{editor} was succesfully patched}}

\renewrobustcmd*{\bibinitperiod}{}
\renewrobustcmd*{\bibinitdelim}{}
\renewrobustcmd*{\bibinithyphendelim}{}
\renewcommand*{\revsdnamepunct}{}

这确保了参考书目中的名称是“姓,名”,并且没有引号@incollection。但请注意,这种变化非常不一致,因为通常“主要作品”被强调(即@collection),而特定部分(@incollection)则在引号中。此外,标题(对于德语文档)更改为“Literaturverzeichnis”。该\AtBeginBibliography{...}部分确保只有参考书目中的名称是小写,作者和年份之后以及标题之后都有一个新行。然后,我们为“in ...”-works 的编辑器定义一个新的宏(这是必要的,这样我们就不会得到任何破折号)。和的参考书目驱动程序@incollection@inbook修补,以包括编辑器标题。最后,我们确保编辑器字符串(“eds。”/“Hrsg。”等)打印在括号中,前面没有任何逗号。最后一块代码格式化了姓名和首字母。首字母后没有句号,两个首字母之间也没有空格。带连字符的姓名被视为非带连字符的姓名,姓氏和名字的首字母之间没有逗号

数学家协会

\documentclass[ngerman]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=authoryear, maxnames=999, maxcitenames=3, firstinits=true]{biblatex}
\usepackage{xpatch}
\usepackage{hyperref}

\addbibresource{biblatex-examples.bib}

\DeclareNameAlias{sortname}{last-first}
\DeclareFieldFormat[incollection,article]{title}{\mkbibemph{#1}}
\DeclareFieldFormat[incollection,article]{citetitle}{\mkbibemph{#1}}

\renewbibmacro{in:}{%
  \ifentrytype{article}{}{%
  \printtext{\bibstring{in}\intitlepunct}}}

\DefineBibliographyStrings{german}{%
  bibliography     = {Literaturverzeichnis},
  references       = {Literaturverzeichnis},
}

\AtBeginBibliography{%
  \renewcommand*{\mkbibnamelast}[1]{\textsc{#1}}%
  \renewcommand*{\labelnamepunct}{\\}%
  \renewbibmacro*{title}{%
    \ifboolexpr{
      test {\iffieldundef{title}}
      and
      test {\iffieldundef{subtitle}}
    }
      {}
      {\printtext[title]{%
         \printfield[titlecase]{title}%
         \setunit{\subtitlepunct}%
         \printfield[titlecase]{subtitle}}%
       \newunit}%
    \printfield{titleaddon}%
    \printunit{\newunitpunct\\}}%
}

\newbibmacro*{ineditor+others}{%
  \ifboolexpr{
    test \ifuseeditor
    and
    not test {\ifnameundef{editor}}
  }
    {\printnames{editor}%
     \setunit{\addspace}%
     \usebibmacro{editor+othersstrg}%
     \clearname{editor}}
    {}}

\xpatchbibdriver{incollection}
  {\usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}%
  }
  {\usebibmacro{ineditor+others}%
   \setunit{\addcolon\space}\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}%
  }%
  {\typeout{replaced \usebibmacro{byeditor+others} by \usebibmacro{ineditor+others} in BibliographyDriver{incollection}}}
  {\typeout{failed to replace \usebibmacro{byeditor+others} by \usebibmacro{ineditor+others} in BibliographyDriver{incollection}}}%


\xpatchbibdriver{inbook}
  {\usebibmacro{bybookauthor}%
   \setunit{\labelnamepunct}\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}%
  }
  {\usebibmacro{ineditor+others}%
   \setunit{\addcolon\space}\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}%
  }%
  {\typeout{replaced \usebibmacro{byeditor+others} by \usebibmacro{ineditor+others} in BibliographyDriver{inbook}}}
  {\typeout{failed to replace \usebibmacro{byeditor+others} by \usebibmacro{ineditor+others} in BibliographyDriver{inbook}}}%

\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\xpatchbibmacro{editor}%
  {\setunit{\addcomma\space}%
  }
  {\setunit{\addspace}%
  }
  {\typeout{patched bibmacro{editor}}}
  {\typeout{failed to patch bibmacro{editor}. Note that this is not necessarily bad if bibmacro{bbx:editor} was succesfully patched}}

% bibmacro{bbx:editor} is specially defined by authortitle and friends for some internal fun
\xpatchbibmacro{bbx:editor}%
  {\setunit{\addcomma\space}%
  }
  {\setunit{\addspace}%
  }
  {\typeout{patched bibmacro{bbx:editor}}}
  {\typeout{failed to patch bibmacro{bbx:editor}, note that this is not necessarily bad if bibmacro{editor} was succesfully patched}}

\renewrobustcmd*{\bibinitperiod}{}
\renewrobustcmd*{\bibinitdelim}{}
\renewrobustcmd*{\bibinithyphendelim}{}
\renewcommand*{\revsdnamepunct}{}

\begin{document}
  \nocite{murray,brandt,hyman,wilde,westfahl:space,aristotle:anima,herrmann,baez/article}

  \printbibliography
\end{document}

给出 在此处输入图片描述

如果您的要求有所不同,请随意发表评论。

相关内容