Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
\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?

share|improve this question
    
I get many syntax errors from Metapost. –  egreg Aug 21 '12 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. –  Stephan Lehmke Aug 22 '12 at 19:12
    
OK, how can I do that? –  Ichibann Aug 22 '12 at 19:14
1  
I'm not a MikTeX user myself, but look here. –  Stephan Lehmke Aug 22 '12 at 19:17
1  
OK. It works finally :). 100 rep anyone ;) ? –  Ichibann Aug 22 '12 at 19:24

1 Answer 1

up vote 4 down vote accepted
+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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.