
나는 \centerarc
제공된 명령을 사용했습니다.이것호로 둘러싸인 영역을 채우는 답입니다. 약간의 수정을 가했습니다. \draw
정의 내부와 첫 번째 매개변수를 제거했습니다 .
MWE:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\centering
\begin{tikzpicture}
\def\centerarc(#1)(#2:#3:#4){ ($(#1)+({#4*cos(#2)},{#4*sin(#2)})$) arc (#2:#3:#4); }
\coordinate (A) at (0,0);
\coordinate (B) at (1.6,0);
\coordinate (C) at (4,-2.5);
\draw \centerarc(0,0)(48.23:60:1.6);
\draw \centerarc(1.6,0)(120:180:1.6);
\draw \centerarc(4,-2.5)(128.47:147.99:4.72);
\fill[red]\centerarc(0,0)(48.23:60:1.6) -- \centerarc(1.6,0)(120:180:1.6) -- \centerarc(4,-2.5)(128.47:147.99:4.72);
\end{tikzpicture}
\end{document}
\centerarc
를 사용할 때 명령이 완벽하게 작동합니다 \draw
. 하지만 를 사용하려고 하면 \fill
명령이 텍스트로 인쇄됩니다.
왜 이런 일이 발생하며 해결 방법이 있습니까?
답변1
명령 \draw
은 다음과 같은 이유로 작동합니다.
\draw \centerarc(0,0)(48.23:60:1.6);
다음과 같이 확장됩니다.
\draw ($(0,0)+({1.6*cos(48.23)},{1.6*sin(48.23)})$) arc (48.23:60:1.6);;
;
( 마지막에 중복되어 해를 끼치 지 않습니다).
그러나 이것은 (첫 번째 명령만 대체):
\fill[red] \centerarc(0,0)(48.23:60:1.6) -- \centerarc(1.6,0)(120:180:1.6) -- \centerarc(4,-2.5)(128.47:147.99:4.72);
(명확성을 위해 줄 바꿈이 추가됨)은 다음과 같습니다.
\fill[red] ($(#1)+({#4*cos(#2)},{#4*sin(#2)})$) arc (#2:#3:#4);
-- \centerarc(1.6,0)(120:180:1.6) -- \centerarc(4,-2.5)(128.47:147.99:4.72);
\fill
에서 명령이 종료됩니다 ;
.
나머지는 -- \centerarc\ETC.
Ti를 제외하고는 어떤 문제도 일으키지 않아야 합니다(예상대로 작동하지 않는 것을 제외하고).케이Z는 스트레이를 무시한다텍스트환경 에서는 있지만 tikzpicture
수학에서는 그렇지 않습니다. 따라서 정의에서 $
... 사이의 모든 내용이 PDF에 기록됩니다.$
\centerarc
해결 방법: ;
정의에서 를 제거하세요. :)
\def\centerarc(#1)(#2:#3:#4){ ($(#1)+({#4*cos(#2)},{#4*sin(#2)})$) arc (#2:#3:#4) }