Closed mangkoran closed 9 months ago
However, it seems figures of tcolorbox is not affected by it.
That's because tcolorbox
sets list type=tcolorbox
initially, which will result in line
\contentsline {tcolorbox}{...}{1}{}%
in .lof
file if blend into=figures
is set. Since \contentsline{xxx}
expands to \l@xxx
, the style of tcolorbox list-of entries is controlled by \l@tcolorbox
by default. But what \cftsetindents{figure}{0em}{2.75em}
from tocloft
altered is \l@figure
.
Setting list type=figure
does the trick.
\documentclass{article}
\usepackage{tcolorbox}
\usepackage[titles]{tocloft}
\cftsetindents{figure}{0em}{2.75em}
\cftsetindents{table}{0em}{2.75em}
% list type=tcolorbox (default), uses \l@tcolorbox
\newtcolorbox[blend into=figures]{myfigure}[1][]{
float=!h, capture=hbox, every float=\centering, #1
}
% list type=figure, uses \l@figure, which is influenced by tocloft
\newtcolorbox[blend into=figures, list type=figure]{myfigure2}[1][]{
float=!h, capture=hbox, every float=\centering, #1
}
\begin{document}
\listoffigures
\begin{myfigure}[title=Env setting \texttt{list type=tcolorbox}]
content content content content
\end{myfigure}
\begin{myfigure2}[title=Env setting \texttt{list type=figure}]
content content content content
\end{myfigure2}
\begin{figure}[!h]
\centering
figure content
\caption{normal \texttt{figure} caption}
\end{figure}
\end{document}
Perhaps blend into
could set corresponding list type
automatically.
https://github.com/T-F-S/tcolorbox/blob/6d98db4263c612279cca47efde22d1ef8404e573/tex/latex/tcolorbox/tcolorbox.sty#L2142-L2145
@muzimuzhi I can confirm that your solution works perfectly. Thank you very much!
However, I am agree with your suggestion as user would think that blend into
will blend tcolorbox
into figure
list, which include how they appear in ToF.
Looking for more response/opinion regarding this. For the time being, I left the issue opened.
Perhaps
blend into
could set correspondinglist type
automatically.
For blend into=listings
, list type=lstlisting
(corresponds to \l@lstlisting
) is the needed setting.
Late update:
\tcbset{
new/.cd,
blend into/figures/.append style={list type=figure},
blend into/tables/.append style={list type=table},
blend into/listings/.append style={list type=lstlisting}
}
I see a certain (small) danger that existing user code may be affected by such changes and may need adaption.
But, I agree that blend into
should act as far as possible as the name suggests. Therefore, setting the list type
automatically is very reasonable for me and I will make these changes for the next version. Thank you for your proposals.
I see a certain (small) danger that existing user code may be affected by such changes and may need adaption.
Well, only for advanced users that know this behavior. We could put breaking change notice in the commit/release.
First of all, thank you for creating such great package. I am pretty new with Latex and tcolorbox has made it much easier to create such beautiful boxes!
I have a question regarding the interaction of
blend into
. I use tocloft package to adjust the indentation of Table of Figures using itscftsetindents
. However, it seems figures oftcolorbox
is not affected by it.As you can see, there are several entries that is indented inside a bit. Those are
tcolorbox
'sInputListing
usingblend into=figures
that is not affected bycftsetindents
.Below is the code I use to adjust the indentation of ToF entries.