
도형을 완성 하는 데 사용되는 선을 "완성"하려면 무엇이 필요합니까 \draw
?
\documentclass{letter}
\usepackage{tikz}
\begin{document}
\tikzset{every picture/.style=thick}
\begin{tikzpicture}[scale=0.2]
\draw (11,-1) -- (13,-1) -- (13,1) -- (11,1) -- (13,0) -- (11,-1);
\draw(12,8) arc (-90:180:1);
\draw(12,8) -- (12,9) -- (11,9);
\end{tikzpicture}
\end{document}
모서리가 일부 모서리에서 들쭉날쭉하거나 다른 모서리의 모양을 "뚫습니다".
답변1
규칙은 다음과 같습니다.
- 완전한 단일 경로를 사용하거나 아래 설명에 있는 자신만의 단어를 사용하여 "한 번에 그려보세요"를 사용하세요. 즉, 둘 이상의
\draw
,\path
또는 so 명령을 사용하지 마십시오. 또한 틈이 없는지 확인하십시오. -- cycle
닫힌 경로를 닫으려면 추가하세요 .- 선택 사항: 적절한 줄 조인을 사용합니다.
사진에 적용하면 다음과 같은 결과가 나옵니다.
\documentclass[tikz, border=3mm]{standalone}
\begin{document}
\tikzset{every picture/.style=thick}
\begin{tikzpicture}[scale=0.2]
\begin{scope}
\draw (12,4) -- (12,3) arc (-90:180:1) -- cycle;
\draw (11,-1) -- (13,-1) -- (13,1) -- (11,1) -- (13,0) -- cycle;
\end{scope}
\begin{scope}[xshift=3.5cm,line join=round]
\draw (12,4) -- (12,3) arc (-90:180:1) -- cycle;
\draw (11,-1) -- (13,-1) -- (13,1) -- (11,1) -- (13,0) -- cycle;
\end{scope}
\begin{scope}[xshift=7cm,line join=bevel]
\draw (12,4) -- (12,3) arc (-90:180:1) -- cycle;
\draw (11,-1) -- (13,-1) -- (13,1) -- (11,1) -- (13,0) -- cycle;
\end{scope}
\begin{scope}[xshift=10.5cm,miter limit=1]
\draw (12,4) -- (12,3) arc (-90:180:1) -- cycle;
\draw (11,-1) -- (13,-1) -- (13,1) -- (11,1) -- (13,0) -- cycle;
\end{scope}
\end{tikzpicture}
\end{document}
이는 몇 가지 다른 라인 조인 옵션을 조사합니다. p를 참조하십시오. 자세한 내용은 pgfmanual v3.1.4의 172를 참조하세요.
물론, 멋진 선 결합을 위해 서로 다른 경로를 함께 패치하는 경우 일부 세그먼트의 방향을 되돌려야 하거나 적어도 유리하게 되돌려야 할 수도 있습니다. 예를 들어, 귀하의 질문에 대한 부록의 세 부분을 함께 패치할 때 하나의 호를 되돌려 다음을 얻습니다.
\documentclass[tikz, border=3mm]{standalone}
\begin{document}
\tikzset{every picture/.style=thick}
\begin{tikzpicture}[scale=0.25]
\draw (5,7) -- (7,5) -- (5,5) -- (7,7)
arc (90:180:1) arc (0:90:1) -- cycle;
\end{tikzpicture}
\end{document}
경로는 다음과 같이 단축될 수 있습니다.
\draw (7,5) -- (5,5) -- (7,7) arc (90:180:1) arc (0:90:1) -- cycle;