我对 beamer 中分割帧中的命令编号有疑问\footfullcite{}
。我想增加每个引用命令的引用计数器,即使这些命令不在同一显示页面上。如果标题已被引用,它应该获得与第一个引用相同的编号。在最后一页,\printbibliography
应该按引用顺序对引用进行排序,并将相应的编号设置为项目。我知道,脚注引用与普通引用有所不同,无论如何,我希望脚注引用的行为与标准引用在样式上具有类似的行为biblatex
numeric
。
这是一个示例代码,我在其中评论了所需的行为。
\documentclass[aspectratio=169]{beamer}
\usepackage[language=english, backend=biber, style=authoryear]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{exampleReferences.bib}
@book{foo1,
year = {2001},
title = {Example title 1},
author = {John One}
}
@book{foo2,
year = {2002},
title = {Example title 2},
author = {John Two}
}
\end{filecontents*}
\addbibresource{exampleReferences.bib}
\begin{document}
\begin{frame}{Example frame 1}
Text on frame that doesn't change.\\
%This citation should be marked with a 1
\only<1>{Special text foo1 to be cited \footfullcite{foo1}}
%This citation should be marked with a 2, as it is the second citation and different from the first citation
\only<2>{Another special text to be cited \footfullcite{foo2}}
%This should be marked once again with 1, as it was already cited before.
\only<3>{Another passage of special text foo1 to be citeted \footfullcite{foo1}}
\end{frame}
\begin{frame}{Example frame 2}
%The reference on a new frame should get the same marker if it was already cited (here it should get a 2)
New frame with reference to already referenced text \footfullcite{foo2}
\end{frame}
\begin{frame}{Bibliography}
%The bibliography of all cited texts.
%It should be sorted in citation-order and have a citation-number item instead of the image [e.g. [1]~\cite{foo1}].
\printbibliography
\end{frame}
\end{document}
有什么建议么?
答案1
最简单的方法似乎是基于该风格numeric
并supercite
用两遍结构进行修改,这样我们就可以为每个引用获得单独的脚注。
\documentclass[aspectratio=169]{beamer}
\usepackage[backend=biber, style=numeric, sorting=none]{biblatex}
\setbeamertemplate{bibliography item}{\insertbiblabel}
\makeatletter
\newcommand*{\mkblankfootnote}[1]{%
\begingroup
\renewcommand\thefootnote{}%
\footnotetext{\bibfootnotewrapper{#1}}%
\endgroup
}
\newcommand*{\mkbibsupercite}[1]{%
\def\cbx@savedcites{\cbx@footfullcite}%
\mkbibsuperscript{\mkbibbrackets{#1}}%
\cbx@savedcites}
\DeclareCiteCommand{\supercite}[\mkbibsupercite]
{\gdef\cbx@savedkeys{}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}%
{}%
\xappto\cbx@savedkeys{\thefield{entrykey},}}
{\supercitedelim}
{\protected@xappto\cbx@savedcites{%
[\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}}
\DeclareCiteCommand{\cbx@footfullcite}
{}
{\mkblankfootnote{%
\printtext[labelnumberwidth]{%
\usebibmacro{cite}%
}%
\setunit{\addspace}%
\usedriver
{\DeclareNameAlias{sortname}{default}}
{\thefield{entrytype}}}}
{}
{}
\makeatother
\usepackage{filecontents}
\begin{filecontents*}{exampleReferences.bib}
@book{foo1,
year = {2001},
title = {Example title 1},
author = {John One}
}
@book{foo2,
year = {2002},
title = {Example title 2},
author = {John Two}
}
\end{filecontents*}
\addbibresource{exampleReferences.bib}
\begin{document}
\begin{frame}{Example frame 1}
Text on frame that doesn't change.
%This citation should be marked with a 1
\only<1>{Special text foo1 to be cited \supercite{foo1}}
%This citation should be marked with a 2, as it is the second citation and different from the first citation
\only<2>{Another special text to be cited \supercite{foo2}}
%This should be marked once again with 1, as it was already cited before.
\only<3>{Another passage of special text foo1 to be citeted \supercite{foo1}}
\end{frame}
\begin{frame}{Example frame 2}
%The reference on a new frame should get the same marker if it was already cited (here it should get a 2)
New frame with reference to already referenced text \supercite{foo2}
\end{frame}
\begin{frame}{Bibliography}
%The bibliography of all cited texts.
%It should be sorted in citation-order and have a citation-number item instead of the image [e.g. [1]~\cite{foo1}].
\printbibliography
\end{frame}
\end{document}
答案2
这只是一个简单的技巧,缺点请参见moewes 评论。
\documentclass[aspectratio=169]{beamer}
\usepackage[language=english, backend=biber, style=numeric]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{exampleReferences.bib}
@book{foo1,
year = {2001},
title = {Example title 1},
author = {John One}
}
@book{foo2,
year = {2002},
title = {Example title 2},
author = {John Two}
}
\end{filecontents*}
\addbibresource{exampleReferences.bib}
\setbeamertemplate{bibliography item}[text]
\makeatletter
\DeclareCiteCommand{\cite}[\mkbibsuperscript]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{\multicitedelim}
{\usebibmacro{postnote}}
\renewbibmacro*{cite}{%
\printtext[bibhyperref]{%
\printfield{labelprefix}%
\printfield{labelnumber}%
\ifbool{bbx:subentry}{%
\printfield{entrysetcount}
}{}%
}%
\footnotetext[\thefield{labelnumber}]{%
\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}
}%
}
\makeatother
\begin{document}
\begin{frame}{Example frame 1}
Text on frame that doesn't change.\\
%This citation should be marked with a 1
\only<1>{Special text foo1 to be cited \cite{foo1}}
%This citation should be marked with a 2, as it is the second citation and different from the first citation
\only<2>{Another special text to be cited \cite{foo2}}
%This should be marked once again with 1, as it was already cited before.
\only<3>{Another passage of special text foo1 to be citeted \cite{foo1}}
\end{frame}
\begin{frame}{Example frame 2}
%The reference on a new frame should get the same marker if it was already cited (here it should get a 2)
New frame with reference to already referenced text \cite{foo2}
\end{frame}
\begin{frame}{Bibliography}
%The bibliography of all cited texts.
%It should be sorted in citation-order and have a citation-number item instead of the image [e.g. [1]~\cite{foo1}].
\printbibliography
\end{frame}
\end{document}