
다음 MWE는 예상대로 작동합니다.
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{quotes}
\begin{document}
\begin{tikzpicture}
\path (0,0) edge node[auto] (label) {label} (1,1);
\draw (label.south west) rectangle (label.north east);
\end{tikzpicture}
\end{document}
그런데 코드라인을 바꾸려고 하면
\path (0,0) edge node[auto] (label) {label} (1,1);;
~와 함께
\path (0,0) edge ["label",name=label] (1,1);
"fr0이라는 셰이프를 알 수 없습니다."라는 오류가 발생합니다.
나는 TikZ 매뉴얼(pp 237)의 설명에 따라 따옴표에 이름을 추가하는 것이 가능할 것으로 예상했습니다.
세부적으로, 따옴표 라이브러리가 로드될 때 Edge에 전달된 옵션 목록의 키-값 쌍 또는 경로 명령이 "로 시작할 때마다 키-값 쌍은 실제로 다음 형식의 문자열이어야 합니다.
"<text>"’<options>
이 문자열은 다음과 같이 변환됩니다.
edge node=node [every edge quotes]<options>]{<text>}
질문:
- 위 이미지와 같이 나중에 좌표로 사용할 수 있는 가장자리 인용에 이름을 추가할 수 있습니까?
- 가능하다면 어떻게 해야 하나요?
답변1
코드가 지정된 구문을 따르지 않습니다.
보다 최소한의 예를 사용하여 작업:
\documentclass[tikz]{standalone}
\usetikzlibrary{quotes}
\begin{document}
\begin{tikzpicture}
\path (0,0) edge ["My name is Harry."{name=Harry}] (1,1);
\draw (Harry.south west) rectangle (Harry.north east);
\end{tikzpicture}
\end{document}
네가 말할 때
<options>, "<text>"
<options>
edge
가 아닌 에 적용됩니다 edge quotes
. 당신은 사용해야합니다
"<text>"<options>
가 아닌 <options>
에 적용 하려는 경우 설명서에 나와 있습니다 .edge quotes
edge
비교하다
\path (0,0) edge [blue, "My name is Harry."{name=Harry, red}] (1,1);
이는 및 red
에 적용 됩니다 . 물론 경로의 노드가 해당 경로의 속성을 상속하기 때문에 이러한 차이는 관련이 없는 경우가 많습니다. 그러니까 그냥 말하면My name is Harry.
blue
edge
\path (0,0) edge [blue, "My name is Harry."{name=Harry}] (1,1);
Harry
와 둘 다 edge
가 될 것입니다 blue
.
그러나 이는 blue
직접 적용되기 때문 Harry
이 아니라 경로의 노드가 기본적으로 해당 경로의 색상을 상속하기 때문입니다. 그러나 이름은 이런 방식으로 상속되지 않습니다. 따라서 원하는 경우이름 Harry
오히려착색그 경우에는 매뉴얼에 명시된 구문을 사용해야 합니다.