我已将 texlive 更新至 2012 版。然而,当我尝试编译从以下网址获得的示例代码时,这里,我的尝试失败了。
\documentclass[tikz,border=2bp]{standalone}
\usetikzlibrary{backgrounds,calc,trees,hobby}
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}
\newcommand{\hobbyconvexpath}[2]{
[
create hobbyhullnodes/.code={
\global\edef\namelist{#1}
\foreach [count=\counter] \nodename in \namelist {
\global\edef\numberofnodes{\counter}
\node at (\nodename)
[draw=none,name=hobbyhullnode\counter] {};
}
\node at (hobbyhullnode\numberofnodes)
[name=hobbyhullnode0,draw=none] {};
\pgfmathtruncatemacro\lastnumber{\numberofnodes+1}
\node at (hobbyhullnode1)
[name=hobbyhullnode\lastnumber,draw=none] {};
},
create hobbyhullnodes
]
($(hobbyhullnode1)!#2!-90:(hobbyhullnode0)$)
\pgfextra{
\gdef\hullpath{}
\foreach [
evaluate=\currentnode as \previousnode using \currentnode-1,
evaluate=\currentnode as \nextnode using \currentnode+1
] \currentnode in {1,...,\numberofnodes} {
\pgfmathtruncatemacro\thecurrentnode\currentnode
\pgfmathtruncatemacro\thepreviousnode\previousnode
\pgfmathtruncatemacro\thenextnode\nextnode
\xdef\hullpath{\hullpath
..($(hobbyhullnode\thecurrentnode)!#2!180:(hobbyhullnode\thepreviousnode)$)
..($(hobbyhullnode\thenextnode)!0.5!(hobbyhullnode\thecurrentnode)$)}
\ifx\currentnode\numberofnodes
\xdef\hullpath{\hullpath .. cycle}
\else
\xdef\hullpath{\hullpath
..($(hobbyhullnode\thenextnode)!#2!-90:(hobbyhullnode\thecurrentnode)$)}
\fi
}
}
\hullpath
}
\begin{document}
\begin{tikzpicture}[use Hobby shortcut,scale=3,transform shape]
\node (f) {f}
child { node (g) {g}
child { node (a) {a}
}
child { node (b) {b}
}
}
child { node (h) {h}
child { node (c) {c}
}
};
\begin{pgfonlayer}{background}
\fill[red,opacity=0.3] \hobbyconvexpath{a,g,b}{10pt};
\end{pgfonlayer}
\draw[blue,dashed]($(hobbyhullnode1)!10pt!-90:(hobbyhullnode0)$)--
($(hobbyhullnode1)!10pt!-90:(hobbyhullnode0)$)..($(hobbyhullnode1)!10pt!180:(hobbyhullnode0)$)..
($(hobbyhullnode2)!0.5!(hobbyhullnode1)$) ..
($(hobbyhullnode2)!10pt!-90:(hobbyhullnode1)$)..($(hobbyhullnode2)!10pt!180:(hobbyhullnode1)$)..($(hobbyhullnode3)!0.5!(hobbyhullnode2)$)..
($(hobbyhullnode3)!10pt!-90:(hobbyhullnode2)$)..($(hobbyhullnode3)!10pt!180:(hobbyhullnode2)$)
..($(hobbyhullnode4)!0.5!(hobbyhullnode3)$) .. cycle;
\begin{pgfonlayer}{background}
\fill[green!50!lime,opacity=0.4] \hobbyconvexpath{g,f,h,c}{10pt};
\end{pgfonlayer}
\draw[blue,dashed]($(hobbyhullnode1)!10pt!-90:(hobbyhullnode0)$)--
($(hobbyhullnode1)!10pt!-90:(hobbyhullnode0)$)..($(hobbyhullnode1)!10pt!180:(hobbyhullnode0)$)..
($(hobbyhullnode2)!0.5!(hobbyhullnode1)$) ..
($(hobbyhullnode2)!10pt!-90:(hobbyhullnode1)$)..($(hobbyhullnode2)!10pt!180:(hobbyhullnode1)$)..($(hobbyhullnode3)!0.5!(hobbyhullnode2)$)..
($(hobbyhullnode3)!10pt!-90:(hobbyhullnode2)$)..($(hobbyhullnode3)!10pt!180:(hobbyhullnode2)$)
..($(hobbyhullnode4)!0.5!(hobbyhullnode3)$) ..
($(hobbyhullnode4)!10pt!-90:(hobbyhullnode3)$)..($(hobbyhullnode4)!10pt!180:(hobbyhullnode3)$)
..($(hobbyhullnode5)!0.5!(hobbyhullnode4)$) .. cycle;
\end{tikzpicture}
\begin{tikzpicture}[use Hobby shortcut,scale=3,transform shape]
\node (f) {f}
child { node (g) {g}
child { node (a) {a}
}
child { node (b) {b}
}
}
child { node (h) {h}
child { node (c) {c}
}
};
\begin{pgfonlayer}{background}
\fill[orange,opacity=0.4] \hobbyconvexpath{a,g,h,b}{13pt};
\end{pgfonlayer}
\end{tikzpicture}
\begin{tikzpicture}[use Hobby shortcut,scale=3,transform shape]
\node (f) {f}
child { node (g) {g}
child { node (a) {a}
}
child { node (b) {b}
}
}
child { node (h) {h}
child { node (c) {c}
}
};
\begin{pgfonlayer}{background}
\fill[cyan,opacity=0.4] \hobbyconvexpath{b,g,f,h}{10pt};
\end{pgfonlayer}
\end{tikzpicture}
\end{document}
下面是错误的片段。
...
(/usr/local/texlive/2012/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
LaTeX Warning: You have requested, on input line 53, version
`2012/12/21' of package expl3,
but only version
`2011/04/09 v2222 L3 Experimental code bundle wrapper'
is available.
/usr/local/texlive/2012/texmf-dist/tex/latex/l3packages/xparse/xparse.sty:65: P
ackage xparse Error: Support package l3kernel too old.
See the xparse package documentation for explanation.
Type H <return> for immediate help.
...
l.65 }
Please install an up to date version of l3kernel
using your TeX package manager or from CTAN.
Loading xparse will abort!
) (/usr/local/texlive/2012/texmf-dist/tex/latex/hobby/pml3array.sty
\l_array_base_int=\count183
\l_array_top_int=\count184
\l_array_tmp_int=\count185
\g_array_base_int=\count186
)
....
我已经移除并安装了,3kernel l3packages l3experimental
但这也无济于事。
sudo tlmgr remove --force l3kernel l3packages l3experimental
sudo tlmgr install l3kernel l3packages l3experimental
查看时/usr/local/texlive/2012/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
我注意到它正在寻找expl3
,但尚未安装。请参见下文。
...
\RequirePackage{expl3}[2012/12/21]
\@ifpackagelater{expl3}{2012/12/21}
{}
{%
\PackageError{xparse}{Support package l3kernel too old}
{%
Please install an up to date version of l3kernel\MessageBreak
using your TeX package manager or from CTAN.\MessageBreak
\MessageBreak
Loading xparse will abort!%
}%
\endinput
}
...
请您给我指出正确的方向,告诉我如何解决这个问题?