savenote 与 tcolorbox,编号问题

savenote 与 tcolorbox,编号问题

我使用tikz-boxes 和tcolorbox我希望将脚注放在页面底部方框之外,并与其他方框的编号相同。总而言之,我想要 tikz 或 tcolorbox 脚注不是与众不同

所以我尝试了 Martin Scharrer 的解决方案这个问题,使用savenotes环境。我将savenotes环境包裹在tikzpicture和周围tcolorbox-boxtikz没问题,但不是tcolorbox。脚注的文本位于页面底部(可以接受),但是它有其他编号

代码如下:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{shapes,snakes}

\usepackage[most]{tcolorbox}

\usepackage{footnote}

\usepackage{environ}

\renewcommand{\thefootnote}{[\Roman{footnote}]}

\tikzstyle{mybox} = [draw=black, fill=white, very thick,
rectangle, rounded corners, inner sep=10pt, inner ysep=20pt]
\NewEnviron{tikzbox}{
    \begin{savenotes} % I add this!!!
            \begin{tikzpicture}
\node [mybox] (box){
    \begin{minipage}{0.50\textwidth}
            \BODY
    \end{minipage}
};
\end{tikzpicture}
\end{savenotes}% I add this!!!

}

\NewEnviron{Tbox}{
        \begin{savenotes}
    \begin{tcolorbox}[enhanced,
        breakable]
        \BODY
    \end{tcolorbox}
\end{savenotes}

}


\begin{document}

Some main text Some main text Some main text Some main text Some main text Some main text\footnote{The first footnote.}

Other main text Other main text Other main text Other main text\footnote{The second footnote.}

\begin{tikzbox}
Some tikzboxed text Some tikzboxed text Some tikzboxed text\footnote{This is OK.}
\end{tikzbox}

\begin{Tbox}
Some tcolorboxed text Some tcolorboxed text Some tcolorboxed text Some tcolorboxed text Some tcolorboxed text Some tcolorboxed text\footnote{This is not OK. I want this footnote outside of the box, at the bottom of the page and with number [IV].}
\end{Tbox}

\end{document}

它看起来是这样的:

在此处输入图片描述

答案1

tcolorbox最后的 es 是minipages。您需要通过为\@mpfnand添加合适的定义来恢复为正常脚注\thempfn(我也稍微缩短了代码):

\documentclass{article}

\usepackage[most]{tcolorbox}
\usepackage{footnote}
\renewcommand{\thefootnote}{[\Roman{footnote}]}

\makeatletter
\newtcolorbox{Tbox}{
  enhanced, breakable,
  before upper=\def\@mpfn{footnote}\def\thempfn{\thefootnote}%
}
\makeatother
\makesavenoteenv{Tbox}

\begin{document}

Some main text Some main text Some main text Some main text Some main text
Some main text\footnote{The first footnote.}

Other main text Other main text Other main text Other main text\footnote{The
  second footnote.}

\begin{Tbox}
  Some tcolorboxed text Some tcolorboxed text Some tcolorboxed text Some
  tcolorboxed text Some tcolorboxed text Some tcolorboxed text\footnote{This
    is not OK. I want this footnote outside of the box, at the bottom of the
    page and with number [III].}
\end{Tbox}

\end{document}

在此处输入图片描述

在此处输入图片描述

相关内容