# How to create footnote for algorithmicx's comment

The number is displayed, but the footnote text is missing. How to fix that?

\documentclass{article}

\usepackage{algorithm}
% Need it for floating environment
\usepackage[noend]{algpseudocode}
% Hide endif .etc
\usepackage{caption}
% Need it for \caption*
\usepackage{xspace}
% Fix macro spacing bug

\algrenewcommand{\algorithmicrequire}{\textbf{Input:}}
\algrenewcommand{\algorithmicensure}{\textbf{Output:}}
\algrenewcommand{\algorithmicforall}{\textbf{for each}}
\newcommand{\To}{\textbf{to}\xspace}
% Not stated in manual, \Return and \algorithmicreturn are defined, but no \algorithmicstate, why?
\newcommand{\Dosth}{\State \textbf{Do Something}\xspace}
% Note no space before \xspace
\newcommand{\ForEach}{\ForAll}
% Fail to use \algorithmicforall, why?
\begin{document}

\begin{algorithm}
\caption*{\textbf{Algorithm:} \textsc{Depth First Search}} \label{alg:dfs1}

\begin{algorithmic}[1]

\Function{DFS}{$v$}
\State $count \gets count + 1$
\Please{mark} $v$ with $count$
\Dosth with $v$
\ForEach{vertex $w \in \mathcal{V}$ adjacent to $v$}
\If{$w$ is marked with $0$} \Comment Only needed to exclude its parent.\footnote{No sibling is visited before the loop. Each sibling will be visited exactly once due to the nature of the loop.}
\State \Call{DFS}{$w$}
\EndIf
\EndFor
\State \Return
\EndFunction

\end{algorithmic}
\end{algorithm}

\end{document}

-

Instead of the \footnote command, you can use \footnotemark and \footnotetext:

\documentclass{article}

\usepackage{algorithm}
% Need it for floating environment
\usepackage[noend]{algpseudocode}
% Hide endif .etc
\usepackage{caption}
% Need it for \caption*
\usepackage{xspace}
% Fix macro spacing bug

\algrenewcommand{\algorithmicrequire}{\textbf{Input:}}
\algrenewcommand{\algorithmicensure}{\textbf{Output:}}
\algrenewcommand{\algorithmicforall}{\textbf{for each}}
\newcommand{\To}{\textbf{to}\xspace}
% Not stated in manual, \Return and \algorithmicreturn are defined, but no \algorithmicstate, why?
\newcommand{\Dosth}{\State \textbf{Do Something}\xspace}
% Note no space before \xspace
\newcommand{\ForEach}{\ForAll}
% Fail to use \algorithmicforall, why?
\begin{document}

\begin{algorithm}
\caption*{\textbf{Algorithm:} \textsc{Depth First Search}} \label{alg:dfs1}

\begin{algorithmic}[1]

\Function{DFS}{$v$}
\State $count \gets count + 1$
\Please{mark} $v$ with $count$
\Dosth with $v$
\ForEach{vertex $w \in \mathcal{V}$ adjacent to $v$}
\If{$w$ is marked with $0$} \Comment Only needed to exclude its parent.\footnotemark
\State \Call{DFS}{$w$}
\EndIf
\EndFor
\State \Return
\EndFunction

\end{algorithmic}
\end{algorithm}
\footnotetext{No sibling is visited before the loop. Each sibling will be visited exactly once due to the nature of the loop.}

\end{document}

-
The footnote mark floats with the algorithm and the footnotetext remains where it's defined. I have my footnotetext two pages before the footnotemark, any solution for this? Thank you. –  Trylks Dec 10 '13 at 16:20