1

I found the code to put the footnotes outside the tcolorbox, but after the first tcolorbox I need that the footnote of the second one to be inside.

How can I do it?

\documentclass[10pt,a4paper]{article}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}

\usepackage{tcolorbox}
\usepackage{footnote}

\BeforeBeginEnvironment{tcolorbox}{\savenotes}
\AfterEndEnvironment{tcolorbox}{\spewnotes}
\begin{document}
    \begin{tcolorbox}
        this is text\footnote{footnote outside the box} text...
    \end{tcolorbox}
    
    \begin{tcolorbox}
        this is text\footnote{footnote inside the box} bla bla bla
    \end{tcolorbox}
\end{document}
3
  • Hi, please clarify Your question with more details so too hard to understand what You wanna Commented Oct 16, 2021 at 22:09
  • Hello @WinnieNotThePooh the footnote in the first tcolorbox ambient is outside the box. I want that the footnote in the 2nd tcolorbox to be inside of the box. Which details do you need? Commented Oct 16, 2021 at 22:12
  • please add photo of Your problem to Your question Commented Oct 16, 2021 at 22:22

1 Answer 1

2

You need to use two different environments: one (new) for footnotes outside and the default for footnotes inside.

b

\documentclass[10pt,a4paper]{article}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}

\usepackage{tcolorbox}
\usepackage{footnote}

\usepackage{environ}% added  <<<<<<<<<<<<

\NewEnviron{TCBx}{ % footnotes ouside the box
    \begin{savenotes}
        \begin{tcolorbox}
                \BODY   
        \end{tcolorbox}
    \end{savenotes}
}
\begin{document}

        \begin{TCBx}    
            This is text\footnote{First footnote outside the box.} text...  
        \end{TCBx}
        
        \begin{tcolorbox}
            This is text\footnote{footnote inside the box.} bla bla bla
        
            This is text\footnote{again footnote inside the box.} bla bla bla
        \end{tcolorbox}
        
        \begin{TCBx}    
            This is text\footnote{Second footnote outside the box.} text... 
        \end{TCBx}
        
        \begin{TCBx}    
            This is text\footnote{Third footnote outside the box.} text...  
        \end{TCBx}

\end{document}
1
  • Thank you very much for your answer @SimonDispa Commented Oct 17, 2021 at 6:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .