
有沒有辦法重新定義 biblatex 的變體\citeauthor[xx]{author}
,以便後註使用“, p./pp.”而不是冒號? 「在作者(第xx頁)中......」(這樣我們就不必在自我理解時多次重複年份。)
我嘗試使用\DeclareDelimFormat
and \DeclareFieldFormat
inside a \DeclareCiteCommand{\citeauthorpage}
,但我不知道我在做什麼。
我認為最好的方法是定義另一個後注巨集:
\newbibmacro{\authorpostnote}{...}
我也嘗試過這個,但它根本不起作用:
\DeclareDelimFormat[citeauthor]{postnotedelim}
{\mkpageprefix[pagination]{#1}}
微量元素
\documentclass{article}
\usepackage[english]{babel}
\usepackage{xspace}
\usepackage[backend=biber,natbib=true,citestyle=ext-authoryear-comp,bibstyle=ext-authoryear,articlein=false,innamebeforetitle=true,dashed=false,useprefix=true,sortcites=false]{biblatex}
\addbibresource{biblatex-examples.bib}
\DeclareFieldFormat{postnote}{\mknormrange{#1}} %remove p. in ref
\DeclareFieldFormat{multipostnote}{\mknormrange{#1}} %remove pp. in ref
\DeclareDelimFormat{postnotedelim}{\addcolon\@\xspace\nobreak} %colon after year in ref
\begin{document}
Lorem \textcite[380]{sigfridsson}
ipsum \citeauthor[380]{sigfridsson}
\printbibliography
\end{document}
答案1
可以輕鬆更改分隔符號citeauthor
(這就是上下文敏感分隔符號介面的用途),但由於您還需要更改字段格式(這對上下文自然不敏感),因此我們最終會重新定義\citeauthor
並使用不太複雜的方法。
\documentclass{article}
\usepackage[english]{babel}
\usepackage[
backend=biber,
natbib=true,
style=ext-authoryear-comp,
articlein=false,
innamebeforetitle=true,
dashed=false,
useprefix=true,
sortcites=false,
]{biblatex}
\addbibresource{biblatex-examples.bib}
\DeclareFieldFormat{postnote}{\mknormrange{#1}}
\DeclareFieldFormat{multipostnote}{\mknormrange{#1}}
\DeclareDelimFormat{postnotedelim}{\addcolon\@\space\nobreak}
\DeclareFieldFormat{postnote:citeauthor}{%
\mkbibparens{%
\mkpageprefix[pagination][\mknormrange]{#1}}}
\newbibmacro*{postnote:citeauthor}{%
\iffieldundef{postnote}
{}
{\setunit{\addspace}%
\printfield[postnote:citeauthor]{postnote}}}
\DeclareCiteCommand{\citeauthor}
{\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\ifciteindex
{\indexnames{labelname}}
{}%
\printnames{labelname}}
{\multicitedelim}
{\usebibmacro{postnote:citeauthor}}
\begin{document}
Lorem \textcite[380]{sigfridsson}
ipsum \citeauthor[380]{sigfridsson}
\printbibliography
\end{document}
可以找到涉及到的巨集的原始定義biblatex.def
。\citeauthor
定義於二。 2172-2181。postnote:citeauthor
是仿照postnote
(二。 2379-2383)。
答案2
問題已解決
- I. 寫出專門的後記
\citeauthor
\newbibmacro{authorpostnote}{\addcomma\space\nobreak\mkpageprefix[pagination][\mknormrange]
\DeclareCiteCommand{\citeauthorpage}[\mkbibparens] % Parencite with just author name!
{\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\ifciteindex
{\indexnames{labelname}}
{}%
\printnames{labelname}}
{\multicitedelim}
{\usebibmacro{authorpostnote}}
- 二.所有格變體
作為補充,我可以提請注意一段精彩的程式碼,它將任何引用命令變成所有格,並且在這種情況下也能完美工作。
致謝@Psychonaut 和@Audrey,請參閱此頁面:
https://tex.stackexchange.com/a/307461/262813。
\documentclass{article}
\usepackage[english]{babel}
\usepackage[
backend=biber,
natbib=true,
style=ext-authoryear-comp,
articlein=false,
innamebeforetitle=true,
dashed=false,
useprefix=true,
sortcites=false,
]{biblatex}
\addbibresource{biblatex-examples.bib}
\DeclareFieldFormat{postnote}{\mknormrange{#1}}
\DeclareFieldFormat{multipostnote}{\mknormrange{#1}}
\DeclareDelimFormat{postnotedelim}{\addcolon\@\space\nobreak}
\DeclareNameWrapperFormat{labelname:poss}{#1's}
\DeclareFieldFormat{shorthand:poss}{%
\ifnameundef{labelname}{#1's}{#1}}
\DeclareFieldFormat{citetitle:poss}{\mkbibemph{#1}'s}
\DeclareFieldFormat{label:poss}{#1's}
\newrobustcmd*{\posscitealias}{%
\AtNextCite{%
\DeclareNameWrapperAlias{labelname}{labelname:poss}%
\DeclareFieldAlias{shorthand}{shorthand:poss}%
\DeclareFieldAlias{citetitle}{citetitle:poss}%
\DeclareFieldAlias{label}{label:poss}}}
\DeclareFieldFormat{postnote:citeauthor}{%
\mkbibparens{%
\mkpageprefix[pagination][\mknormrange]{#1}}}
\newbibmacro*{postnote:citeauthor}{%
\iffieldundef{postnote}
{}
{\setunit{\addspace}%
\printfield[postnote:citeauthor]{postnote}}}
\DeclareCiteCommand{\citeauthorpage}
{\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\ifciteindex
{\indexnames{labelname}}
{}%
\printnames{labelname}}
{\multicitedelim}
{\usebibmacro{postnote:citeauthor}}
\newrobustcmd*{\citeauthorpagepos}{%
\posscitealias%
\citeauthorpage}
\begin{document}
Lorem \citeauthorpage[380]{sigfridsson}
ipsum \citeauthorpagepos[380]{sigfridsson}
\printbibliography
\end{document}