I am writing a book-like set of classroom notes using the memoir documentstyle.
I would like to set off some pieces of text as 'digressions" by using a background color: I've tried two solutions, mimicking an answer to a previous question.
One uses the "framed" package:
\usepackage{framed}
\colorlet{shadecolor}{lightgray}
\newenvironment{digression}[1][]%
{\colorlet{shadecolor}{lightgray}%
\bigskip%
\begin{shaded}%
\begin{flushleft}%
\textbf{\LARGE{Digression:}\\ \Large{#1}}\\%
\medskip
}%
{%
\end{flushleft}%
\end{shaded}%
\bigskip%
}
The other uses the "tcolorbox" package:
\usepackage{tcolorbox}
\tcbuselibrary{breakable}
\newenvironment{digression}[1][]%
{%
\begin{tcolorbox}[boxrule=0pt, sharp corners, parbox=true, breakable]
\begin{flushleft}%
\textbf{\LARGE{Digression:}\\ \Large{#1}}\\%
\medskip
}%
{%
\end{flushleft}%
\end{tcolorbox}%
\bigskip%
}
Both do the trick as far as getting background color is concerned, but there are two problems that remain for me: (1) if I use the first version, footnotes disappear; with the second, they appear within the box rather than at the bottom of the page; (2) neither one allows figures--the same error occurs in both (not in outer paragraph mode).
I guess the problem (especially (2)) is that this is creating a mini-page (or some analogue).
So my question is: is there a way to introduce a background color which doesn't have these limitations?
I'm not in this instance interested in the bells and whistles which are useful for creating beamer slides; I just want to have a part of my page highlighted with a contrasting color.
footnotestake a look at Tcolorbox - footnotes at end of each page you'll find a solution. And respectfiguresis normal that you have problems.figureis a floating element, so it's not possible to include it into atcolorboxbut you can include non-floating images and add a caption to them withcaptionpackage. – Ignasi Jan 25 '21 at 09:24