我正在使用带注释的 BibLaTeX 作者列表 ( author+an
),正如在先前的问题并作为新近整合变成 BibLaTeX 子命令(例如,\mkbibcompletename
)。
我想自动生成一份修改后的作者列表,其中包括表示共同第一作者的匕首和表示共同通讯作者的星号。
例如,下面的 BibLaTeX 条目应在其完整参考文献中生成带注释的作者列表,并带有上标匕首/星号符号(格式未显示),作为其完整引文的一部分。现有注释(例如前两位列出的作者后当前包含的星号)也应被删除和忽略。
@Article{ scott:beyond,
author = {Mastromatteo, Scott * and Viner, Coby * and Denisko, Danielle and
Negrea, Jeffrey and Tang, Yanbo and Zhang, Lin and Hoffman,
Michael M. and Sun, Lei},
author+an = {1=jointfirst; 2=jointfirst;
2=jointcorresponding; 7=jointcorresponding; 8=jointcorresponding},
title = {Beyond statistical significance: ranking transcription
factor binding motifs by effect size},
year = {2023},
month = {4},
% doi = {10.1101/XXXXXX},
% journal = {{bioRxiv}},
% pages = {0XXXXX},
pubstate = {\bibstring{inpreparation}},
note = {Manuscript draft available upon request.},
addendum = {doctoral work}
}
Mastromatteo, S†、Viner, C†*、Denisko, D、Negrea, J、Tang, Y、Zhang, L、Hoffman, MM*、Sun, L*,2023 年。超越统计意义:按效应大小对转录因子结合基序进行排序。手稿草稿可应要求提供。正在准备中。
我目前没有尝试这样做,因为我不清楚 BibLaTeX 宏中当前的解析和使用这些作者注释的能力。我非常希望得到包括一些关于这个主题的解释或参考的答案。
目前,我对参考文献进行了其他处理,如下所示,这些请求的修改理想情况下可以集成到其中:
% some adaptations from: http://www.khirevich.com/latex/biblatex/
\DeclareSourcemap{
\maps[datatype=bibtex, overwrite]{
\map{ % journal names to shorter names, if existing
\step[fieldsource=shortjournal] % e.g. Proc. Natl. Acad. Sci. U.S.A.
%\step[fieldsource=shortestjournal] % e.g. PNAS; use to also map to shortest names, if existing
\step[fieldset=journaltitle, origfieldval]
}
%
\map{ % book/conference names to short names
\step[fieldsource=shortbook]
\step[fieldset=booktitle, origfieldval]
}
\map{
% suppress the following fields
\step[fieldset=month, null]
\step[fieldset=eventdate, null]
\step[fieldset=publisher, null]
\step[fieldset=editor, null] % N.B. no editor for now...
%
% do not clear, if submitted
% From: https://tex.stackexchange.com/a/453744/134641
% N.B. The below must be at the end of this map statement, as the below
% use of "final" will terminate this map, if notmatch is SAT.
%
% XXX N.B. Now keeping all pubstates, as demarcating pre-published from in-prep.
%
%\step[fieldsource=pubstate, notmatch={[sS]ubmitted}, final]
%\step[fieldset=pubstate, null]
}
\map{ % suppress the following field(s), except for presentations
\pernottype{inproceedings}
\expandafter\step[fieldset=addendum, null] % suppress NSERC education segment designations
}
\map{ % NSERC doesn't want numbers, but we still include it for patents
\pernottype{patent}
\step[fieldset=number, null]
}
\map{
\pertype{patent}
%
% clear patent scope, obviating output of redundant info. for US patents
\step[fieldset=location, null]
%
% we include the USPTO kind codes, but do not use them
\step[fieldset=kind, null]
%
% we use the field "appnumber" to store the USPTO application number
% we simply map it to be appended to the "type" field, in the standard data model
% ------------------------------------------------------------
% "terrible hack"; used for now, in favour of custom DBX definition
% From: https://tex.stackexchange.com/a/454143/134641
%
\step[fieldsource=appnumber, final]
%
% also save this in userf, to permit external use
\step[fieldset=userf, origfieldval]
%
\step[fieldsource=type, match=\regexp{\A(.*)\Z}, replace=\regexp{\\ifbibstring\{$1\}\{\\bibstring\{$1\}\}\{$1\}\x{20}}]
\step[fieldsource=appnumber]
\step[fieldset=type, origfieldval, append]
% ------------------------------------------------------------
}
% map citation count fields to user-defined fields, to permit usage
\map{
\step[fieldsource=citecount]
\step[fieldset=usera, origfieldval]
}
\map{
\step[fieldsource=citecountNS]
\step[fieldset=userb, origfieldval]
}
}
}
% TODO the below fails, but something like this would be nice
%\DeclareDataInheritance{patent}{patent}{
% % map the parent's appnumber (in userf) to the child's usere
% \inherit[override]{userf}{usere}
%}
% ------------------------------------------------------------
% Patch the BibLaTeX output for @Patent entries:
% add punctuation, after the "type" field.
%
\xpatchbibdriver{patent}%
{\printfield{type}\setunit*{\addspace}}%
{\printfield{type}\setunit*{\addsemicolon\space}}{}{}
% ------------------------------------------------------------
% custom citation command to output paper citation information
\DeclareCiteCommand{\citationscite}{}{Cited $\thefield{usera}$ times ($\thefield{userb}$, strictly non-self; per \href{https://scholar.google.ca/citations?user=RUrFz2oAAAAJ}{Google Scholar}).}{}{}
\DefineBibliographyStrings{english}{%
patrequs = {US patent application} % "application", not "request"; no dots in "US"
}
% italisize the book's title for @inproceedings entries
\DeclareFieldFormat[inproceedings]{booktitle}{\mkbibemph{#1}}
% remove volume indication (i.e. vol.) before volume numbers for @inproceedings entries
\DeclareFieldFormat[inproceedings]{volume}{\textbf{#1}}
%------------------------------------------------
% Apply page range compression
% From: http://tex.stackexchange.com/a/25374
\DeclareFieldFormat{postnote}{\mkcomprange[{\mkpageprefix[pagination]}]{#1}}
\DeclareFieldFormat{pages}{\mkcomprange{#1}}
% Compress ranges where lower limit > 100
\setcounter{mincomprange}{100}
% Don't compress beyond the fourth digit
\setcounter{maxcomprange}{1000}
% Display compressed upper limit with at least two digits,
% unless leading digit is zero
\setcounter{mincompwidth}{10}
%--------------------------------------
目前没有提供最小工作示例 (MWE)。我正在寻找此问题的一般解决方案。如果一段时间后仍未提供解决方案,我将尝试编写适当的 MWE。对于给您带来的不便深表歉意,并提前感谢您的帮助!
答案1
对于答案的第一部分,我将假设该author
字段不包含任何额外的标记,如*
。
请注意,如果要将多个注释传递给一个列表项,则必须使用
<item no>=<annotation_1>, <annotation_2>, ..., <annotation_n>;
而不是<item no>=<annotation_1>; <item_no>=<annotation_2>; ...; <item no>=<annotation_n>;
。在后一种形式中,只有最后一个注释保留下来。(此示例和格式语法可在 §3.7 中找到数据注释的手册biblatex
,具体为第 85 页。)
然后您可以使用与链接中建议的代码类似的代码。
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=authoryear, maxbibnames=999]{biblatex}
\DeclareNameWrapperFormat{sortname}{%
\renewcommand*{\mkbibcompletename}[1]{%
##1%
\ifitemannotation{jointfirst}{\dag}{}%
\ifitemannotation{jointcorresponding}{*}{}}%
#1}
\begin{filecontents}{\jobname.bib}
@article{scott:beyond,
author = {Mastromatteo, Scott and Viner, Coby and Denisko, Danielle and
Negrea, Jeffrey and Tang, Yanbo and Zhang, Lin and Hoffman,
Michael M. and Sun, Lei},
author+an = {1=jointfirst; 2=jointfirst, jointcorresponding;
7=jointcorresponding; 8=jointcorresponding},
title = {Beyond statistical significance: ranking transcription
factor binding motifs by effect size},
year = {2023},
month = {4},
pubstate = {\bibstring{inpreparation}},
note = {Manuscript draft available upon request.},
addendum = {doctoral work},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
Lorem \autocite{sigfridsson,scott:beyond}
\printbibliography
\end{document}
如果我们必须author
先清除不需要的标记,我建议使用源映射。始终存在这样的风险:您*
的.bib
文件中的名称中确实存在此源映射会清除的内容,这就是为什么我首先更喜欢保持数据干净(另外,源映射对性能的影响很小),但如果您坚持,这可能是最快的解决方案。
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=authoryear, maxbibnames=999]{biblatex}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[foreach=setnames]{
\step[fieldsource=\regexp{$MAPLOOP},
match=\regexp{\s+\*},
replace={}]
}
}
}
\DeclareNameWrapperFormat{sortname}{%
\renewcommand*{\mkbibcompletename}[1]{%
##1%
\ifitemannotation{jointfirst}{\dag}{}%
\ifitemannotation{jointcorresponding}{*}{}}%
#1}
\begin{filecontents}{\jobname.bib}
@article{scott:beyond,
author = {Mastromatteo, Scott * and Viner, Coby * and Denisko, Danielle and
Negrea, Jeffrey and Tang, Yanbo and Zhang, Lin and Hoffman,
Michael M. and Sun, Lei},
author+an = {1=jointfirst; 2=jointfirst, jointcorresponding;
7=jointcorresponding; 8=jointcorresponding},
title = {Beyond statistical significance: ranking transcription
factor binding motifs by effect size},
year = {2023},
month = {4},
pubstate = {\bibstring{inpreparation}},
note = {Manuscript draft available upon request.},
addendum = {doctoral work},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
Lorem \autocite{sigfridsson,scott:beyond}
\printbibliography
\end{document}