tcolorbox 패키지를 사용하여 만든 예제 환경에서 \footnote 명령을 어떻게 처리합니까?

tcolorbox 패키지를 사용하여 만든 예제 환경에서 \footnote 명령을 어떻게 처리합니까?

관련 항목에서 @Jonathan이 제안한 예제 환경을 사용하고 싶습니다.우편. 이는 거의 동일한 MWE입니다.

\documentclass{article}
\usepackage[most]{tcolorbox}
\newcounter{testexample}
\usepackage{xparse}
\usepackage{lipsum}
\def\exampletext{Example}
\NewDocumentEnvironment{testexample}{ O{} }
{
\colorlet{colexam}{red!55!black}
\newtcolorbox[use counter=testexample]{testexamplebox}{
    empty,
    title={\exampletext: #1},
    attach boxed title to top left,
       minipage boxed title,
    boxed title style={empty,size=minimal,toprule=0pt,top=4pt,left=3mm,overlay={}},
coltitle=colexam,fonttitle=\bfseries,
before=\par\medskip\noindent,parbox=false,boxsep=0pt,left=3mm,right=0mm,top=2pt,breakable,pad at break=0mm,
   before upper=\csname @totalleftmargin\endcsname0pt,
overlay unbroken={\draw[colexam,line width=.5pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); },
overlay first={\draw[colexam,line width=.5pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); },
overlay middle={\draw[colexam,line width=.5pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); },
overlay last={\draw[colexam,line width=.5pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); },%
}
\begin{testexamplebox}}
{\end{testexamplebox}\endlist}

\begin{document}

\begin{testexample}[Latin Text]
\lipsum[1]\footnote{my footnote}
\lipsum[2]
\end{testexample}

\end{document}

\footnote그런 다음 예제 끝 부분이 아닌 페이지 하단에 각주를 만들었 으면 합니다 . 나는 이미 찾았습니다이 답변비슷한 질문에 대해서는 이미 등장한 각주를 사용하는 것에 관한 것입니다. \footnote예시에 한 번만 나타나는 경우에도 똑같이 할 수 있나요 ?

답변1

환경 내에서 각주를 재정의하는 방법은 다음과 같습니다.

\documentclass{article}
\usepackage[most]{tcolorbox}
\newcounter{testexample}
\usepackage{xparse}
\usepackage{pgffor}
\usepackage{lipsum}
\newcounter{FootnoteCounter}
\newcounter{Init}
\let\oldfootnote\footnote
\def\exampletext{Example}

\NewDocumentEnvironment{testexample}{ O{} }
{
\colorlet{colexam}{red!55!black}
\newtcolorbox[use counter=testexample]{testexamplebox}{
    empty,
    title={\exampletext: #1},
    attach boxed title to top left,
       minipage boxed title,
    boxed title style={empty,size=minimal,toprule=0pt,top=4pt,left=3mm,overlay={}},
coltitle=colexam,fonttitle=\bfseries,
before=\par\medskip\noindent,parbox=false,boxsep=0pt,left=3mm,right=0mm,top=2pt,breakable,pad at break=0mm,
   before upper=\csname @totalleftmargin\endcsname0pt,
overlay unbroken={\draw[colexam,line width=.5pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); },
overlay first={\draw[colexam,line width=.5pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); },
overlay middle={\draw[colexam,line width=.5pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); },
overlay last={\draw[colexam,line width=.5pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); },%
}
\begin{testexamplebox}%
\setcounter{Init}{\value{footnote}}
\setcounter{FootnoteCounter}{\value{Init}}
\def\footnote##1{\stepcounter{footnote}\stepcounter{FootnoteCounter}\footnotemark[\arabic{FootnoteCounter}]\def\temp{##1}\expandafter\expandafter\expandafter\global\expandafter\let\csname F\arabic{FootnoteCounter}\endcsname\temp
}}
{\end{testexamplebox}\endlist\stepcounter{Init}\foreach \f in {\arabic{Init},...,\arabic{FootnoteCounter}}{\footnotetext[\f]{\csname F\f\endcsname}}}


\begin{document}

\begin{testexample}[Latin Text]
\lipsum[1]\footnote{my first footnote}
\lipsum[2]\footnote{Another Footnote}
\end{testexample}

A text with a footnote here\footnote{Test Outside}

\begin{testexample}[Latin Text]
\lipsum[1]\footnote{my third footnote}
\lipsum[2]\footnote{Another Footnote}
\end{testexample}

\end{document}

여기에 이미지 설명을 입력하세요

관련 정보