我想要如下的输出:
An online journal article with a DOI
我想使用以下格式进行引用:
我的输出是:
我在用:
% An online journal article with a DOI using @article
@article{Test2,
author = {Kovalchuk, Y. and Stewart, R. and Broadbent, M. and Hubbard, T. J. P. and Dobson, R. J. B.},
title = {Analysis of diagnoses extracted from electronic health records in a large mental health case register},
journal = {Plus One},
volume = "12",
number = "2",
date = {2017},
DOI = "http://dx.doi.org/10.1371/journal.pone.0171526",
}
如果我使用@online
。
% An online journal article with a DOI using @Online
@online{Test1,
author = {Kovalchuk, Y. and Stewart, R. and Broadbent, M. and Hubbard, T. J. P. and Dobson, R. J. B.},
title = {Analysis of diagnoses extracted from electronic health records in a large mental health case register},
journal = {Plus One},
volume = "12",
number = "2",
date = {2017},
url = {http://dx.doi.org/10.1371/journal.pone.0171526},
}
下面的输出是title become italic
我不想引用的website
。
我的完整 MWE:
\documentclass{article}
\usepackage{xpatch}
% \usepackage[style = authoryear-comp, maxnames = 99]{biblatex}
\usepackage[backend=biber,
% style=authoryear,
style=authoryear-comp,
% citestyle=authoryear,
dashed=false,
maxcitenames=2,
maxbibnames=99,
giveninits,
alldates=comp,
dateabbrev=false,
uniquename=init]{biblatex}
% to make volume (number), eg. 4(2)
\newcommand*{\volnumdelim}{}
\DeclareFieldFormat[article,periodical]{number}{\mkbibparens{#1}}
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
\setunit*{\volnumdelim}%
\printfield{number}%
\setunit{\addcomma\space}%
\printfield{eid}}
\newcommand*{\jourvoldelim}{\addcomma\space}
\newcommand*{\jourserdelim}{\newunitpunct}
\newcommand*{\servoldelim}{\jourvoldelim}
\newcommand*{\volnumdatedelim}{\addspace}
\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\setunit*{\jourvoldelim}%
\iffieldundef{series}
{}
{\setunit*{\jourserdelim}%
\printfield{series}%
\setunit{\servoldelim}}%
\usebibmacro{volume+number+eid}%
\setunit{\volnumdatedelim}%
\usebibmacro{issue+date}%
\setunit{\addcolon\space}%
\usebibmacro{issue}%
\newunit}
% to make volume (number), eg. 4(2)
\DeclareNameAlias{sortname}{family-given} %for second and third author name
\DeclareFieldFormat{postnote}{\printtext[bibhyperref]{#1}}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{csquotes}
\addto\captionsenglish{
\renewcommand{\listfigurename}{\textsf{List of Figures}}
\renewcommand{\listtablename}{\textsf{List of Tables}}
}
% Flag for whether to add front matter to TOC
\newtoggle{fulltoc}
\toggletrue{fulltoc} % Change to \togglefalse{fulltoc} to remove front matter
\renewcommand{\contentsname}{Table of Contents}
\usepackage[unicode,colorlinks,citecolor=blue]{hyperref}
% for a chapter edited by a book
\usepackage{xpatch}
% \renewcommand*{\finalnamedelim}{\addspace\&\space}
% \renewcommand*{\intitlepunct}{\space} (to become In:)
\renewcommand{\labelnamepunct}{\space} %to delete . after (1997)
% \DeclareFieldFormat[article, incollection, unpublished]{pages}{#1} % to add in PP. (page)
\DeclareFieldFormat[article, incollection, unpublished]{title}{#1}
% \renewcommand{\bibpagespunct}{\ifentrytype{article}{\addcolon}{\addperiod\addspace}} %cancel out this in order to add in PP. (page)
% for title italic
% \DeclareFieldFormat*{title}{\mkbibemph{#1}} %for title italic in all format (conference, paper..)
\DeclareFieldFormat*{title}{#1} %for conference title delete ".."
\DeclareFieldFormat[incollection]{title}{\mkbibemph{#1}} %for incollecion title italic ONLY
\DeclareFieldFormat[thesis]{title}{\mkbibemph{#1}} %for phdthesis title italic ONLY
% for title italic
% to delete "In:" for article
\renewbibmacro{in:}{%
\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}
% to delete "In:" for article
% for delete comma after Author A and Aurhor b
\DefineBibliographyExtras{english}{%
\let\finalandcomma\empty
\let\finalandsemicolon\empty
}
\renewcommand{\compcitedelim}{\space\&\space}
\DeclareNameAlias{editorin}{given-family}
\newbibmacro*{byeditor:in}{%
\ifnameundef{editor}
{}
{\printnames[editorin]{editor}%
\setunit{\addcomma\space}%
\usebibmacro{editorstrg}%
\clearname{editor}}}
\DeclareDelimFormat[textcite]{postnotedelim}{\addcolon\space}
\DeclareDelimFormat[parencite]{postnotedelim}{\addcolon\space}
% \DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{postnote}{\printtext[bibhyperref]{#1}}
\DeclareFieldFormat{multipostnote}{#1}
% for references 's studies (year)
\renewcommand*{\nameyeardelim}{\addcomma\space}
\newcommand{\mycite}[1]{\citeauthor{#1}'s \citeyear{#1}}
\DeclareCiteCommand{\citeauthor}
{\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\ifciteindex
{\indexnames{labelname}}
{}%
\printtext[bibhyperref]{\printnames{labelname}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\DeclareCiteCommand{\citeyear} % <======================================
{}
{(\bibhyperref{\printdate})}
{\multicitedelim}
{}
\DeclareCiteCommand{\parencite}[\mkbibparens]
{\renewcommand*{\postnotedelim}{\addcolon\space}%
\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{cite}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\DeclareCiteCommand{\cbx@textcite}
{\renewcommand*{\postnotedelim}{\addsemicolon\space}%
\usebibmacro{cite:init}}
{\usebibmacro{citeindex}%
\usebibmacro{textcite}}
{}
{\usebibmacro{textcite:postnote}}
\makeatletter
\let\abx@macro@textciteOrig\abx@macro@textcite
\renewbibmacro{textcite}{% <============================================
\bibhyperref{%
\let\bibhyperref\relax\relax%
\abx@macro@textciteOrig%
}%
}%
\makeatother
% for references 's studies (year)
\DeclareFieldFormat{url}{Available at\addcolon\space\url{#1}}
\DeclareFieldFormat{urldate}{\mkbibbrackets{\bibstring{urlseen}\space#1}}
\DeclareFieldFormat[online]{title}{\mkbibemph{#1}}
\DefineBibliographyStrings{english}{%
urlseen = {Accessed},
}
\DefineBibliographyExtras{english}{%
\protected\def\mkdaterangecomp{%
\mkdaterangetrunc{long}}%
\protected\def\mkdaterangeterse{%
\mkdaterangetrunc{short}}%
\protected\def\mkdaterangecompextra{%
\mkdaterangetruncextra{long}}%
\protected\def\mkdaterangeterseextra{%
\mkdaterangetruncextra{short}}%
\protected\def\mkbibdatelong#1#2#3{%
\iffieldundef{#3}
{}
{\thefield{#3}%
\iffieldundef{#2}{}{\nobreakspace}}%
\iffieldundef{#2}
{}
{\mkbibmonth{\thefield{#2}}%
\iffieldundef{#1}{}{\space}}%
\iffieldbibstring{#1}
{\bibstring{\thefield{#1}}}
{\dateeraprintpre{#1}\stripzeros{\thefield{#1}}}}%
}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
% An online journal article with a DOI using @Online
@online{Test1,
author = {Kovalchuk, Y. and Stewart, R. and Broadbent, M. and Hubbard, T. J. P. and Dobson, R. J. B.},
title = {Analysis of diagnoses extracted from electronic health records in a large mental health case register},
journal = {Plus One},
volume = "12",
number = "2",
date = {2017},
url = {http://dx.doi.org/10.1371/journal.pone.0171526},
}
% An online journal article with a DOI using @article
@article{Test2,
author = {Kovalchuk, Y. and Stewart, R. and Broadbent, M. and Hubbard, T. J. P. and Dobson, R. J. B.},
title = {Analysis of diagnoses extracted from electronic health records in a large mental health case register},
journal = {Plus One},
volume = "12",
number = "2",
date = {2017},
DOI = "http://dx.doi.org/10.1371/journal.pone.0171526",
}
%M Maintain this format Website
@online{Maintain1,
author = {World Health Organization},
title = {Global Health Observatory Data Repository},
date = {2014},
url = {http://www.who.int/gho/database/en/},
urldate = {2014-12-23},
}
% Maintaine this format for Journal
@article{Maintain2,
title={The building information modelling trajectory in facilities management: a review},
author={Parn, E. A. and Edwards, D. J. and Sing, M. C. P.},
journal={Automation in Construction},
volume={75},
pages={45--55},
year={2017},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{WinNT}
This is a ABC done by \textcite{Test1}.
book \parencite{Test2}
\textcite{Maintain1}
\textcite{Maintain2}
\printbibliography
\end{document}
谢谢。
答案1
这个问题已经在这里得到解答了:如何将 BibLatex 中引用网站的“url”更改为“Available at”?
我可以使用相同的过程更改 DOI 格式:
\DeclareFieldFormat{doi}{Available at\addcolon\space\url{#1}}
对于“无斜体”部分,我受到了此处描述的问题的启发:如何在参考文献中将 & 符号作为论文标题。我尝试了 \&和上一篇文章。您需要重新定义,这样biblatex
就不会强调文本:
\DeclareFieldFormat[online]{title}{#1}
最后结果:
编辑
@moewe 在评论中提出的替代方案:
\DeclareFieldFormat{doi}{\bibstring{urlfrom}\addcolon\space\url{#1}}
这样,您就可以对要重新定义的所有格式使用唯一的字符串。如果您想修改该字符串:
\DefineBibliographyStrings{english}{%
urlfrom = {Available at}
}
要获取所有带有斜体标题的文章,您可以使用之前的命令:
\DeclareFieldFormat[article]{title}{\mkbibemph{#1}}
最后但并非最不重要的一点是,“世界卫生组织”没有姓氏。它就像一个公司,所以你必须告诉 bib(la)tex 不要解析这个名字。这是通过添加一对额外的 { } 来实现的,如下所示:
author = {{World Health Organization}},