Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra top space (an empty paragraph) if used inside tcolorbox #16

Closed
muzimuzhi opened this issue Oct 5, 2020 · 5 comments
Closed

Extra top space (an empty paragraph) if used inside tcolorbox #16

muzimuzhi opened this issue Oct 5, 2020 · 5 comments

Comments

@muzimuzhi
Copy link
Owner

From T-F-S/tcolorbox#122. Note that theorems defined by amsthm work ok.

The problem occurs when

  • \parskip is non-zero and
  • tcolorbox option parbox=false is set.
\documentclass{article}
\usepackage{tcolorbox} % reproducible even prior to tcolorbox v4.32
\usepackage{lipsum}

\usepackage{amsthm}
\newtheorem{thm}{Amsthm}
\usepackage{thmtools}
\declaretheorem[name=Thmtools]{theorem}

\parskip=10pt
\def\dummy{
  Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi. \par
  Morbi auctor lorem non justo. Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus.}

\begin{document}
\tcbset{parbox=false}

\begin{tcolorbox}
  \begin{theorem} \dummy \end{theorem}
\end{tcolorbox}

\begin{tcolorbox}
  \begin{thm} \dummy \end{thm}
\end{tcolorbox}
\end{document}

image

@muzimuzhi muzimuzhi changed the title If wrapped in tcolorbox, \parskip is always inserted If wrapped in tcolorbox, beginning \parskip is always inserted Oct 5, 2020
@mbertucci47
Copy link
Collaborator

mbertucci47 commented Jan 7, 2024

The output is different now; both cases have the extra space. I think it boils down to the fact that amsthm implements theorems as trivlists, and tcolorbox produces the extra space when the box begins with a list.

\documentclass{article}
\usepackage{tcolorbox}

\parskip=10pt

\begin{document}

\begin{tcolorbox}
\begin{itemize}
\item one
\item two
\end{itemize}
\end{tcolorbox}

\tcbset{parbox=false}

\begin{tcolorbox}
\begin{itemize}
\item one
\item two
\end{itemize}
\end{tcolorbox}

\end{document}

document-1

@muzimuzhi
Copy link
Owner Author

muzimuzhi commented Jan 7, 2024

Looks like (another) parbox=false problem from tcolorbox. Not sure whether the current behavior is intended.

Tested on overleaf.com, tcolorbox v4.30 (2020-04-28) won't cause empty paragraph in the parbox=false box in your example.

@muzimuzhi muzimuzhi changed the title If wrapped in tcolorbox, beginning \parskip is always inserted Extra top space (an empty paragraph) if used inside tcolorbox Jan 7, 2024
@mbertucci47
Copy link
Collaborator

I've added a comment to the corresponding closed tcolorbox issue.

@muzimuzhi
Copy link
Owner Author

muzimuzhi commented Jan 8, 2024

@mbertucci47
Copy link
Collaborator

mbertucci47 commented Jan 12, 2024

Fixed with the fix for tcolorbox #262.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants