
footnotes
의 하단이 아닌 페이지 하단에 를 가져오려면 의 내부 와 아래에 tcolorbox
사용합니다 . MWE는 다음과 같습니다.\footnotemark
tcolorbox
\footnotetext
tcolorbox
\documentclass[11pt]{book}
\usepackage{tcolorbox}
\begin{document}
\begin{tcolorbox}
This is a \textbf{tcolorbox}\footnotemark.
And this is some text.\footnotemark.
\end{tcolorbox}
\footnotetext{This is footnote 1}
\footnotetext{This is footnote 2}
And more text.\footnote{This is footnote 3}
\end{document}
출력은 다음과 같습니다. (그림 크기를 합리적으로 유지하기 위해 약간 가짜로 만들어야 했습니다.):
페이지 하단에서 각주 2와 각주 3은 모두 2와 3으로 올바르게 표시되어 있지만 각주 1에는 2로 잘못 표시되어 있습니다.
답변1
이 문제의 원인은 적용될 때마다 덮어쓰이는 사용 tcolorbox
과 관련이 없으므로 를 여러 번 호출하면 카운터 가 증가 하지만 해당 각주 카운터 값과 해당 . 여러 사양을 지정하면 관련 각주 카운터 라벨이 증가하지 않습니다.\footnotetext
\@thefnmark
\footnotemark
\footnotemark
footnote
\footnotetext
\footnotetext
\footnotetext[value]{...}
카운터를 그룹으로 설정하는 대신 사용할 수 있습니다 footnote
. 외부로 누출되지 않습니다.
아래 솔루션은 \footnotemark
호출 수를 추적하고 여기에 레이블을 할당하고 \morefootnotetext
레이블을 검색하고 카운터 값을 추출한 다음 로 조판합니다 \footnotetext[value]{...}
.
할당 \footnotetext
보다 호출 이 더 많으면 이 접근 방식은 실패합니다 !\footnotemark
\documentclass[11pt]{book}
\usepackage{xassoccnt}
\usepackage{tcolorbox}
\usepackage{refcount}
\newcounter{totalfootnotes}
\newcounter{totalfootnotetexts}
\DeclareAssociatedCounters{footnote}{totalfootnotes}% Count all footnotes
\usepackage{xpatch}
\usepackage{xparse}
\xpatchcmd{\footnotemark}{\stepcounter}{\refstepcounter}{}{}
\xapptocmd{\footnotemark}{\label{fnmark-\number\value{totalfootnotes}}}{}{}
\xpretocmd{\footnote}{\stepcounter{totalfootnotetexts}}{}{}% Explicitly step!
\NewDocumentCommand{\morefootnotetext}{o+m}{%
\IfValueTF{#1}{%
\footnotetext[#1]{#2}%
}{%
\stepcounter{totalfootnotetexts}%
\footnotetext[\getrefnumber{fnmark-\number\value{totalfootnotetexts}}]{#2}
}%
}
\begin{document}
\begin{tcolorbox}
This is a \textbf{tcolorbox}\footnotemark
And this is some text.\footnotemark
\end{tcolorbox}
\morefootnotetext{This is footnote 1 from inside}
\morefootnotetext{This is footnote 2 from inside}
And more text.\footnote{This is footnote 3 from outside}
Now an example with 4 footnotemark\footnote{A dummy footnote} calls
\begin{tcolorbox}
This is a \textbf{tcolorbox}\footnotemark
And this is some text.\footnotemark
Stuff\footnotemark Otherstuff\footnotemark
\end{tcolorbox}
\morefootnotetext{This is footnote 3 from inside}
\morefootnotetext{This is footnote 4 from inside}
\morefootnotetext{This is footnote 5 from inside}
\morefootnotetext{This is footnote 6 from inside}
\end{document}