Beamer 引文脚注:算法环境

Beamer 引文脚注:算法环境

跟进,我在使用环境时遇到了一个问题algorithm。请参见下面的最小工作示例(大部分是从回答):在这里,algorithm环境只是将引用视为好像它之前没有被打印过一样。

\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}
    test\footnote{test}

    First time, \cite{bad}   

    test\footnote{test}
\end{frame}

\begin{frame}{Again}
    Next time, \cite{bad} only
\end{frame}


\begin{frame}{Again 1}
    \begin{algorithm}[H]
        \begin{algorithmic}[1]
            \State \cite{bad}
        \end{algorithmic}
    \end{algorithm}
\end{frame}


\begin{frame}{Again 2}

    \begin{table}[htb]
        \begin{tabular}{cc}
            ee & \cite{bad}\\
        \end{tabular}
    \end{table}
\end{frame}

\end{document}

只是为了清楚我需要什么:

  • 每个参考书目条目将仅出现在首次引用页面的脚注中
  • 同一引用键的后续实例将超链接回打印参考书目的脚注

答案1

这是一个回答来自用户萨姆卡特(显然已被该网站暂停访问):

\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}
    test\footnote{test}

    First time, \cite{bad}   

    test\footnote{test}
\end{frame}

\begin{frame}{Again}
    Next time, \cite{bad} only
\end{frame}


\begin{frame}{Again 1}
%    \begin{algorithm}[H]
\rule{\textwidth}{1pt}
        \begin{algorithmic}[1]
            \State \cite{bad}
        \end{algorithmic}
%    \end{algorithm}
\raisebox{.4\baselineskip}{\rule{\textwidth}{1pt}}
\end{frame}


\begin{frame}{Again 2}

    \begin{table}[htb]
        \begin{tabular}{cc}
            ee & \cite{bad}\\
        \end{tabular}
    \end{table}
\end{frame}

\end{document}

我的理解是,这个解决方案algorithm用水平规则取代了环境。

相关内容