如何使用 biblatex 引用标题、参考文献和页码?

如何使用 biblatex 引用标题、参考文献和页码?

我希望能够使用 biblatex 引用参考文献中的特定页面。我注意到,这from \textcite[109]{Klein:400738}会打印作者姓名,并在括号中包含页码和参考文献标签,如下所示:“来自 Klein [1, p.109]”。不过,我更希望打印标题而不是作者姓名:“来自 « Basic concept I » [1, p.109]”。我通过简单地调用两者来“自制”修复它,\citetitle{Klein:400738}\cite[109]{Klein:400738}但我想知道是否没有任何默认或更简洁的方法可以做到这一点。

如果需要的话,请输入 MWE。

\documentclass[french, 11pt, a4paper, titlepage]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\usepackage{hyperref}
\usepackage[
    hyperref=true,
    backend=biber,
    style=numeric,
    sorting=ynt
]{biblatex}

\begin{filecontents}{\jobname.bib}
@article{Klein:400738,
    author  = {Klein, H.},
    title   = {Basic concepts I},
    journal = {{CAS - CERN Accelerator School: RF Engineering for Particle Accelerators}},
    month = {apr},
    year    = {1991},
    doi = {10.5170/CERN-1992-003.97},
    pages = {97-124}
}
\end{filecontents}

\addbibresource{\jobname.bib}


\begin{document}
Default citation with page number: \cite[109]{Klein:400738}\\
Textcite printing the author: \textcite[109]{Klein:400738}\\
My solution: \citetitle{Klein:400738}~\cite[109]{Klein:400738}\\
Improved one: ?
\printbibliography[title={Bibliographie}]
\end{document}

太感谢了。

答案1

如果您想更频繁地使用这种构造,用 定义专用的引用命令是一个非常好的主意\titletextcite

我们可以窃取一些代码\textcite并稍微简化一下,最终得到

\documentclass[french, 11pt, a4paper, titlepage]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[
    backend=biber,
    style=numeric,
    sorting=ynt
]{biblatex}
\usepackage{hyperref}

\makeatletter
\newbibmacro*{titletextcite}{%
  \printfield[citetitle]{labeltitle}%
  \setunit*{\addnbspace}%
  \printtext{\bibopenbracket}\global\booltrue{cbx:parens}%
  \usebibmacro{cite}%
  \setunit{%
    \ifbool{cbx:parens}
      {\bibclosebracket\global\boolfalse{cbx:parens}}
      {}%
    \multicitedelim}}

\DeclareCiteCommand{\titletextcite}
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{titletextcite}}
  {}
  {\usebibmacro{textcite:postnote}}
\makeatother


\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Klein:400738,
  author  = {Klein, H.},
  title   = {Basic concepts I},
  journal = {{CAS - CERN Accelerator School: RF Engineering for Particle Accelerators}},
  month   = apr,
  year    = {1991},
  doi     = {10.5170/CERN-1992-003.97},
  pages   = {97-124}
}
\end{filecontents}

\addbibresource{\jobname.bib}


\begin{document}
Default citation with page number: \cite[109]{Klein:400738}

Textcite printing the author: \textcite[109]{Klein:400738}

My solution: \citetitle{Klein:400738}~\cite[109]{Klein:400738}

Improved one: \titletextcite[109]{Klein:400738}

\printbibliography[title={Bibliographie}]
\end{document}

改进版:“基本概念 I” [1,第 109 页]

相关内容