
Есть ли способ переопределить вариант biblatex \citeauthor[xx]{author}
так, чтобы в примечании вместо двоеточия использовалось ", p./pp."? "In Author (p. xx)..." (Таким образом, нам не придется повторять год несколько раз, когда он и так понятен сам по себе.)
Я пробовал с \DeclareDelimFormat
и \DeclareFieldFormat
внутри \DeclareCiteCommand{\citeauthorpage}
, но понятия не имею, что делаю.
Я думаю, лучшим способом было бы определить еще один макрос postnote:
\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}}
- II. Притяжательный вариант
В качестве дополнения я могу обратить внимание на замечательный фрагмент кода, который превращает любую команду cite в притяжательную форму и который отлично работает и в этом случае.
Благодарности @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}