
\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
2 番目の図の 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}
最初のコマンド群は線を描き、点の参照名をいくつか提供します。2番目のコマンド群は矢印とラベルを印刷します。xypic のリファレンスマニュアル詳細については、 (またはtexdoc xyrefer
コンピュータ上で) を参照してください。これはtexdoc xypic
、いわゆる「可換図」の作成を主に対象としたユーザー ガイド ( ) よりも役立ちます。
構文を注意深く確認してください。線描画操作で**@{-}
は、スタックの最後の 2 つのポイントが使用されます。;
最後のポイントから続行する場合は が続きますが、,
完全に新しい操作を開始する必要がある場合は が続きます。
コメントではR
からD
ではなくから への矢印をこの図に追加する方法についても質問されていると思います。1つの方法は、R
P
"R"; "D" **@{-} ?(.7)*\dir{>}
これは、 からまで.7
の距離の矢印の先を配置します。 同様の構造を、一番下の線の矢印にも使用できます。R
D
答え2
よく分かりませんxy
が、ここに1つの可能性を挙げます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}