colorslatexcallouts

Changing arrow parameters


Problem :

I want to make callouts on figures. I use package callouts, its great - but I want to have white shadow behind the arrow (to make them more visible). I also want the window with the number (for example 2.2) to be framed with black color.

This is what I have :

enter image description here

And this is what I want:

enter image description here

My code:


\documentclass[12pt,a4paper,notitlepage, twoside]{article}
\usepackage[utf8]{inputenc}
\usepackage{tabulary} 
\usepackage[OT4]{polski} 
\usepackage[polish]{babel}
\usepackage[export]{adjustbox} 
\usepackage[T1]{fontenc}
\usepackage{graphicx}
%\usepackage{nicematrix,tikz} 
\usepackage[table]{xcolor} 
**\usepackage[margin = 2cm, top=2cm, bottom=2cm, left=2.5cm, right=2.5cm, headsep=1cm]{geometry}**
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{hyperref}
\usepackage{caption}
\usepackage[text= black, background = white , arrow = black ]{callouts} 
\usepackage{tikz} % Rysowanie strzałek, odnośników na figures
\setcounter{tocdepth}{4} 
\setcounter{secnumdepth}{4} 
\usepackage{multirow}
\usepackage{nicematrix} 
\usepackage{calc}
\usepackage[export]{adjustbox} 
\usepackage{enumitem} 

\begin{figure}
    \centering
    \begin{annotate}{\includegraphics[width=0.9\textwidth]{zdj3.png}}{0.9}
        %\helpgrid[black]
        \callout{-6.2,3}{2.2}{-6.2,0.8}
        \callout{-5,3}{2.3}{-5,0.8}
        \callout{-4,3}{2.4}{-4,0.8}
        \callout{-2,3}{2.5}{-2,0.8}
    \end{annotate}
    \caption{FESTO}
    \label{fig:first}
\end{figure}


Solution

  • You could redefine the callout and add a second, white, arrow behind the normal arrow:

    \documentclass[12pt,a4paper,notitlepage, twoside]{article}
    \usepackage[utf8]{inputenc}
    \usepackage{tabulary} 
    \usepackage[OT4]{polski} 
    \usepackage[polish]{babel}
    \usepackage[export]{adjustbox} 
    \usepackage[T1]{fontenc}
    \usepackage{graphicx}
    %\usepackage{nicematrix,tikz} 
    \usepackage[table]{xcolor} 
    \usepackage[margin = 2cm, top=2cm, bottom=2cm, left=2.5cm, right=2.5cm, headsep=1cm]{geometry}
    \usepackage{fancyhdr}
    \pagestyle{fancy}
    \usepackage{hyperref}
    \usepackage{caption}
    \usepackage[text= black, background = white , arrow = black ]{callouts} 
    \usepackage{tikz} % Rysowanie strzałek, odnośników na figures
    \setcounter{tocdepth}{4} 
    \setcounter{secnumdepth}{4} 
    \usepackage{multirow}
    \usepackage{nicematrix} 
    \usepackage{calc}
    \usepackage[export]{adjustbox} 
    \usepackage{enumitem}
    
    
    \usetikzlibrary{arrows.meta}
    
    
    \renewcommand{\callout}[3]{%
    \node [fill=\bgcol] (text) at (#1) {\scriptsize\color{\focol} #2};
    \draw [
        \arcol,
        thick,
        -{Latex},
        preaction={draw=white,line width=4pt,-{Latex[length=3pt 2.5 0.8]},shorten >=-4.5pt}
      ] (text) -- (#3);
    }
    
     
    \begin{document}
    
    \begin{figure}
        \centering
        \begin{annotate}{\includegraphics[width=0.9\textwidth]{example-image-duck}}{0.9}
            %\helpgrid[black]
            \callout{-6.2,3}{2.2}{-6.2,0.8}
            \callout{-5,3}{2.3}{-5,0.8}
            \callout{-4,3}{2.4}{-4,0.8}
            \callout{-2,3}{2.5}{-2,0.8}
        \end{annotate}
        \caption{FESTO}
        \label{fig:first}
    \end{figure}
    
    \end{document}
    

    enter image description here