Biblatex 字母格式无作者/编辑/年份/等的缩写

Biblatex 字母格式无作者/编辑/年份/等的缩写

我在 biblatex 中使用字母顺序引用样式。有时我会有一些条目没有给出作者、编辑或年份。例如,会议论文集通常没有编辑。目前我将条目留空editor,但我想改变这种行为,以便 biblatex 在参考书目中自动打印“s.ed.”(拉丁文 sine editore)。

当我将其写入字段时,editor我得到了s.ed. (Ed.)。所以我需要阻止输出(Ed.),但我不知道在哪里实现这一点。

以同样的方式打印以下条目(见关联德语)当该字段通常是必填项类型时:

  • 'sa' (拉丁语 sine auctore,“无作者”)
  • “s.ed.”(拉丁语 sine editore“无编辑”)
  • 'sa' (拉丁语 sine anno“无年份”)
  • ‘st’(拉丁语 sine titulo“无标题”)
  • ‘sl’(拉丁语 sine loco“无位置”)
  • “s.ed.”(拉丁语 sine editore“无出版商”)

目前我不知道如何处理文本中引用的缺失作者或年份,因为这样[ABCs.a.]看起来不太好。因此,欢迎提出建议 ;)

梅威瑟:

MWE 说明了缺失条目的不同情况。我总是手动将缩写写入字段(第二个条目除外),以说明输出应该是什么样子。除了没有给出编辑器的情况外,输出是正确的,因为输出是,s.ed., ed.但它应该是s.ed.。这是我需要帮助来修复它的第一个点。

如果我稍后想将缩写从拉丁语改为英语,这将是一项复杂的任务。因此,这是我需要帮助解决以下问题的第二个点:

我想要实现的是告诉 biblatex 我没有特定字段的值,并且我想打印适当的缩写来向读者说明该字段没有可用信息(可能是这样的命令\noauthor)。 如果我只是将该字段留空,它应该被解释为忽略该字段,就像 biblatex 对第二个条目所做的那样noAuthor2 WARN - The field 'author' in entry 'noAuthor2' cannot be null, deleting it

\documentclass{article}
\usepackage[backend=biber,style=alphabetic, autocite=footnote]{biblatex}


\begin{filecontents*}{bibliography.bib}
% Example for no author
@BOOK{noAuthor,
  author = {s.a.},
  title = {Rocket Propulsion and Spaceflight Dynamics},
  year = {1979},
    location = {New York},
  publisher = {Pitman},
}
% Example for no author and field left empty
@BOOK{noAuthor2,
  author = {},
  title = {Rocket Propulsion and Spaceflight Dynamics},
  year = {1979},
    location = {New York},
  publisher = {Pitman},
}
% Example for no editor
@Collection{noEditor,
    editor                  = {s.ed.},
    title                       = {Book of light}, 
    year                        = {1985},
    publisher               = {Springer Science+Business Media, LLC},
    location                = {New York}
}
% Example for an incollection where the collection has no editor
@Incollection{noEditor,
    crossref                = {noEditor},
    author                  = {Wayne, John},
    title                   = {Some nice title},
    pages                   = {10--20},
    bookpagination          = {page},
}
% Example for no year
@BOOK{noYear,
  author = {Cornelisse, J. W. and Schoeyer, H. Ferry R. and Wakker, Karel F.},
  title = {Rocket Propulsion and Spaceflight Dynamics},
  year = {s.a.},
    location = {New York},
  publisher = {Pitman},
}
% Example for no title
@BOOK{noTitle,
  author = {Cornelisse, J. W. and Schoeyer, H. Ferry R. and Wakker, Karel F.},
  title = {s.t.},
  year = {1979},
    location = {New York},
  publisher = {Pitman},
}
% Example for no location
@BOOK{noLocation,
  author = {Cornelisse, J. W. and Schoeyer, H. Ferry R. and Wakker, Karel F.},
  title = {Rocket Propulsion and Spaceflight Dynamics},
  year = {1979},
    location = {s.l.},
  publisher = {Pitman},
}
% Example for no publisher
@BOOK{noPublisher,
  author = {Cornelisse, J. W. and Schoeyer, H. Ferry R. and Wakker, Karel F.},
  title = {Rocket Propulsion and Spaceflight Dynamics},
  year = {1979},
    location = {New York},
  publisher = {s.ed.},
}
\end{filecontents*}


\addbibresource{bibliography.bib}
\nocite{*} 

\begin{document}
\null
\vfill

\printbibliography
\end{document}

答案1

这是一个开始。这不是一个完整的解决方案,但对于评论来说太长了。它并没有完全解决编辑器问题,尽管它确实适用于与问题的 MWE 中的条目类似的条目。

基本上,这个想法是在你的 中创建一系列书目字符串biblatex.cfg(如果你以前从未使用过,则可能需要创建 - 我的tex/latex/config/在 my下TEXMFHOME)。然后,你为所需的每种语言指定这些字符串的值,并创建一些宏来生成字符串。宏将生成适合活动语言的任何字符串。在你的.bib文件中,你使用新的宏,例如\noauthor。处理后,这些将替换为相关语言的指定字符串,例如s.a.forenglish或其他。

如果稍后您决定要为给定语言使用不同的字符串,则可以编辑字符串,即,biblatex.cfg每个要重新定义的字符串都需要编辑一次。如果您需要使用新语言,则可以为相应的语言添加一组额外的字符串,而无需覆盖现有的字符串。

