0

Last time I updated MiKTeX was over an year and till now the below MWE worked:

\begin{filecontents*}{tst.tex}
  \begin{tikzpicture}[auto]
    % placing the nodes
    \node[signal] (input) {};
    \node[
          sum,
          right = of input
         ] (left sum) {};
    \node[
          block,
          right = of left sum
         ] (controller) {$#3$};
    \node[
          block,
          right = of controller
         ] (system) {$#5$};
    \node[
          sum,
          right = of system
         ] (right sum) {};
    \node[
          block,
          above = of right sum
         ] (Gd) {$#7$};
    \node[
          signal,
          above = of Gd
         ] (disturbances) {};
    \node[
          branch,
          right = of right sum
         ] (branch) {};
    \node[
          signal,
          right = of branch
         ] (output) {};
    \node[
          signal,
          below = of left sum
         ] (feedback) {};
    % connecting the nodes
    \draw
      [->] (input) -- node {$#1$} (left sum);
    \draw
      [->] (left sum) -- node {$#2$} (controller);
    \draw
      [->] (controller) -- node {$#4$} (system);
    \draw
      [->] (system) -- (right sum);
    \draw
      [->] (disturbances) -- node {$#6$} (Gd);
    \draw
      [->] (Gd) -- node {$#8$} (right sum);
    \draw
      (right sum) -- (branch);
    \draw
      [->] (branch) -- node {$#9$} (output);
    \draw
      (branch) |- (feedback);
    \draw
      [->] (feedback) -- node[pos = .95] {$-$} (left sum);
  \end{tikzpicture}
\end{filecontents*}

\documentclass{scrartcl}
\usepackage{
            tikz,
            amsmath
            }
\usepackage{siunitx} % for test reasons

\usetikzlibrary{positioning}
\tikzset{
         signal/.style = coordinate,
         sum/.style = {
                       draw,
                       circle,
                       inner sep = 0pt,
                       minimum size = 2mm
                      },
         block/.style = {
                         draw,
                         rectangle,
                         minimum height = 2em,
                         minimum width = 4em
                        },
         branch/.style = {
                          sum,
                          minimum size = 1mm,
                          fill = black
                         }
        }

\newcommand*\Y{\underline Y}
\newcommand*\G{\mathbf G}
\newcommand*\D{\underline D}
\newcommand*\K{\mathbf K}
\newcommand*\E{\underline E}
\newcommand*\R{\underline R}
\ExplSyntaxOn
  \cs_generate_variant:Nn
  \cs_set_protected:Nn {cV}
  \NewDocumentCommand{\loadFile}{mO{0}m}{\tl_set_from_file:Nnn
                                         \l_tmpa_tl {}{#3}
                                         \cs_set_protected:cV {__tempFuction:\prg_replicate:nn {#2}{n}}
                                         \l_tmpa_tl
                                         \cs_new_eq:Nc #1 {__tempFuction:\prg_replicate:nn {#2}{n}}}
\ExplSyntaxOff
\loadFile\controlWithoutNoise[9]{tst}

\begin{document}

  \controlWithoutNoise{\R}{\E}{\K}{\underline0}{\G}{\D}{\G_d}{}{\Y}

\end{document}

So I suppose that the syntax of this part (which I have from here):

\ExplSyntaxOn
  \cs_generate_variant:Nn
  \cs_set_protected:Nn {cV}
  \NewDocumentCommand{\loadFile}{mO{0}m}{\tl_set_from_file:Nnn
                                         \l_tmpa_tl {}{#3}
                                         \cs_set_protected:cV {__tempFuction:\prg_replicate:nn {#2}{n}}
                                         \l_tmpa_tl
                                         \cs_new_eq:Nc #1 {__tempFuction:\prg_replicate:nn {#2}{n}}}
\ExplSyntaxOff

was changed it this time. Is there a way to get it work again?

Thank you for your help and effort in advance!

3
  • Could you say what exactly the error is?
    – Joseph Wright
    Commented Aug 26, 2021 at 8:46
  • @JosephWright \tl_set_from_file:Nnn is undefined. Commented Aug 26, 2021 at 8:48
  • I fixed the code in the quoted answer replacing the deprecated function.
    – egreg
    Commented Aug 26, 2021 at 10:55

1 Answer 1

3

\tl_set_from_file:Nnn has been deprecated. You must replace it and change the order of the arguments:

\begin{filecontents*}{tst.tex}
  \begin{tikzpicture}[auto]
    % placing the nodes
    \node[signal] (input) {};
    \node[
          sum,
          right = of input
         ] (left sum) {};
    \node[
          block,
          right = of left sum
         ] (controller) {$#3$};
    \node[
          block,
          right = of controller
         ] (system) {$#5$};
    \node[
          sum,
          right = of system
         ] (right sum) {};
    \node[
          block,
          above = of right sum
         ] (Gd) {$#7$};
    \node[
          signal,
          above = of Gd
         ] (disturbances) {};
    \node[
          branch,
          right = of right sum
         ] (branch) {};
    \node[
          signal,
          right = of branch
         ] (output) {};
    \node[
          signal,
          below = of left sum
         ] (feedback) {};
    % connecting the nodes
    \draw
      [->] (input) -- node {$#1$} (left sum);
    \draw
      [->] (left sum) -- node {$#2$} (controller);
    \draw
      [->] (controller) -- node {$#4$} (system);
    \draw
      [->] (system) -- (right sum);
    \draw
      [->] (disturbances) -- node {$#6$} (Gd);
    \draw
      [->] (Gd) -- node {$#8$} (right sum);
    \draw
      (right sum) -- (branch);
    \draw
      [->] (branch) -- node {$#9$} (output);
    \draw
      (branch) |- (feedback);
    \draw
      [->] (feedback) -- node[pos = .95] {$-$} (left sum);
  \end{tikzpicture}
\end{filecontents*}

\documentclass{scrartcl}
\usepackage{
            tikz,
            amsmath
            }
\usepackage{siunitx} % for test reasons

\usetikzlibrary{positioning}
\tikzset{
         signal/.style = coordinate,
         sum/.style = {
                       draw,
                       circle,
                       inner sep = 0pt,
                       minimum size = 2mm
                      },
         block/.style = {
                         draw,
                         rectangle,
                         minimum height = 2em,
                         minimum width = 4em
                        },
         branch/.style = {
                          sum,
                          minimum size = 1mm,
                          fill = black
                         }
        }

\newcommand*\Y{\underline Y}
\newcommand*\G{\mathbf G}
\newcommand*\D{\underline D}
\newcommand*\K{\mathbf K}
\newcommand*\E{\underline E}
\newcommand*\R{\underline R}
\ExplSyntaxOn
  \cs_generate_variant:Nn
  \cs_set_protected:Nn {cV}
  \NewDocumentCommand{\loadFile}{mO{0}m}{\file_get:nnN %<------------
                                         {#3}{}\l_tmpa_tl %<----------
                                         \cs_set_protected:cV {__tempFuction:\prg_replicate:nn {#2}{n}}
                                         \l_tmpa_tl
                                         \cs_new_eq:Nc #1 {__tempFuction:\prg_replicate:nn {#2}{n}}}
\ExplSyntaxOff
\loadFile\controlWithoutNoise[9]{tst}

\begin{document}

  \controlWithoutNoise{\R}{\E}{\K}{\underline0}{\G}{\D}{\G_d}{}{\Y}

\end{document}

You must log in to answer this question.

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