在 `biblatex` 中使用 `authoryear` 样式自定义 `\textcite` 括号

在 `biblatex` 中使用 `authoryear` 样式自定义 `\textcite` 括号

第二行的引用格式是默认的\textcite。说“参见”并提及年份看起来甚至都不对。相反,作者年份应该放在括号中(或者如果有些人觉得括号多余,可以不用括号)。

我想要的是类似第三行的内容,但年份的链接必须将读者带到参考书目条目。

在此处输入图片描述

\begin{filecontents*}{sample.bib}
    @article{wu2019method,
        title={A method to identify weak points of interconnection of renewable energy resources},
        author={Wu, Di and Aldaoudeyeh, Al~Motasem and Javadi, Milad and Ma, Feng and Tan, Jin and Jiang, John N and others},
        journal={International Journal of Electrical Power \& Energy Systems},
        volume={110},
        pages={72--82},
        year={2019},
        publisher={Elsevier}
    }
\end{filecontents*}


\documentclass{book}

\usepackage[x11names]{xcolor}

\usepackage{hyperref}
\hypersetup{citecolor=DodgerBlue3, citebordercolor=DodgerBlue3, colorlinks=true}

\usepackage[style=ext-authoryear,refsection=chapter,backref=true]{biblatex}
\addbibresource{sample.bib}
\DeclareInnerCiteDelims{cite}{\bibopenbracket}{\bibclosebracket}
\DeclareOuterCiteDelims{cite}{\bibopenparen}{\bibcloseparen}



\begin{document}

    \cite{wu2019method}

    \textcite[see][pages 15-28]{wu2019method}

    (see [Wu et al. 2019], pages 15-28)

    \printbibliography

\end{document}

答案1

这是可能的,但你需要挖掘得比高级biblatexbiblatex-ext类似的命令更深入一些\Declare...CiteDelims

\documentclass{article}

\usepackage[x11names]{xcolor}

\usepackage[style=ext-authoryear]{biblatex}
\usepackage{hyperref}
\hypersetup{citecolor=DodgerBlue3, citebordercolor=DodgerBlue3, colorlinks=true}

\DeclareFieldFormat{medparencite}{\mkbibbrackets{#1}}
\DeclareCiteCommand{\parencite}[\mkouterparencitedelims]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \printtext[medparencite]{\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}


\addbibresource{biblatex-examples.bib}
\begin{document}
  \parencite{sigfridsson}

  \parencite[380]{sigfridsson}

  \parencite[cf.][]{sigfridsson}

  \parencite[see][381]{sigfridsson}

  \printbibliography
\end{document}

([Sigfridsson and Ryde 1998])//([Sigfridsson and Ryde 1998],第 380 页)//(参见 [Sigfridsson and Ryde 1998])//(参见 [Sigfridsson and Ryde 1998],第 381 页)


只是为了好玩我们可以biblatex-ext在这里实现一个类似的接口

\documentclass{article}

\usepackage[x11names]{xcolor}

\usepackage[style=ext-authoryear]{biblatex}
\usepackage{hyperref}
\hypersetup{citecolor=DodgerBlue3, citebordercolor=DodgerBlue3, colorlinks=true}

\makeatletter
\newrobustcmd*{\DeclareMedCiteDelims}{%
  \extblx@declareciteddelims{med}}

\newrobustcmd*{\UndeclareMedCiteDelims}{%
  \extblx@undeclareciteddelims{med}}

\newrobustcmd*{\DeclareMedCiteDelimsAlias}{%
  \@ifstar
    {\extblx@declareciteddelims@alias@i{med}}
    {\extblx@declareciteddelims@alias{med}}}

\RegisterCiteDelims{med}{parencite}
\DeclareFieldFormat{extblx@medparencitedelims}{%
  \csuse{mkmed\blx@delimcontext delims}{#1}}
\makeatother

\DeclareMedCiteDelims{parencite}{\bibopenbracket}{\bibclosebracket}

\DeclareCiteCommand{\parencite}[\mkouterparencitedelims]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \printtext[extblx@medparencitedelims]{\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}


\addbibresource{biblatex-examples.bib}
\begin{document}
  \parencite{sigfridsson}

  \parencite[380]{sigfridsson}

  \parencite[cf.][]{sigfridsson}

  \parencite[see][381]{sigfridsson}

  \printbibliography
\end{document}

输出是一样的。

相关内容