سلام
جهت آشنایی با دستورات قرار دادم.
روش 1)
\documentclass[a4paper,12pt]{report}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathmorphing,decorations.markings}
\tikzstyle{midarr}=[postaction={decorate},decoration={markings,mark=at position 0.5 with {\arrow[xshift=3.333pt]{stealth'}}}]
\tikzstyle{vertex}=[circle,draw,inner sep=0pt,minimum size=5pt]
\newcommand{\vertex}{\node[vertex]}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=1]
\draw[thick,decorate,decoration={snake,amplitude=0.6mm,segment length=1.5mm,post length=0mm}](0,-0.04) -- (-1.3,1.3);
\draw[thick,decorate,decoration={snake,amplitude=0.6mm,segment length=1.5mm,post length=0mm}](1.54,-0.04) -- (2.84,1.3);
%
\draw[midarr,line width=0.4mm] (-1.3,-1.3) --(0,0);
\vertex[fill] (b) at (0,-0.03) [] {};
\draw[midarr,very thick] (0,-0.04) --(1.54,-0.04);
\draw[midarr,very thick] (1.54,-0.04) --(2.8,-1.3);
%node
\node (a1) at (-1.3,0.8) {$p$};
\node (a2) at (-1.3,-0.8) {$q$};
\node (a3) at (0.75,-0.78) {$q+p$};
\node (a4) at (2.8,0.8) {$p'$};
\node (a5) at (2.8,-0.8) {$q'$};
\end{tikzpicture}
\end{center}
\end{document}
توضیح: برای رسم گراف مورد نظر، از بسته tikz
استفاده کردم.
برای رسم پیکان پر(stealth'
) در وسط مسیر کافی است کتابخانه arraws
و decorations.markings
را فراخوانی کنید.
سپس استایل قراردهی پیکان پر در وسط مسیر را با استفاده از دستور:
\tikzstyle{midarr}=[postaction={decorate},decoration={markings,mark=at position 0.5 with {\arrow[xshift=3.333pt]{stealth'}}}]
برای رسم دایره:
\tikzstyle{vertex}=[circle,draw,inner sep=0pt,minimum size=5pt]
\newcommand{\vertex}{\node[vertex]}
برای رسم فنر کتابخانه decorations.pathmorphing
و دستور زیر:
\draw[thick,decorate,decoration={snake,amplitude=0.6mm,segment length=1.5mm,post length=0mm}](0,-0.04) -- (-1.3,1.3);
برای قرار دادن p:
\node (a1) at (-1.3,0.8) {$p$};
برای تغییر اندازه کل گراف میتونی scale=1
رو تغییر دهید.
خروجی:
روش 2)
\documentclass[a4paper,12pt]{report}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathmorphing,decorations.markings}
\tikzstyle{midarr}=[postaction={decorate},decoration={markings,mark=at position 0.5 with {\arrow[xshift=3.333pt]{stealth'}}}]
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=1]
\draw[thick,decorate,decoration={snake,amplitude=0.6mm,segment length=1.5mm}](0,-0.04) -- (-1.3,1.3);
\draw[thick,decorate,decoration={snake,amplitude=0.6mm,segment length=1.5mm}](1.54,-0.04) -- (2.84,1.3);
%
\draw[midarr,-*,line width=.4mm] (-1.3,-1.3) --(0,0);
\draw[midarr,very thick] (0,-0.04) --(1.54,-0.04);
\draw[midarr,very thick] (1.54,-0.04) --(2.8,-1.3);
%node
\node (a) at (-1.3,0.8) {$p$};
\node (a) at (-1.3,-0.8) {$q$};
\node (a) at (0.75,-0.78) {$q+p$};
\node (a) at (2.8,0.8) {$p'$};
\node (a) at (2.8,-0.8) {$q'$};
\end{tikzpicture}
\end{center}
\end{document}
برای رسم دایره از کتابخانه arrows
و -*
در دستور زیر:
\draw[midarr,-*,line width=.4mm] (-1.3,-1.3) --(0,0);
برای ضخیم کردن خط میتونی در line width=.4mm
مقدار رو تغییر دهید.
خروجی:
روش 3)
\documentclass[a4paper,12pt]{report}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathmorphing,decorations.markings}
\tikzstyle{midway}=[postaction={decorate},decoration={markings,mark=at position 0.5 with {\arrow{>}}}]
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=1]
\draw[thick,decorate,decoration={snake,amplitude=0.6mm,segment length=1.5mm}](0,-0.04) -- (-1.3,1.3);
\draw[thick,decorate,decoration={snake,amplitude=0.6mm,segment length=1.5mm}](1.54,-0.04) -- (2.84,1.3);
%
\draw[midway,-*,line width=0.4mm] (-1.3,-1.3) --(0,0);
\draw[midway,very thick] (0,-0.04) --(1.54,-0.04);
\draw[midway,very thick] (1.54,-0.04) --(2.8,-1.3);
%node
\node (a1) at (-1.3,0.8) {$p$};
\node (a2) at (-1.3,-0.8) {$q$};
\node (a3) at (0.75,-0.78) {$q+p$};
\node (a4) at (2.8,0.8) {$p'$};
\node (a5) at (2.8,-0.8) {$q'$};
\end{tikzpicture}
\end{center}
\end{document}
برای رسم پیکان در وسط مسیر کافی است کتابخانهdecorations.markings
را فراخوانی کنید.
سپس استایل قراردهی پیکان در وسط مسیر را با استفاده از دستور:
\tikzstyle{midway}=[postaction={decorate},decoration={markings,mark=at position 0.5 with {\arrow{>}}}]
خروجی:
روش 4)
\documentclass[a4paper,12pt]{report}
\usepackage{tikz}
\usetikzlibrary{snakes,arrows}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=1,thick]
%left arrow
\draw [->,>=stealth'](-1.5,-1.5)--(-0.75,-0.75);
\draw [-*](-0.754,-0.754)--(0,0);
%center arrow
\draw [->,>=stealth'](0,-0.05)--(0.75,-0.05);
\draw (0.746,-0.05)--(1.5,-0.05);
%right arrow
\draw [->,>=stealth'](1.5,-0.05)--(2.25,-0.75);
\draw (2.246,-0.746)--(3,-1.5);
%segment
\draw[snake=coil,segment aspect=0,segment amplitude=3pt] (1.5,-0.05) -- (2.9,1.77);
\draw[snake=coil,segment aspect=0,segment amplitude=3pt] (0,-0.05) -- (-1.4,1.77);
%node
\node (a1) at (-1.5,1.1) {$p$};
\node (a2) at (-1.5,-1.1) {$q$};
\node (a3) at (0.75,-0.78) {$q+p$};
\node (a4) at (3,1.1) {$p'$};
\node (a5) at (3,-1.1) {$q'$};
\end{tikzpicture}
\end{center}
\end{document}
برای رسم فنر از کتابخانه snakes
و دستور زیر:
\draw[snake=coil,segment aspect=0,segment amplitude=3pt] (1.5,-0.05) -- (2.9,1.77);
خروجی:
موفق باشید