-
Notifications
You must be signed in to change notification settings - Fork 16
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
v5.1.0(pre2): Extra top space if parbox=false
tcolorbox starts with a list
#262
Comments
Currently, I see no good solution here. For an automatic solution I see no way. A manual way to remove the extra space, if the content starts with a list, is also not pleasant to implement, see \documentclass{article}
\usepackage{tcolorbox}
\tcbset{set parbox/.style={parbox=#1, title={\texttt{parbox=#1}}}}
\makeatletter
\tcbset{
special remove 1/.style={%
before upper={\vspace{-13.055555pt}},% value ?
},
special remove 2/.code={%
\appto\tcb@lateoptions@hook{\preto\kvtcb@before@upper{\let\tcb@set@parbox@indent\@empty}}% upper
},
}
\makeatother
\begin{document}
% issue #123, extra top space in "parbox=false" tcolorbox starting with a list
\begin{tcolorbox}
\begin{enumerate}
\item abc
\end{enumerate}
\end{tcolorbox}
\begin{tcolorbox}[set parbox=false,
% special remove 1,
special remove 2,
]
\begin{enumerate}
\item abc
\end{enumerate}
\end{tcolorbox}
% issue #171, no "before skip" if nested in a "parbox=false" tcolorbox
\begin{tcolorbox}
content
\begin{tcolorbox}[before skip=20pt]
test \texttt{before skip balanced}
\end{tcolorbox}
\end{tcolorbox}
\begin{tcolorbox}[set parbox=false]
content
\begin{tcolorbox}[before skip=20pt]
test \texttt{before skip balanced}
\end{tcolorbox}
\end{tcolorbox}
\end{document}
\documentclass{article}
\usepackage[skins]{tcolorbox}
\tcbset{set parbox/.style={parbox=#1, title={\texttt{parbox=#1}}}}
\begin{document}
\tcbset{size=minimal,draft}
% issue #123, extra top space in "parbox=false" tcolorbox starting with a list
\begin{tcolorbox}[set parbox=true]
\begin{enumerate}
\item abc
\end{enumerate}
\end{tcolorbox}
\bigskip
\begin{tcolorbox}[set parbox=false]
\begin{enumerate}
\item abc
\end{enumerate}
\end{tcolorbox}
\bigskip
\makeatletter
\begin{tcolorbox}[set parbox=false,
%before upper={\vspace{-13.055555pt}},
%code={\let\tcb@set@parbox@indent\@empty},
%code={\appto\tcb@lateoptions@hook{\preto\kvtcb@before@upper{\let\tcb@set@parbox@indent\@empty}}},
]
%\vspace{-13.055555pt}%
%\show\tcb@lateoptions@hook
%\show\kvtcb@before@upper
\begin{enumerate}
\item abc
\end{enumerate}
\end{tcolorbox}
\makeatother
\bigskip
% issue #171, no "before skip" if nested in a "parbox=false" tcolorbox
\begin{tcolorbox}[set parbox=true]
content
\begin{tcolorbox}[before skip=20pt]
test \texttt{before skip balanced}
\end{tcolorbox}
\end{tcolorbox}
\bigskip
\begin{tcolorbox}[set parbox=false]
content
\begin{tcolorbox}[before skip=20pt]
test \texttt{before skip balanced}
\end{tcolorbox}
\end{tcolorbox}
\end{document} The |
As a replacement of Here is a loose attempt which tries to not apply
Example v2, using
|
Current (v6.1.0) | \OmitIndent unconditionally |
\OmitIndent conditionally |
---|---|---|
Example v2 typesets 7 pairs of examples
- Current (v6.1.0): extra top space in 5th
parbox=false
example \OmitIndent
unconditionally:\OmitIndent
mistakenly applied (marked by a vert followed by current box number in superscript) before boxes in 1st and 3rdparbox=false
examples and inside nestedparbox=true
box in 6th.
This is a very interesting idea. I tested your code and added some further tests. Currently, all seems to work with the conditional Even, if new things come up, the approach may be adaptable to further conditions. I will make further tests. By the way: The height control test with |
I forgot to save positions first, (see This \newcommand{\testParboxFalse}[2][]{%
\stepcounter{ypos}
\begin{multicols}{2}
\begin{tcolorbox}[set parbox=true,#1]
#2
\end{tcolorbox}%
% \rlap{\rule{\columnwidth}{.5pt}}
\UseName{tex_savepos:D}%
\RecordProperties{parbox=true\arabic{ypos}}{ypos}%
\newcolumn
\begin{tcolorbox}[set parbox=false,#1]
#2
\end{tcolorbox}%
% \clap{\rule{2\columnwidth}{.5pt}}
% two rules overlaps => "parbox=(true|false)" results in the same height
\UseName{tex_savepos:D}%
\RecordProperties{parbox=false\arabic{ypos}}{ypos}%
\end{multicols}
\par
% raise an error if heights of boxes with "parbox=(true|false)" are different
\ifnum\RefProperty{parbox=true\arabic{ypos}}{ypos}=%
\RefProperty{parbox=false\arabic{ypos}}{ypos}\relax
\else
\PackageError{debug}{Different heights!}{\detokenize{#2}}%
\fi
} |
Yes, thank you. Works fine :-) |
Fixed with https://github.com/T-F-S/tcolorbox/releases/tag/v6.2.0 |
I'm still more or less worried about using Would a new, specific boolean be needed? |
A boolean marker will not enhance the code per se, but may prevent accidential code changes in future which may break the test. So, yes, I will add a boolean as marker. |
Unfortunately, the fix for #171 caused regression of #123. The extra top space actually consists of vertical spacing of an empty paragraph (
\baselineskip
) plus\parskip
.parbox=false
,before skip
is ignored in inner box #171Since the culprit is the insertion position of
\noindent
, different from that in #171 which was the color whatsit, I choose to open a new issue.The text was updated successfully, but these errors were encountered: