5
\documentclass{article}
\usepackage[shellescape]{gmp}
\begin{document}
\begin{figure}
\begin{mpost}[use]
input metauml;

Interface.A("Interface")
       ();

A.info.iAttributeStack.top := 0;
A.info.iAttributeStack.bottom := 0;

Class.B("Class")
       ()
       ();       

A.w = B.e + (50, 0);

drawObjects(A, B);

clink(association)(B, A);
\end{mpost}
\caption{association}
\end{figure}

\begin{figure}
\begin{mpost}[use]
input metauml;

Interface.A("Interface")
       ();

A.info.iAttributeStack.top := 0;
A.info.iAttributeStack.bottom := 0;

Class.B("Class")
       ()
       ();       

A.w = B.e + (50, 0);

drawObjects(A, B);

clink(associationUni)(B, A);
\end{mpost}
\caption{associationUni}
\end{figure}

\begin{figure}
\begin{mpost}[use]
input metauml;

Interface.A("Interface")
       ();

A.info.iAttributeStack.top := 0;
A.info.iAttributeStack.bottom := 0;

Class.B("Class")
       ()
       ();       

A.w = B.e + (50, 0);

drawObjects(A, B);

clink(inheritance)(B, A);
\end{mpost}
\caption{inheritance}
\end{figure}

\begin{figure}
\begin{mpost}[use]
input metauml;

Interface.A("Interface")
       ();

A.info.iAttributeStack.top := 0;
A.info.iAttributeStack.bottom := 0;

Class.B("Class")
       ()
       ();       

A.w = B.e + (50, 0);

drawObjects(A, B);

clink(realization)(B, A);
\end{mpost}
\caption{realization}
\end{figure}

\begin{figure}
\begin{mpost}[use]
input metauml;

Interface.A("Interface")
       ();

A.info.iAttributeStack.top := 0;
A.info.iAttributeStack.bottom := 0;

Class.B("Class")
       ()
       ();       

A.w = B.e + (50, 0);

drawObjects(A, B);

clink(aggregation)(B, A);
\end{mpost}
\caption{aggregation}
\end{figure}

\begin{figure}
\begin{mpost}[use]
input metauml;

Interface.A("Interface")
       ();

A.info.iAttributeStack.top := 0;
A.info.iAttributeStack.bottom := 0;

Class.B("Class")
       ()
       ();       

A.w = B.e + (50, 0);

drawObjects(A, B);

clink(aggregationUni)(B, A);
\end{mpost}
\caption{aggregationUni}
\end{figure}

\begin{figure}
\begin{mpost}[use]
input metauml;

Interface.A("Interface")
       ();

A.info.iAttributeStack.top := 0;
A.info.iAttributeStack.bottom := 0;

Class.B("Class")
       ()
       ();       

A.w = B.e + (50, 0);

drawObjects(A, B);

clink(composition)(B, A);
\end{mpost}
\caption{composition}
\end{figure}

\begin{figure}
\begin{mpost}[use]
input metauml;

Interface.A("Interface")
       ();

A.info.iAttributeStack.top := 0;
A.info.iAttributeStack.bottom := 0;

Class.B("Class")
       ()
       ();       

A.w = B.e + (50, 0);

drawObjects(A, B);

clink(compositionUni)(B, A);
\end{mpost}
\caption{compositionUni}
\end{figure}

\begin{figure}
\begin{mpost}[use]
input metauml;

Interface.A("Interface")
       ();

A.info.iAttributeStack.top := 0;
A.info.iAttributeStack.bottom := 0;

Class.B("Class")
       ()
       ();       

A.w = B.e + (50, 0);

drawObjects(A, B);

clink(dependency)(B, A);
\end{mpost}
\caption{dependency}
\end{figure}
\end{document}

This example shows all possible links between classes/interfaces as described on page 9 of metauml documentation

All links display correctly except for one. It is "realization". That link does not appear.

It now looks like this:

classes

How can it be fixed?

I use MetaPost, version 1.504 (MiKTeX 2.9)

This is what I get when I compile egreg's solution:

enter image description here

Here you can find a log from metapost trying to generate realization link.

EDIT:

I found out that I have version older than 0.2.4 because the file C:\Program Files (x86)\MiKTeX 2.9\metapost\generic\metauml\metauml_class_relations.mp didn't contain definition of realization. Realization support was added in 0.2.4.

I did only one thing. I downloaded the newest version and replaced every file in C:\Program Files (x86)\MiKTeX 2.9\metapost\generic\metauml. This caused a "little" trouble.
The logs (tmp+mp000X.log) say that:

! I can't open file `metauml_component'.
l.77 input metauml_component
                            ;
Please type another input file name
! Emergency stop.
l.77 input metauml_component
                            ;
*** (job aborted, file error in nonstop mode)

I checked and mentioned file does exist. What should I do next?

