9

Am having difficulty changing the footnote symbol, especially within an mdframed environment.

I thought I was done when I came across Changing footnote symbols, but the accepted solution (commented out in the MWE) does not seem to work for me. Then I tried the

\renewcommand{\thefootnote}{$\dagger$}

which seems to work, but not inside an mdframed environment, even if I issue the \renewcommand after the \begin{mdframed}:

enter image description here

References:

Notes:

  • For this particular use case I really only want one symbol. But having a solution that actually works and allows for multiple symbols is fine with me.

Code:

\documentclass{article}
\usepackage[textheight=3cm, textwidth=9cm]{geometry}
\usepackage{mdframed}

%% This at least produces the dagger outside of mdframed
\renewcommand{\thefootnote}{$\dagger$}%

%%% https://tex.stackexchange.com/questions/78221/changing-footnote-symbols
%%% This yields a numerical value outside of mdframed and an alphabetical foot note inside mdframed
%\makeatletter
%\def\@fnsymbol#1{\ensuremath{\ifcase#1\or *\or \dagger\or \ddagger\or
%   \mathsection\or \mathparagraph\or \|\or **\or \dagger\dagger
%   \or \ddagger\ddagger \else\@ctrerr\fi}}
%\makeatother


\begin{document}

This\footnote{Outside of Mdframed a dagger is used as desired.} is a footnote outside of mdframed.

\begin{mdframed}
\renewcommand{\thefootnote}{$\dagger$}% <-- This seems to have no effect.
This\footnote{Want a dagger for footnotes inside of Mdframed} is a footnote inside mdframed.
\end{mdframed}

\end{document}
0

1 Answer 1

11

Footnotes inside a mdframed are treated as inside a minipage, so \thempfootnote is used:

\documentclass{article}
\usepackage[textheight=3cm, textwidth=9cm]{geometry}
\usepackage{mdframed}

%% This at least produces the dagger outside of mdframed
\renewcommand{\thefootnote}{$\dagger$}%

%%% http://tex.stackexchange.com/questions/78221/changing-footnote-symbols
%%% This yields a numerical value outside of mdframed and an alphabetical foot note inside mdframed
%\makeatletter
%\def\@fnsymbol#1{\ensuremath{\ifcase#1\or *\or \dagger\or \ddagger\or
%   \mathsection\or \mathparagraph\or \|\or **\or \dagger\dagger
%   \or \ddagger\ddagger \else\@ctrerr\fi}}
%\makeatother


\begin{document}

This\footnote{Outside of Mdframed a dagger is used as desired.} is a footnote outside of mdframed.

\begin{mdframed}
\renewcommand{\thempfootnote}{$\dagger$}% <-- This will now have an effect.
This\footnote{Want a dagger for footnotes inside of Mdframed} is a footnote inside mdframed.
\end{mdframed}

\end{document}

enter image description here

Of course, you can make the definition based on a set of symbols and apply it either only to footnotes inside mdframed (as in my example just below) or to all footnotes (as in the example at the bottom):

\documentclass{article}
\usepackage[textheight=6cm, textwidth=9cm]{geometry}
\usepackage{mdframed}
\usepackage{etoolbox}

\makeatletter
\AtBeginEnvironment{mdframed}{%
\def\@fnsymbol#1{\ensuremath{\ifcase#1\or \dagger\or \ddagger\or
   \mathsection\or \mathparagraph\or \|\or **\or \dagger\dagger
   \or \ddagger\ddagger \else\@ctrerr\fi}}%
}   
\renewcommand\thempfootnote{\fnsymbol{mpfootnote}}
\makeatother

\begin{document}

This\footnote{I have a regular marker for this footnote outside of \texttt{mdframed}} is a footnote outside mdframed.

\begin{mdframed}
This\footnote{I have a \texttt{dagger} for this footnote inside of \texttt{mdframed}} is a footnote inside mdframed.
This\footnote{I have a \texttt{ddagger} for this footnote inside of \texttt{mdframed}} is a footnote inside mdframed.
This\footnote{I have a \texttt{mathsection} for this footnote inside of \texttt{mdframed}} is a footnote inside mdframed.
\end{mdframed}

This\footnote{I have a regular marker for this footnote outside of \texttt{mdframed}} is a footnote outside mdframed.

\end{document}

enter image description here

\documentclass{article}
\usepackage[textheight=6cm, textwidth=9cm]{geometry}
\usepackage{mdframed}
\usepackage{xpatch}

\makeatletter
\def\@fnsymbol#1{\ensuremath{\ifcase#1\or \dagger\or \ddagger\or
   \mathsection\or \mathparagraph\or \|\or **\or \dagger\dagger
   \or \ddagger\ddagger \else\@ctrerr\fi}}%
\renewcommand\thefootnote{\fnsymbol{footnote}}   
\renewcommand\thempfootnote{\fnsymbol{mpfootnote}}
\makeatother

\begin{document}

This\footnote{I have a \texttt{dagger} for this footnote outside of \texttt{mdframed}} is a footnote outside mdframed.

\begin{mdframed}
This\footnote{I have a \texttt{dagger} for this footnote inside of \texttt{mdframed}} is a footnote inside mdframed.
This\footnote{I have a \texttt{ddagger} for this footnote inside of \texttt{mdframed}} is a footnote inside mdframed.
This\footnote{I have a \texttt{mathsection} for this footnote inside of \texttt{mdframed}} is a footnote inside mdframed.
\end{mdframed}

This\footnote{I have a \texttt{ddagger} for this footnote outside of \texttt{mdframed}} is a footnote outside mdframed.

\end{document}

enter image description here

3
  • If it is easy can you also add how to change the footnote outside the mdframed as well. I don't need it, but that will complete all the possible options. Using the obvious \renewcommand\thefootnote{\fnsymbol{mpfootnote}} does not work. Commented May 8, 2014 at 1:23
  • @PeterGrill I've added this option in my updated answer. Commented May 8, 2014 at 1:42
  • Very compliments for your answer.
    – Sebastiano
    Commented Oct 26, 2017 at 20:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .