我尝试重现 Andrew Stacey 的图表,该图表来自这个问题“在 TikZ 中创建矢量水印“,但我收到了几条错误消息,并且没有生成 PDF 文件。
但是,如果我使用 Overleaf,它就可以完美地工作,我不明白为什么。也许 Overleaf 使用了旧版本的软件包?
我的 Latex 技术水平很低,您有什么办法可以帮助我使这个文件可编译吗?
\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
文件提取:
! 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
正如我在评论中写到的,spath3
自从给出最初的答案以来,这个库已经得到了很大的发展,由于它使用了内部代码,更新破坏了它。以下代码重新实现了它。它使用了可从以下网址获得的开发版本:github
因为它自 ctan 版本以来已经进一步更新,其中一部分是路径的错误处理得到改善。如果您无法更新,请将代码替换split~ at~ into
为:
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}
}
这个键,split at into
感觉应该以某种形式放在图书馆里,所以我会考虑把它放进去。
\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}
在我的(慢速)机器上编译需要一点时间;结果是: