1
我想繪製一個帶箭頭的圖形,並且希望箭頭的標籤位於行之間(不在上面或下面)像這樣: 輸出應該如何: 在箭頭(不低於/高於)與邊緣節點之間插入標籤,tikz
我正在使用tikz庫和邊緣節點繪製兩個節點之間的箭頭。 這是一個小例子,用箭頭上面的標籤:
\documentclass[12pt]{article}
\usepackage[letterpaper, margin=1in, top=2.5cm, bottom=2.5cm]{geometry}
\usepackage{xcolor}
\definecolor{corn}{rgb}{0.98, 0.93, 0.36}
\definecolor{emerald}{rgb}{0.31, 0.78, 0.47}
\usepackage{array}
\usepackage{tikz}
\usepackage{siunitx}
\usepackage{float}
\usepackage{subcaption,caption}
\captionsetup{labelsep=period}
\usetikzlibrary{positioning,patterns,arrows,decorations.markings,decorations.pathreplacing,shapes,shapes.misc}
\tikzset{
%Define standard arrow tip
>=stealth',
% Define arrow style
pil/.style={
->,
thick,
shorten <=3pt,
shorten >=3pt,}
}
\title{ }
\begin{document}
\maketitle
\begin{figure}[h!]
\centering
\caption{}
\label{paths}
\begin{subfigure}{0.9\textwidth}
\resizebox{.9\textwidth}{!}{
\begin{tikzpicture}[shorten >=2pt,on grid,auto]
\node (A) [draw=black,fill=emerald,double=white,double distance=2pt,shape=rounded rectangle,minimum width=4cm ]{A};
\node[right=9cm of A] (B) [draw,fill=corn,shape=rounded rectangle,minimum width=4cm ]{B};
\path[->]
(A) edge[line width=0.742mm] node[ anchor=center, above, pos=0.5,font=\bfseries] {\Huge +} (B);
\end{tikzpicture}
}
\caption{}
\label{M1w}
\end{subfigure}
\end{figure}
\end{document}%\grid
我在網上搜索,但沒有找到與邊緣節點的任何實例。我真的很感激任何幫助!
這工作得很好。非常感謝! – michela
那麼你能接受答案嗎?謝謝! – Nick