
Ich arbeite an einem Interaktionsdiagramm für einen Programmierdesignkurs. Für Objektsätze muss ich überlappende Rechtecke zeichnen, ungefähr so:
Da war einBeitrag zu überlappenden Füllungendas scheint ziemlich nah an dem zu sein, was ich will, aber ich konnte nicht herausfinden, wie ich den Stil meiner anderen Rechtecke verwenden kann.
Hier ist eine Minimalversion von dem, was ich habe:
\documentclass{article}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{positioning}
\title{Interaction Diagram - Add Book}
\author{}
\begin{document}
\begin{center}
\begin{tikzpicture}[
auto,
block/.style = {
minimum width = 9em,
rectangle,
draw=black,
align=center,
rounded corners
}
]
\node[block, below = 2cm of start] (controller) {\underline{: SystemController}};
\node[block, below = 2cm of controller] (system) {\underline{: System}};
% the following line should be the doubled up rectangles.
\node[block, below = 2cm of system] (books) {Books};
\end{tikzpicture}
\end{center}
\end{document}
Antwort1
Ich nehme an, dass Du eigentlich gerne so etwas hättest:
oder
oder
Für das letzte Bild verwende ich folgenden Code:
\documentclass[tikz,
border= 3mm]{standalone}
\usetikzlibrary{positioning,shadows}
\begin{document}
\begin{tikzpicture}[
book/.style = {rectangle, draw, rounded corners, fill= white,
text width=9em, align= center,
copy shadow={draw, fill=gray,
shadow xshift=0.5mm, shadow yshift=-0.5mm}
}
]
\node[book] (books) {Books};
\end{tikzpicture}
\end{document}
Im Code verwende ich die TikZ-Bibliothek shadows
.
Antwort2
Hier ist eine Möglichkeit ohne tikz
. Die \rule
Abmessungen und das erste Argument von \stackengine
ermöglichen unterschiedliche Boxgrößen und -versätze.
In diesem Fall sind die Boxen 30pt x 30pt groß, mit einem horizontalen Versatz von 4pt und einem vertikalen Versatz von 3pt. Die Boxlinienstärke ist die Standardstärke \fboxrule
.
\documentclass[12pt]{article}
\usepackage{xcolor,stackengine}
\fboxsep=-\fboxrule
\begin{document}
\stackengine{3pt}{\rule{4pt}{0pt}\fbox{\textcolor{white}{\rule{30pt}{30pt}}}}
{\fbox{\textcolor{white}{\rule{30pt}{30pt}}}}
{O}{l}{F}{F}{L}
\end{document}