使用 Bibulous 创建自己的参考书目样式时遇到的问题

使用 Bibulous 创建自己的参考书目样式时遇到的问题

我需要用 Bibulous 创建这种书目样式。在此处输入图片描述

使用下面的代码我非常接近:

TEMPLATES:
book =  [<au>.] [\textit{"<title>"}.] [<address> <year>.]
electronic = [<au>.] [\textit{<institution>.}] [<date>.] ["<title>".] 
[<url>.] 
[<dateofchange>]. [<urldate>.]            
oral = [<author>.] [<interviewer>,] [<date>,] [<address>.]
inbook = [<author>.] ["<articletitle>".] [In: <title>,] hg. v. 
[<publisher>.] [<address>] [<place>.] [<pages>.]
article = [<author>.] ["<title>".] [\textit{<journal>,] [<year>,] 
[<number>,}] [<pages>.]

可选的括号是故意设计的,因为 .bib 文件中经常缺少一个参数。

现在我需要按字母顺序对它们进行排序(如下所述:biblical 可以按字母顺序排列参考文献吗?问)(先写出姓氏,然后写出名字,两者都要完整写出),但左侧没有数字。它应该看起来像例子#9这里。不知为何我无法将代码整合在一起以便它们正常工作。

\documentclass[11pt, a4papter] {scrartcl}
\begin{document}
Lorem ipsum dolor sit amet, \cite{gehalt} consetetur sadipscing elitr, 
\cite{Lenz1}. Lorem ipsum dolor sit amet. \cite{ackeret}
\end{document}

带有.bib文件

