4

I am using the tikz based neuralnetwork library and I am trying to change the variable nnlinklabelextrastyle to modify the font of of the edge labels, but I can't figure out how to target nnlinklabelextrastyle with the renewcommand or how to go about looking for a solution, terminology wise, in case the way I am trying to do it is all wrong.

Edit: Here is a minimal examples that produces a neural network image but the text is too big. I am trying to make it smaller by changing the font style. Also there are some error when running the example but I cannot figure out how to fix it from the error message, although I think I am missing a package definition or something similar...

\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{neuralnetwork}


\begin{document}
\begin{neuralnetwork} [nodespacing=12mm, layerspacing=45mm,
            maintitleheight=2.5em, layertitleheight=2.5em,
            height=5, toprow=false, nodesize=30pt, style={},
            titlestyle={}]
%\newcommand\nnlinklabelextrastyle{font=\small}  %<-- failed attempt
\newcommand{\linklabelsU}[4]{Error wrt $w_{#4,#2}^#3$}
\inputlayer[count=3, bias=false]
\hiddenlayer[count=4, bias=false]
\link[style={thick, color=red}, from layer=1, to layer=0, from node=1, to node=1, label=\linklabelsU]
\outputlayer[count=1]
\link[style={thick, color=red}, from layer=2, to layer=1, from node=1, to node=1, label=\linklabelsU]
\link[style={thick, color=red}, from layer=2, to layer=1, from node=1, to node=2, label=\linklabelsU]
\link[style={thick, color=red}, from layer=2, to layer=1, from node=1, to node=3, label=\linklabelsU]
\link[style={thick, color=red}, from layer=2, to layer=1, from node=1, to node=4, label=\linklabelsU]
\end{neuralnetwork}
\end{document}

Backpropagation of neural net

7
  • you don't do renewcommand to pgfkeys based /.style options.
    – percusse
    Mar 5, 2016 at 16:12
  • Please provide a Minimal Working Example. So others can help you Mar 5, 2016 at 16:13
  • If anyone understand what I am trying to do and has a better title in mind, please don't hesitate and edit it, because I think it is not very descriptive. Mar 5, 2016 at 16:31
  • @percusse nnlinklabelextrastyle is not a style key, it's a macro that is \defed in the package code. Mar 5, 2016 at 17:26
  • @PaulGessler Really? Oh my. I would stay away from that probably.
    – percusse
    Mar 5, 2016 at 17:34

1 Answer 1

2

This is due to the fact that the author defined the options using xkeyval inside the TikZ key declarations. My guess is that he/she wanted to mimic the TikZ syntax without the tedious TikZ parser hacking.

Hence to be able to make the keys seen by the TikZ parser, the author used \edef on the macros. But that trips when TeX tries to expand \small and so on.

If you really need this package, then I would suggest converting things to pgfkeys once and for all and make a pull request on Github.

You must log in to answer this question.

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