4

I would like to have a universal callout style that works with boundaries, transparency, multiple pointers, and different sizes of pointers. Something similar to this solution.

Kpym's solution works very good with multiple pointers. Example:

\documentclass[border=5mm]{standalone}
\usepackage{standalone}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usetikzlibrary{
decorations.pathreplacing,
shadows.blur}
\definecolor{left} {HTML}{001528}
\tikzset{
add path/.style = {
decoration={show path construction,
moveto code={
\xdef\savedpath{\savedpath (\tikzinputsegmentfirst)}
},
lineto code={
\xdef\savedpath{\savedpath -- (\tikzinputsegmentlast)}
},
curveto code={
\xdef\savedpath{\savedpath .. controls (\tikzinputsegmentsupporta) and 
(\tikzinputsegmentsupportb) ..(\tikzinputsegmentlast)}
 },
 closepath code={
 \xdef\savedpath{\savedpath -- cycle}}},decorate},store path/.style = {add 
 path},
 store path/.prefix code={\xdef\savedpath{}},
 callouts/.style={
 store path,
 append after command={
 foreach \target in {#1}{
 ($(callout)!2pt!-90:\target$)--\target --($(callout)!2pt!90:\target$)
 } \savedpath},
 alias=callout},
 custom style/.style={fill=black!20,text=,},}
\begin{document}
\begin{tikzpicture}
\path[custom style] (7.5,-11) 
node[rounded corners,align=left,callouts={(9,-12),(9,-10)}]{blah, blah};
\end{tikzpicture} 
\end{document}

enter image description here

However, as soon as you try to change the custom style to a callout with transparency and boundaries the result is very ugly.

\documentclass[border=5mm]{standalone}
\usepackage{standalone}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usetikzlibrary{
decorations.pathreplacing,
shadows.blur}
\definecolor{left} {HTML}{001528}
\tikzset{
add path/.style = {
decoration={show path construction,
moveto code={
\xdef\savedpath{\savedpath (\tikzinputsegmentfirst)}
},
lineto code={
\xdef\savedpath{\savedpath -- (\tikzinputsegmentlast)}
},
curveto code={
\xdef\savedpath{\savedpath .. controls (\tikzinputsegmentsupporta) and 
(\tikzinputsegmentsupportb) ..(\tikzinputsegmentlast)}
 },
 closepath code={
 \xdef\savedpath{\savedpath -- cycle}}},decorate},store path/.style = {add 
 path},
 store path/.prefix code={\xdef\savedpath{}},
 callouts/.style={
 store path,
 append after command={
 foreach \target in {#1}{
 ($(callout)!2pt!-90:\target$)--\target --($(callout)!2pt!90:\target$)
 } \savedpath},
 alias=callout},
 custom style/.style={fill=black!20,text=,},}
\begin{document}
\begin{tikzpicture}
\path[custom style] (7.5,-11) 
node[rounded corners,align=left,callouts={(9,-12),(9,-10)}]{blah, blah};
\end{tikzpicture} 
\end{document}

enter image description here

Question: As described above my question is if there is a similar solution with transparancy, boundaries, and different sizes of pointers.

  • I think there are not many who will understand what you are after. So you might want to explain what features you want to have added to Kpym's solution. Most people won't know that in its present form it does not allow you to draw a nice border very easily. – user121799 Sep 7 '18 at 15:13
  • 1
    Thanks for your input. I tried to make my question clearer. I hope now everyone understands what I am looking for. – danik Sep 7 '18 at 19:55
  • the solution closest to what you like to have is (to my opinion) provided in answer https://tex.stackexchange.com/questions/187165/callout-with-multiple-pointers-how-to-design-it/361532#361532 – Zarko Sep 7 '18 at 20:10
3

Here is a very simple-minded proposal, certainly not a full solution. Kpym's solution is particularly attractive IMHO because it does not make use of any sophisticated methods, and just works. Of course, it has the limitations you mention. The solutions by Qrrbrbirlbel and by Symbol 1 are of course ingenious. Their key observation is to put several callouts on top of each other. One way to go is to take Kpym's solution and adopt the philosophy of the others. With a little bit of copy and paste one can then get pretty much everything one wants. The basic trick is to draw a callout with some larger line width and draw and draw a second one without draw but some fill on top of it.

\documentclass[border=5mm]{standalone}
\usepackage{standalone}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usetikzlibrary{
decorations.pathreplacing,
shadows.blur}
\definecolor{left} {HTML}{001528}
\tikzset{
add path/.style = {
decoration={show path construction,
moveto code={
\xdef\savedpath{\savedpath (\tikzinputsegmentfirst)}
},
lineto code={
\xdef\savedpath{\savedpath -- (\tikzinputsegmentlast)}
},
curveto code={
\xdef\savedpath{\savedpath .. controls (\tikzinputsegmentsupporta) and 
(\tikzinputsegmentsupportb) ..(\tikzinputsegmentlast)}
 },
 closepath code={
 \xdef\savedpath{\savedpath -- cycle}}},decorate},store path/.style = {add 
 path},
 store path/.prefix code={\xdef\savedpath{}},
 callouts/.style={
 store path,
 append after command={
 foreach \target in {#1}{
 ($(callout)!2pt!-90:\target$)--\target --($(callout)!2pt!90:\target$)
 } \savedpath},
 alias=callout},
 custom style/.style={},}
\begin{document}
\begin{tikzpicture}
% first
\path[draw,very thick,line join=round] (7.5,-3) 
node[rounded corners,align=left,callouts={(9,-4),(9,-2)}]{blah, blah};
\path[fill=white] (7.5,-3) 
node[rounded corners,align=left,callouts={(9,-4),(9,-2)}]{blah, blah};
% second
\path[draw,very thick,line join=round,blur shadow] (7.5,-6) 
node[rounded corners,align=left,callouts={(9,-7),(9,-5)}]{blah, blah};
\path[fill=white] (7.5,-6) 
node[rounded corners,align=left,callouts={(9,-7),(9,-5)}]{blah, blah};
\path[fill=blue,opacity=0.3] (7.5,-6) 
node[rounded corners,align=left,callouts={(9,-7),(9,-5)}]{blah, blah};
\end{tikzpicture} 
\end{document}

enter image description here

Of course, one can make this a macro that saves one from copy and paste, or even a TikZ style by using the save path/use path trick. If you ask me to, I'll be happy to spell this out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.