Beamer 引文脚注:在引文中添加 *注释*

Beamer 引文脚注:在引文中添加 *注释*

这是一个跟进问题(见这个问题另一个后续问题也是如此)。

从接受回答,当我尝试添加笔记[不确定正确的术语是什么] 引用(如\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 页 第2页

我怎样才能消除重复?

答案1

您应该在的定义中删除prenotepostnote部分,也许还有相关的标点符号,因为\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}

相关内容