
다음 코드가 있습니다.
미리 정의된 기본 모양이 있는 노드가 포함된 tikz 행렬을 만들고 싶습니다.
그러나 때로는 매트릭스 내부에서 수동으로 지정하여 일부 노드의 모양을 변경하고 싶습니다.
나는 tikz 매뉴얼에서 수직선이 있는 노드의 텍스트 앞에 작성된 모든 코드가 노드의 코드로 전달된다는 것을 읽었습니다.
따라서 다음 코드는 두 번째 Joe Doe 노드의 코드로 전달되어야 합니다.
|(shape = rectangle)|
하지만 이것을 실행해도 작동하지 않는 것 같습니다.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix(a)[
matrix of nodes,
nodes in empty cells,
nodes={draw, circle, align=center, text width=0.8cm},
column sep={1.5cm, between origins},
row sep={1.5cm, between origins}
]{
& John \linebreak Doe &[5cm]|(shape = rectangle)| John \linebreak Doe& \\[2cm]
& & &\\
};
\draw[->] (a-1-1) -- (a-2-1);
\end{tikzpicture}
\end{document}
답변1
구분 기호가 잘못되었습니다. []
노드 옵션을 추가/재정의하려면 대괄호를 사용하세요 .
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix(a)[
matrix of nodes,
nodes in empty cells,
nodes={draw, circle, align=center, text width=0.8cm},
column sep={1.5cm, between origins},
row sep={1.5cm, between origins}
]{
& John \linebreak Doe &[5cm]|[rectangle]| John \linebreak Doe& \\[2cm]
& & &\\
};
\draw[->] (a-1-1) -- (a-2-1);
\end{tikzpicture}
\end{document}