-
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
Magic number yshift=0.1mm
in bicolor skin
#166
Comments
Yes, it is connected to thin white line issue. As far as I remember
|
Sorry I forgot to provide a link to "thin white line" example (also the ones linked to this question on tex-sx). According to feedbacks on tex-sx (1 and 2), it seems Imho the specific small shifting amount is not cared about until users add some visual benchmark. In this case, either canceling the shifting (by providing a new option) or making the shifting amount accessible (so user drawings can be around a fake |
For what it is worth, here is an example of the need to deal with the magic number \documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{listings,skins}
\begin{document}
\begin{tcblisting}{%
sharp corners,
skin=bicolor,
top=0.5cm,
middle=0.5cm,
overlay={
\node[minimum width=1cm,minimum height=0.5cm,outer sep=auto,
anchor=north east,fill=white] at (interior.north east)
{\itshape\small code};
\node[minimum width=1cm,minimum height=0.5cm,outer sep=auto,
anchor=north east,fill=white] at (% [yshift=.1mm]
segmentation.east)
{\itshape\small result};
}
}
Foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foooo
foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foooo
\end{tcblisting}
\end{document} |
I will add configuration of the magic number as new feature:
This allows the following: \documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{listings,skins}
\begin{document}
\begin{tcolorbox}[bicolor, sharp corners,
colframe=blue!50!black, colback=blue!10, colbacklower=red!10,
top=5mm, bottom=2mm, middle=3.5mm, overlaplower=1.5mm,
underlay={
\node[minimum width=1cm,minimum height=0.5cm,outer sep=auto,
anchor=north east,fill=white] at (interior.north east)
{\itshape\small upper};
\node[minimum width=1cm,minimum height=0.5cm,outer sep=auto,
anchor=north east,fill=white]
at ([yshift=\tcboverlaplower]segmentation.east)
{\itshape\small lower};
}
]
This is the upper part.
\tcblower
And that is the lower part.
\end{tcolorbox}
\end{document} |
With
skin=bicolor
, the lower part is filled with a possibly different color. But the top of that filling is0.1mm
higher than the y-coord ofsegmentation
node. Since0.1mm ~= 0.28pt
is comparable to the default line with0.4pt
, this shifting is noticeable in certain use cases, for example the one in https://tex.stackexchange.com/q/628634 as noticed by @dbitouze .The introduce of such magic number dates back to
v3.0.5
and I suspect it is used to prevent the "thin white line" issue when upper and lower parts are filled with the same color (withskin=bicolor
).Multiple workarounds/improvements exist:
.01mm
Related code lines
tcolorbox/tex/latex/tcolorbox/tcbskins.code.tex
Lines 219 to 227 in adb84d6
The text was updated successfully, but these errors were encountered: