错误:我不知道密钥 \tikz\general shadow

错误:我不知道密钥 \tikz\general shadow

它可以编译,但是我看到一个错误:

I do not know the key \tikz\general shadow

这是代码:

\documentclass[10pt]{article}
\usepackage{amstext}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{array}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usepackage[margin=1.5in]{geometry} 
\usepackage{graphicx}
\usetikzlibrary{shapes,positioning}
\usepackage[utf8]{inputenc}

\begin{document}
 
\begin{tikzpicture}[scale = 0.3]
\tikzset{
    cli/.style={circle,ball color=black,inner sep=0pt,minimum size=5pt],draw, general shadow={fill=gray!60,shadow xshift=1pt,shadow yshift=-1pt}},
    c1/.style={very thick,black},
    c2/.style={very thick,red!65!black},
    c3/.style={very thick,green!70!black}}
\node[cli] (w0) at (-2,0) {}; 
\node[cli] (w1) at (-2,-4) {};
\node[cli] (w2) at (2,-4) {};
\node[cli] (w3) at (2,0) {};
\draw[c1] (w0) -- (w1);
\draw[c1] (w0) -- (w3);
\draw[c2] (w1) to  node [black,below] {$aaa$} (w2);
\draw[c1] (w2) -- (w3);
\draw[c2] (w2) -- (w0); 
\draw[c2] (w1) -- (w3); 
\end{tikzpicture}
\end{document}

答案1

您需要加载shadowsTikZ 库(\usetikzlibrary{shapes,positioning,shadows}):

在此处输入图片描述

\documentclass[10pt]{article}
\usepackage{amstext}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{array}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usepackage[margin=1.5in]{geometry} 
\usepackage{graphicx}
\usetikzlibrary{shapes,positioning,shadows}
\usepackage[utf8]{inputenc}

\begin{document}
 
\begin{tikzpicture}[scale = 0.3]
\tikzset{
    cli/.style={circle,ball color=black,inner sep=0pt,minimum size=5pt],draw, general shadow={fill=gray!60,shadow xshift=1pt,shadow yshift=-1pt}},
    c1/.style={very thick,black},
    c2/.style={very thick,red!65!black},
    c3/.style={very thick,green!70!black}}
\node[cli] (w0) at (-2,0) {}; 
\node[cli] (w1) at (-2,-4) {};
\node[cli] (w2) at (2,-4) {};
\node[cli] (w3) at (2,0) {};
\draw[c1] (w0) -- (w1);
\draw[c1] (w0) -- (w3);
\draw[c2] (w1) to  node [black,below] {$aaa$} (w2);
\draw[c1] (w2) -- (w3);
\draw[c2] (w2) -- (w0); 
\draw[c2] (w1) -- (w3); 
\end{tikzpicture}
\end{document}

相关内容