gpt4 book ai didi

latex - 在带有边缘节点tikz的箭头(不位于下方/上方)之间插入标签

转载 作者:行者123 更新时间:2023-12-04 22:56:22 26 4
gpt4 key购买 nike

我正在尝试绘制带有箭头的图形,我希望箭头的标签位于线条之间(而不是上方或下方),如下所示:
输出应如下所示:

我正在使用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

我已经在线搜索,找不到边缘节点的任何示例。我真的很感激任何帮助!

最佳答案

如下更改\path似乎可以解决问题:

\path[->] (A) edge[line width=0.742mm] node[ fill=white, anchor=center, pos=0.5,font=\bfseries] {\Huge +} (B);

关于latex - 在带有边缘节点tikz的箭头(不位于下方/上方)之间插入标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44263596/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com