6
  • I get many syntax errors from Metapost.
    – egreg
    Commented Aug 21, 2012 at 20:24
  • 1
    If the file is new in this package version maybe you need to refresh the file name database before it can be found. Commented Aug 22, 2012 at 19:12
  • OK, how can I do that?
    – Ichibann
    Commented Aug 22, 2012 at 19:14
  • 1
    I'm not a MikTeX user myself, but look here. Commented Aug 22, 2012 at 19:17
  • 1
    OK. It works finally :). 100 rep anyone ;) ?
    – Ichibann
    Commented Aug 22, 2012 at 19:24

1 Answer 1

5
+100

This is the correct way to input the Metapost snippets:

\documentclass{article}
\usepackage[shellescape]{gmp}
\begin{document}

\begin{mpost}[use,mpsettings={input metauml;}]
Interface.A("Interface")
       ();
A.info.iAttributeStack.top := 0;
A.info.iAttributeStack.bottom := 0;
Class.B("Class")
       ()
       ();       
A.w = B.e + (50, 0);
drawObjects(A, B);
clink(association)(B, A);
\end{mpost}

\begin{mpost}[use,mpsettings={input metauml;}]

Interface.A("Interface")
       ();

A.info.iAttributeStack.top := 0;
A.info.iAttributeStack.bottom := 0;

Class.B("Class")
       ()
       ();       

A.w = B.e + (50, 0);

drawObjects(A, B);

clink(associationUni)(B, A);
\end{mpost}

\begin{mpost}[use,mpsettings={input metauml;}]

Interface.A("Interface")
       ();

A.info.iAttributeStack.top := 0;
A.info.iAttributeStack.bottom := 0;

Class.B("Class")
       ()
       ();       

A.w = B.e + (50, 0);

drawObjects(A, B);

clink(inheritance)(B, A);
\end{mpost}

\begin{mpost}[use,mpsettings={input metauml;}]

Interface.A("Interface")
       ();

A.info.iAttributeStack.top := 0;
A.info.iAttributeStack.bottom := 0;

Class.B("Class")
       ()
       ();       

A.w = B.e + (50, 0);

drawObjects(A, B);

clink(realization)(B, A);
\end{mpost}

\begin{mpost}[use,mpsettings={input metauml;}]

Interface.A("Interface")
       ();

A.info.iAttributeStack.top := 0;
A.info.iAttributeStack.bottom := 0;

Class.B("Class")
       ()
       ();       

A.w = B.e + (50, 0);

drawObjects(A, B);

clink(aggregation)(B, A);
\end{mpost}

\begin{mpost}[use,mpsettings={input metauml;}]

Interface.A("Interface")
       ();

A.info.iAttributeStack.top := 0;
A.info.iAttributeStack.bottom := 0;

Class.B("Class")
       ()
       ();       

A.w = B.e + (50, 0);

drawObjects(A, B);

clink(aggregationUni)(B, A);
\end{mpost}

\begin{mpost}[use,mpsettings={input metauml;}]

Interface.A("Interface")
       ();

A.info.iAttributeStack.top := 0;
A.info.iAttributeStack.bottom := 0;

Class.B("Class")
       ()
       ();       

A.w = B.e + (50, 0);

drawObjects(A, B);

clink(composition)(B, A);
\end{mpost}

\begin{mpost}[use,mpsettings={input metauml;}]

Interface.A("Interface")
       ();

A.info.iAttributeStack.top := 0;
A.info.iAttributeStack.bottom := 0;

Class.B("Class")
       ()
       ();       

A.w = B.e + (50, 0);

drawObjects(A, B);

clink(compositionUni)(B, A);
\end{mpost}

\begin{mpost}[use,mpsettings={input metauml;}]

Interface.A("Interface")
       ();

A.info.iAttributeStack.top := 0;
A.info.iAttributeStack.bottom := 0;

Class.B("Class")
       ()
       ();       

A.w = B.e + (50, 0);

drawObjects(A, B);

clink(dependency)(B, A);
\end{mpost}

\end{document}

I've left out the inessential captions and figure environments. This is the result.

enter image description here

Check the version of your MetaUML package. With version 0.2.5 it works: see

<texroot>/doc/metapost/metauml/README

for checking the version number. Use your package manager (MiKTeX or tlmgr for TeX Live) for updating.

6
  • I changed this and I still can't get the realization arrow. WHat could be wrong? Every other arrow is just fine.
    – Ichibann
    Commented Aug 22, 2012 at 6:11
  • @Ichibann Did you remove the +mp00xy.mp files?
    – egreg
    Commented Aug 22, 2012 at 9:40
  • egreg yes and realization still doesn't work...
    – Ichibann
    Commented Aug 22, 2012 at 15:55
  • I updated my question to show the output.
    – Ichibann
    Commented Aug 22, 2012 at 16:04
  • 1
    Sorry, but my tmp+mp0004.mp compiles perfectly. My metauml version is 0.2.5
    – egreg
    Commented Aug 22, 2012 at 17:53

You must log in to answer this question.

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