使用 biblatex 重新定义 \footcite 命令以仅打印第一作者的姓氏和头衔

使用 biblatex 重新定义 \footcite 命令以仅打印第一作者的姓氏和头衔

为了限制 beamer 演示文稿中引用所占用的空间,我想限制作者列表,以便在脚注字段中使用时仅打印第一个姓氏,但我很难找到这样做的方法。

从...开始使用 Biblatex 在 Beamer 中统一引用编号,如何修改 MWE 中的 hypercite bibmacro 以仅打印选定的字段,即第一作者的姓氏和头衔?

梅威瑟:

\documentclass[10pt]{beamer}
\usepackage[utf8]{inputenc}

\usepackage{filecontents}
\begin{filecontents}{MWE.bib}
@article{Knuth92,
        author = "D.E. Knuth",
        title = "Two notes on notation",
        journal = "Amer. Math. Monthly",
        volume = "99",
        year = "1992",
        pages = "403--422",
}

@book{ConcreteMath,
        author = "R.L. Graham and D.E. Knuth and O. Patashnik",
        title = "Concrete mathematics",
        publisher = "Addison-Wesley",
        address = "Reading, MA",
        year = "1989"
}

@unpublished{Simpson,
        author = "H. Simpson",
        title = "Proof of the {R}iemann {H}ypothesis",
        note = "preprint (2003), available at
        \texttt{http://www.math.drofnats.edu/riemann.ps}",
        year = "2003"
}
\end{filecontents}

\usetheme[progressbar=frametitle,numbering=fraction]{metropolis}
\setbeamertemplate{bibliography item}{\insertbiblabel} %% Remove book symbol from references and add number
\usepackage[style=ieee,backend=bibtex,citetracker=true]{biblatex}
\addbibresource{MWE.bib}

% See https://tex.stackexchange.com/a/396754/28146
\makeatletter
\newbibmacro*{hypercite}{%
  \renewcommand{\@makefntext}[1]{\noindent\normalfont##1}%
  \footnotetext{%
    \blxmkbibnote{foot}{%
    \printtext[labelnumberwidth]{%
      \printfield{prefixnumber}%
      \printfield{labelnumber}}%
    \addspace
    \fullcite{\thefield{entrykey}}}}}

\DeclareCiteCommand{\hypercite}%
  {\usebibmacro{cite:init}}
  {\usebibmacro{hypercite}}
  {}
  {\usebibmacro{cite:dump}}

% Redefine the \footcite command to use the reference number
\renewcommand{\footcite}[1]{\cite{#1}\hypercite{#1}}
\makeatother

\begin{document}

\begin{frame}{Some references}
Some references non cited in the footnotes, \cite{Knuth92,Simpson,ConcreteMath} and some cited also in the footnotes\footnote{A footnote}, \footcite{Knuth92} and \footcite{ConcreteMath}\footnote{A second footnote}
\end{frame}


\begin{frame}[t,allowframebreaks]{References} %% Aligned top
\printbibliography[heading=none]
\end{frame}

\end{document}

答案1

要在脚注中仅打印第一作者的姓氏,您可以使用快速而又简单的方法并使用\printnames[][1-1]{author}

梅威瑟:

\documentclass[10pt]{beamer}
\usepackage[utf8]{inputenc}

\begin{filecontents}{MWE.bib}
@article{Knuth92,
        author = "D.E. Knuth",
        title = "Two notes on notation",
        journal = "Amer. Math. Monthly",
        volume = "99",
        year = "1992",
        pages = "403--422",
}

@book{ConcreteMath,
        author = "R.L. Graham and D.E. Knuth and O. Patashnik",
        title = "Concrete mathematics",
        publisher = "Addison-Wesley",
        address = "Reading, MA",
        year = "1989"
}

@unpublished{Simpson,
        author = "H. Simpson",
        title = "Proof of the {R}iemann {H}ypothesis",
        note = "preprint (2003), available at
        \texttt{http://www.math.drofnats.edu/riemann.ps}",
        year = "2003"
}
\end{filecontents}

\usetheme[progressbar=frametitle,numbering=fraction]{moloch}% modern fork of the metropolis theme
\setbeamertemplate{bibliography item}{\insertbiblabel} %% Remove book symbol from references and add number
\usepackage[style=ieee,backend=bibtex,citetracker=true]{biblatex}
\addbibresource{MWE.bib}

% See https://tex.stackexchange.com/a/396754/28146
\makeatletter
\newbibmacro*{hypercite}{%
  \renewcommand{\@makefntext}[1]{\noindent\normalfont##1}%
  \footnotetext{%
    \blxmkbibnote{foot}{%
    \printtext[labelnumberwidth]{%
      \printfield{prefixnumber}%
      \printfield{labelnumber}}%
    \addspace
    \printnames[][1-1]{author}
    \setunit{\addcomma\addspace}
    \printfield{title}}}}

\DeclareCiteCommand{\hypercite}%
  {\usebibmacro{cite:init}}
  {\usebibmacro{hypercite}}
  {}
  {\usebibmacro{cite:dump}}

% Redefine the \footcite command to use the reference number
\renewcommand{\footcite}[1]{\cite{#1}\hypercite{#1}}
\makeatother

\begin{document}

\begin{frame}
\frametitle{Some references}
Some references non cited in the footnotes, \cite{Knuth92,Simpson,ConcreteMath} and some cited also in the footnotes\footnote{A footnote}, \footcite{Knuth92} and \footcite{ConcreteMath}\footnote{A second footnote}
\end{frame}


\begin{frame}[t,allowframebreaks]
\frametitle{References} %% Aligned top
\printbibliography[heading=none]
\end{frame}

\end{document}

在此处输入图片描述

相关内容