我在使用 TikZ 绘制下图时遇到了问题。有人能帮我吗?我现在已经尝试了 2 个小时 :( 提前谢谢!
这是我的代码。我尝试重写另一个代码,但我认为我失败了
\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
[
every node/.style=
{
minimum height={1.5cm},
thick,
align=center
},
]
\node[draw] (PS) {Potential\\bidder\\solicitation};
\node[draw, right=of PS] (CA) {Confidentiality\\Agreements};
\node[draw, right=of CA] (IB) {Informal\\Bidding};
\node[draw, right=of IB] (FR) {Final\\Round};
\node[draw, right=of FR] (TA) {Takeover\\agreement and\\announcement};
\node[draw, right=of TA] (PB) {Publicbidding\\newtakeover\\agreement};
\draw[->] (PS) -- (CA);
\draw[->] (CA) -- (IB);
\draw[->] (IB) -- (FR);
\draw[->] (FR) -- (TA);
\draw[->] (TA) --(PB);
\end{tikzpicture}
\end{document}
答案1
\documentclass[12pt]{article}
\usepackage[margin=20mm]{geometry} % added
\usepackage{tikz}
\usetikzlibrary{arrows.meta, % added
chains, % added
decorations.pathreplacing, % added
calligraphy, % added, had to be after decorations.pathreplacing
positioning}
\begin{document}
\begin{tikzpicture}
[
node distance = 7mm,
start chain = going right,
box/.style =
{
draw,
minimum height={1.5cm},
thick,
rounded corners,
align=flush center,
font=\small,
on chain,
join=by Arrow
},
Arrow/.style =
{
draw=gray, line width=2mm, -{Triangle[length=3mm, width=6mm]},
shorten >=1mm, shorten <=1mm
},
BC/.style =
{
decorate,
decoration={calligraphic brace, amplitude=6pt,
raise=2mm}
very thick,
pen colour={gray}
},
]
\begin{scope}[every node/.append style={box}]
\node (PS) {Potential\\ Bidder\\ Solicitation};
\node (CA) {Confidentiality\\ Agreements};
\node (IB) {Informal\\ Bidding};
\node (FR) {Final\\ Round};
\node (TA) {Takeover\\ Agreement and\\ Announcement};
\node (PB) {Publicbidding\\ Newtakeover\\ Agreement};
\end{scope}
%
\draw[BC] (PS.north west) -- node[above=4mm] {Private Takeover Stage} (FR.north east);
\draw[BC] (TA.north west) -- node[above=4mm] {Public Takeover Stage} (PB.north east);
\end{tikzpicture}
\end{document}
注意:您的图表非常宽,因此可能无法将其放入文本宽度中。也许您可以进一步减小字体大小,例如从\small
到\footnotesize
。
编辑:
在 MWE 序言中添加了注释,以注释添加的 TikZ 库和包(几何)。对于节点的定位,使用库chains
,对于它们之间的箭头,使用chains
宏join
。对于括号,使用库calligraphy
,它可以渲染漂亮的括号(括号也可以只用绘制decorations.pathreplacing
,有关详细信息,请参阅 TikZ 手册)。