尝试用二次输入生成交叉图

尝试用二次输入生成交叉图

我制作了类似下面的内容,但无法实现,我所拥有的只是节点,但它不起作用,任何帮助都将不胜感激

 \documentclass{article}

 \usepackage{tikz}
 \usetikzlibrary{arrows.meta}

 \begin{document}

 \begin{tikzpicture}[
   vertex/.style = {shape=circle,draw,minimum size=2em},
   edge/.style = {->,-Latex},
   ]
   % Vertices
   \node[vertex] (c) at (0,0) {6};
   \node[vertex] (a) at (-2,-2) {};
   \node[vertex] (b) at (2,-2) {};
   \node[vertex] (d) at (0,-3) {6};
   \node[vertex] (e) at (-1,-5) {?};
   \node[vertex] (f) at (1,-5 {?};
   \node[vertex] (g) at (-2,-7) {};
   \node[vertex] (h) at (0,-7) {5};
   \node[vertex] (i) at (2,-7) {};
   \node[vertex] (bx) at (0,-9) {5};
   % Edges
   \draw[edge, ultra thick] (a) -- (c) node[midway,left] {$\times$}  ;
   \draw[edge, ultra thick] (b) -- (c) node[midway,right] {$\times$} ;
   \draw[edge, ultra thick] (g) -- (bx) node[midway,left] {$\times$}  ;
   \draw[edge, ultra thick] (I) -- (bx) node[midway,right] {$\times$} ;
   \draw[edge, ultra thick] (a)t to  node[left] {} (i);

  \end{document}

我喜欢的东西,旋转

如果您知道如何编写方程式来使其工作,这将是令人惊奇的,但如果我可以手动输入数字,那么同样好。

答案1

这是纠正图表的一种方法,毕竟它并没有那么糟糕:

  • 修正了一些拼写错误(见% <<<
  • 添加缺失的信息
  • 添加\end{tikzpicture}(即关闭环境)
  • 修正运算符
  • 添加缺失的行
  • 稍微调整了 y 坐标

结果

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\begin{document}

 \begin{tikzpicture}[
   vertex/.style = {shape=circle,draw,minimum size=2em},
   edge/.style = {->,-Latex},
   ]
   % Vertices
   \node[vertex] (c) at (0,0) {6};
   \node[vertex] (a) at (-2,-2) {3};% <<< missing content
   \node[vertex] (b) at (2,-2) {2};% <<< missing content
   \node[vertex] (d) at (0,-3) {6};
   \node[vertex] (e) at (-1,-4.5) {?};% adjusted y-coordinate
   \node[vertex] (f) at ( 1,-4.5) {?};% <<< missing ), adjusted y-coordinate
   \node[vertex] (g) at (-2,-7) {2};% <<< missing content
   \node[vertex] (h) at (0,-7) {5};
   \node[vertex] (i) at (2,-7) {3};% <<< missing content
   \node[vertex] (bx) at (0,-9) {5};
   % Edges
   \draw[edge, ultra thick] (a) -- (c) node[midway,left] {$\times$}  ;
   \draw[edge, ultra thick] (b) -- (c) node[midway,right] {$\times$} ;
   \draw[edge, ultra thick] (b) -- (g) node[midway,right] {} ;% missing line
   \draw[edge, ultra thick] (g) -- (bx) node[midway,left] {$+$}  ;% wrong operator
   \draw[edge, ultra thick] (i) -- (bx) node[midway,right] {$+$} ;% typo I, wrong operator
   \draw[edge, ultra thick] (a) to  node[left] {} (i);% <<< typo excessive t
 \end{tikzpicture}% <<< missing

\end{document}

相关内容