The following source causes the "EXERCSISES" head in the theorem-like environment to be overwritten with the 1st item of the enumerated list inside:
\documentclass{article}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{enumitem}
\declaretheoremstyle[
headfont=\bfseries,%
headpunct={\vspace{\topsep}\newline},
numbered=no,
spaceabove=3\topsep,
postheadspace=0 pt ]{exercs}
\declaretheorem[name=EXERCISES,style=exercs]{problems}
\newlist{problemsenum}{enumerate}{3}
\setlist[problemsenum,1]{%
label=\arabic*.,
before=\leavevmode \vspace{-\dimexpr\baselineskip+\topsep\relax}
}
\usepackage{showkeys}
\begin{document}
\begin{problems}
\label{myproblems}
\begin{problemsenum}
\item Do this one first.
\item Solve this next.
\end{problemsenum}
\end{problems}
\end{document}
Commenting out the \usepackage{showkeys}
or omitting the \label
prevents the overwriting:
Is there some way to prevent the overwriting even with showkeys
loaded and with the \label
still included?
One way to prevent the overwriting when showkeys
is not loaded is simply to remove the newline between \begin{problems}
and the \label
command:
\begin{problems}%
\label{my problems}
However, even with that change, once showkeys
is loaded the overwriting persists. Hence a more robust workaround would be desirable.
Note: The seemingly convoluted definition of the problemsenum
environment is needed in order to be able to create cross-references to individual items in the problemsenum
environment, with \cref
, even though the theorem-like environment is unnumbered. (See How use cleveref to get theorem-like name and list item number? and How change vertical space after head in theorem-like environment .)
\label
? There isn't anything there to refer to, is there?showkeys
operates in horizontal mode, I think. However, you have put TeX in vertical mode, also I think. Hence, no adjustment is done.\hskip 0pt
after\label
. But you would be better advised to heed the recommendations provided in response to your earlier questions, I think.\usepackage[left]{showlabels}
instead of\usepackage{showkeys}
. Theshowlabels
package is usually more robust thanshowkeys
. David will appreciate.\leavevmode \vspace
is a very weird construct, it forces the space into a vadjust node so that it is inserted after the paragraph has been broken into lines, after the first line of the paragraph.