사후 조치 장식의 두 번째 마크 좌표가 인식되지 않습니다.

사후 조치 장식의 두 번째 마크 좌표가 인식되지 않습니다.

장식에서 두 번째 마크 좌표가 인식되지 않습니다.

  \draw[thick,red,zigzag,postaction={
    decoration={
        markings,
        mark=at position 0.7 with \coordinate (x);
        mark=at position 0.5 with \coordinate (z); %unable to recognize z
    },
    decorate
  }] (-2,0) coordinate(a) -- (2,0) coordinate(b);

MWE는 다음과 같습니다.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\tikzset{zigzag/.style={decorate,decoration=zigzag}}
\begin{document}
\begin{tikzpicture}
  \coordinate (c) at (0,-2);
  \coordinate (d) at (4,-2);
  \coordinate (e) at (2,-4);
  \draw[thick,red,zigzag,postaction={
    decoration={
        markings,
        mark=at position 0.7 with \coordinate (x);
        mark=at position 0.5 with \coordinate (z); %unable to recognize z
    },
    decorate
  }] (-2,0) coordinate(a) -- (2,0) coordinate(b);

  \draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- cycle;
  \draw[thick,postaction={
    decoration={
        markings,
        mark = at position 0.7 with \coordinate (y);
    },
    decorate
  }] (a) -- (c);
  \draw[thick,red,dashed] (x) -- (y);

  \node[above = 10ex of z,red] (sn) {singularity};
\end{tikzpicture}
\end{document} 

PDFLaTeX를 사용하여 이 코드를 컴파일하면 다음과 같은 결과가 나타납니다.

! Package pgf Error: No shape named z is known.

See the pgf package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.32   \node[above = 10ex of z,red]
                                    (sn) {singularity};
? 

내가 어디로 잘못 가고 있는지 안내해주십시오.

답변1

옵션을 쉼표로 구분해야 합니다. 복잡한 인수를 중괄호 안에 넣는 것도 좋은 생각입니다.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\tikzset{zigzag/.style={decorate,decoration=zigzag}}
\begin{document}
\begin{tikzpicture}
  \coordinate (c) at (0,-2);
  \coordinate (d) at (4,-2);
  \coordinate (e) at (2,-4);
  \draw[thick,red,zigzag,postaction={
    decoration={
        markings,
        mark=at position 0.7 with {\coordinate (x);},
        mark=at position 0.5 with {\coordinate (z);},
    },
    decorate
  }] (-2,0) coordinate(a) -- (2,0) coordinate(b);

  \draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- cycle;
  \draw[thick,postaction={
    decoration={
        markings,
        mark = at position 0.7 with \coordinate (y);
    },
    decorate
  }] (a) -- (c);
  \draw[thick,red,dashed] (x) -- (y);

  \node[above = 10ex of z,red] (sn) {singularity};
\end{tikzpicture}
\end{document}

여기에 이미지 설명을 입력하세요

관련 정보