tikz를 사용하여 그림에 주석 달기; 특정 사진 너비 이상으로 장식이 사라지나요?

tikz를 사용하여 그림에 주석 달기; 특정 사진 너비 이상으로 장식이 사라지나요?

tikz를 사용하여 사진에 주석을 달려고 합니다. 어쨌든 내가 이해하지 못하는 행동이 있습니다. 주석선 끝에는 원에 불과한 장식을 그립니다. 장식은 를 통해 정의됩니다 tikzset. 지금까지는 특별한 것이 없습니다. 그런데 7cm 이상의 폭으로 사진에 주석을 달려고 하면 장식이 사라지는 현상이 발생합니다. Overleaf에서 테스트한 내용의 (최소) MWE는 다음과 같습니다.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage{float}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\tikzset{
    o/.style={
        shorten >=#1,
        decoration = {
            markings,
            mark={
                at position 1
                with {
                    \draw circle [radius=#1];   
                }
            }   
        },
        postaction = decorate,
    },
    o/.default=2pt
}

\begin{document}
  \begin{tikzpicture}
    \node[anchor=south west,inner sep=0] (image) at (0,0,0){
        \includegraphics[width=7cm]{frog}   %%% works with a picture width of 7cm
    };
    \begin{scope}[x={(image.south east)},y={(image.north west)}]
      \draw[o,>=stealth,shorten <= 2mm, line width=0.5mm] (-0.25,1.25) node {Frog} to[out=-90] (0.41,0.6);
    \end{scope}
  \end{tikzpicture}

  \begin{tikzpicture}
    \node[anchor=south west,inner sep=0] (image) at (0,0,0){
      \includegraphics[width=8cm]{frog} %%% circle vanishes with a picture width of 8cm
    };
    \begin{scope}[x={(image.south east)},y={(image.north west)}]
      \draw[o,>=stealth,shorten <= 2mm, line width=0.5mm] (-0.25,1.25) node {Frog} to[out=-90] (0.41,0.6);
    \end{scope}
  \end{tikzpicture}
\end{document}

첫 번째 사진은 가로 7cm로 설정되어 있습니다. 끝 부분에 원이 \draw여전히 그려져 있습니다. 너비가 8cm(유일한 차이점)로 설정된 두 번째 그림에서는 원이 더 이상 그려지지 않습니다.

왜 이런 일이 발생하는지, 어떻게 우회/수정할 수 있는지 알고 싶습니다.

답변1

어떤 크기의 이미지에서도 줄 끝의 원을 얻을 수 없습니다. 나는 이유를 조사하지 않고 대신 이미지에서 개구리를 가리키는 라인에 대한 훨씬 간단한 코드를 새로 작성했습니다. 여기에서는 두 개의 라이브러리를 사용합니다. arrows.meta선 끝의 원과 positioning선 좌표 결정을 위한 것입니다.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage{float}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, positioning}

\tikzset{line/.style={-{Circle[open,length=#1]},shorten <= 2mm, line width=0.5mm},
         line/.default=5pt}

\begin{document}
  \begin{tikzpicture}
    \node[anchor=north west,inner sep=0] (image) at (0,0,0){
        \includegraphics[width=3cm]{example-image-a}};
    \coordinate[above left=0.25 and 1.25 of image]         (a);
    \coordinate[above left=0.25 and 1.25 of image.center]  (b);
    \draw[line] (a) node {Frog} to[out=-90] (b);
  \end{tikzpicture}

\bigskip
  \begin{tikzpicture}
    \node[anchor=north west,inner sep=0] (image) at (0,0,0){
      \includegraphics[width=8cm]{example-image-b}};
    \coordinate[above left=0.25 and 1.25 of image]         (a);
    \coordinate[above left=0.60 and 0.41 of image.center]   (b);
    \draw[line] (a) node {Frog} to[out=-90] (b);
  \end{tikzpicture}
\end{document}

이는 다음을 제공합니다: 여기에 이미지 설명을 입력하세요

관련 정보