\footnotemark and \footnotetext in minipage

The Tufte handout class give a neat layout that shows the footnote at the right hand side not bottom line.

But, when I use the minipage with tufte-handout, and if the minipage has the footnote, the footnote is broken as the class modifies the footnote setup. So, I used the \footnotemark and \footnotetext, but the number is shown in alphabetical form at the bottom, whereas the arabic in the text area. And even, it gives me the error message -

l.29 The caller\footnotemark{\value{footnote}}
\footnotetext[2]{hello} uses ...


What's wrong with my code? And how to get the correct footnote number?

\documentclass{tufte-handout}
\usepackage{tikz}
\newcommand{\clj}{\textcolor{blue}{\textsc{clojure}}}

\title{Week 31, August$^{1st}$ 2010}
\newlength{\RoundedBoxWidth}
\newsavebox{\GrayRoundedBox}
\newenvironment{GrayBox}[1][\dimexpr\textwidth-4.5ex]%
{\setlength{\RoundedBoxWidth}{\dimexpr#1}
\begin{lrbox}{\GrayRoundedBox}
\begin{minipage}{\RoundedBoxWidth}}%
{   \end{minipage}
\end{lrbox}
\begin{center}
\begin{tikzpicture}%
\draw node[draw=black,fill=black!10,rounded corners,%
inner sep=2ex,text width=\RoundedBoxWidth]%
{\usebox{\GrayRoundedBox}};
\end{tikzpicture}
\end{center}}

\begin{document}
hello\footnote{experiment}
%\newcounter{\myfootnote}
%\setcounter{\myfootnote}{\value{footnote}}
\vskip2ex
\begin{GrayBox}[1.2\textwidth]
{\LARGE How to use external \clj\ code}
\vskip0.3em\hrule\vskip1em

The caller uses use' to use \verb|CLASSPATH/hello.clj|. Now, it's OK to call
the (hi).\footnotemark[\thefootnote]{}\footnotetext[\thefootnote]{Hello}

\end{GrayBox}
hello\footnote{experiment again}
\end{document}

-

Footnotes within minipage environments are printed with small letters. The definition in latex.ltx is

\def\thempfootnote{{\itshape\@alph\c@mpfootnote}}


You could redefine it. A quick way would be:

\let\thempfootnote\thefootnote


Afterwards the footnote symbols within a minipage will be an arabic number as well.

-
Thanks it works. – prosseek Aug 4 '10 at 0:26

Also, you probably shouldn't use \thefootnote in the optional argument to \footnotemark and \footnotetext, since those commands expect a number, while \thefootnote can carry formatting information, and may actually be text (if you use roman or alpha numbering) or symbols.

Instead you should use \value{footnote}.

But better yet, you should do this: in the definition of the GrayBox environment, add the lines

\setcounter{mpfootnote}{\value{footnote}}
\renewcommand{\thempfootnote}{\arabic{mpfootnote}}


directly after \begin{minipage}, and

\setcounter{footnote}{\value{mpfootnote}}


directly before \end{minipage} so that the GrayBox will have consistent numbering of footnotes with the surrounding text, and you won't have to manually increment the footnote counter after every use. Of course, you should swap \arabic to the appropriate style you want for the footnote.

-