\citeauthor postnote のフォーマットを変更する

\citeauthor postnote のフォーマットを変更する

ポストノートでコロンの代わりに「, p./pp.」が使用されるように、 biblatex のバリアントを再定義する方法はありますか\citeauthor[xx]{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}

ロレム・シグフリッドソンとライド(1998:380) ipsum シグフリッドソンとライド(p. 380)

関連するマクロの元の定義は以下で確認できます。biblatex.def\citeauthor次のように定義されます2172-2181年.は(postnote:citeauthorをモデルにしていますpostnote2379-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}

ここに画像の説明を入力してください

関連情報