5

I tried to reproduce Andrew Stacey's graph from the question "Creating this vectorised watermark in TikZ", but I get several error messages and no PDF file is produced.

However, if I use Overleaf, it works perfectly, I don't understand why. Maybe Overleaf uses an old version of the package?

My technical level in Latex is quite low, would you have any ideas to help me to make this file compilable?

\documentclass{article}
% \url{https://tex.stackexchange.com/q/427775/86}

\usepackage{tikz}

\usetikzlibrary{calligraphy}

\ExplSyntaxOn
\NewDocumentCommand \SPathSplit { m m m m }
{
  \spath_get:nnN {#2} {path} \l__tmpa_tl
  \spath_split_curve:nVNN {#1} \l__tmpa_tl \l__tmpb_tl \l__tmpc_tl
  \spath_clear_new:n {#3}
  \spath_clear_new:n {#4}
  \spath_put:nnV {#3} {path} \l__tmpb_tl
  \spath_put:nnV {#4} {path} \l__tmpc_tl
}
\ExplSyntaxOff

\makeatletter
\tikzset{save as spath/.code={%
    \tikz@addmode{%
      \pgfsyssoftpath@getcurrentpath\spath@tmp@path%
      \MakeSPath{#1}{\spath@tmp@path}%
    }%
  },%
  restore spath/.code={%
    \SPathInfoInto{#1}{minbb}{\spath@tmp@pt}%
    \expandafter\pgfqpoint\spath@tmp@pt
    \pgf@protocolsizes\pgf@x\pgf@y
    \SPathInfoInto{#1}{maxbb}{\spath@tmp@pt}%
    \expandafter\pgfqpoint\spath@tmp@pt
    \pgf@protocolsizes\pgf@x\pgf@y
    \SPathInfoInto{#1}{path}{\spath@tmp@path}%
    \pgfsyssoftpath@setcurrentpath\spath@tmp@path
  },
  heavy line width=.8pt,
  light line width=.1pt,
  line cap=butt
}
\makeatother

\begin{document}


\begin{tikzpicture}
\pen (0,0);
\clip (1,-5) rectangle (11,1);
\foreach[count=\n] \x in {0,0.05,...,2}{
  \tikzset{every path/.style={blue!\n!red!80},pen colour=blue!\n!red!80}
  \begin{scope}[opacity=.35,transparency group]
  \path[save spath=curve] (0,\x) .. controls (4-\x,-4-3*\x) and (11-2*\x,4-3*\x) .. (12,-5+3*\x);
  \SPathSplit{1/2}{curve}{first}{last}
  \SPathSplit{1/2}{first}{first}{middle}
  \draw[ultra thin, restore spath=first];
  \calligraphy[heavy, restore spath=middle];
  \draw[ultra thin, restore spath=last];
  \end{scope}

  \begin{scope}[opacity=.35,transparency group]
  \path[save spath=curve] (0,\x-1) .. controls (4-\x,\x-2) and (11-2*\x,-4-3*\x) .. (12,-3+3*\x);
  \SPathSplit{3/4}{curve}{first}{last}
  \SPathSplit{3/4}{last}{middle}{last}
  \draw[ultra thin, restore spath=first];
  \calligraphy[heavy, restore spath=middle];
  \draw[ultra thin, restore spath=last];
  \end{scope}

  \begin{scope}[opacity=.35,transparency group]
  \path[save spath=curve] (0,\x-3) .. controls (4-\x,\x-2) and (11-4*\x,-1-4*\x) .. (12,-5+3.5*\x);
  \SPathSplit{1/4}{curve}{first}{last}
  \SPathSplit{2/3}{last}{middle}{last}
  \draw[ultra thin, restore spath=first];
  \calligraphy[heavy, restore spath=middle];
  \draw[ultra thin, restore spath=last];
  \end{scope}


}
  \end{tikzpicture}
\end{document}

log file extract :

! Package pgfkeys Error: I do not know the key '/tikz/save spath', to which you
 passed 'curve', and I am going to ignore it. Perhaps you misspelled it.

See the pgfkeys package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.79 }
    
This error message was generated by an \errmessage
command, so I can't give any explicit help.
Pretend that you're Hercule Poirot: Examine all clues,
and deduce the truth by order and method.

! Undefined control sequence.
\SPathSplit code #1#2#3#4->\spath_get:nnN 
                                          {#2}{path}\l__tmpa_tl \spath_split...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...get:nnN {#2}{path}\l__tmpa_tl 
                                                  \spath_split_curve:nVNN {#...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...pa_tl \spath_split_curve:nVNN 
                                                  {#1}\l__tmpa_tl \l__tmpb_t...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...it_curve:nVNN {#1}\l__tmpa_tl 
                                                  \l__tmpb_tl \l__tmpc_tl \s...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...N {#1}\l__tmpa_tl \l__tmpb_tl 
                                                  \l__tmpc_tl \spath_clear_n...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...pa_tl \l__tmpb_tl \l__tmpc_tl 
                                                  \spath_clear_new:n {#3}\sp...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...l__tmpc_tl \spath_clear_new:n 
                                                  {#3}\spath_clear_new:n {#4...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ..._new:n {#3}\spath_clear_new:n 
                                                  {#4}\spath_put:nnV {#3}{pa...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...lear_new:n {#4}\spath_put:nnV 
                                                  {#3}{path}\l__tmpb_tl \spa...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...put:nnV {#3}{path}\l__tmpb_tl 
                                                  \spath_put:nnV {#4}{path}\...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...th}\l__tmpb_tl \spath_put:nnV 
                                                  {#4}{path}\l__tmpc_tl 
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...put:nnV {#4}{path}\l__tmpc_tl 
                                                  
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code #1#2#3#4->\spath_get:nnN 
                                          {#2}{path}\l__tmpa_tl \spath_split...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...get:nnN {#2}{path}\l__tmpa_tl 
                                                  \spath_split_curve:nVNN {#...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...pa_tl \spath_split_curve:nVNN 
                                                  {#1}\l__tmpa_tl \l__tmpb_t...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...it_curve:nVNN {#1}\l__tmpa_tl 
                                                  \l__tmpb_tl \l__tmpc_tl \s...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...N {#1}\l__tmpa_tl \l__tmpb_tl 
                                                  \l__tmpc_tl \spath_clear_n...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...pa_tl \l__tmpb_tl \l__tmpc_tl 
                                                  \spath_clear_new:n {#3}\sp...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...l__tmpc_tl \spath_clear_new:n 
                                                  {#3}\spath_clear_new:n {#4...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ..._new:n {#3}\spath_clear_new:n 
                                                  {#4}\spath_put:nnV {#3}{pa...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...lear_new:n {#4}\spath_put:nnV 
                                                  {#3}{path}\l__tmpb_tl \spa...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...put:nnV {#3}{path}\l__tmpb_tl 
                                                  \spath_put:nnV {#4}{path}\...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...th}\l__tmpb_tl \spath_put:nnV 
                                                  {#4}{path}\l__tmpc_tl 
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\SPathSplit code ...put:nnV {#4}{path}\l__tmpc_tl 
                                                  
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\pgfkeys@code #1\pgfeov ->\SPathInfoInto 
                                         {#1}{minbb}{\spath@tmp@pt }\expanda...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\pgfkeys@code ...foInto {#1}{minbb}{\spath@tmp@pt 
                                                  }\expandafter \pgfqpoint \...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\pgfkeys@code ...ndafter \pgfqpoint \spath@tmp@pt 
                                                  \pgf@protocolsizes \pgf@x ...
l.79 }
    
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Missing number, treated as zero.
<to be read again> 
\relax 
l.79 }
    
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again> 
\relax 
l.79 }
    
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

! Missing = inserted for \ifdim.
<to be read again> 
\relax 
l.79 }
    
I was expecting to see `<', `=', or `>'. Didn't.

! Missing number, treated as zero.
<to be read again> 
\relax 
l.79 }
    
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again> 
\relax 
l.79 }
    
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

! Missing number, treated as zero.
<to be read again> 
\relax 
l.79 }
    
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again> 
\relax 
l.79 }
    
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

! Missing number, treated as zero.
<to be read again> 
\global 
l.79 }
    
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again> 
\global 
l.79 }
    
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

! Missing number, treated as zero.
<to be read again> 
\relax 
l.79 }
    
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again> 
\relax 
l.79 }
    
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

! Missing number, treated as zero.
<to be read again> 
\relax 
l.79 }
    
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again> 
\relax 
l.79 }
    
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

! Missing = inserted for \ifdim.
<to be read again> 
\relax 
l.79 }
    
I was expecting to see `<', `=', or `>'. Didn't.

! Missing number, treated as zero.
<to be read again> 
\relax 
l.79 }
    
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again> 
\relax 
l.79 }
    
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

! Missing number, treated as zero.
<to be read again> 
\global 
l.79 }
    
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again> 
\global 
l.79 }
    
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

! Missing number, treated as zero.
<to be read again> 
\relax 
l.79 }
    
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again> 
\relax 
l.79 }
    
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

! Missing number, treated as zero.
<to be read again> 
\global 
l.79 }
    
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again> 
\global 
l.79 }
    
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

! Missing = inserted for \ifdim.
<to be read again> 
\global 
l.79 }
    
I was expecting to see `<', `=', or `>'. Didn't.

! Missing number, treated as zero.
<to be read again> 
\global 
l.79 }
    
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again> 
\global 
l.79 }
    
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

! You can't use a prefix with `the character <'.
<to be read again> 
<
l.79 }
    
I'll pretend you didn't say \long or \outer or \global or
\protected.

! Missing number, treated as zero.
<to be read again> 
\global 
l.79 }
    
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again> 
\global 
l.79 }
    
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

! Missing number, treated as zero.
<to be read again> 
\global 
l.79 }
    
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again> 
\global 
l.79 }
    
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

! Missing number, treated as zero.
<to be read again> 
\global 
l.79 }
    
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again> 
\global 
l.79 }
    
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

