使用参考书目中的短作者和速记进行正确排序

使用参考书目中的短作者和速记进行正确排序

我在我的文档中一直使用以下答案:

author当我有来自同一(和相同的)多个作品时,这无法正常工作shortauthor

这是一个最小的工作示例:

\documentclass{report}

\usepackage[style=authoryear-comp,backend=biber]{biblatex} 

\renewbibmacro*{begentry}{%
    \ifkeyword{Key}{\sffamily}{}%
    \iffieldundef{shorthand}{}{%
        \printfield{shorthand}:\space}%
    \ifnameundef{shortauthor}%
    {}%
    {\printnames{shortauthor}%
        \addspace\textendash\space}}

\DeclareSortingScheme{nyt}{%
    \sort{\field{presort}}
    \sort[final]{\field{sortkey}}
    \sort{%
        \field{shorthand}
        \name{sortname}\name{author}\name{editor}\name{translator}
        \field{sorttitle}\field{title}}
    \sort{\field{sortyear}\field{year}}
    \sort{\field{sorttitle}\field{title}}
    \sort{%
        \field[padside=left,padwidth=4,padchar=0]{volume}
        \literal{0000}}}

\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
    @report{IATA2009,
        author = {{International Air Transport Association}},
        date = {2009-03},
        title = {Standard Schedules Information Manual},
        shortauthor = {IATA}
    }


    @report{IATA2015,
        author = {{International Air Transport Association}},
        date = {2015-08},
        title = {Worldwide Slot Guidelines},
        shortauthor = {IATA}
    }

    @report{IATA2016,
        author = {{International Air Transport Association}},
        date = {2015-09},
        title = {Airport Guide},
        shortauthor = {IATA},
        shorthand = {Shorthand}
        }
\end{filecontents*}

\addbibresource{\jobname.bib}

\begin{document}

\nocite{*}
\printbibliography


\end{document}

因此,结果如下:

IATA——国际航空运输协会(2009 年)。标准时间表信息手册。
国际航空运输协会——(2015a)。全球老虎机指南。
速记:IATA--(2015b)。机场指南。

它应该给出的是:

IATA——国际航空运输协会(2009 年)。标准时间表信息手册。
—(2015a)。全球老虎机指南。
速记:—(2015b)。机场指南。

(实际上,我不确定最后一行是否应该是

简写:IATA——国际航空运输协会 (2015b)。机场指南。

哪一个看起来更好?)

我如何实现这个目标?

答案1

尝试以下操作

\makeatletter
\renewbibmacro*{begentry}{%
  \ifkeyword{Key}{\sffamily}{}%
  \iffieldundef{shorthand}
    {}
    {\global\undef\bbx@lasthash
     \printfield{shorthand}%
     \addcolon\space}%
  \ifboolexpr{test {\usebibmacro{bbx:dashcheck}} or test {\ifnameundef{shortauthor}}}%
    {}%
    {\printnames{shortauthor}%
     \addspace\textendash\space}}
\makeatother

shortauthor根据此定义,如果bbx:dashcheck返回 true(即,如果最后一个相同) ,则不打印该字段author。如果我们有,则shorthand无论名称是否与姓氏一致,我们都会自动打印该名称(我更喜欢这种方式,您可以通过注释掉该行来关闭该行为\global\undef\bbx@lasthash)。

平均能量损失

\documentclass{article}
\usepackage[style=authoryear-comp,backend=biber]{biblatex} 

\makeatletter
\renewbibmacro*{begentry}{%
  \ifkeyword{Key}{\sffamily}{}%
  \iffieldundef{shorthand}
    {}
    {\global\undef\bbx@lasthash
     \printfield{shorthand}%
     \addcolon\space}%
  \ifboolexpr{test {\usebibmacro{bbx:dashcheck}} or test {\ifnameundef{shortauthor}}}%
    {}%
    {\printnames{shortauthor}%
     \addspace\textendash\space}}
\makeatother

\DeclareSortingScheme{nyt}{%
    \sort{\field{presort}}
    \sort[final]{\field{sortkey}}
    \sort{%
        \field{shorthand}
        \name{sortname}\name{author}\name{editor}\name{translator}
        \field{sorttitle}\field{title}}
    \sort{\field{sortyear}\field{year}}
    \sort{\field{sorttitle}\field{title}}
    \sort{%
        \field[padside=left,padwidth=4,padchar=0]{volume}
        \literal{0000}}}

\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
@report{IATA2009,
  author = {{International Air Transport Association}},
  date = {2009-03},
  title = {Standard Schedules Information Manual},
  shortauthor = {IATA},
}

@report{IATA2015,
  author = {{International Air Transport Association}},
  date = {2015-08},
  title = {Worldwide Slot Guidelines},
  shortauthor = {IATA},
}

@report{IATA2016,
  author = {{International Air Transport Association}},
  date = {2015-09},
  title = {Airport Guide},
  shortauthor = {IATA},
  shorthand = {Shorthand},
}
\end{filecontents*}

\addbibresource{\jobname.bib}

\begin{document}

\nocite{*}
\printbibliography
\end{document}

示例输出

相关内容