I'd like to do call-outs on a tcolorbox like the ones in this diagram from the longfbox documentation's Breakable Content Section.
I've got my whole document using tcolorbox and pstricks but can't figure out how to make them work together. I think I need to imbed pstricks nodes inside the boxes somehow, but they are verbatim-style boxes so I'm at a loss. (Listings using the minted package inside the tcolorboxes.)
I did find this question that might help, but it is using Tikz and I'd rather stick with pstricks as I'm more familiar and comfortable with it. Can I embed pstricks in an overlay somehow as well? Would this help me pinpoint parts of a line of code within the main listing box?
Similarly this question holds promise, but is using Tikz and won't work with breakable boxes which all of mine are. This one pinpoints whole lines by line number, but I need parts of a line to show associativity of operations within the statement.
Details: I usually use underbracing on the board to draw this, but am producing some notes for public consumption and would like it to look similarly in the PDF.
Here's a MWE for a line and the idea I'm after but can't get to work:
\documentclass{article}
\usepackage{minted}
\usepackage[minted]{tcolorbox}
\tcbuselibrary{skins,breakable,listings,xparse,raster}
% tcb minted
\NewTCBListing{Cpp}{ O{} !O{} }{%
listing engine=minted,
listing only,
minted language=cpp,
minted options={style=default,
autogobble,
%showspaces,
tabsize=4,
#2},
skin=standard,
breakable,
#1}
\newmintinline[CppInline]{cpp}{autogobble,tabsize=4,style=default}
\newcommand{\code}[1]{\leavevmode\CppInline#1}
\begin{document}
Here's a line of code, for instance:
\begin{Cpp}[]
cin >> r1 >> r2 >> r3;
\end{Cpp}
I'd like underbraces below \code{cin >> r1} with a label saying
\code{cin}. And likewise another underbrace below that \code{cin} over to
the \code{r2}. Finally one connecting that 2$^{\textrm{}nd}$ brace's
\code{cin} to the \code{r3}.
\end{document}
It needs pygmentize installed with python and the -shell-escape command-line argument to the latex command.
Here is the result:
Any thoughts welcome!


tikzmark? Like https://tex.stackexchange.com/questions/657375/how-to-use-listing-tikz-and-tikzmark-packages-together-to-annotate-source-code – Rmano May 26 '23 at 18:30