为 IET 期刊 (bbx) 定制 biblatex 风格

为 IET 期刊 (bbx) 定制 biblatex 风格

我将调整 biblatex 中的 numeric-comp 样式,以提供 IET 期刊指定的以下参考/引用格式:

杂志文章

Smith, T. 和 Jones, M.:“论文标题”,IET Syst. Biol.,2007 年,1,(2),第 1-7 页

会议论文

Jones, L. 和 Brown, D.:“会议论文的标题”。Proc. Int. Conf. Systems Biology,瑞典斯德哥尔摩,2006 年 5 月,第 1-7 页

书籍、书籍章节和手册

Hodges, A. 和 Smith, N.:《本书章节的标题》,载于 Brown, S. (Ed.) 所著《系统生物学手册》(IEE Press,2004 年,第 1 版),第 1-7 页

Harrison, EA 和 Abbott, C.:《书名》(XYZ Press,2005 年,第 2 版,2006 年)

论文

Abbott,NL:“论文标题”。XYZ 大学博士论文,2005 年


但我不知道从哪里开始。这是我目前所做的:

\documentclass{article}

\usepackage[style=numeric-comp,sorting=none,firstinits=true,maxbibnames=999,isbn=false,doi=false]{biblatex}
\DeclareNameAlias{default}{last-first}
\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
  {title}{`#1'}
\DefineBibliographyStrings{english}{%
edition = {edn.}
}
\renewcommand*{\newunitpunct}{\addcomma\space}
\DeclareFieldFormat[article]{volume}{\mkbibbold{#1}}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}
\renewbibmacro*{volume+number+eid}{%
  \printfield{volume}%
  \setunit*{\addcomma\space}%
  \printfield{number}%
  \setunit{\addcomma\space}%
  \printfield{eid}}
\renewbibmacro{in:}{%
  \ifentrytype{article}{%
  }{%
    \printtext{\bibstring{in}\intitlepunct}%
  }%
}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@ARTICLE{zierler_linear_1959,
  author = {Zierler, N.},
  title = {Linear recurring sequences},
  journaltitle = {J. Soc. Ind. Appl. Math.},
  year={1959},
  volume = {7},
  number = {1},
  pages = {31--48}
}
@incollection{serfling_asymptotic_2011,
    address = {London},
    title = {Asymptotic relative efficiency in estimation},
    volume = {1},
    isbn = {978-3-642-04897-5},
    booktitle = {International Encyclopedia of Statistical Science},
    publisher = {Springer},
    author = {Serfling, Robert},
    editor = {Lovric, Miodrag},
    year = {2011},
    pages = {68--72}
}
@PHDTHESIS{enqvist_linear_2005,
  author = {Anon, B.},
  title = {A PhD Thesis},
  school = {\LaTeX University},
  year = {1999},
  location = {London}
}
@inproceedings{wong_sysid_2012,
author = {Anon, B.},
title = {Writing in \LaTeX},
eventtitle = {Some conference},
location = {Brussels, Belgium},
eventdate = {2012-07}
}
\end{filecontents}

\addbibresource{\jobname.bib}

\nocite{*}

\begin{document}

\printbibliography

\end{document}

给出

Zierler,N.,《线性循环序列》,J. Soc. Ind. Appl. Math.7, (1) (1959),第31-48页。

Serfling, R.,“估计中的渐近相对效率”,载于:《国际统计科学百科全书》,由 Lovric, M. 编辑,第 1 卷,伦敦:Springer,2011 年,第 68-72 页。

Anon,B.,《A PhD Thesis》,博士论文,伦敦:LATEX 大学,1999 年。

Anon, B.,《用 LATEX 写作》,载于:某次会议(2012 年 7 月),比利时布鲁塞尔。

这并不完全正确。值得注意的是,书籍出版商等缺少冒号、括号等

提前非常感谢您。

答案1

让我们系统地解决这个问题。

首先找到导致问题的条目类型的相关驱动程序:在本例中book(实际上,在您的数据中incollection:但我们最好从开始book)。经过一番挖掘standard.bbx(编辑),我们发现了这一点。

\DeclareBibliographyDriver{book}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{maintitle+title}%
  ...
  \newunit\newblock
  \printfield{edition}%
  ...
  \newunit\newblock
  \usebibmacro{publisher+location+date}%
  \newunit\newblock
  .... 
  \usebibmacro{finentry}}

我们几乎立刻就得到了第一个问题的线索——冒号。它看起来像是\labelnamepunct在作者之后打印出来的。事实证明,这对于我们感兴趣的所有驱动程序来说都是通用的,我们可以重新定义它来获得冒号:

\renewcommand\labelnamepunct{\addcolon\space}

出版商信息比较棘手。让我们确定我们想要什么。括号中的信息似乎由出版商、逗号、原始出版年份、版本(包括第 1 版)组成,然后没有逗号,然后是最新版的出版年份(如果以前没有印刷过)。真是一团糟!

我们的第一个想法可能是摆弄publisher+location+date宏。但是如果我们看一下,standard.def就会发现它用于各种地方,而不仅仅是书籍和类似书籍的文档;所以我们可能需要小心。目前,定义一个新的宏似乎更安全。让我们分阶段进行。

通常我会先制作包装纸,以确保有东西可以印刷。但实际上我们知道会有,因为如果没有其他事情,一切都将是第一版!

\newbibmacro{publication:info}{%
    \printtext{\bibopenparen}
    % PUBLISHER,
    % ORIGINAL YEAR IF THERE IS ONE OTHERWISE YEAR IF THERE IS ONE,
    % EDITION or 1st EDITION
    % YEAR IF NOT ALREADY PRINTED
    \printtext{\bibcloseparen}}

这样我们就得到了一个骨架。现在我们可以填充各个部分了。

发布者很容易:

  \printlist{publisher}%
  \newunit

原始年份或最近的年份有点棘手:我们需要测试并清除年份字段,以防止它被打印两次

\iffieldundef{origyear}
  {\iffieldundef{year}
     {}
     {\printfield{year}%
      \clearfield{year}}}
  {\printfield{origyear}%
   \clearfield{origyear}}%
\newunit

版本只有一个复杂之处:如果没有给出版本,我们假设是第一个(显然会被印刷出来——这是我从未见过的!)

  \iffieldundef{edition}
    {\printtext{\mkbibordinal{1}\space\bibstring{edition}}}
    {\printfield{edition}}

然后我们遇到了一个麻烦:我们不需要逗号,而是需要在年份前加一个空格(如果年份仍要打印的话)。由于我们已经清除了该字段(如果该字段已被使用),因此我们不需要进行任何检查

  \setunit{\addspace}%
  \printfield{year}%

最后,我们必须考虑到可能存在一些杂散的标点符号,因此我们在关闭括号之前要将其删除;

  \setunit{}%
  \printtext{\bibcloseparen}}

完成之后,我们需要将其重新合并到我们的驱动程序中。由于我们将在宏中处理版本,因此publication:info我们删除了处理该版本的行。然后我们合并了publication:info,但由于这是括号,因此我们在它周围放置了空格。因此,我们将周围的行替换\usebibmacro{publisher+location+date}如下:

\setunit{\addspace}\newblock
\usebibmacro{publication:info}%
\setunit{\addspace}\newblock

现在我们用各种方法测试它,如果我们对它适用于一本书感到满意,我们就会找出其他驱动程序需要替换版本和出版商信息:当然,inbook并且incollection:可能还有其他。

本书驱动程序修改的最终结果在本长答案的末尾给出。我慢慢来,因为如果你正在使用标准样式,那么查看一些关于如何处理任务的提示可能会有所帮助;我并不是说它们是完美的,但它们在大多数情况下对我有用。请记住,如果打算将其作为标准样式,则需要考虑数据不完美的可能性,并决定如何处理它。而且你需要大量的测试数据并不断进行测试,因为很容易做出导致混乱的小改动,例如宏中缺少注释字符会导致所有空格都乱套。

\renewcommand{\labelnamepunct}{\addcolon\space}

\DeclareBibliographyDriver{book}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{maintitle+title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \usebibmacro{series+number}%
  \newunit\newblock
  \printfield{note}%
  \setunit{\addspace}\newblock
  \usebibmacro{publication:info}%
  \setunit{\addspace}\newblock
  \usebibmacro{chapter+pages}%
  \newunit
  \printfield{pagetotal}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

\newbibmacro{publication:info}{%
  \printtext{\bibopenparen}%
  \printlist{publisher}%
  \newunit
  \iffieldundef{origyear}
    {\iffieldundef{year}
       {}
       {\printfield{year}%
        \clearfield{year}}}
    {\printfield{origyear}%
     \clearfield{origyear}}%
  \newunit
  \iffieldundef{edition}
    {\printtext{\mkbibordinal{1}\space\bibstring{edition}}}
    {\printfield{edition}}%
  \setunit{\addspace}%
  \printfield{year}%
  \setunit{}%
  \printtext{\bibcloseparen}}

答案2

根据要求,这是我在 IET 论文中使用的标题,有些人可能会觉得有用。对参考书目的支持并不完整,但适用于文章、书籍和论文集。

\documentclass[10pt]{article}
\usepackage[T1]{fontenc}
\usepackage{setspace} 
\usepackage{authblk} %\author block
\usepackage{graphicx}
\usepackage{amsmath,amssymb}
\usepackage[UKenglish]{babel}% Recommended for biblatex
\usepackage{csquotes}% Recommended for biblatex
\usepackage{txfonts}% Times like fonts
\usepackage{fix-cm}% Fix font size warnings
\usepackage[margin=1in]{geometry}
%Figure captions
\usepackage{caption}
\captionsetup[figure]{name=Fig.,labelfont={sf,bf},textfont=sl,labelsep=quad}
\usepackage[caption=false,font=footnotesize]{subfig}
\usetikzlibrary{patterns,shapes.geometric,arrows,positioning}
%===============================================
%BIBLATEX package customization for IET format:-
\usepackage[backend=bibtex,style=numeric-comp,sorting=none,firstinits=true,maxbibnames=999,isbn=false,doi=false]{biblatex}
\DeclareNameAlias{default}{last-first}
\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
  {title}{\mkbibquote{#1\isdot}} %title field is put inside quotation marks
\DefineBibliographyStrings{english}{%
edition = {edn\adddot},
byeditor = {\mkbibparens{Ed\adddot}},
part = {pt\adddot},
january = {January},
february = {February},
march = {March},
april = {April},
may = {May},
june = {June},
july = {July},
august = {August},
september = {September},
october = {October},
november = {November},
december = {December}
}
\DeclareFieldFormat[article,inproceedings]{volume}{\mkbibbold{#1}} %Bold volume numbers
\DeclareFieldFormat[article,inproceedings]{number}{\mkbibparens{#1}} %Isse number in parentheses
\DeclareFieldFormat{part}{\bibstring{part}~#1}% physical part of a logical volume
\DeclareFieldFormat[inproceedings]{note}{\MakeCapital{#1}} %Handling conferences where proceedings are not yet available by exploting the note field, e.g. "presented at the"
\DeclareFieldFormat{labelnumberwidth}{#1}
\DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}}
\AtEveryBibitem{\ifentrytype{article}{\clearfield{month}}{}}
\renewbibmacro*{byeditor}{% Switch position of byeditor string and names
  \ifnameundef{editor}
    {}
    {\printnames[byeditor]{editor}%
     \setunit{\addspace}%
     \usebibmacro{bytypestrg}{editor}{editor}%
     \newunit}%
  \usebibmacro{byeditorx}}
\renewbibmacro*{byeditor+others}{% Switch position of byeditor string and names
  \ifnameundef{editor}
    {}
    {\printnames[byeditor]{editor}%
     \clearname{editor}%
     \setunit{\addspace}%
     \usebibmacro{byeditor+othersstrg}%
     \newunit}%
  \usebibmacro{byeditorx}%
  \usebibmacro{bytranslator+others}}
\renewcommand{\labelnamepunct}{\addcolon\space} %Add colons after author names
\renewcommand{\intitlepunct}{\space} %Remove defaul colon of in:
\renewcommand{\newunitpunct}{\addcomma\space} %Use comma after titles instead of fullstops
\newbibmacro{publication:info}{%Redefine publishing macro
  \printtext{\bibopenparen}%
  \printlist{publisher}%
  \newunit
  \iffieldundef{origyear}
    {\iffieldundef{year}
       {}
       {\printfield{year}%
        \clearfield{year}}}
    {\printfield{origyear}% print original year if exists
     \clearfield{origyear}}% clear the year field if it is used to stop it being printed twice
  \newunit
  \iffieldundef{edition}
    {\printtext{\mkbibordinal{1}\space\bibstring{edition}}} %if no edition has been given, we assume the first
    {\printfield{edition}}%
  \setunit{\addspace}%
  \printfield{year}% We cleared the field if already used before, no need to check
  \setunit{}%
  \printtext{\bibcloseparen}}

\renewbibmacro*{volume+number+eid}{%
  \printfield{volume}%
  \setunit*{\addcomma\space}%
  \printfield{number}%
  \setunit{\addcomma\space}%
  \printfield{eid}}
\renewbibmacro{in:}{%
  \ifentrytype{article}{% remove 'in' string in articles
  }{%
    \printtext{\bibstring{in}\intitlepunct}%
  }%
}
\renewbibmacro*{issue+date}{%redefined to remove parentheses surrounding date
    \iffieldundef{issue}
      {\usebibmacro{date}}
      {\printfield{issue}%
       \setunit*{\addspace}%
       \usebibmacro{date}}%
  \newunit}
\renewbibmacro*{event+venue+date}{%redefined to remove parentheses surrounding date
  \printfield{eventtitle}%
  \ifboolexpr{
    test {\iffieldundef{venue}}
    and
    test {\iffieldundef{eventyear}}
  }
    {}
    {\setunit*{\addcomma\addspace}%
     \printtext{%
       \printfield{venue}%
       \setunit*{\addcomma\space}%
       \printeventdate}}%
  \newunit}  
\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit{,\addspace}%
  \usebibmacro{issue+date}%
  \setunit{\addcolon\space}%
  \usebibmacro{issue}%
  \setunit*{\addcomma\addspace}%
  \iffieldundef{series}
    {}
    {\newunit
     \printfield{series}%
     \setunit{\addspace}}%
  \usebibmacro{volume+number+eid}%
  \setunit{\addcomma\addspace}%
  }

\DeclareBibliographyDriver{book}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{maintitle+title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \usebibmacro{series+number}%
  \newunit\newblock
  \printfield{note}%
  \setunit{\addspace}\newblock
  \usebibmacro{publication:info}% Replaced original publication definition
  \setunit{\addspace}\newblock
  \usebibmacro{chapter+pages}%
  \newunit
  \printfield{pagetotal}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

\DeclareBibliographyDriver{incollection}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}\setunit{\addcomma}%
  \newunit
  \printlist{language}%
  \setunit{\addcomma\addspace}\newblock
  \usebibmacro{in:}% Moved in: before editors
  \usebibmacro{byeditor+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{maintitle+booktitle}%
  \newunit\newblock
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \usebibmacro{series+number}%
  \newunit\newblock
  \printfield{note}%
  \setunit{\addspace}\newblock
  \usebibmacro{publication:info}%
  \setunit{\addspace}\newblock
  \usebibmacro{chapter+pages}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

\DeclareBibliographyDriver{inproceedings}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \setunit{\adddot\space}\newblock
  \iffieldundef{note}
  {\printtext{Proc.\space}}
  {\printfield{note}\addspace}%e.g. "presented at the"
  \usebibmacro{maintitle+booktitle}%
  \setunit{}\newblock
  \usebibmacro{event+venue+date}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \usebibmacro{series+number}%
  \newunit\newblock
  \printlist{organization}%
  \newunit
  \usebibmacro{publisher+location+date}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}
%============END BIBLATEX CUSTOMIZATION=================
%Custom macros
%Universal referencing scheme:
\def\figname{Fig.~} %Define label for citing figures
\def\tblname{Table~} %Define label for citing figures
\def\eqname{} %Define label for citing an equation
\def\eqnames{} %Define label for citing equations
\def\secname{Section~} %Define label for citing a section
\def\secnames{Sections~} %Define label for citing sections
\usepackage{xstring} %Required for macro \uniref
\newcommand{\uniref}[1]{%
\IfBeginWith*{#1}{eqn:}{%
    \eqname\eqref{#1}%
    }{%
        \IfBeginWith*{#1}{fig:}{%
        \figname\ref{#1}%
        }{%
            \IfBeginWith*{#1}{sec:}{%
            \secname\ref{#1}%
            }{%
            \ref{#1}%
            }%
        }%
    }%
}%
\newcommand{\sub}[1]{\ensuremath{_\textup{#1}}} %upright subscripts
\newcommand{\super}[1]{\text{\textsuperscript{#1}}} %superscripts
\newcommand{\Exp}[1]{\ensuremath{\operatorname{E}{\left[#1\right]}}} %Expectation operator
\newcommand{\tsfrac}[2]{\text{\sfrac{#1}{#2}}} %sfrac in text mode typesetting
\addbibresource{QuickIdentification_Spiky/QuickIdentification_Spiky.bib}

%Single-column-figures width
\def\singleColFigWidth{3.2in}

%Section heading styles
\usepackage{sectsty}
\sectionfont{\sffamily\large\bfseries}
\subsectionfont{\sffamily\normalsize\mdseries\itshape}

%authblk package options
\renewcommand\Authfont{\itshape\large}
\renewcommand\Affilfont{\itshape\normalsize}

\author[1]{A.~N.~Anon}
\affil[1]{The Institution}
\title{A very interesting paper}
\maketitle
{\bfseries\noindent Abstract:~} Abstract begins...

答案3

对于那些正在寻找 IET 会议 BibTeX 样式文件的人来说,我已经上传了一个我在 IET 会议上最近发表的文章中使用的文件这里。它没有任何保证,而且显然不以任何方式得到 IET 的支持,但它满足了我的需求。我希望这对某些人有用。

相关内容