8

I am trying to build a simple UML diagram in LaTeX using a tikz-uml package. I am failing when using \umlinherit command.

My code and an error message are below, thank you for any ideas!

\documentclass{article}
\usepackage{tikz-uml}

\begin{document}

\begin{tikzpicture}
\begin{umlpackage}[x=0,y=0]{Tierhof}
\umlclass[x=7]{Tier}{
  }{
\~{} fuettern():void\\
\# getNahrungsBedarf():void\\
\# getVerkaufsPreis():void 
  }
\umlclass[x=5, y=-3]{Pferd}{ }{} 
\umlinherit{Pferd}{Tier}
\end{umlpackage}

\end{tikzpicture} 

\end{document}

error:

! Undefined control sequence.
\pgfmath@dimen@ ...men@@ #1=0.0pt\relax \pgfmath@ 

l.15 \umlinherit{Pferd}{Tier}
1
  • 2
    I think, if I'm not misremembering, that the package has not been updated to accommodate new versions of TikZ/PGF. But I might be misremembering.
    – cfr
    Aug 25, 2015 at 20:42

4 Answers 4

8

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:

  1. Include the new TikZ library math.
  2. 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
2

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.

0
1

UPDATE: 2015-Oct-10

I will leave this answer here for a while, but I got a real solution to this problem that I have included just now as a new answer to this same question.


I am facing this problem as well.

The first thing I did to overcome this incompatibility was to use an older installation of TexLive (2013). This solution worked well, but it made me switch between versions 2013 and 2015 when compiling other documents.

What I found so far that is a fairly well solution (as long as tikz-uml continues to be incompatible with an up-to-date TexLive) is having an old version of pgf installed locally in the same project folder, using at the same time an up-to-date TexLive.

Assuming:

  • $PROJHOME: pointing to the project folder.
  • $TEMPPATH: pointing to some temporal location.

What has worked for me:

  1. Create an special folder inside the project folder. For example:

    cd $PROJHOME
    mkdir -p texmf/tex
    
  2. Download archived version of pgf:

    cd $TEMPPATH
    wget ftp://tug.org/historic/systems/texlive/2013/tlnet-final/archive/pgf.tar.xz
    
  3. Decompress it:

    tar Jxf pgf.tar.xz
    
  4. Copy the contents of tex folder inside the folder created in the first step.

    cd $TEMPPATH
    cp -rp tex/* $PROJHOME/texmf/tex
    
  5. Make LaTeX find your old package:

    1. If a Makefile is being used, then export this environment variable (as one of the first lines):

      export TEXMFHOME:=.:./texmf:~/texmf:${TEXMFHOME}
      
    2. Else, set that as an environment variable in your session.


What I've written here has been based on these answers from Tex.SX:

1

Using \tikzmath causes another problem that I can't solve. The solution I found is more basic, removing \real and writing \pgfmathsetmacro{\weightT}{1.0-\weight} It works with TiKZ 3 and should normally work with TikZ 2. This fix will be available soon in the new release of tikz-uml

0

You must log in to answer this question.

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