Tcolorbox, Übungen und das Manyfoot-Paket-2

Tcolorbox, Übungen und das Manyfoot-Paket-2

Ich verwende das tcolorboxPaket, um Übungen mit Lösungen zu erstellen. Man kann sehen, dass die üblichen Fußnoten in die Box geschrieben werden, aber wenn ich manchmal mehrere Fußnoten habe, verwende ich das manyfootPaket, um diese Fußnoten „inline“ zu schreiben, aber ich erhalte ein unerwünschtes Ergebnis. Es werden nur die Markierungen der Fußnoten erstellt, nicht aber die Fußnoten selbst. Die erste Frage zu meinem Zweck wurde hier gestellt:

Tcolorbox, Übungen und das Manyfoot-Paket

Meine Frage ist nun folgende: In der Box der Übung erzeuge ich die Fußnoten außerhalb der Box mit den Befehlen, die auf dem Suffix meines Iniline-Elements basieren \footnotetextC, Cdas nach der Box der Übung angegeben ist, und man kann sehen, dass dies das gewünschte Ergebnis für die Frage erzeugt (siehe die unten verwendete .tex-Datei und ihre Kompilierung). Wie kann ich eine ähnliche Methode für die Fußnoten in der Box der Lösung erreichen (die auf Befehlen wie basieren kann \footnotetextC), die die Fußnoten außerhalb der Box der Lösung erzeugt, wie für die Box der Übung.

Hier ist die verwendete .tex-Datei:

\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}
\shade[inner color=green!80!yellow,outer color=yellow!10!white]
(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}
\shade[inner color=red!50!yellow,outer color=yellow!10!white]
(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}

und seine Kompilierung mit xelatex: Bildbeschreibung hier eingeben

Antwort1

Wenn ich Ihre Frage richtig verstehe, möchten Sie, dass Ihre Fußnoten im paraStil von gesetzt werden manyfoot, aber innerhalb von tcolorbox. Das Paket paranoteskann das für Sie erledigen.

Wenn es nicht die komplexen „Übungslösungen“ gäbe tcolorbox, wäre es einfacher, die „Parnotes“ zu automatisieren, die auf einem impliziten oder expliziten \parnotesBefehl zum Drucken der Notizen basieren. Aber es ist nicht allzu schwierig, dies mit einer teilweisen Automatisierung zu tun.

\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}
      \shade[inner color=green!80!yellow,outer color=yellow!10!white]
      (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}
      \shade[inner color=red!50!yellow,outer color=yellow!10!white]
      (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}

Hinweis: Ich habe Ihren Code entfernt, um die Boxen in ein anderes Verzeichnis zu schreiben (das nicht in ein MWE aufgenommen werden sollte, es sei denn, dies ist der Schwerpunkt der Frage).

tcolorbox-parnote

Antwort2

Basierend auf der Antwort von @jon, die ich akzeptiere, gebe ich eine Antwort auf meine Frage, die eigentlich eine Antwort auf eine ausgearbeitete Frage ist ... Ich habe diese Frage in eine arabische Umgebung gestellt, eine Umgebung von rechts nach links, und die lateinischen Sätze werden innerhalb der Befehle \LR{} angegeben, die sie von links nach rechts schreiben. Ich gebe Beispiele unter Verwendung des Pakets manyfoot, wo wir sehen, dass die Fußnoten nicht geschrieben werden, und ein Beispiel unter Verwendung von parnotes, und wir sehen, dass der Befehl \LR{\parnotes} die Fußnoten, wenn ich will, von links nach rechts, innerhalb der Box schreibt.

Hier ist die erhaltene .tex-Datei:

\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}
\shade[inner color=green!80!yellow,outer color=yellow!10!white]
(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}
\shade[inner color=red!50!yellow,outer color=yellow!10!white]
(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}

und seine Kompilierung mit xelatex:

Bildbeschreibung hier eingeben

Bildbeschreibung hier eingeben

verwandte Informationen