我希望仅在我已将条目放入文件中的情况下才阻止biblatex
打印by (name of author)
参考书目。我假设我可以在序言中放置一个相对简单的命令来处理这个问题。下面是一个愚蠢的例子:OPTIONS = "useauthor=false"
.bib
.tex
\documentclass{article}
\usepackage{csquotes}
\usepackage[
bibstyle = authoryear,
citestyle = authoryear-comp,
sorting = nyt,
language = american,
abbreviate = false,
backend = biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{bible,
AUTHOR = "God",
EDITOR = "James, King",
TITLE = "The {H}oly {B}ible",
YEAR = "1611",
OPTIONS = "useauthor=false, useeditor=true"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\noindent
Text \parencite{bible}.
\printbibliography
\end{document}
答案1
有很多方法可以做到这一点;但其中一种简单的方法(根本不需要摆弄书目驱动程序)就是在为假时清除该author
字段:useauthor
\AtEveryCitekey{\ifuseauthor{}{\clearname{author}}}
\AtEveryBibitem{\ifuseauthor{}{\clearname{author}}}
答案2
重新定义byauthor
bibmacro 使其不执行任何操作。
\documentclass{article}
\usepackage{csquotes}
\usepackage[
bibstyle = authoryear,
citestyle = authoryear-comp,
sorting = nyt,
language = american,
abbreviate = false,
backend = biber]{biblatex}
\renewbibmacro*{byauthor}{}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{bible,
AUTHOR = "God",
EDITOR = "James, King",
TITLE = "The {H}oly {B}ible",
YEAR = "1611",
OPTIONS = "useauthor=false, useeditor=true"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\noindent
Text \parencite{bible}.
\printbibliography
\end{document}
比较原始版本byauthor
:
\newbibmacro*{byauthor}{%
\ifboolexpr{
test \ifuseauthor
or
test {\ifnameundef{author}}
}
{}
{\usebibmacro{bytypestrg}{author}{author}%
\setunit{\addspace}%
\printnames[byauthor]{author}}}