\documentclass[english]{article}
\usepackage{filecontents}
\begin{filecontents}{biblatex.cfg}
  \NewBibliographyString{noauthor}
  \NewBibliographyString{noeditor}
  \NewBibliographyString{nodate}
  \NewBibliographyString{notitle}
  \NewBibliographyString{nolocation}
  \NewBibliographyString{nopublisher}
  \DefineBibliographyStrings{english}{%
    noauthor      =   {s\adddot a\adddot},
    noeditor      =   {s\adddot ed\adddot},
    nodate        =   {s\adddot a\adddot},
    notitle       =   {s\adddot t\adddot},
    nolocation    =   {s\adddot l\adddot},
    nopublisher   =   {s\adddot ed\adddot},
  }
  \newcommand*\nosomethings{noauthor,noeditor,nodate,notitle,nolocation,nopublisher}
  \@for \xx:=\nosomethings \do {%
    \expandafter\ifcsname\xx\endcsname\relax\else
    \expandafter\expandafter\expandafter\expandafter\edef\csname\xx\endcsname{\noexpand\bibstring{\xx}}%
    \fi}
\end{filecontents}

\usepackage[backend=biber, style=alphabetic, autocite=footnote]{biblatex}

\begin{filecontents}{bibliography.bib}
  % Example for no author
  @BOOK{noAuthor,
    author = {\noauthor},
    title = {Rocket Propulsion and Spaceflight Dynamics},
    year = {1979},
    location = {New York},
    publisher = {Pitman},
  }
  % Example for no author and field left empty
  @BOOK{noAuthor2,
    author = {},
    title = {Rocket Propulsion and Spaceflight Dynamics},
    year = {1979},
    location = {New York},
    publisher = {Pitman},
  }
  % Example for no editor
  @Collection{noEditor,
    editor                  = {\noeditor},
    title                       = {Book of light},
    year                        = {1985},
    publisher               = {Springer Science+Business Media, LLC},
    location                = {New York}
  }
  @Collection{noEditor2,
    editor                  = {\noeditor},
    title                       = {Book of Darkness},
    year                        = {1945},
    publisher               = {Oxford University Press},
    location                = {Oxford},
    isbn = {01234556789X}
  }
  @Collection{noEditor3,
    editor                  = {\noeditor},
    title                       = {Book of Greyness},
    year                        = {1045},
    publisher               = {Cambridge University Press},
    location                = {Cambridge},
    isbn = {01234879890789X}
  }
  @Collection{Editor,
    editor                  = {Ditor, E.},
    title                       = {Book of light},
    year                        = {1985},
    publisher               = {Springer Science+Business Media, LLC},
    location                = {New York}
  }
  % Example for no year
  @BOOK{noYear,
    author = {Cornelisse, J. W. and Schoeyer, H. Ferry R. and Wakker, Karel F.},
    title = {Rocket Propulsion and Spaceflight Dynamics},
    year = {\nodate},
    location = {New York},
    publisher = {Pitman},
  }
  % Example for no title
  @BOOK{noTitle,
    author = {Cornelisse, J. W. and Schoeyer, H. Ferry R. and Wakker, Karel F.},
    title = {\notitle},
    year = {1979},
    location = {New York},
    publisher = {Pitman},
  }
  % Example for no location
  @BOOK{noLocation,
    author = {Cornelisse, J. W. and Schoeyer, H. Ferry R. and Wakker, Karel F.},
    title = {Rocket Propulsion and Spaceflight Dynamics},
    year = {1979},
    location = {\nolocation},
    publisher = {Pitman},
  }
  % Example for no publisher
  @BOOK{noPublisher,
    author = {Cornelisse, J. W. and Schoeyer, H. Ferry R. and Wakker, Karel F.},
    title = {Rocket Propulsion and Spaceflight Dynamics},
    year = {1979},
    location = {New York},
    publisher = {\nopublisher},
  }
\end{filecontents}

\addbibresource{bibliography.bib}

\newif\ifuseeditorstg
\useeditorstgfalse
\useeditorstgtrue

\renewbibmacro*{editor}{%
  \ifboolexpr{
    test \ifuseeditor
    and
    not test {\ifnameundef{editor}}
  }
  {\printnames{editor}%
    \setunit{\addcomma\space}%
    \mystringtestnamehash\ifuseeditorstg\usebibmacro{editorstrg}\fi%
    \clearname{editor}}
  {}}

\renewbibmacro*{editor+others}{%
  \ifboolexpr{
    test \ifuseeditor
    and
    not test {\ifnameundef{editor}}
  }
  {\printnames{editor}%
    \setunit{\addcomma\space}%
    \mystringtestnamehash\ifuseeditorstg\usebibmacro{editorstrg}\fi%
    \clearname{editor}}
  {}}


% based on Andrew Swann's answer at http://tex.stackexchange.com/a/169379
\edef\noeditornamehash{\detokenize{a811c44f19354a66e35057fa5cdb5ad2}}
\newcommand*\mystringtestnamehash{%
  \edef\tempa{\strfield{namehash}}%
  \ifx\noeditornamehash\tempa\useeditorstgfalse\else\useeditorstgtrue\fi}

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

丢失的信息

相关内容