
私はプログラミング設計コースのインタラクション図を作成中です。オブジェクトのセットについては、おおよそ次のような重なり合う四角形を描く必要があります。
ありました重なり合う塗りつぶしに関する投稿これは私が望んでいるものにかなり近いように思えますが、他の長方形のスタイルをどのように使用すればよいかわかりませんでした。
私が持っているものの最小バージョンは次のとおりです。
\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}
答え1
実際には、次のようなものがお好みだと思います。
または
または
最後の画像では次のコードを使用します。
\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}
コードでは TikZ ライブラリを使用しますshadows
。
答え2
以下は を使用しない 1 つの方法ですtikz
。\rule
の寸法と最初の引数により、\stackengine
異なるボックス サイズとオフセットが可能になります。
この場合、ボックスは 30pt x 30pt で、水平オフセットは 4pt、垂直オフセットは 3pt です。ボックス ルールの太さはデフォルトです\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}