对于下面的 MWE:
\documentclass[a4paper,11pt,twoside]{report}
\usepackage[left=2.5cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{pgfplots,tikz}
\usetikzlibrary{calc,trees,positioning,fit,arrows,chains,shapes.geometric,%
decorations.pathreplacing,decorations.pathmorphing,shapes,%
matrix,shapes.symbols,automata}
\tikzset{
>=stealth',
punktchain/.style={
rectangle,
rounded corners,
% fill=black!10,
draw=black, very thick,
text width=10em,
minimum height=3em,
text centered,
on chain},
line/.style={draw, thick, <-},
element/.style={
tape,
top color=white,
bottom color=blue!50!black!60!,
minimum width=8em,
draw=blue!40!black!90, very thick,
text width=10em,
minimum height=3.5em,
text centered,
on chain},
every join/.style={->, thick,shorten >=1pt},
tuborg/.style={decorate},
tubnode/.style={midway, right=2pt},
every rectangle node/.style={thick}
}
\begin{document}
\begin{center}
\begin{tikzpicture}
[node distance=.5cm,
start chain=going below,]
\node[punktchain, join] (timing) {Timing Solver};
\node[punktchain, join] (solver) {Solver};
\node[punktchain, join] (impl) {SolverImpl};
\node[punktchain, join] (stp) {STPSolver};
\node[punktchain, join, ] (stpimpl) {STPSolverImpl};
\draw[tuborg, decoration={brace}] let \p1=(solver.north), \p2=(impl.south) in
($(2.5, \y1)$) -- ($(2.5, \y2)$) node[tubnode] {*};
%\draw[red,thick,dashed] ($(solver.north west)+(-0.2,0.2)$) rectangle ($(impl.south east)+(0.2,-0.2)$);
\draw[red,thick,dashed] ($(timing.north west)+(-1,0.3)$) rectangle ($(stpimpl.south east)+(1,-0.2)$);
\node[anchor=south] at (current bounding box.north) {The Solver Instance};
\end{tikzpicture}
\end{center}
\end{document}
如何从 STPSolverImpl 向 STPSolver 添加箭头?我知道这是一条链,但有什么办法吗?编辑:我实际上想要两个箭头。一个向上,一个向下。所以不想只替换那个箭头
答案1
您可以为样式提供额外的选项join
。将相关行更改为
\node[punktchain, join= by {<-}, ] (stpimpl) {STPSolverImpl};
将会反转箭头。