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

Plain tcolorbox uses autoparskip, not beforeafter skip balanced #182

Closed
muzimuzhi opened this issue Jun 23, 2022 · 5 comments
Closed

Plain tcolorbox uses autoparskip, not beforeafter skip balanced #182

muzimuzhi opened this issue Jun 23, 2022 · 5 comments
Assignees
Labels

Comments

@muzimuzhi
Copy link
Contributor

Originally reported by @mlhetland in #115 (comment)

Example

\documentclass[twocolumn]{article}
\usepackage{tcolorbox}
\begin{document}
\def\test{Before \begin{tcolorbox} Contents \end{tcolorbox} After}

\test
\newpage

\tcbset{beforeafter skip balanced = 0.5\baselineskip plus 2pt}
\test
\end{document}

image

Analysis

b9106e4 (released since v5.0.0) moved setting

\tcbset{%
  autoparskip,minipage,savedelimiter=tcolorbox,%
  set@extensions@preframe=,set@extensions@postframe=,set@extensions@final=,%
}%

from mid-file to the very end of tcolorbox.sty, even after use of initialize@reset=reset@core.

To demonstrate the situation after b9106e4:

% file tcolorbox.sty
\tcbset{
  initialize@reset/.code={\tcbset{#1}\appto\tcb@reset{\tcbset{#1}}},%
  reset@core/.style={
    % ...
    beforeafter skip balanced=0.5\baselineskip plus 2pt, %...
  },
  initialize@reset=reset@core,
  % ..
}

\tcbset{autoparskip, ...} % <<< this will overwrite `/tcb/before` and `/tcb/after`

Thus for plain tcolorbox on first layer, the autoparskip wins beforeafter skip balanced=0.5\baselineskip plus 2pt.

Proposal
Just remove that autoparskip used after initialize@reset=reset@core.

@T-F-S
Copy link
Owner

T-F-S commented Jun 23, 2022

The analysis is correct. The autoparskip setting is a remnant of the former behaviour.

Removing this setting would give the intended and documented behaviour.

Alas, the is another problem. I changed the default setting with version 4.40, because the new settings caused no notable changes to several old documents I tested. Now, we know why no notable changes happened...

The current situation is that all boxes on layer 1 have autoparskip and all boxes inside boxes have beforeafter skip balanced. I fear that a change may influence the spacing of many existing documents (I will test a few).

I see two possibilities:

  • Repair the code and possibly get a lot of trouble with changed documents.
  • No change to the code, but adapting the documentation to describe all correctly.

First, I'm going to test some legacy documents.

@muzimuzhi
Copy link
Contributor Author

muzimuzhi commented Jun 23, 2022

[...] Now, we know why no notable changes happened...

v4.40 and v5.0.0 are released on Sep 25, 2020 and Dec 16, 2021, respectively. So

  • the new setting had been effective for a year (and a bit longer) and for vanilla texlive 2021 (the .iso image), and
  • the old setting has been restored for one and a half years half a year and for vanilla texlive 2022.

Seems only adapting the documentation gains max backward compatibility, though leaves some inconsistencies.

Hmm I'm weak at date calculations. It seems to me repairing the code is OK.

@T-F-S
Copy link
Owner

T-F-S commented Jun 23, 2022

I just tested several of my documents with many boxes and found no critical changes, if the code is repaired.

And you bring in some new good points. I checked that your observations are correct and the new setting actually was effecive with v4.40 and gone with v5.0.0 where I moved the code with the remnant to the current position (not completely sure why) where is came to effect.

The good news (for me) is that I was not so dumb to oversee a missing new setting in v4.40... Also, all tests of this time are valid tests, because the setting was effective.

So, I am going to repair the code by removing the offending autoparskip part.

Unluckily, this came up very shortly after the release of v5.1.0. I wait until tomorrow, if new thoughts come up. Otherwise I am going to do a new release and I hope that the good people at CTAN do not curse me for updating so fast again...

@T-F-S T-F-S self-assigned this Jun 23, 2022
@T-F-S T-F-S added the bug label Jun 23, 2022
@muzimuzhi
Copy link
Contributor Author

muzimuzhi commented Jun 23, 2022

[...] gone with v5.0.0 where I moved the code with the remnant to the current position (not completely sure why) [...]

When tracing the problem once I moved the \tcbset{autoparskip,minipage,...} block back to mid-file and got a "Unknown capture mode minipage. [...]" error.

Hence I suspect the code movement is caused by implementing

The new code for caption style requires that the default setting minipage, which is a shorthand for capture=minipage is used after all \tcb@@capture@<mode> are defined.

Otherwise I am going to do a new release and I hope that the good people at CTAN do not curse me for updating so fast again...

It's not rare that hotfix releases appear shortly after a normal release1, though that's not the case for tcolorbox this time. For example during Dec 26--28, 2020, pgf released one normal and two hotfix releases, named v3.1.8, v3.1.8a, and v3.1.8b.

Footnotes

  1. especially when the release process is automated and is triggered as simple as pushing a new git tag

@T-F-S
Copy link
Owner

T-F-S commented Jun 24, 2022

Resolved with https://github.com/T-F-S/tcolorbox/releases/tag/v5.1.1

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

No branches or pull requests

2 participants