
\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
주로 소위 "교환 다이어그램" 작성에 관한 사용자 안내서( )보다 더 유용합니다 .
구문을 주의 깊게 살펴보세요. 선 그리기 작업에서는 **@{-}
스택의 마지막 두 점을 사용합니다. ;
마지막 지점부터 계속하고 싶지만 ,
완전히 새로운 작업을 시작해야 할 때가 뒤 따릅니다 .
R
아마 당신은 이 다이어그램에 화살표를 추가하는 방법(아마도 from to D
가 아니라 R
to )을 P
주석에 추가하는 방법을 묻고 있었던 것 같습니다 . 한 가지 방법은
"R"; "D" **@{-} ?(.7)*\dir{>}
에서 .7
까지 거리의 화살촉을 배치합니다 . 하단 라인의 화살표에도 비슷한 구성을 사용할 수 있습니다.R
D
답변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}