muzimuzhi / thmtools

New home for LaTeX package bundle thmtools
LaTeX Project Public License v1.3c
16 stars 3 forks source link

restatable does not respect after-indent suppression with ntheorem #42

Open mbertucci47 opened 10 months ago

mbertucci47 commented 10 months ago

When thmtools is used with ntheorem (or the llncs class or just the kernel \newtheorem), the paragraph after a restatable environment or a restated theorem is indented regardless of whether there is an empty line in the code. This is the default behavior of amsthm but not ntheorem, llncs, or the kernel.

textbefore

For reasons I don't understand, if a theorem, or a theorem followed by text, is placed before a restatable environment or restated theorem with no empty lines, then the following paragraph is not indented.

theorembefore

For the restatable environment, an obvious "fix" is

\AddToHook{env/restatable/after}{\noindent\ignorespacesafterend}
\AddToHook{env/restatable*/after}{\noindent\ignorespacesafterend}

(or something more sophisticated) in thm-ntheorem.sty and thm-llncs.sty. I couldn't figure out how to suppress the indent after a restated theorem.

It seems standard to suppress indent after an environment if an empty line is not present; at least, this is the case with quote, verbatim, etc.

Source of examples

Full example ```tex \documentclass{article} \usepackage{ntheorem,thmtools,kantlipsum} % suppresses indent after restatable env but not restated theorem %\AddToHook{env/restatable/after}{\noindent\ignorespacesafterend} %\AddToHook{env/restatable*/after}{\noindent\ignorespacesafterend} \declaretheorem{theorem} \begin{document} \section{Space before, text after} \subsection{\{restatable\}\{theorem\}\{foo\}} \begin{restatable}{theorem}{foo} \kant[1][2] \end{restatable} \kant[2][1] \subsection{\{theorem\}} \begin{theorem} \kant[1][1] \end{theorem} \kant[2][1] \subsection{\textbackslash foo} \foo* \kant[2][1] \newpage \section{Text before, text after} \subsection{\{restatable\}\{theorem\}\{foobar\}} \kant[3][1] \begin{restatable}{theorem}{foobar} \kant[1][2] \end{restatable} \kant[2][1] \subsection{\{theorem\}} \kant[3][1] \begin{theorem} \kant[1][1] \end{theorem} \kant[2][1] \subsection{\textbackslash foobar} \kant[3][1] \foobar* \kant[2][1] \newpage \section{Theorem and text before, text after} \subsection{\{restatable\}\{theorem\}\{blub\}} \begin{theorem} \kant[1][1] \end{theorem} \kant[3][1] \begin{restatable}{theorem}{blub} \kant[1][2] \end{restatable} \kant[2][1] \subsection{\{theorem\}} \begin{theorem} \kant[1][1] \end{theorem} \kant[3][1] \begin{theorem} \kant[1][1] \end{theorem} \kant[2][1] \subsection{\textbackslash blub} \begin{theorem} \kant[1][1] \end{theorem} \kant[3][1] \blub* \kant[2][1] \newpage \section{Theorem before, text after} \subsection{\{restatable\}\{theorem\}\{blubfoo\}} \begin{theorem} \kant[1][1] \end{theorem} \begin{restatable}{theorem}{blubfoo} \kant[1][2] \end{restatable} \kant[2][1] \subsection{\{theorem\}} \begin{theorem} \kant[1][1] \end{theorem} \begin{theorem} \kant[1][1] \end{theorem} \kant[2][1] \subsection{\textbackslash blubfoo} \begin{theorem} \kant[1][1] \end{theorem} \blubfoo* \kant[2][1] \end{document} ```
muzimuzhi commented 10 months ago

Thanks for reporting it, again. As you may find in #40, there exist more vertical spacing issues, like #29.

Sorry I don't have (whole) enough block of time to digging into this right now.