
我在 Macbook 上使用 Texmaker,但我的程式碼有問題。當我運行我的程式碼時,它總是顯示以下訊息:
「未定義的控制序列\pic」。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\usepackage{xcolor,pict2e}% to allow any radius
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{pics/myarc/.style args={inner #1 and outer #2 with fill #3}{
code={
\draw[very thick, #1] (1,0) arc (0:90:1cm);
\draw[very thick] (0,1) -- (0,2.2);
\draw[very thick, #2] (0,2.2) arc (90:0:2.2cm);
\draw[very thick] (2.2,0) -- (1,0);
\fill[#3] (1,0) arc (0:90:1cm) -- (0,2.2) arc (90:0:2.2cm) -- cycle;
}
}}
\begin{document}
\begin{tikzpicture}
\draw[very thick,<->] (-6,0) -- (6,0)node[anchor=north west] {$x$};
\pic [draw,very thick, rotate=-45] {myarc={inner blue!90 and outer blue with fill green!}};\end{tikzpicture}\end{document}