我指的是在此处输入链接描述用于在文中引用页码
我得到的输出:
ABC book is done (Gaver, 1986, p. 150)
This book is done by Gaver (1986, p. 150)
如何更改为:
ABC book is done (Gaver, 1986: 150)
This book is done by Gaver (1986; 150)
This book is done by Gaver (1986; 150-152)
基本上,删除并将p
更改:
为\parencite
并将更改;
为\textcite
。
也无法进行交叉引用吗?页面未以蓝色突出显示
\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,
uniquename=init]{biblatex}
\DeclareNameAlias{sortname}{family-given} %for second and third author name
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{csquotes}
\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}}}
\xpatchbibdriver{inbook}
{\usebibmacro{in:}%
\usebibmacro{bybookauthor}%
\newunit\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}}
{\usebibmacro{in:}%
\usebibmacro{bybookauthor}%
\newunit\newblock
\usebibmacro{byeditor:in}%
\newunit\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}}
{}{}
\xpatchbibdriver{incollection}
{\usebibmacro{in:}%
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}}
{\usebibmacro{in:}%
\usebibmacro{byeditor:in}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor}}
{}{}
\xpatchbibdriver{inproceedings}
{\usebibmacro{in:}%
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{event+venue+date}%
\newunit\newblock
\usebibmacro{byeditor+others}}
{\usebibmacro{in:}%
\usebibmacro{byeditor:in}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{event+venue+date}%
\newunit\newblock
\usebibmacro{byeditor+others}}
{}{}
\xpatchbibdriver{phdthesis}
{\usebibmacro{in:}%
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{event+venue+date}%
\newunit\newblock
\usebibmacro{byeditor+others}}
{\usebibmacro{in:}%
\usebibmacro{byeditor:in}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{event+venue+date}%
\newunit\newblock
\usebibmacro{byeditor+others}}
{}{}
% 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]
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{cite}}}
{\multicitedelim}
{\usebibmacro{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)
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{gaver1986auditory,
title={Auditory icons: Using sound in computer interfaces},
author={Gaver, William W},
journal={Human-computer interaction},
volume={2},
number={2},
pages={167--177},
year={1986},
publisher={Taylor \& Francis}
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
ABC book is done \parencite[150]{gaver1986auditory}\\
This book is done by \textcite[150]{gaver1986auditory}
\printbibliography
\end{document}
答案1
附注格式(是否带页码前缀等)由字段格式 控制postnote
。附注与其余引文之间的标点符号由 控制postnotedelim
。
在biblatex
3.13 及以上版本中,是一个上下文相关的分隔符,可以轻松地在和postnotedelim
之间切换。\textcite
\parencite
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=authoryear-comp, backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}
\DeclareDelimFormat[textcite]{postnotedelim}{\addsemicolon\space}
\DeclareDelimFormat[parencite]{postnotedelim}{\addcolon\space}
\DeclareFieldFormat{postnote}{\mknormrange{#1}}
\DeclareFieldFormat{multipostnote}{\mknormrange{#1}}
\begin{document}
\cite[380]{sigfridsson}
\textcite[381]{sigfridsson}
\parencite[382]{sigfridsson}
\printbibliography
\end{document}
我似乎记得您正在使用过时的版本biblatex
,因此您可能无法使用上下文相关的postnotedelim
。
在这种情况下,最简单的方法是将的重新定义直接插入到和postnotedelim
的定义中。\parencite
\textcite
您已经\parencite
在序言中重新定义了,因此您只需要稍微修改一下该定义
\DeclareCiteCommand{\parencite}[\mkbibparens]
{\renewcommand*{\postnotedelim}{\addcolon\space}%
\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{cite}}}
{\multicitedelim}
{\usebibmacro{postnote}}
因为\textcite
您需要使用以下样式修改内部命令authoryear-comp
\DeclareCiteCommand{\cbx@textcite}
{\renewcommand*{\postnotedelim}{\addsemicolon\space}%
\usebibmacro{cite:init}}
{\usebibmacro{citeindex}%
\usebibmacro{textcite}}
{}
{\usebibmacro{textcite:postnote}}
注意:这些重新定义如果与-comp
风格一起使用,就会出现缺陷,正如如何将引用“A et al., 2014; 2016; B et al. 2014”更改为“A et al., 2014 & 2016; B et al., 2014”。
后记通常没有链接,我也会保留它。