1

I have the following really specific issue, which is probably just a bug in the thmtools package, but I'm wondering if I can work around it.

Basically, if I include the parskip package and try to use the shaded style of the thmtools package, then the vertical spacing inside the theorem environment gets messed up, with all the blank space disappearing between paragraphs and between items of enumerated lists, like this:

enter image description here

Is there a way that I can fix this issue?

Here's the MWE code:

\documentclass{article}
\usepackage{amsthm}
\usepackage{thmtools}
\declaretheorem[shaded]{theorem}
\usepackage{parskip}

\begin{document}
\begin{theorem}
The following is an enumerated list: 
\begin{enumerate}
    \item one
    \item two
    \item three
\end{enumerate}

This is a paragraph.

This is another paragraph.
\end{theorem}

Here is the same content outside of a theorem environment:
\begin{enumerate}
    \item one
    \item two
    \item three
\end{enumerate}

This is a paragraph.

This is another paragraph.
\end{document}

1 Answer 1

3

It is not really a bug of thmtools. When using the shaded style, thmtools loads the shadethm package, and wrap the theorem with the shadebox environment of the shadethm package.

The shadebox environment typeset its content inside minipage, which by default has \parskip=0pt inside of it (see Why is \parskip zero inside a minipage?).

Fortunately, the shadebox environment has a hook called \shadesetinsideminipage which restores \parindent inside shadebox, so we can make him restore \parskip as well:

\documentclass{article}
\usepackage{amsthm}
\usepackage{thmtools}
\declaretheorem[shaded]{theorem}
\usepackage{parskip}

\newlength\saveparskip
\setlength\saveparskip\parskip
\renewcommand\shadesetinsideminipage{%
    \setlength\parindent\saveparindent % \saveparindent is defined inside `shadethm' package
    \setlength\parskip\saveparskip     % this line restores \parskip
}
\begin{document}
    
    \begin{theorem}
        The following is an enumerated list: 
        \begin{enumerate}
            \item one
            \item two
            \item three
        \end{enumerate}
        
        This is a paragraph.
        
        This is another paragraph.
    \end{theorem}
    
    Here is the same content outside of a theorem environment:
    \begin{enumerate}
        \item one
        \item two
        \item three
    \end{enumerate}
    
    This is a paragraph.
    
    This is another paragraph.
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .