# Tcolorbox, exercises and the manyfoot package-2

I use the tcolorbox package to produce exercises with solution. One can see that the usual footnotes are written inside the box, but when I have sometimes several footnotes, I use the manyfoot package to write these footnotes in "inlined" way, but I obtain an unwanted result. Only the marks of the footnotes are produced but not the footnotes themselves. The first question of my purpose was given here:

Tcolorbox, exercises and the manyfoot package

My question now is the following: In the box of the exercise, I produce its footnotes outside the box with the commands based on \footnotetextC where C is the suffix of my iniline item, given after the box of exercise, and one can see that it produces the wanted result for the question (see the .tex file used below and it's compilation). How can I obtain a similar way for the footnotes in the box of the solution (which can be based on commands like \footnotetextC), which produces the footnotes outside the box of the solution, like for the box of exercise.

Here's the .tex file used:

\documentclass{book}

\usepackage[most]{tcolorbox}
\tcbuselibrary{skins,breakable,xparse}

\usepackage{polyglossia}
\setmainlanguage{english}

\usepackage[para*]{manyfoot}
\DeclareNewFootnote[para]{C}
\makeatletter
\let\c@footnoteC\c@footnote
\makeatother

\renewcommand{\thefootnoteC}{\fnsymbol{footnote}}

\NewTColorBox[auto counter,number within=chapter]{exercise}{+O{}}{%
enhanced,colframe=green!20!black,colback=yellow!10!white,coltitle=green!40!black,
fonttitle=\bfseries,
underlay={\begin{tcbclipinterior}
(interior.north west) circle (2cm);
\draw[help lines,step=5mm,yellow!80!black,shift={(interior.north west)}]
(interior.south west) grid (interior.north east);
\end{tcbclipinterior}},
title={Exercise~ \thetcbcounter:},
label={exercise@\thetcbcounter},
attach title to upper=\quad,
after upper={\par\hfill\textcolor{green!40!black}%
{\itshape Solution on page~\pageref{solution@\thetcbcounter}}},
lowerbox=ignored,
savelowerto=solutions/exercise-\thetcbcounter.tex,
record={\string\solution{\thetcbcounter}{solutions/exercise-\thetcbcounter.tex}},
#1
}
\NewTotalTColorBox{\solution}{mm}{%
enhanced,colframe=red!20!black,colback=yellow!10!white,coltitle=red!40!black,
fonttitle=\bfseries,
underlay={\begin{tcbclipinterior}
(interior.north west) circle (2cm);
\draw[help lines,step=5mm,yellow!80!black,shift={(interior.north west)}]
(interior.south west) grid (interior.north east);
\end{tcbclipinterior}},
title={Solution of Exercise~\ref{exercise@#1} on page~\pageref{exercise@#1}:},
phantomlabel={solution@#1},
attach title to upper=\par,
}{\input{#2}}

\tcbset{no solution/.style={no recording,after upper=}}

\begin{document}
\chapter{The first chapter}

\section{Exercises}
\tcbstartrecording
\begin{exercise}
Exercise with inlined footnotes, \footnoteC{inlined footnote 1} and \footnoteC{inlined footnote 2}, in the question.
\tcblower
Exercise with inlined footnotes, \footnoteC{inlined footnote 1} and \footnoteC{inlined footnote 2}, in the answer.
\end{exercise}
\footnotetextC[1]{inlined footnote 1}
\footnotetextC[2]{inlined footnote 2}
\begin{exercise}
Exercise with usual footnotes, \footnote{footnote 1} and \footnote{footnote 2}, in the question.
\tcblower
Exercise with usual footnotes, \footnote{footnote 1} and \footnote{footnote 2}, in the answer.
\end{exercise}
\tcbstoprecording
\section{Solutions of exercises}
\tcbinputrecords

\end{document}


and it's compilation, using xelatex:

If I understand your question correctly, you want your footnotes set in the 'para' style of manyfoot, but inside the tcolorbox. The package paranotes can do this for you.

If not for the complex 'exercise-solution' tcolorboxes, it would be easier to automate the 'parnotes', which rely on an implicit or explicit \parnotes command to print the notes. But it is not too much trouble to do it with partial automation.

\documentclass{book}

\usepackage[most]{tcolorbox}
\tcbuselibrary{skins,breakable,xparse}

\usepackage{polyglossia}
\setmainlanguage{english}

\usepackage{parnotes}

\NewTColorBox[auto counter,number within=chapter]{exercise}{+O{}}{%
enhanced,
colframe=green!20!black,
colback=yellow!10!white,
coltitle=green!40!black,
fonttitle=\bfseries,
underlay={\begin{tcbclipinterior}
(interior.north west) circle (2cm);
\draw[help lines,step=5mm,yellow!80!black,shift={(interior.north west)}]
(interior.south west) grid (interior.north east);
\end{tcbclipinterior}
},
title={Exercise~ \thetcbcounter:},
label={exercise@\thetcbcounter},
attach title to upper=\quad,
after upper={\par\hfill\textcolor{green!40!black}%
{\itshape Solution on page~\pageref{solution@\thetcbcounter}}%
\par\parnotes
},
lowerbox=ignored,
savelowerto=exercise-\thetcbcounter.tex,
record={\string\solution{\thetcbcounter}{exercise-\thetcbcounter.tex}},
#1,
code={\parnotereset}, % <-- parnotes
}

\NewTotalTColorBox{\solution}{mm}{%
enhanced,
colframe=red!20!black,
colback=yellow!10!white,
coltitle=red!40!black,
fonttitle=\bfseries,
underlay={\begin{tcbclipinterior}
(interior.north west) circle (2cm);
\draw[help lines,step=5mm,yellow!80!black,shift={(interior.north west)}]
(interior.south west) grid (interior.north east);
\end{tcbclipinterior}},
title={Solution of Exercise~\ref{exercise@#1} on page~\pageref{exercise@#1}:
},
phantomlabel={solution@#1},
attach title to upper=\par,
}{\input{#2}}

\tcbset{no solution/.style={no recording,after upper=}}

\begin{document}

\chapter{The first chapter}

\section{Exercises}

\tcbstartrecording
\begin{exercise}
1.  Exercise with inlined footnotes, \parnote{inlined footnote 1}
and \parnote{inlined footnote 2}, in the question.

% \parnotes % <-- this won't work because of your "Solution on page ..."

\tcblower

2.  Exercise with inlined footnotes, \parnote{inlined footnote 1}
and \parnote{inlined footnote 2}, in the answer.

\parnotes

\end{exercise}

% \footnotetextC[1]{inlined footnote 1}
% \footnotetextC[2]{inlined footnote 2}

\begin{exercise}
Exercise with usual footnotes, \footnote{footnote 1} and
\footnote{footnote 2}, in the question.

\tcblower

Exercise with usual footnotes, \footnote{footnote 1} and
\footnote{footnote 2}, in the answer.
\end{exercise}
\tcbstoprecording

\section{Solutions of exercises}
\tcbinputrecords

\end{document}


Note: I removed your code to write the boxes to another directory (which shouldn't be included in an MWE unless that's the focus of the question).

• Your answer is good and I can accept it, but it is an answer for the other question tex.stackexchange.com/questions/351606/… Now what about the rule? Is there a command to put the rule easily after the right comment "solution on page..." ? – Faouzi Bellalouna Feb 2 '17 at 8:48
• I'll add something about the rule later today (I hope). But I do not fully understand your question above. Could you edit it and make it clearer? You want footnotes outside the box? – jon Feb 2 '17 at 16:34
• I want to choose between the 2 ways of footnoting, yes. The first way like yo do directly with parnotes, and the second, by a same way that I use in my ECM... with commands like \footnotetextC in the manyfoot package – Faouzi Bellalouna Feb 2 '17 at 17:44
• I tried the commands you introduce with the arabic language (with the command \setmainlanguage{arabic}) and it seems non functional... I have the following error message ! Package polyglossia Error: The current roman font does not contain the Arabic script!... – Faouzi Bellalouna Feb 2 '17 at 19:47
• I think you should ask two questions: 1. How to get paragraphed footnotes inside the tcolorbox; and 2. how to get paragraphed footnotes at the bottom of the page. But if you need Arabic, you should edit the question to include that requirement. (Please also use a very basic Arabic font as most of us don't have any Arabic fonts beyond what are available through CTAN.) – jon Feb 2 '17 at 20:34

Based on the answer given by @jon, what I accept, I give an answer of my question, which is really an answer for a developped question... I put this question in arabic environment, a right-to-left environment, and the latin sentences are given inside the commands \LR{} which writes it in left-to-right. I give examples using the manyfoot package, where we see that the footnotes are not written, and an example using parnotes, and we see that the command \LR{\parnotes} writes the footnotes, in left-to-right mode if I want, inside the box.

Here is the .tex file obtained:

\documentclass{book}

\usepackage[most]{tcolorbox}
\tcbuselibrary{skins,breakable,xparse}

\usepackage{polyglossia}
\setmainlanguage[numerals=maghrib]{arabic}
\setotherlanguage{english}
\setmainfont[Script=Arabic,Scale=1.2]{Arial}

\usepackage{parnotes}

\usepackage[para*]{manyfoot}
\DeclareNewFootnote[para]{C}
\makeatletter
\let\c@footnoteC\c@footnote
\makeatother

\renewcommand{\thefootnoteC}{\fnsymbol{footnote}}

\NewTColorBox[auto counter,number within=chapter]{exercise}{+O{}}{%
enhanced,colframe=green!20!black,colback=yellow!10!white,coltitle=green!40!black,
fonttitle=\bfseries,
underlay={\begin{tcbclipinterior}
(interior.north west) circle (2cm);
\draw[help lines,step=5mm,yellow!80!black,shift={(interior.north west)}]
(interior.south west) grid (interior.north east);
\end{tcbclipinterior}},
title={Exercise~ \thetcbcounter:},
label={exercise@\thetcbcounter},
attach title to upper=\quad,
after upper={\par\hfill\textcolor{green!40!black}%
{\itshape Solution on page~\pageref{solution@\thetcbcounter}}},
lowerbox=ignored,
savelowerto=solutions/exercise-\thetcbcounter.tex,
record={\string\solution{\thetcbcounter}{solutions/exercise-\thetcbcounter.tex}},
#1
}

\NewTotalTColorBox{\solution}{mm}{%
enhanced,colframe=red!20!black,colback=yellow!10!white,coltitle=red!40!black,
fonttitle=\bfseries,
underlay={\begin{tcbclipinterior}
(interior.north west) circle (2cm);
\draw[help lines,step=5mm,yellow!80!black,shift={(interior.north west)}]
(interior.south west) grid (interior.north east);
\end{tcbclipinterior}},
title={Solution of Exercise~\ref{exercise@#1} on page~\pageref{exercise@#1}:},
phantomlabel={solution@#1},
attach title to upper=\par,
}{\input{#2}}

\tcbset{no solution/.style={no recording,after upper=}}

\renewcommand{\theparnotemark}{\fnsymbol{parnotemark}} %% The mark for parnote
\renewcommand{\parnotefmt}[1]{\footnotesize\rmfamily
\noindent\rule{\linewidth}{.5pt}\\ %% The rule before the footnotes
\noindent #1\par
\noindent\rule{\linewidth}{.5pt} %% The rule below the footnotes
}
\begin{document}
\chapter{The first chapter}
\section{Exercises}
\tcbstartrecording
\begin{exercise}
\LR{Exercise with inlined footnotes, using manyfoot, \footnoteC{inlined footnote 1} and \footnoteC{inlined footnote 2}, in the question.}
\tcblower
\LR{Exercise with inlined footnotes, using manyfoot, \footnoteC{inlined footnote 1} and \footnoteC{inlined footnote 2}, in the answer.}
\end{exercise}
\begin{exercise}
\LR{1.  Exercise with inlined footnotes, using parnotes, \parnote{inlined footnote 1} and \parnote{inlined footnote 2}, in the question.}
\LR{\parnotes}
\tcblower
\LR{2.  Exercise with inlined footnotes, using parnotes, \parnote{inlined footnote 1} and \parnote{inlined footnote 2}, in the answer.}
\LR{\parnotes}
\end{exercise}

\begin{exercise}
\LR{Exercise with usual footnotes, \footnote{footnote 1} and \footnote{footnote 2}, in the question.}
\tcblower
\LR{Exercise with usual footnotes, \footnote{footnote 1} and \footnote{footnote 2}, in the answer.}
\end{exercise}
\tcbstoprecording
\section{Solutions of exercises}
\tcbinputrecords
\end{document}


and its compilation, using xelatex: