在我尝试使用的每个程序中,括号的右端编译时都很奇怪。有人能帮我吗?
\documentclass[tikz,border=5]{standalone}
\usepackage{tikz}
\usepackage[brazilian]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usetikzlibrary{decorations.pathreplacing}
\def\layersep{2cm}
\begin{document}
\begin{tikzpicture}[shorten >=1pt,->,draw=black!50, node distance=\layersep]
\tikzstyle{every pin edge}=[<-,shorten <=1pt]
\tikzstyle{neuron}=[circle,thin,draw=black!80,minimum size=20pt,inner sep=0pt]
\tikzstyle{annot} = [text width=2cm, text centered]
\tikzstyle{input}=[circle,,fill=none,minimum size=20pt,inner sep=0pt]
% Draw the input layer nodes
\foreach \name / \y in {1,...,4}
% This is the same as writing \foreach \name / \y in {1/1,2/2,3/3,4/4}
\node[neuron] (I-\name) at (0,-\y) {$x_{\name}$};
% Draw the hidden layer nodes
\foreach \name / \y in {1,...,5}
\path[yshift=0.5cm]
node[neuron] (H1-\name) at (\layersep,-\y cm) {};
% Draw the hidden layer nodes
\foreach \name / \y in {1,...,2}
\path[yshift=0.5cm]
node[neuron] (H2-\name) at (2*\layersep,-\y cm - 1.5 cm) {};
% Draw the second hidden layer nodes
\foreach \name / \y in {1,...,6}
\path[yshift=0.5cm]
node[neuron] (H3-\name) at (3*\layersep,-\y cm + 0.5 cm){};
% Draw the output layer node
\foreach \name / \y in {1,...,3}
\path[yshift=0.5cm]
node[neuron] (O-\name) at (4*\layersep,-\y cm - 1cm){};
\foreach \name / \y in {1,...,3}
\path[yshift=0.5cm]
node[input] (Oy-\name) at (4.5*\layersep, -\y cm - 1cm) {$y_{\y}$};
% Connect every node in the input layer with every node in the
% hidden layer.
\foreach \source in {1,...,4}
\foreach \dest in {1,...,5}
\path (I-\source) edge (H1-\dest);
\foreach \source in {1,...,5}
\foreach \dest in {1,...,2}
\path (H1-\source) edge (H2-\dest);
\foreach \source in {1,...,2}
\foreach \dest in {1,...,6}
\path (H2-\source) edge (H3-\dest);
\foreach \source in {1,...,6}
\foreach \dest in {1,...,3}
\path (H3-\source) edge (O-\dest);
\foreach \source in {1,...,3}
\path (O-\source) edge (Oy-\source);
\draw[decoration=brace, decorate] (H1-1.north west |- 0,0.5) -- (H3-1.north east |- 0,0.5)
node (hiddenlayer) [midway, above=1pt] {\footnotesize{Hidden Layers}};
\end{tikzpicture}
\end{document}
答案1
->
由于您在所有行中使用,因此在这里
\begin{tikzpicture}[shorten >=1pt,->,draw=black!50, node distance=\layersep]
您需要添加-
此行,以便->
不使用默认行,因此正确的行是
\draw[decoration=brace, decorate,-] ...