3

The mdframed package provides a nice functionality to insert footnotes inside a theorem. I am in search of a way to implement the paragraph style of footnote option within a theorem environment. This forces footnotes to appear within a single paragraph which is a very helpful option when one has many short footnotes which create a long, ugly column and waste space. I am trying to use, for example, the para option within the footmisc package. As you can see in the compilation of my MWE, the footnotes are still printing in their own paragraphs (a single column) for some reason.

Also, please note that a preferable solution would leave the option for both standard and paragraph style footnotes, as one may still want an occasional long footnote. For example, I know the bigfoot package offers this functionality with the distinct \footnote{} and \footnote+{} commands. Thank you in advance for any help.

\documentclass{article}

\usepackage{thmtools}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage[para]{footmisc} 

\declaretheorem[mdframed]{theorem}

\begin{document}

\begin{theorem}
     This is the first part of the theorem,\footnote{First footnote} this is the second part,\footnote{Second footnote} and this is the third part.\footnote{Third footnote}
\end{theorem}

\end{document}

enter image description here

1 Answer 1

3

Some dirty work.

Use \parfn and \normalfn to change between different shapes of footnote.

Use \parmpfn and \normalmpfn to change between different shapes of footnote in minipage.

\documentclass{article}

\usepackage{thmtools}
\usepackage[framemethod=TikZ]{mdframed}
\makeatletter

\newbox\my@footins%
\newtoks\my@output%

\long\def\my@footnotetext#1{%
  \global\setbox\my@footins\hbox{%
    \unhbox\my@footins
    \reset@font\footnotesize
    \hsize\columnwidth
    \@parboxrestore
    \protected@edef\@currentlabel
         {\csname p@footnote\endcsname\@thefnmark}%
    \color@begingroup
      \my@makefntext{%
        \rule\z@\footnotesep\ignorespaces#1\rule{1em}\z@\@finalstrut\strutbox}%
    \color@endgroup}}

\def\my@makecol{%
  \setbox\footins\vbox{\footnoterule\box\my@footins}
  \my@latex@makecol%
}

\let\my@latex@makecol\@makecol
\let\my@latex@footnotetext\@footnotetext

\def\parfn{%
  \let\@makecol\my@makecol%
  \let\@footnotetext\my@footnotetext%
}%
\def\normalfn{%
  \let\@makecol\my@latex@makecol%
  \let\@footnotetext\my@latex@footnotetext%
}%

\long\def\my@mpfootnotetext#1{%
  \global\setbox\@mpfootins\hbox{%
    \unhbox\@mpfootins
    \reset@font\footnotesize
    \hsize\columnwidth
    \@parboxrestore
    \protected@edef\@currentlabel
         {\csname p@mpfootnote\endcsname\@thefnmark}%
    \color@begingroup
      \my@makefntext{%
        \rule\z@\footnotesep\ignorespaces#1\rule{1em}\z@\@finalstrut\strutbox}%
    \color@endgroup}}

\newrobustcmd*\mymdf@footnoteoutput{%
     \ifvoid\@mpfootins\else%
          \nobreak%
          \vskip\mdf@footenotedistance@length%
          \normalcolor%
          \mdf@footnoterule%
          \noindent\unhbox\@mpfootins%
     \fi%
}

\newrobustcmd*\mymdf@footnoteinput{%
   \def\@mpfn{mpfootnote}%
   \def\thempfn{\thempfootnote}%
   \c@mpfootnote\z@%
   \let\@footnotetext\my@mpfootnotetext%
}

\newcommand\my@makefntext[1]{%
    \parindent 1em%
    \noindent
    \@makefnmark#1}

\let\oldmdf@footnoteinput\mdf@footnoteinput%
\let\oldmdf@footnoteoutput\mdf@footnoteoutput%

\def\parmpfn{%
  \let\mdf@footnoteinput\mymdf@footnoteinput%
  \let\mdf@footnoteoutput\mymdf@footnoteoutput%
}

\def\normalmpfn{%
  \let\mdf@footnoteinput\oldmdf@footnoteinput%
  \let\mdf@footnoteoutput\oldmdf@footnoteoutput%
}

\makeatother

\declaretheorem[mdframed]{theorem}

\begin{document}
\parfn
Some text\footnote{test}

Some text\footnote{test}

\parmpfn
\begin{theorem}
     This is the first part of the theorem,\footnote{First footnote} this is the second part,\footnote{Second footnote} and this is the third part.\footnote{Third footnote}
\end{theorem}

\normalmpfn
\begin{theorem}
     This is the first part of the theorem,\footnote{First footnote} this is the second part,\footnote{Second footnote} and this is the third part.\footnote{Third footnote}
\end{theorem}

\end{document}

enter image description here

4
  • Is there any way to switch back and forth between these two modes then? Distinct commands?
    – tdstoff
    Sep 22, 2020 at 16:45
  • 1
    Sure, see the changed answer.
    – ZhiyuanLck
    Sep 22, 2020 at 17:56
  • Final thought: Could the \footnote command itself have this distinction? This way I wouldn't have to constantly change the \parmpfn flag, and both a paragraph style and column style footnote could exist. Something like a combination of \footnotepar{} and just regular \footnote{}?
    – tdstoff
    Sep 22, 2020 at 19:12
  • 1
    You can not let two footnote of different shapes show in the same page.
    – ZhiyuanLck
    Sep 23, 2020 at 6:06

You must log in to answer this question.

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