如何在 tikz 中构建以下六边形?
现在我尝试过:
\begin{tikzpicture}[]
\foreach \l [count=\n] in {text,text,text,text,text,text}
{\pgfmathsetmacro\angle{90-360/6*(\n-1)}
\node[label={\angle:\l}] (n\n) at (\angle:1) {};}
\draw[dashed] (n2) -- (n4) -- (n6) -- (n2);
\draw[dotted] (n1) -- (n3) -- (n5) -- (n1);
\draw[->] (n2) -- (n1);
\draw[->] (n2) -- (n3);
\draw[->] (n4) -- (n3);
\draw[->] (n4) -- (n5);
\draw[->] (n6) -- (n5);
\draw[->] (n6) -- (n1);
\draw[>-<] (n1) -- (n4);
\draw[>-<] (n2) -- (n5);
\draw[>-<] (n3) -- (n6);
\end{tikzpicture}
答案1
可能不是最优雅的方式......但它有效:
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[
implikation/.style={stealth-stealth, thick},
disjunktion/.style={dotted},
exklusion/.style={dashed},
kontravalenz/.style={>-<, shorten >=5pt, shorten <=5pt},
]
\foreach[count=\i from 1] \txt/\pos in {%
verboten/right,%
pflichtig/above,%
geboten/left,%
{(relativ)\\erlaubt}/left,%
{indifferent\\(absolut) erlaubt}/below,%
{ungeboten\\(freigestellt)}/right%
}{
\coordinate[label={[align=center]\pos:\txt}] (node-\i) at ({60*\i-30}:2.5cm) {};
}
\draw[exklusion] (node-1) -- (node-3) -- (node-5) -- (node-1);
\draw[disjunktion] (node-2) -- (node-4) -- (node-6) -- (node-2);
\foreach \from/\to in {1/4, 2/5, 3/6}{
\draw[kontravalenz] (node-\from) -- (node-\to);
}
\foreach \i/\j/\k in {6/1/2, 2/3/4, 4/5/6}{
\draw[implikation] (node-\i) -- (node-\j) -- (node-\k);
}
\begin{scope}[shift={(-3,-4)}]
\foreach \xpos/\ypos/\name/\style in {%
0/0/Implikation/implikation,%
3.5/0/Disjunktion/disjunktion,%
0/-0.5/Exklusion/exklusion,%
3.5/-0.5/Kontravalenz/kontravalenz%
}{
\draw[\style] (\xpos,\ypos) -- ++(0.8,0) node[right] {$=${} \name};
}
\end{scope}
\end{tikzpicture}
\end{document}