
Я использую tcolorbox
пакет для создания упражнений с решением. Можно увидеть, что обычные сноски написаны внутри рамки, но когда у меня иногда есть несколько сносок, я использую пакет manyfoot
для записи этих сносок "встроенным" способом, но получаю нежелательный результат. Создаются только отметки сносок, но не сами сноски. Первый вопрос моей цели был задан здесь:
Tcolorbox, упражнения и пакет manyfoot
Мой вопрос теперь заключается в следующем: в блоке упражнения я создаю его сноски за пределами блока с помощью команд, основанных на том, \footnotetextC
где C
находится суффикс моего элемента iniline, заданный после блока упражнения, и можно увидеть, что это дает желаемый результат для вопроса (см. файл .tex, используемый ниже, и его компиляцию). Как я могу получить аналогичный способ для сносок в блоке решения (который может быть основан на командах типа \footnotetextC
), который создает сноски за пределами блока решения, как для блока упражнения.
Вот используемый файл .tex:
\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}
решение1
Если я правильно понял ваш вопрос, вы хотите, чтобы ваши сноски были установлены в para
стиле ' ' manyfoot
, но внутри tcolorbox
. Пакет paranotes
может сделать это за вас.
Если бы не сложные 'exercise-solution' tcolorbox
es, было бы проще автоматизировать 'parnotes', которые полагаются на неявную или явную \parnotes
команду для печати заметок. Но это не так уж и сложно сделать с частичной автоматизацией.
\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}
Примечание: я удалил ваш код для записи ящиков в другой каталог (который не должен быть включен в MWE, если только это не является целью вопроса).
решение2
На основе ответа, данного @jon, который я принимаю, я даю ответ на свой вопрос, который на самом деле является ответом на развернутый вопрос... Я помещаю этот вопрос в арабскую среду, среду справа налево, и латинские предложения даются внутри команд \LR{}, которые пишут его слева направо. Я привожу примеры с использованием пакета manyfoot, где мы видим, что сноски не пишутся, и пример с использованием parnotes, и мы видим, что команда \LR{\parnotes} пишет сноски слева направо, если я захочу, внутри поля.
Вот полученный файл .tex:
\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}
и его компиляция с использованием xelatex: