我对 TikZ 或 Pstricks 有第二个问题。我该如何输入代码来获得这样的结果?谢谢
答案1
您可以使用 TikZ 及其decorations.markings
库。请参阅 TikZ3 手册中的第 48.5 节第 592 页及以后的内容,http://ftp.cvut.cz/tex-archive/graphics/pgf/base/doc/pgfmanual.pdf。我附上了一个借助该postaction
选项的这种方法的示例。
\documentclass[a4paper]{article}
\pagestyle{empty}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[x=1cm, y=1cm, decoration={markings, mark=at position 0.7 with {\arrow[scale=3]{>}}}, m/.style={blue,line width=1pt}]
\node[font=\bfseries] at (0,1.5) {Sexe};
\node[font=\bfseries] at (3,1.5) {Types d'\'etudes};
\node (f) at (0,0) {F};
\node (m) at (0,-1) {M};
\node (l) at (3.75,0.5) {Litt.};
\node (s) at (3.75,-0.5) {SC};
\node (t) at (3.75, -1.5) {Tech.};
\draw[m, postaction={decorate}] (f) to [bend left=20] (l);
\draw[m, postaction={decorate}] (m) to [bend left=20] (s);
\draw[m, postaction={decorate}] (m) to [bend left=-10] (t);
\end{tikzpicture}
\end{document}
答案2
运行xelatex
\documentclass[a4paper]{article}
\pagestyle{empty}
\usepackage{pstricks-add}
\begin{document}
\def\arraystretch{1.7}
\begin{tabular}{@{} c @{\hspace{1.5cm}} c @{}}
\bfseries\itshape Sexe & \bfseries\itshape Types d'\'etudes \\
& \rnode{l}{Litt.} \\
\rnode{f}{F} \\
& \rnode{s}{SC~~} \\
\rnode{m}{M} \\
& \rnode{t}{Tech.}
\end{tabular}
\psset{ArrowInside=->,ArrowInsidePos=0.7,arrowscale=2,angleB=180}
\nccurve{f}{l} \nccurve{m}{s} \nccurve{m}{t}
\end{document}
答案3
这是一个可能的解决方案,其中myarrow
在 position=0.7 处定义箭头装饰的样式。可以使用bend left/right=xx
,xx=一些选择角度。
代码
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.markings,arrows,positioning}
\tikzset{myarrow/.style={decoration={markings,
%mark=at position 0.3 with {\arrow{stealth'}},
mark=at position 0.7 with {\arrow{stealth'}}
},postaction={decorate}
}}
\begin{document}
\begin{tikzpicture}
\node (A) {Sexe};
\node[right =2cm of A] (B) {Types};
\node [below= 1cm of A](A1){F};
\node [below= 1.5cm of A1](A2){M};
\node [below= 1cm of B](B1){Litt};
\node [below= 1cm of B1](B2){SC};
\node [below= 1cm of B2](B3){Tech};
\draw (A1) edge[myarrow,bend left] (B1);
\draw (A2) edge[myarrow,bend left] (B2);
\draw (A2) edge[myarrow,bend right] (B3);
\end{tikzpicture}
\end{document}
答案4
解决方案的变体pstricks
,使用该 makecell
包,为右列产生不同的对齐方式:
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{MinionPro}
\pagestyle{empty}
\usepackage{makecell}
\renewcommand*\theadfont{\bfseries\itshape}
\usepackage[pdf]{pstricks}%
\usepackage{pstricks-add}
\begin{document}
\begin{tabular}{c@{\hskip2.5cm}c}
\thead{Sexe} & \thead{Types d'études} \\%
\makecell{\rnode{F}{F}\\[12pt] \rnode{M}{M}} & \makecell*{\makecell[l]{\rnode{L}{Litt.}\\[15pt] \rnode{S}{SC}\\[15pt] \rnode{T}{Tech.}}} \\
\end{tabular}
\psset{ArrowInside = ->, ArrowInsidePos = 0.6,linewidth = 1.5pt, linecolor = blue}
\ncarc[nodesep = 6pt ]{F}{L}
\nodexn{(M) + (9pt,0)}{M}
\ncarc[nodesepA = 0pt, nodesepB = 6pt]{M}{S}
\ncarc[ArrowInside = -<, ArrowInsidePos = 0.4,nodesepA = 6pt, nodesepB = 0pt ]{T}{M}
\end{document}