@Electronic{gehalt,
  author      = {Rütti, Nicole},
  institution = {NZZ Online},
  date        = {2017-07-27},
  title       = {Sind Frauen wirklich selber schuld am tieferen Gehalt?},
  url         = {https://www.nzz.ch/wirtschaft/frauen-und-lohnverhandlungen-auf-stoeckelschuhen-rueckwaerts-ueber-ein-minenfeld-laufen-ld.1307984},
  urldate     = {2018-10-14},
}


@Electronic{ackeret,
  author      = {Ackeret, Markus},
  institution = {NZZ Online},
  date        = {2017-05-25},
  title       = {Im Übereifer des politischen Gefechts},
  url         = {https://www.nzz.ch/international/debatte-um-die-bundeswehr-im-uebereifer-des-politischen-gefechts-ld.1296154},
  urldate     = {2018-10-14},
}

@Electronic{Lenz1,
  author      = {Lenz, Christoph},
  institution = {Tages-Anzeiger Online.},
  date        = {2017-07-04},
  title       = {Rechenspiele der Armee haben politische Folgen},
  url         = {https://www.tagesanzeiger.ch/schweiz/standard/rechenspiele-der-armee-haben-politische-folgen/story/19945957},
  urldate     = {2018-10-16},
}

编辑:根据moewe的建议我稍微修改了一下代码:

\documentclass[11pt, a4papter] {scrartcl}
 \renewcommand{\@biblabel}[1]{} \renewcommand{\@cite}[2]{{#1\if@tempswa , 
  #2\fi}} \makeatother
    \begin{document}
    Lorem ipsum dolor sit amet, \cite{gehalt} consetetur sadipscing elitr, 
    \cite{Lenz1}. Lorem ipsum dolor sit amet. \cite{ackeret}
    \end{document}

.bst文件

TEMPLATES:
book =  [<au>.] [\textit{"<title>"}.] [<address> <year>.]
electronic = [<au>.] [\textit{<institution>.}] [<date>.] ["<title>".] `[<url>.] [<dateofchange>]. [<urldate>.]`            
oral = [<author>.] [<interviewer>,] [<date>,] [<address>.]
inbook = [<author>.] ["<articletitle>".] [In: <title>,] hg. v. 

[<publisher>.] [<address>] [<place>.] [<pages>.]
    article = [<author>.] ["<title>".] [{\textit<journal>,] [<year>,] [<number>,}] [<pages>.]


SPECIAL-TEMPLATES:
au = <authorname.0>; ...; <authorname.9>

这两个更改删除了数字并显示作者的全名。但是,作者不是按字母顺序排列的,我仍然无法做到先姓后名。

如果有人能帮助我我将非常感激。

答案1

由于 Bibulous 是 BibTeX 的直接替代品,因此您可以将其与可用于 BibTeX 的任何引文包结合使用。我建议您加载natbib,因为natbib它对作者年份引文有很好的支持。在natbib作者年份模式下运行时,参考书目中将没有编号。

可以按照作者和年份进行排序sortkey

\documentclass[11pt, a4papter] {scrartcl}
\usepackage{natbib}

\usepackage{filecontents}
\begin{filecontents*}{svenz.bst}
TEMPLATES:
book =  [<au>.] [\textit{\enquote{<title>}}.] [<address> <year>.]
electronic = [<au>.] [\textit{<institution>.}] [<date>.] [\enquote{<title>}.] [<url>.] [<dateofchange>.] [<urldate>.]
oral = [<au>.] [<interviewer>,] [<date>,] [<address>.]
inbook = [<au>.] [\enquote{<title>}.] [In: <booktitle>,] hg. v. [<publisher>.] [<address>] [<place>.] [<pages>.]
article = [<au>.] [\enquote{<title>}.] [\textit{<journal>,] [<year>,] [<number>,}] [<pages>.]

SPECIAL-TEMPLATES:
citelabel = <authorlist.0.last>, <year>
sortkey = <authorlist.0.last><year>

OPTIONS:
namelist_format = last_name_first
use_firstname_initials = False
\end{filecontents*}
\begin{filecontents}{\jobname.bib}
@Electronic{gehalt,
  author      = {Rütti, Nicole},
  institution = {NZZ Online},
  year        = {2017},
  date        = {2017-07-27},
  title       = {Sind Frauen wirklich selber schuld am tieferen Gehalt?},
  url         = {https://www.nzz.ch/wirtschaft/frauen-und-lohnverhandlungen-auf-stoeckelschuhen-rueckwaerts-ueber-ein-minenfeld-laufen-ld.1307984},
  urldate     = {2018-10-14},
}


@Electronic{ackeret,
  author      = {Ackeret, Markus},
  institution = {NZZ Online},
  year        = {2017},
  date        = {2017-05-25},
  title       = {Im Übereifer des politischen Gefechts},
  url         = {https://www.nzz.ch/international/debatte-um-die-bundeswehr-im-uebereifer-des-politischen-gefechts-ld.1296154},
  urldate     = {2018-10-14},
}

@Electronic{Lenz1,
  author      = {Lenz, Christoph},
  institution = {Tages-Anzeiger Online},
  year        = {2017},
  date        = {2017-07-04},
  title       = {Rechenspiele der Armee haben politische Folgen},
  url         = {https://www.tagesanzeiger.ch/schweiz/standard/rechenspiele-der-armee-haben-politische-folgen/story/19945957},
  urldate     = {2018-10-16},
}
\end{filecontents}

\begin{document}
Lorem ipsum dolor sit amet, \citet{gehalt} consetetur sadipscing elitr, 
\cite{Lenz1}. Lorem ipsum dolor sit amet. \cite{ackeret}

\bibliographystyle{svenz}
\bibliography{\jobname}
\end{document}

在此处输入图片描述

在上面的例子中,我必须同时给出year和,date因为 Bibulous 默认不解析该date字段。但应该可以编写一个小的 Python 函数来自动执行此操作……

我认为这.bst甚至可以date,但是却不行,因为我无法让 Bibulous 解析特殊模板部分中的变量(请参阅https://github.com/nzhagen/bibulous/issues/15)。

TEMPLATES:
book =  [<au>.] [\textit{\enquote{<title>}}.] [<address> <year>.]
electronic = [<au>.] [\textit{<institution>.}] [<date>.] [\enquote{<title>}.] [<url>.] [<dateofchange>.] [<urldate>.]
oral = [<au>.] [<interviewer>,] [<date>,] [<address>.]
inbook = [<au>.] [\enquote{<title>}.] [In: <booktitle>,] hg. v. [<publisher>.] [<address>] [<place>.] [<pages>.]
article = [<au>.] [\enquote{<title>}.] [\textit{<journal>,] [<year>,] [<number>,}] [<pages>.]


SPECIAL-TEMPLATES:
citelabel = <authorlist.0.last>, <dateyear>
sortkey = <authorlist.0.last><dateyear>


OPTIONS:
allow_scripts = True
namelist_format = last_name_first
use_firstname_initials = False


VARIABLES:
dateyear = parse_date_or_year(entry, options)

DEFINITIONS:
def parse_date_or_year(entry, options):
    '''
    Parses the ISO 8601 date in the date field or year in year field
    '''

    if ('date' in entry):
        datematch = re.search(r'\A([0-9]{4})(?:-[0-9]{2}){0,2}(?:/([0-9]{4})(?:-[0-9]{2}){0,2})?\Z', entry['date'])
        if datematch.group(2):
            return(datematch.group(1) + "--" + datematch.group(2))
        elif datematch.group(1):
            return(datematch.group(1))
    elif ('year' in entry):
        return(entry['year'])

    return(None)

相关内容