! Missing = inserted for \ifdim.
<to be read again> 
\global 
l.79 }
    
I was expecting to see `<', `=', or `>'. Didn't.

! Missing number, treated as zero.
<to be read again> 
\global 
l.79 }
    
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
1
  • The spath3 library has been considerably updated recently and so code that digs a bit deeper, like this, might need adapting. I guess that overleaf uses the older version. Sep 22, 2021 at 8:39

1 Answer 1

6

As I wrote in the comment, the spath3 library has developed considerably since the original answer was given and as it uses internal code, the update broke it. The following code re-implements it. This uses the development version available from github because it has updated even further since the version on ctan and part of that was a better error handling of paths. If you can't update, replace the split~ at~ into code with:

split~ at~ into/.code~ n~ args={4}{
        \spath_split_at:ccvn
        {\__tikzspath_path_name:n {#1}}
        {\__tikzspath_path_name:n {#2}}
        {\__tikzspath_path_name:n {#3}}
        {#4}
  }

This key, split at into, feels like it ought to be in the library in some form so I'll look at putting that in.

\documentclass{article}
% \url{https://tex.stackexchange.com/q/427775/86}
% \url{https://tex.stackexchange.com/q/616249/86}

\usepackage{tikz}

\usetikzlibrary{calligraphy,spath3}

\ExplSyntaxOn

\cs_generate_variant:Nn \spath_split_at:NNnn {ccvn}

\tikzset{
  spath/.cd,
  split~ at~ into/.code~ n~ args={4}{
    \__tikzspath_maybe_current_path:nn
    {
      \__tikzspath_check_path:nnn
      {
        \spath_split_at:ccvn
        {\__tikzspath_path_name:n {#1}}
        {\__tikzspath_path_name:n {#2}}
      }
    }
    {#3} {\use_none:n} {#4}
  }
}

\ExplSyntaxOff

\tikzset{
  heavy line width=.8pt,
  light line width=.1pt,
  line cap=butt
}

\begin{document}


\begin{tikzpicture}
\pen (0,0);
\clip (1,-5) rectangle (11,1);
\foreach[count=\n] \x in {0,0.05,...,2}{
  \tikzset{every path/.style={blue!\n!red!80},pen colour=blue!\n!red!80}
  \begin{scope}[opacity=.35,transparency group]
  \path[spath/save=curve] (0,\x) .. controls (4-\x,-4-3*\x) and (11-2*\x,4-3*\x) .. (12,-5+3*\x);
  \tikzset{
    spath/split at into={first}{last}{curve}{.5},
    spath/split at into={first}{middle}{first}{.5},
  }
  \draw[ultra thin, spath/use=first];
  \calligraphy[heavy,spath/use=middle];
  \draw[ultra thin,spath/use=last];
  \end{scope}

  \begin{scope}[opacity=.35,transparency group]
  \path[spath/save=curve] (0,\x-1) .. controls (4-\x,\x-2) and (11-2*\x,-4-3*\x) .. (12,-3+3*\x);
  \tikzset{
    spath/split at into={first}{last}{curve}{.75},
    spath/split at into={middle}{last}{last}{.75},
  }
  \draw[ultra thin, spath/use=first];
  \calligraphy[heavy, spath/use=middle];
  \draw[ultra thin, spath/use=last];
  \end{scope}

  \begin{scope}[opacity=.35,transparency group]
  \path[spath/save=curve] (0,\x-3) .. controls (4-\x,\x-2) and (11-4*\x,-1-4*\x) .. (12,-5+3.5*\x);
  \tikzset{
    spath/split at into={first}{last}{curve}{.25},
    spath/split at into={middle}{last}{last}{2/3},
  }
  \draw[ultra thin, spath/use=first];
  \calligraphy[heavy, spath/use=middle];
  \draw[ultra thin, spath/use=last];
  \end{scope}


}
  \end{tikzpicture}
\end{document}

It takes a bit of time to compile on my (slow) machine; the result is:

tapering paths

8
  • 1
    I have these error on MikTeX : ! Undefined control sequence. \pgfk@/tikz/spath/split at into/.@@body ...ath:nn {\__tikzspath_check_path:n... l.79 }
    – AndréC
    Sep 25, 2021 at 20:25
  • @AndréC Bother. I forgot that I've changed some of the structure even since the last version I uploaded to CTAN. Either get the latest version from CTAN or try the fix I've just put in the answer. Sep 25, 2021 at 21:49
  • 3
    It looks like a book cover - I absolutely like it.
    – Sebastiano
    Sep 25, 2021 at 22:18
  • (I can no longer edit the comment above - I meant "latest version from github") Sep 26, 2021 at 7:32
  • @AndrewStacey MikTeX has just been updated to version 2.4 and I have still this error ! Undefined control sequence. \pgfk@/tikz/spath/split at into/.@@body ...ath:nn {\__tikzspath_check_path:n... l.79 }
    – AndréC
    Oct 4, 2021 at 12:59

You must log in to answer this question.

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