5

I have the MWE to illustrate my problem. Either I have to remove the tkz-euclide package from the input and then give up on the \tkzMarkRighAngle function, or give up on drawing the neuralnetwork. Here is the code by commenting out the tkz-euclide and \tkzMarkRighAngle directives.

Please uncomment the \tkzMarkRighAngle directive to see what happens.

\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}

Here is the picture without the right angles

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 Answer 1

1

Missing to specify the necessary file by \usetkzobj

I suppose you are working with an early version than 3.03 of tkz-euclid package. In those versions one have to declare which particular files of tkz-euclid are require to do the job of the (specific) invoked commands.

In order to do that is need to write \usetkzobj{<file>} after \usepackage{tkz-euclid}. As an example the files would be <circles>, <polygon>, <arcs>,... If you not know exactly which files are required (in this case to \tkzMarkRightAngle), then the easiest way is to load all of the files by \usetkzobj{all}.

So simply write

\usepackage{tkz-euclide}
\usetkzobj{all}

in your preamble.

Notice that \usetkzobj{all} is no more needed since 3.03 as explained in the tkz-euclide documentation at page 18. Moreover in the newest version tkz-euclid will load tikz automatically.

1
  • You are right. I was using an old version. The newer version does not take the \usetkzobj directive. Nov 9, 2020 at 22:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .