Undefined control sequence error when using tikz-uml package in LaTeX
Found the problem:
I have found the problem in the original tikz-uml.sty
:
In its line 629 there is this statement:
\pgfmathsetmacro{\weightT}{1-\real{\weight}
The problem with it is the use of \real
, that has been moved to other macro in the new version of pgfmathparser
, and since the new version of PGF it is no longer available there to be used.
Got a solution:
The solution to this problem is as simple as:
- Include the new TikZ library
math
. Replace the line 629 with this code:
\tikzmath{% real \weightT;% \weightT = 1 - real \weight;% }%
Simple patch:
In order to patch the original version of tikz-uml.sty
, we can apply the following patch to it:
--- tikz-uml.sty.orig 2015-10-10 23:44:04.978866966 -0300
+++ tikz-uml.sty 2015-10-10 23:29:46.902834319 -0300
@@ -16,7 +16,7 @@
\RequirePackage{xstring}%
\RequirePackage{calc}%
\RequirePackage{pgfopts}%
-\usetikzlibrary{backgrounds,arrows,shapes,fit,shadows,decorations.markings}%
+\usetikzlibrary{backgrounds,arrows,shapes,fit,shadows,decorations.markings,math}%
\def\tikzumlPackageLayersNum{3}%
\pgfkeys{/tikzuml/options/.cd, packageLayers/.initial=3}%
@@ -626,7 +626,11 @@
\setcounter{posT}{100*\real{\positionT}}%
\setcounter{posStereo}{100*\real{\positionStereotype}}%
%
- \pgfmathsetmacro{\weightT}{1-\real{\weight}}%
+ % \pgfmathsetmacro{\weightT}{1-\real{\weight}}%
+ \tikzmath{%
+ real \weightT;%
+ \weightT = 1 - real \weight;%
+ }%
%
\def\tikzumlControlNodesNum{0}%
%
If the patch above is saved in a file called tikz-uml.patch
, in the same folder of the original library, then it can be applied this way:
cp tikz-uml.sty tikz-uml.sty.old
patch < tikz-uml.patch
I have had a similar issue since updating the pgf
package to 3.0.1. Any connector usage in tikz-uml
causes the pgfmath
problem. I have written to Mr. Kielbasiewicz and await his reply as I am not savvy enough to unravel the mystery of this one. Meanwhile, reverting to an earlier pgf
version has solved the problem for me.