mdframed 定理内的段落样式脚注?

mdframed 定理内的段落样式脚注?

mdframed包提供了一个很好的功能,可以在定理中插入脚注。我正在寻找一种方法来在定理环境中实现脚注选项的段落样式。这会强制脚注出现在单个段落中,当有许多短脚注时,这是一个非常有用的选项,因为短脚注会形成一个长而丑陋的列并浪费空间。例如,我正在尝试使用包para中的选项footmisc。正如您在我的 MWE 汇编中所看到的,出于某种原因,脚注仍然打印在自己的段落(单个列)中。

另外,请注意,更好的解决方案是保留标准选项段落样式的脚注,因为有时可能仍需要较长的脚注。例如,我知道该bigfoot软件包通过 distinct\footnote{}\footnote+{}命令提供了此功能。提前感谢您的帮助。

\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}

在此处输入图片描述

答案1

一些脏活。

使用\parfn\normalfn在不同形状的脚注之间切换。

使用\parmpfn\normalmpfn在 中切换不同形状的脚注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}

在此处输入图片描述

相关内容