在 tikzpicture 中将右箭头与图像之间的路径对齐

在 tikzpicture 中将右箭头与图像之间的路径对齐

我想知道是否有更好的方法来对齐图 1 和图 2 之间的右箭头。目前我可以用 来做到这一点node[right=2cm]

我想知道为什么我不能使用node[midway](这是图 2 和图 3 的工作原理)。我认为这会将右箭头放置在“图 1 和图 2 的中间”

在此处输入图片描述

\documentclass[hidelinks,14pt, letterpaper]{extarticle}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{caption}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[scale=1]

 \begin{scope}[local bounding box=R]
 \coordinate [label=left:$A$] (A) at (-1.5cm,-1.cm);
 \coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);
 \coordinate [label=below right:$C$] (C) at (1.5cm,-1.0cm);
 \draw 
   (A) -- 
   node[midway,above left=0pt] {$\sqrt{1+x^2}$} (B) --
   node[right] {?} (C) -- 
   node[below] {?} 
   (A);
 \draw 
   (1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);
 \end{scope}
   \path (R) -- (M) node[right=2cm, scale=1.4]{$\boldsymbol{\Longrightarrow}$};
 \node[anchor=north,text width=6cm,align=center] at (R.south) {\captionof{figure}{Caption 1}};

 \begin{scope}[xshift=6cm,local bounding box=M]
 \coordinate [label=left:$A$] (A) at (-1.5cm,-1.cm);
 \coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);
 \coordinate [label=below right:$C$] (C) at (1.5cm,-1.0cm);
 \draw 
   (A) -- 
   node[midway,above left=0pt] {$\sqrt{1+x^2}$} (B) --
   node[right] {x} (C) -- 
   node[below] {1} 
   (A);
 \draw 
   (1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);
 \end{scope}
 \node[anchor=north,text width=6cm,align=center] at (M.south) {\captionof{figure}{Caption 2}};
 \begin{scope}[xshift=12cm,local bounding box=R]
 \coordinate [label=left:$A$] (A) at (-1.5cm,-1.cm);
 \coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);
 \coordinate [label=below right:$C$] (C) at (1.5cm,-1.0cm);
 \draw 
   (A) -- 
   node[midway,above left=0pt] {$\sqrt{1+x^2}$} (B) --
   node[right] {1} (C) -- 
   node[below] {x} 
   (A);
 \draw 
   (1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);
 \end{scope}
 \path (M) -- (R) node[midway,scale=1.4]{$\boldsymbol{\Longrightarrow}$};
 \draw[red,thick] (R.north west)  -- (R.south east)
  (R.north east)  -- (R.south west);
 \node[anchor=north,text width=6cm,align=center] at (R.south) {\captionof{figure}{Caption 3}};
\end{tikzpicture}
\end{figure}
\end{document}

編輯:不居中 在此处输入图片描述

答案1

只需赋予local bounding boxes 唯一的名称并重复您在右侧所做的操作。

\documentclass[hidelinks,14pt, letterpaper]{extarticle}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{caption}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[scale=1]

 \begin{scope}[local bounding box=L]
 \coordinate [label=left:$A$] (A) at (-1.5cm,-1.cm);
 \coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);
 \coordinate [label=below right:$C$] (C) at (1.5cm,-1.0cm);
 \draw 
   (A) -- 
   node[midway,above left=0pt] {$\sqrt{1+x^2}$} (B) --
   node[right] {?} (C) -- 
   node[below] {?} 
   (A);
 \draw 
   (1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);
 \end{scope}
 \node[anchor=north,text width=6cm,align=center] at (L.south) {\captionof{figure}{Caption 1}};

 \begin{scope}[xshift=6cm,local bounding box=M]
 \coordinate [label=left:$A$] (A) at (-1.5cm,-1.cm);
 \coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);
 \coordinate [label=below right:$C$] (C) at (1.5cm,-1.0cm);
 \draw 
   (A) -- 
   node[midway,above left=0pt] {$\sqrt{1+x^2}$} (B) --
   node[right] {x} (C) -- 
   node[below] {1} 
   (A);
 \draw 
   (1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);
 \end{scope}
 \node[anchor=north,text width=6cm,align=center] at (M.south) {\captionof{figure}{Caption 2}};
 \begin{scope}[xshift=12cm,local bounding box=R]
 \coordinate [label=left:$A$] (A) at (-1.5cm,-1.cm);
 \coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);
 \coordinate [label=below right:$C$] (C) at (1.5cm,-1.0cm);
 \draw 
   (A) -- 
   node[midway,above left=0pt] {$\sqrt{1+x^2}$} (B) --
   node[right] {1} (C) -- 
   node[below] {x} 
   (A);
 \draw 
   (1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);
 \end{scope}
 \path (L) -- (M) node[midway,scale=1.4]{$\boldsymbol{\Longrightarrow}$};
 \path (M) -- (R) node[midway,scale=1.4]{$\boldsymbol{\Longrightarrow}$};
 \draw[red,thick] (R.north west)  -- (R.south east)
  (R.north east)  -- (R.south west);
 \node[anchor=north,text width=6cm,align=center] at (R.south) {\captionof{figure}{Caption 3}};
\end{tikzpicture}
\end{figure}
\end{document}

在此处输入图片描述

相关内容