Background
I'm using a theorem style where there is a new line between the title and the statement.
\newtheoremstyle{simple}
{}{}
{\normalfont}{}
{\normalfont}{}
{\newline}
{{\thmname{#1}\nobreakspace\thmnumber{#2}}
{\thmnote{\hspace{.4em}\ensuremath{(\text{#3})}}}\smallskip}
To effectively prevent page break following the title, I decided to put it inside a transparent tcolorbox where one can use the key breakable and set lines before break = 3. (The reason that I chose to adopt this complicated method is that those "normal" solutions I've found, like in this question, does not work quite well.)
I have succeeded in producing such a box and wrapping the environment within it. However, I was not able to reproduce the exact vertical spaces before and after a theorem. My guessed value was \topsep+\parskip, which is smaller than the actual value (I also tried e.g. \thm@preskip and \thm@postskip, but they seem to be 0pt).
Is there some way to access to the exact value of these vertical spaces?
(The goal is to produce the same result, except for page breaking point, with or without the extra tcolorbox.)
Note: the question actually has little to do with tcolorbox. The thing I'm interested is the exact value of these two lengths:
Below is a MWE. You can comment and uncomment the ExplSyntax part (which wraps a tcolorbox around the environment theorem) to see the difference.
\documentclass{article}
\usepackage{geometry}
\usepackage{amsthm}
\newtheoremstyle{simple}
{}{}
{\normalfont}{}
{\normalfont}{}
{\newline}
{{\thmname{#1}\nobreakspace\thmnumber{#2}}
{\thmnote{\hspace{.4em}\ensuremath{(\text{#3})}}}\smallskip}
\theoremstyle{simple}
\newtheorem{theorem}{Theorem}
\ExplSyntaxOn
\PassOptionsToPackage { many } { tcolorbox }
\RequirePackage { tcolorbox }
\cs_new_protected:Nn \minimclass_box_environment:n
{
\hook_gput_code:nnn { env/#1/before } { minimalist }
{
\begin { tcolorbox }
[
enhanced~jigsaw,
frame~hidden,
interior~hidden,
top = 0pt, bottom = 0pt,
left = 0pt, right = 0pt,
boxrule = 0pt, boxsep = 0pt,
before~skip = \topsep+\parskip,
after~skip = \topsep+\parskip,
breakable, lines~before~break=3,
]
}
\hook_gput_code:nnn { env/#1/after } { minimalist }
{
\end { tcolorbox }
}
}
\minimclass_box_environment:n { theorem }
\ExplSyntaxOff
\usepackage{blindtext}
\begin{document}
\blindtext
\begin{theorem}
\blindtext
\end{theorem}
\blindtext
\begin{theorem}
\blindtext
\end{theorem}
\begin{proof}
\blindtext
\end{proof}
\end{document}

\nopagebreak- there are questions on this site about applying\nopagebreakin this theorem style, but the result is not quite satisfying. Also, I think the problem is not quite related totcolorbox, the only thing left is to know the correct value of the vertical spaces produced byamsthm, and then one needs to insert the right value as parameters totcolorbox. – Jinwen Apr 03 '22 at 13:02\@afterheadingis for? Also, theneedspacepackage comes to mind. – cgnieder Apr 03 '22 at 13:11\@afterheadingapproach but it didn't work in the testing document (unfortunately I didn't keep it), so I switched to this more complicated method, which at least can be guaranteed to always work. – Jinwen Apr 03 '22 at 13:15amsthm, but I'm not optimistic. I'm not experienced in usingtcolorboxso can't help with that, and don't have time to test. – barbara beeton Apr 03 '22 at 13:42tcolorboxis not actually quite related to the real question. I have reformulated my question to emphasis the point, i.e., the value for the vertical spaces before and after a theorem. – Jinwen Apr 03 '22 at 13:53\def\thm@space@setup{% \thm@preskip=\topsep \thm@postskip=\thm@preskip }You should be able to find the value of\topsep– barbara beeton Apr 03 '22 at 14:01\topsepthat I have been using, but it seems narrower than the actual value. I must have missed something. – Jinwen Apr 03 '22 at 14:07