我正在用乳胶准备我的简历,使用稍微修改过的模板一个在这里找到。我非常喜欢它,特别是书目可以分成几种类型的贡献。我也申请了这里描述的技巧作者 Andrzej。问题在于参考书目中的第一作者的格式与其他作者不同,格式为姓氏、首字母、第二作者首字母姓氏。因此,用于给我的名字加下划线的技巧并不适用于所有我是第一作者的条目。我想改变第一作者的显示方式,以与其他方式兼容。因此,我认为这样加下划线的技巧应该有效。
根据要求,我发布了与参考书目设置相关的代码
\documentclass[a4paper,11pt]{article}
\usepackage[sorting=ynt,bibstyle=authoryear-comp,labelyear=false,labelyear=false,defernumbers=true,maxnames=100,uniquename=init,backend=bibtex8,dashed=false,arxiv=abs]{biblatex}
\DeclareFieldFormat{url}{\url{#1}}
\DeclareFieldFormat[article]{pages}{#1}
\DeclareFieldFormat[inproceedings]{pages}{\lowercase{pp.}#1}
\DeclareFieldFormat[incollection]{pages}{\lowercase{pp.}#1}
\DeclareFieldFormat[article]{volume}{\textbf{#1}}
\DeclareFieldFormat[article]{number}{(#1)}
\DeclareFieldFormat[article]{title}{\MakeCapital{#1}}
\DeclareFieldFormat[inproceedings]{title}{#1}
\DeclareFieldFormat{shorthandwidth}{#1}
\DeclareBibliographyDriver{article}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor}%
\setunit{\labelnamepunct}\newblock
\MakeSentenceCase{\usebibmacro{title}}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{version}%
\newunit\newblock
% \usebibmacro{in:}%
\usebibmacro{journal+issuetitle}%
\newunit\newblock
\printfield{note}%
\setunit{\bibpagespunct}%
\printfield{pages}
\newunit\newblock
\printfield{issn}%
\newunit\newblock
\printfield{doi}%
\newunit\newblock
\usebibmacro{eprint}
%\newunit\newblock
%\usebibmacro{url+urldate}%
\newunit\newblock
\printfield{addendum}%
\newunit\newblock
\usebibmacro{pageref}%
\usebibmacro{finentry}}
% Remove dot between volume and number in journal articles.
\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\setunit*{\addspace}%
\iffieldundef{series}
{}
{\newunit
\printfield{series}%
\setunit{\addspace}}%
\printfield{volume}%
%\setunit*{\adddot}%
\printfield{number}%
\setunit{\addcomma\space}%
\printfield{eid}%
\setunit{\addspace}%
\usebibmacro{issue+date}%
\newunit\newblock
\usebibmacro{issue}%
\newunit}
%added a trick to underline my surname
\renewbibmacro*{name:first-last}[4]{%
\usebibmacro{name:delim}{#2#3#1}%
\usebibmacro{name:hook}{#2#3#1}%
\ifthenelse{\equal{#1}{Vianello}}% matches last name against YourLastName
{
\uline{% wrapped with \uline
\ifblank{#2}{}{\mkbibnamefirst{#2}\isdot\bibnamedelimd}%
\ifblank{#3}{}{%
\mkbibnameprefix{#3}\isdot%
\ifpunctmark{'}%
{}%
{\ifuseprefix{\bibnamedelimc}{\bibnamedelimd}}}%
\mkbibnamelast{#1}\isdot%
\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}}}%
{% original
\ifblank{#2}{}{\mkbibnamefirst{#2}\isdot\bibnamedelimd}%
\ifblank{#3}{}{%
\mkbibnameprefix{#3}\isdot%
\ifpunctmark{'}%
{}%
{\ifuseprefix{\bibnamedelimc}{\bibnamedelimd}}}%
\mkbibnamelast{#1}\isdot%
\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}}}
\usepackage{filecontents}
\begin{filecontents}{biblio.bib}
@article{PhysRevLett.106.125002,
author = {Vianello, Nicola and Naulin, V and Schrittwieser, R and M uller, H. W. and Zuin, M and Ionita, C and Rasmussen, J J and Mehlmann, F and Rohde, V and Cavazzana, R and Maraschek, M},
title = {{Direct Observation of Current in Type-I Edge-Localized-Mode Filaments on the ASDEX Upgrade Tokamak}},
journal = {Physical Review Letters},
year = {2011},
volume = {106},
number = {12},
pages = {125002},
month = mar
}
\end{filecontents}
\addbibresource{biblio.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
现在我认为只要提供了一个 biblio.bib 文件(任何书目文件都应该可以工作),这个例子就应该可以工作。唯一的诀窍就是你选择的姓氏,我的姓氏是 Vianello)对于所提供示例中的问题,我深表歉意。
答案1
要操作名称的输出,您必须sortname
以正确的方式进行设置。
\DeclareNameAlias{sortname}{last-first}
在这种情况下,第一作者旁边的名字将作为首字母打印。
要修改它,您必须通过定义您自己的格式指令\DeclareNameFormat
。
last-first
一个简单的例子是由(参见)的定义给出的biblatex.def
:
\DeclareNameFormat{last-first}{%
\iffirstinits
{\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}
{\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}%
\usebibmacro{name:andothers}}
参数含义如下:
% #1 = last name
% #2 = last name (initials)
% #3 = first name
% #4 = first name (initials)
% #5 = name prefix, a.k.a. 'von part'
% #6 = name prefix (initials)
% #7 = name affix, a.k.a. 'junior part'
% #8 = name affix (initials)
在这种情况下,您可以格式化姓名列表。
如果你想以特殊方式处理第一作者,你可以使用测试
\ifnumequal{\value{listcount}}{1}
{ONLY FIRST AUHTOR}
{ALL OTHER AUTHORS}
例如,如果您想在列表中的第一作者下划线,并且姓名列表的格式如下,last name, first name (initials)
您可以这样做:
\usepackage[normalem]{ulem}
\DeclareFieldFormat{FirstAuthor}{\uline{#1}}
\DeclareNameFormat{last-first-underline}{%
\ifnumequal{\value{listcount}}{1}
{
{\printtext[FirstAuthor]{\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}}
}%
{
{\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}
}%
\usebibmacro{name:andothers}}
答案2
据我记得,名称在参考书目中的显示方式可以用以下方式进行修改
\DeclareNameFormat{labelname}{%
\ifuseprefix
{\usebibmacro{name:last-first}{#1}{#4}{#5}{#8}}
{\usebibmacro{name:last-first}{#1}{#4}{#6}{#8}}%
\usebibmacro{name:andothers}}
这应该始终输出 Lastname Inital(姓氏 = #1。首字母 = #4)
答案3
由于我花了一些时间来解决类似的问题(强调一位作者),所以我只是在这里发布我的解决方案。我遇到的其他解决方案的问题是,如果引用缩写,则“et al.”会被删除...
我希望这也能对其他人有所帮助。
\usepackage[normalem]{ulem}
\renewcommand{\ULthickness}{0.5pt}
\DeclareNameFormat{author}{%
\ifthenelse{\equal{#1}{MYNAME}}%
{\uline{#1\ifblank{#4}{}{\space#4}}}%
{#1\ifblank{#4}{}{\space#4}}%
\ifthenelse{\value{listcount}<\value{liststop}}%
{\addcomma\space}
{\ifthenelse{\ifmorenames}{~et\,al\adddot}}{}}