如何用線連接箭頭的左端?

如何用線連接箭頭的左端?
\documentclass[a4paper,twoside]{article}
\usepackage{xypic}
\begin{document}

\xymatrix{
A\ar@{-} [rr]  & & D\ar @{-}[r] & E\\
 L\ar @{-}[rrr]              &         &         & M \\
P\ar[rrr]\ar[uu]  & R\ar[ruu] & S & T\ar @{-}[uu]
}

\end{document}  

這會產生下圖:

交換圖

但是,我想製作下圖:

調整後的圖

我該如何使用該包來做到這一點xypic

答案1

這是第二張圖的 xypic 版本。

樣本輸出

\documentclass[a4paper,twoside]{article}

\usepackage{xypic}

\begin{document}

\begin{xy}<1cm,0cm>:
  (0,0)="P"; (0,2)="A" **@{-};
  (4,2)="E" **@{-}; (4,0)="T" **@{-}; "P" **@{-},
  (0,1)="L"; (4,1)="M" **@{-},
  (1.3,0)="R"; "R"+(0,0.1) **@{-},
  (3,0)="S"; "S"+(0,0.1) **@{-},
  (2.6,2)="D"; "D"-(0,0.1) **@{-},
  (2.2,0) *{>},
  "P"-(0.2,0.2)*{P},
  "L"-(0.2,0)*{L},
  "A"+(-0.2,0.2)*{A},
  "D"+(0,0.2)*{D},
  "E"+(0.2,0.2)*{E},
  "M"+(0.2,0)*[r]{M},
  "T"+(0.2,-0.2)*{T},
  "S"-(0,0.2)*{S},
  "R"-(0,0.2)*{R}
\end{xy}

\end{document}

第一個指令集合繪製線條並提供點的一些參考名稱。第二個集合列印箭頭和標籤。請參閱xypic參考手冊(或texdoc xyrefer在您的電腦上)以了解更多詳細資訊。這比使用者指南 ( ) 更有幫助texdoc xypic,使用者指南主要針對創建所謂的「交換圖」。

仔細注意文法。畫線操作**@{-}使用堆疊上的最後兩個點;接下來是;當我們想要從最後一點繼續進行時,以及,當我們需要開始一個全新的操作時。

我猜您還問如何在該圖中添加箭頭,大概是從到RD而不是RP註釋中添加箭頭。一種方法是

"R"; "D" **@{-} ?(.7)*\dir{>}

其中放置了從到 的.7距離的箭頭。底線上的箭頭可以使用類似的結構。RD

答案2

我不太清楚xy,但這是一種使用的可能性TikZ:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,decorations.markings}

\begin{document}

\begin{tikzpicture}[node distance=1cm]
% coordinates for the points
\coordinate (A) ;
\coordinate[right = 2cm of A] (D) ;
\coordinate[right = of D] (E) ;
\coordinate[below = of A] (L) ;
\coordinate[below = of L] (P) ;
\coordinate[right = of P] (R) ;
\coordinate[right = 1.3cm of R] (S) ;
\coordinate[below = of E] (M);
\coordinate[below = of M] (T);
% join some points with straight line segments
\draw (R) -- (P) -- (L) -- (A) -- (D) -- (E) -- (M) -- (T) -- (S);
\draw (L) -- (M);
% draw the segment from R to S with arrow in the middle
\draw[postaction=decorate,decoration={markings,mark=at position 0.5 with {\arrow{>}}}] (R) -- (S);
% draw tick-marks at R,S and D
\draw (R) -- +(0,3pt);
\draw (S) -- +(0,3pt);
\draw (D) -- +(0,-3pt);
% place the labels
\foreach \coor/\posi in {R/below,P/below left,L/left,A/above left,D/above,E/above right,M/right,T/below right,S/below}
  \node[\posi] at (\coor) {\coor};
\end{tikzpicture}

\end{document}

在此輸入影像描述

相關內容