Open hafid68 opened 1 week ago
I doubt this (ams align
+ \tcblower
) ever worked. None of overleaf's images, from texlive 2014 to texlive 2024 complied your example.
align
and several other amsmath
displayed equation environments need to collect the content of environment. Thus with ams align
or ams align upper
, the whole content of current tcolorbox
environment, not just the upper part, would be collected (by the \align
inserted at beginning of upper part), which when typeset, will raise errors if \tcblower
is included.
Example below patches an amsmath
internal macro to show what's collected.
\documentclass{article}
\usepackage[theorems]{tcolorbox}
\makeatletter
% amsmath.sty v2.17q, 2024/05/23, line 1413:
\def\addto@envbody#1{%
% added debugging error
\PackageError{debug}{collect: \detokenize{#1}}{}%
\global\@envbody\@xp{\the\@envbody#1}}
\makeatother
\begin{document}
\begin{tcolorbox}[ams align upper]
\alpha &= \beta \\
\theta &= \gamma
\tcblower
abc
\end{tcolorbox}
\end{document}
which raises an debugging error
! Package debug Error: collect: \alpha &= \beta \\ \theta &= \gamma \tcblower
abc .
I doubt this (
ams align
+\tcblower
) ever worked. None of overleaf's images, from texlive 2014 to texlive 2024 complied your example.
I think that is true. The example was supposed to work like expected, but never did. Years ago I had the plan to fix it somehow or the adapt the documentation, but then it dimmed away with other things to do ...
I should adapt the documentation for ams align
and friends, maybe even change the code of ams align
to be an alias for ams align upper
only, to prevent users to find out what works and what works not themselves.
Of course, you can have align
for both the upper and the lower part, if you change the example code. The following shows working environments. The last two are variants to achieve the desired goal:
\documentclass{article}
\usepackage[theorems]{tcolorbox}
\begin{document}
\begin{tcolorbox}[ams align,title=Upper only with 'ams align']
\alpha &= \beta \\
\theta &= \gamma
\end{tcolorbox}
\begin{tcolorbox}[ams align upper,title=Upper only with 'ams align upper']
\alpha &= \beta \\
\theta &= \gamma
\end{tcolorbox}
\begin{tcolorbox}[ams align lower,title='ams align lower']
abc
\tcblower
\alpha &= \beta \\
\theta &= \gamma
\end{tcolorbox}
\begin{tcolorbox}[ams nodisplayskip upper,ams align lower,title=Upper and lower variant 1]
\begin{align}
\alpha &= \beta \\
\theta &= \gamma
\end{align}
\tcblower
abc
\end{tcolorbox}
\begin{tcolorbox}[ams nodisplayskip,title=Upper and lower variant 2]
\begin{align}
\alpha &= \beta \\
\theta &= \gamma
\end{align}
\tcblower
\begin{align}
abc
\end{align}
\end{tcolorbox}
\end{document}
The same goes for ams align*
, ams gather
, and ams gather*
.
the following snippet throws errors