在 mdframed 中更改脚注符号

在 mdframed 中更改脚注符号

很难更改脚注符号,特别是在mdframed环境。

我以为我已经完成了,但我遇到了更改脚注符号,但可接受的解决方案(在 MWE 中注释掉)似乎对我不起作用。然后我尝试了

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

这似乎有效,但在mdframed环境中却不行,即使我\renewcommand在之后发出\begin{mdframed}

在此处输入图片描述

参考:

笔记:

  • 对于这个特定的用例,我真的仅有的我想要一个符号。但是有一个实际有效且允许使用多个符号的解决方案对我来说很好。

代码:

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

答案1

内的脚注mdframed被视为 内的内容minipage,因此\thempfootnote使用:

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

在此处输入图片描述

当然,您可以根据一组符号进行定义,并将其仅应用于内部的脚注mdframed(如下面的示例所示)或所有脚注(如下方的示例所示):

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

在此处输入图片描述

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

在此处输入图片描述

相关内容