2

To create a TikZ component diagram, I use TikZ-UML (https://perso.ensta-paris.fr/~kielbasi/tikzuml/index.php?lang=en&id=download). For relative positioning, I position my umlbasiccomponents with right=1.5cm of component-body.east (like described in Tikz UML relative positioning problems) . While the component itself gets aligned correctly, the heading is aligned wrong, as demonstrated here:

\documentclass{beamer}

\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{tikzpeople}
\usepackage{tikz-uml}

\usetheme[compress]{Berlin}

\begin{document}

\begin{frame}{Komponenten}
  \begin{tikzpicture}    
    \begin{umlcomponent}[name=peass]{Peass} 
      \umlbasiccomponent[anchor=west, name=dependency,  fill=white]{Dependency}
      \umlbasiccomponent[right=1.5cm of dependency-body.east, name=measurement, fill=white]{Measurement}
    \end{umlcomponent}  
  \end{tikzpicture}
\end{frame}

\end{document}

wrong positioning of Measurement-tag

Is there any way to align both, text and the frame of the component, correctly?

2
  • 1
    The size of the Peass is also wrong. You can of course do \umlbasiccomponent[x=5, name=measurement, fill=white]{Measurement}, but then you don't get the relative position. – Torbjørn T. Oct 15 '20 at 15:56
  • Yes, the examples of tikz-uml make use of the absolute positioning. But I want to define the relations (e.g. Measurement is left of Dependency) and be able to change the concrete positioning afterwards by setting spacing etc.. Therefore, I want to use relative positions. – David Georg Reichelt Oct 15 '20 at 21:07
1

One (not very nice) solution is to use umldocument (https://github.com/maybeec/tikz-uml-component-diagram.git) instead, which easily allows relative positioning:

\documentclass{beamer}

\definecolor{SeaGreen}{rgb}{0.0,0.8,0.1}

\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\usepackage{tikz}

\usetikzlibrary{
  arrows.meta,
  shapes,
  positioning,
  calc,
  decorations.markings,
  decorations.pathreplacing,
  decorations.text,
  decorations.pathmorphing,
  decorations.shapes
}


\usepackage{umldocument}
\usepackage{umlmultidocument}
\usepackage{umlcomponent}

\usetheme[compress]{Berlin}

\tikzset{
    doc/.style={umldocument, align=center, text width=1.5cm, minimum height=2.5cm},
    multdoc/.style={umlmultidocument, align=center, text width=1.5cm, minimum height=2.5cm},
    comp/.style={umlcomponent, align=center, text width=2cm, minimum height=1.0cm},
    comment/.style={umldocument,fill=SeaGreen, text width=1.7cm, minimum height=.7cm}
}

\begin{document}

\begin{frame}
 \begin{tikzpicture}
    \node[comp] (dependency) {Dependency};
    \node[right=of dependency, comp] (measurement) {Measurement};
    \node[right=of measurement, comp] (analysis) {Analysis};

    \node[comp, right=-0.5cm of dependency.west, minimum width=10cm, fill opacity=0.0, text opacity=1.0, text depth=1.5cm] (peass) {Peass};  
  \end{tikzpicture}
\end{frame}

\end{document}

Which results in:

enter image description here

Since this is not an exact solution, I'll accept a solution using tikz-uml and/or preserving the splitted components, but for now, this is a viable workaround.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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