다음 그래프를 그리기 위해 tikz를 사용하고 있지만 Q와 Z의 교차점이 그래프에 표시되지 않습니다. 이에 대해 도움을 주십시오. .
\documentclass{article}
\usepackage[x11names]{xcolor}
\usepackage{tikz}
\usetikzlibrary{intersections}
\pgfdeclarelayer{bg} % declare background
\pgfsetlayers{bg,main} % order of layers (main = standard layer)
\usepackage{amsmath}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\draw (0,-1)--(0,5);
\draw (-1,0)--(8,0);
\draw[name path=P3] (7,0)node(a){A}--(0,2)node (b){B};
\draw[name path=P1] (3,0)node(c){C}--(0,3.5)node(m){M};
\draw[name path=P2] (2,0)node(e){E}--(2,4)node(d){D};
\draw (0,0)node(o){O};
\path [name intersections={of=P1 and P3,by=Q}];
\path [name intersections={of=P1 and P2,by=Z}];
\begin{pgfonlayer}{bg} % select background
\path [fill=blue!50] (o.center) --(e.center) --(Z.center) -- (Q.center)--(b.center)-- (o.center) --cycle;
\end{pgfonlayer}
\end{tikzpicture}
\end{document}
답변1
좌표는 표시하지 않기 때문에 표시되지 않지만 올바르게 계산됩니다. 다음은 이를 표시하는 한 가지 가능한 방법입니다.
\documentclass{article}
\usepackage[x11names]{xcolor}
\usepackage{tikz}
\usetikzlibrary{intersections}
\pgfdeclarelayer{bg} % declare background
\pgfsetlayers{bg,main} % order of layers (main = standard layer)
\usepackage{amsmath}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[dot/.style={circle,fill,inner sep=1pt}]
\draw (0,-1)--(0,5);
\draw (-1,0)--(8,0);
\draw[name path=P3]
(7,0)coordinate[label=below:$A$](a)--(0,2)coordinate[label=left:$B$](b);
\draw[name path=P1] (3,0)coordinate[label=below:$C$](c)--(0,3.5)coordinate[label=left:$M$](m);
\draw[name path=P2] (2,0)coordinate[label=below:$E$](e)--(2,4)coordinate[label=left:$D$](d);
\path(0,0)coordinate[label=below left:$O$](o);
\path [name intersections={of=P1 and P3,by=Q}] (Q) node[dot,label=above:$Q$]{};
\path [name intersections={of=P1 and P2,by=Z}] (Z) node[dot,label=right:$Z$]{}; ;
\begin{pgfonlayer}{bg} % select background
\path [fill=blue!50] (o.center) --(e.center) --(Z.center) -- (Q.center)--(b.center)-- (o.center) --cycle;
\end{pgfonlayer}
\end{tikzpicture}
\end{document}