我有 MWE 来说明我的问题。要么我必须tkz-euclide
从输入中删除包,然后放弃该\tkzMarkRighAngle
函数,要么放弃绘制神经网络。这是注释掉tkz-euclide
和\tkzMarkRighAngle
指令的代码。
请取消注释该\tkzMarkRighAngle
指令以查看会发生什么。
\documentclass[12pt]{article}
\usepackage[pdftex]{graphicx}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{subcaption}
\usepackage{ifthen}
%\usepackage{tkz-euclide}
\usepackage{neuralnetwork}
\pgfplotsset{compat=newest}
\providecommand{\norm}[1]{\lVert#1\rVert}
\begin{document}
\begin{center}
\begin{neuralnetwork}[height=5]
\newcommand{\nodetexth}[2]{\footnotesize $a=S \left ( \sum x_i \theta_i \right ) $}
\newcommand{\nodetextx}[2]{$x_#2$}
\newcommand{\nodetexty}[2]{$h(\theta,x)$}
\newcommand{\linklabelsA}[4]{$\theta_1$}
\newcommand{\linklabelsB}[4]{$\theta_2$}
\newcommand{\linklabelsC}[4]{$\theta_3$}
\newcommand{\linklabelsD}[4]{$\theta_4$}
\newcommand{\linklabelsO}[4]{$\theta_0$}
\inputlayer[count=4, bias=true, title=Input\\layer, text=\nodetextx]
\hiddenlayer[count=1, bias=false, title=Hidden\\layer, text=\nodetexth]
\linklayers
\link[from layer=0, to layer=1, from node=0, to node=1, label=\linklabelsO]
\link[from layer=0, to layer=1, from node=1, to node=1, label=\linklabelsA]
\link[from layer=0, to layer=1, from node=2, to node=1, label=\linklabelsB]
\link[from layer=0, to layer=1, from node=3, to node=1, label=\linklabelsC]
\link[from layer=0, to layer=1, from node=4, to node=1, label=\linklabelsD]
\outputlayer[count=1, title=Output\\layer, text=\nodetexty] \linklayers
\end{neuralnetwork}
\end{center}
\begin{center}
\begin{tikzpicture}[scale=1.0]
% Draw axes
\coordinate (O) at (0,0);
\draw [-latex,thick] (O) -- (0,8) node [above] {$y$};
\draw [-latex,thick] (O)-- (8,0) node [above] {$x$};
% draw points
\coordinate (P1) at (1,3);
\coordinate (P2) at (1.6,0.8);
\coordinate (P3) at (3.5,4.2);
\coordinate (P4) at (5.5,6.2);
\draw[red,thick] (P1) circle (6pt) node[] {$-$};
\draw[red,thick] (P2) circle (6pt) node[] {$-$};
\draw[black,thick] (P3) circle(6pt) node[] {$+$};
\draw[black,thick] (P4) circle (6pt) node[]{$+$};
% draw lines
\coordinate (A) at (3.33,2.35);
\coordinate (B) at (5.13,0.3);
\coordinate (C) at (0.1,4);
\coordinate (D) at (2.33,5.6);
\draw[dashed] (C) -- (3.33,0.3);
% width of segment
%\draw[dashed] (3.7,4) -- (6.93,0.3); % y=x+1
\draw[] (0.1,6.06) -- (B); % y=x+1
\draw[dashed] (0.1,8.12) -- (6.93,0.3); % y=x+1
\draw [dotted] (O) -- (A);
\draw [-latex,line width=2] (O) -- (1.11,0.783) node [above] {$w$};
%\tkzMarkRightAngle[draw=red,size=.2](O,A,B);
\node[xshift=2.2cm, rotate=-49] at (A) {$w \cdot x - b = 1$};
\node[xshift=0.4cm, rotate=-49] at (A) {$w \cdot x - b = 0$};
\node[xshift=-0.9cm, yshift=-0.7cm, rotate=-49] at (A) {$w \cdot x - b = -1$};
\end{tikzpicture}
\end{center}
\end{document}
If you uncomment the line with:
%\tkzMarkRightAngle[draw=red,size=.2](O,A,B);
you will find the error:
! Undefined control sequence.
l.1 \nn
@label
l.37 \end{neuralnetwork}
?
答案1
缺少指定必要的文件\usetkzobj
3.03
我猜你正在使用比软件包更早的版本tkz-euclid
。在这些版本中,必须声明哪些特定文件是tkz-euclid
执行(特定)调用命令所需的。
为了做到这一点,需要\usetkzobj{<file>}
在 之后写入\usepackage{tkz-euclid}
。例如,文件将是<circles>
、<polygon>
、<arcs>
、... 如果您不知道确切需要哪些文件(在本例中为\tkzMarkRightAngle
),那么最简单的方法是通过 加载所有文件\usetkzobj{all}
。
所以只需写
\usepackage{tkz-euclide}
\usetkzobj{all}
在你的序言中。
请注意,\usetkzobj{all}
由于3.03
如tkz-euclide 文档在第18页。此外,最新版本tkz-euclid
将tikz
自动加载。