根据作者自定义引文和出版物列表

根据作者自定义引文和出版物列表

假设我在文档中使用参考书目文件,依靠 Biblatex 和 Biber 进行引用管理。

给出一个引用命令,例如\cite{A, B, C}(或任何其他标准 Biblatex 引用命令),我希望根据给定字段(例如作者字段)在相应的参考书目条目中包含给定的字符串(例如某人的姓氏)。

此外,我想根据与上述相同的条件在生成的文档中生成两个不同的参考书目部分。

通常,这将用于在正文和附录的引用级别上区分我与他人合作撰写的出版物。

编辑:添加 MWE:

\documentclass{article}
\usepackage{filecontents}
\usepackage[backend=biber,style = alphabetic]{biblatex}
\usepackage[colorlinks=true, breaklinks, allcolors = blue]{hyperref}
\DeclareSourcemap{%
  \maps[datatype=bibtex]{%
    \map{%
      \step[fieldsource=author, match=Doe, final]%
      \step[fieldset=keywords, fieldvalue=doe]%
    }%
  }%
}
\begin{filecontents}{\jobname.bib}
@Book{p1,
  author =       "A. U. Thor and John Doe",
  title =        "A Scientific Article 1",
  year =         "1975"  
}
@Book{p2,
  author =       "John Doe",
  title =        "A Scientific Article 2",
  year =         "1985"  
}
@Book{p3,
  author =       "Joe Bar",
  title =        "A Scientific Article 3",
  year =         "1995"  
}
@Book{p4,
  author =       "Jane Baz",
  title =        "A Scientific Article 4",
  year =         "2005"  
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
% Requirement 1: should make citations of Doe bold
In \parencite{p4, p1, p2, p3}, ``TD75'' and ``Doe85'' should appear in
bold (the semicolon should remain plain).

% Requirement 2: separating bibliographies. IT WORKS.
\section{Co-authored Publications}
\nocite{*}
\printbibliography[keyword=doe,heading=none]

\section{Other Publications}
\nocite{*}
\printbibliography[notkeyword=doe,heading=none] 
\end{document}

答案1

使用来自的解决方案biblatex:在参考书目中分离特定作者的出版物设置你只需要的关键字

\DeclareFieldFormat{prefixnumber}{\ifkeyword{doe}{\mkbibbold{#1}}{#1}}
\DeclareFieldFormat{labelalpha}{\ifkeyword{doe}{\mkbibbold{#1}}{#1}}
\DeclareFieldFormat{extraalpha}{\ifkeyword{doe}{\mkbibbold{#1}}{#1}}

得到你想要的。

平均能量损失

\documentclass{article}
\usepackage{filecontents}
\usepackage[backend=biber,style = alphabetic]{biblatex}
\usepackage[colorlinks=true, breaklinks, allcolors = blue]{hyperref}
\DeclareSourcemap{%
  \maps[datatype=bibtex]{%
    \map{%
      \step[fieldsource=author, match=Doe, final]%
      \step[fieldset=keywords, fieldvalue=doe]%
    }%
  }%
}
\begin{filecontents}{\jobname.bib}
@Book{p1,
  author =       "A. U. Thor and John Doe",
  title =        "A Scientific Article 1",
  year =         "1975"  
}
@Book{p2,
  author =       "John Doe",
  title =        "A Scientific Article 2",
  year =         "1985"  
}
@Book{p3,
  author =       "Joe Bar",
  title =        "A Scientific Article 3",
  year =         "1995"  
}
@Book{p4,
  author =       "Jane Baz",
  title =        "A Scientific Article 4",
  year =         "2005"  
}
\end{filecontents}
\addbibresource{\jobname.bib}

\DeclareFieldFormat{prefixnumber}{\ifkeyword{doe}{\mkbibbold{#1}}{#1}}
\DeclareFieldFormat{labelalpha}{\ifkeyword{doe}{\mkbibbold{#1}}{#1}}
\DeclareFieldFormat{extraalpha}{\ifkeyword{doe}{\mkbibbold{#1}}{#1}}

\nocite{*}
\begin{document}
In \parencite{p4, p1, p2, p3}, ``TD75'' and ``Doe85'' should appear in
bold (the semicolon should remain plain).

\section{Co-authored Publications}
\printbibliography[keyword=doe,heading=none]

\section{Other Publications}
\printbibliography[notkeyword=doe,heading=none] 
\end{document}

只是因为使用名称哈希很花哨,这里是 Audrey 对biblatex:动态过滤参考文献中特定作者的出版物

您可以在文件中找到需要使用的名称哈希.bbl(如使用 biblatex 突出显示参考书目中的作者,并允许使用参考书目样式对其进行格式化)。

这个解决方案使用类别而不是关键字,所以我们必须稍微调整一下代码,但基本思想是一样的。

\documentclass{article}
\usepackage{filecontents}
\usepackage[backend=biber,style = alphabetic]{biblatex}
\usepackage[colorlinks=true, breaklinks, allcolors = blue]{hyperref}
\begin{filecontents}{\jobname.bib}
@Book{p1,
  author =       "A. U. Thor and John Doe",
  title =        "A Scientific Article 1",
  year =         "1975"  
}
@Book{p2,
  author =       "John Doe",
  title =        "A Scientific Article 2",
  year =         "1985"  
}
@Book{p3,
  author =       "Joe Bar",
  title =        "A Scientific Article 3",
  year =         "1995"  
}
@Book{p4,
  author =       "Jane Baz",
  title =        "A Scientific Article 4",
  year =         "2005"  
}
\end{filecontents}
\addbibresource{\jobname.bib}

\DeclareBibliographyCategory{byname}

\DeclareIndexNameFormat{byname}{%
  \iffieldequalstr{hash}{bd051a2f7a5f377e3a62581b0e0f8577}
    {\addtocategory{byname}{\thefield{entrykey}}}
    {}%
}

\AtDataInput{%
  \indexnames[byname]{author}}


\DeclareFieldFormat{prefixnumber}{\ifcategory{byname}{\mkbibbold{#1}}{#1}}
\DeclareFieldFormat{labelalpha}{\ifcategory{byname}{\mkbibbold{#1}}{#1}}
\DeclareFieldFormat{extraalpha}{\ifcategory{byname}{\mkbibbold{#1}}{#1}}

\nocite{*}
\begin{document}
In \parencite{p4, p1, p2, p3}, ``TD75'' and ``Doe85'' should appear in
bold (the semicolon should remain plain).

\section{Co-authored Publications}
\printbibliography[category=byname,heading=none]

\section{Other Publications}
\printbibliography[notcategory=byname,heading=none] 
\end{document}

两位 MWE 都给出了

example output for both MWEs

相关内容