从接受回答,当我尝试添加笔记[不确定正确的术语是什么] 引用(如\cite[page 0]{mybibitem}
),我观察到笔记出现两次(参见下面的最小工作示例):
\documentclass{beamer}
\usepackage[style=numeric,citecounter=true,citetracker=true]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{myreferences.bib}
@online{bad,
author = {{Bad Man}},
year = {1313},
title = {Bad Title},
url = {http://badurl.com/},
}
\end{filecontents*}
\addbibresource{myreferences.bib}
%https://tex.stackexchange.com/a/165016/38244
\hypersetup{
colorlinks,
citecolor=red,
linkcolor=blue,
% backref=true
}
\usepackage{algorithm}
\PassOptionsToPackage{noend}{algpseudocode}% comment out if want end's to show
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx
\usepackage{algorithmicx}
\let\svthefootnote\thefootnote
\makeatletter
% https://tex.stackexchange.com/a/29931/38244
\DeclareCiteCommand{\cite}
{\usebibmacro{prenote}}%
{%
\ifciteseen{}{%
\usebibmacro{citeindex}%
\let\thefootnote\relax%
\footnotetext{%
\blx@anchor
\mkbibbrackets{\usebibmacro{cite}}%
\setunit{\addnbspace}
\printnames{labelname}%
\setunit{\labelnamepunct}
\printfield[citetitle]{title}%
\newunit%
\printfield[]{year}%
}%
\let\thefootnote\svthefootnote%
}%
\autocite{\thefield{entrykey}}%
}
{\addsemicolon\space}
{\usebibmacro{postnote}}
\makeatother
\begin{document}
\begin{frame}{What I found}
First time, \cite[page 99]{bad}
\end{frame}
\begin{frame}{Again}
Next time, \cite[page 1]{bad} only
\end{frame}
\end{document}
我怎样才能消除重复?
答案1
您应该在的定义中删除prenote
和postnote
部分,也许还有相关的标点符号,因为\cite
调用\autocite
将处理这些问题:
\documentclass{beamer}
\usepackage[style=numeric,citecounter=true,citetracker=true]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{myreferences.bib}
@online{bad,
author = {{Bad Man}},
year = {1313},
title = {Bad Title},
url = {http://badurl.com/},
}
\end{filecontents*}
\addbibresource{myreferences.bib}
%https://tex.stackexchange.com/a/165016/38244
\hypersetup{
colorlinks,
citecolor=red,
linkcolor=blue,
% backref=true
}
\usepackage{algorithm}
\PassOptionsToPackage{noend}{algpseudocode}% comment out if want end's to show
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx
\usepackage{algorithmicx}
\let\svthefootnote\thefootnote
\makeatletter
% https://tex.stackexchange.com/a/29931/38244
\DeclareCiteCommand{\cite}
{}%
{%
\ifciteseen{}{%
\usebibmacro{citeindex}%
\let\thefootnote\relax%
\footnotetext{%
\blx@anchor
\mkbibbrackets{\usebibmacro{cite}}%
\setunit{\addnbspace}
\printnames{labelname}%
\setunit{\labelnamepunct}
\printfield[citetitle]{title}%
\newunit%
\printfield[]{year}%
}%
\let\thefootnote\svthefootnote%
}%
\autocite{\thefield{entrykey}}%
}
{}
{}
\makeatother
\begin{document}
\begin{frame}{What I found}
First time, \cite[page 99]{bad}
\end{frame}
\begin{frame}{Again}
Next time, \cite[page 1]{bad} only
\end{frame}
\end{document}
我还删除了\addsemicolon\space
,但您可能想要保留它,它是同一个调用中的多个引用之间的标点符号\cite
:\cite{one,two}
。
在您的评论中,您要求从脚注的输出中删除年份。您只需从新cite
命令中删除相应的行:
\makeatletter
\DeclareCiteCommand{\cite}
{}%
{%
\ifciteseen{}{%
\usebibmacro{citeindex}%
\let\thefootnote\relax%
\footnotetext{%
\blx@anchor
\mkbibbrackets{\usebibmacro{cite}}%
\setunit{\addnbspace}
\printnames{labelname}%
\setunit{\labelnamepunct}
\printfield[citetitle]{title}%
}%
\let\thefootnote\svthefootnote%
}%
\autocite{\thefield{entrykey}}%
}
{}
{}
\makeatother
答案2
\documentclass{beamer}
\usepackage[style=numeric,citecounter=true,citetracker=true]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{myreferences.bib}
@online{bad,
author = {{Bad Man}},
year = {1313},
title = {Bad Title},
url = {http://badurl.com/},
}
\end{filecontents*}
\addbibresource{myreferences.bib}
%https://tex.stackexchange.com/a/165016/38244
\hypersetup{
colorlinks,
citecolor=red,
linkcolor=blue,
% backref=true
}
\usepackage{algorithm}
\PassOptionsToPackage{noend}{algpseudocode}% comment out if want end's to show
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx
\usepackage{algorithmicx}
\let\svthefootnote\thefootnote
\makeatletter
% https://tex.stackexchange.com/a/29931/38244
\DeclareCiteCommand{\cite}
{\usebibmacro{prenote}}%
{%
\ifciteseen{}{%
\usebibmacro{citeindex}%
\let\thefootnote\relax%
\footnotetext{%
\blx@anchor
\mkbibbrackets{\usebibmacro{cite}}%
\setunit{\addnbspace}
\printnames{labelname}%
\setunit{\labelnamepunct}
\printfield[citetitle]{title}%
\newunit%
\printfield[]{year}%
}%
\let\thefootnote\svthefootnote%
}%
\autocite{\thefield{entrykey}}%
}
{}
{}
\makeatother
\begin{document}
\begin{frame}{What I found}
First time, \cite[page 99]{bad}
\end{frame}
\begin{frame}{Again}
Next time, \cite[page 1]{bad} only
\end{frame}
\end{document}