我有一个流程图,其中文本显示在箭头右侧。我想将其移至箭头左侧,可以吗?
\begin{center}
\begin{tikzpicture}[auto,
node distance = 3mm and 2mm,
start chain = A going below,
arr/.style = {-Stealth},
every edge/.style = {draw, arr},
BC/.style = {decorate, % Brace Calligraphic
decoration={calligraphic brace, amplitude=2mm,
raise=1mm, mirror},
very thick, pen colour={black}
},
box/.style = {draw, rounded corners, fill=blue!20, align=center,
minimum height=5ex, text width=5.5em},
decision/.style = {diamond, aspect=1.5, draw, fill=blue!20,
inner xsep=-3pt, minimum width=5.4em, align=center},
ellip/.style = { ellipse, aspect=1.5,draw, fill=blue!20,
inner xsep=-3pt, text width=5.4em, align=center},
]
% nodes in chain
\begin{scope}[nodes={on chain=A, join=by arr}]
\node [box] {start}; % name=A-1
\node [box] {end};
\end{scope}
\draw[arr] (A-1.south) -- node{This Text} (A-2.north);
\end{tikzpicture}
\end{center}
答案1
为了使向下箭头旁边的文本出现在箭头的左侧而不是右侧,您可以使用swap
:
来自 pgf 手册:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{chains, arrows.meta}
\begin{document}
\begin{center}
\begin{tikzpicture}[auto,
node distance = 3mm and 2mm,
start chain = A going below,
arr/.style = {-Stealth},
every edge/.style = {draw, arr},
BC/.style = {decorate, % Brace Calligraphic
decoration={calligraphic brace, amplitude=2mm,
raise=1mm, mirror},
very thick, pen colour={black}
},
box/.style = {draw, rounded corners, fill=blue!20, align=center,
minimum height=5ex, text width=5.5em},
decision/.style = {diamond, aspect=1.5, draw, fill=blue!20,
inner xsep=-3pt, minimum width=5.4em, align=center},
ellip/.style = { ellipse, aspect=1.5,draw, fill=blue!20,
inner xsep=-3pt, text width=5.4em, align=center},
]
% nodes in chain
\begin{scope}[nodes={on chain=A, join=by arr}]
\node [box] {start}; % name=A-1
\node [box] {end};
\end{scope}
\draw[arr, swap] (A-1.south) -- node{This Text} (A-2.north);
\end{tikzpicture}
\end{center}
\end{document}