TIKZ 数学图:箭头应该有一个共同的源头

TIKZ 数学图:箭头应该有一个共同的源头

下面的代码

\documentclass[10pt]{amsart}
\usepackage{tikz}
    \usetikzlibrary{shadows,matrix,arrows}

\begin{document}
\begin{tikzpicture}\small\begin{scope}[->,shorten >=3pt,shorten <=3pt]
\matrix (m) [matrix of math nodes,row sep=0.5cm, column sep=1cm,outer sep=0pt,inner sep=0pt]
{                       &                   \\
                        &e_{12}e_{14}e_{25}e_{25}e_{25} \\
e_{14}e_{15}e_{24}e_{25}&e_{12}e_{15}e_{24}e_{25}e_{25} \\
                        &e_{13}e_{14}e_{35}e_{25}e_{25} \\
                        &e_{13}e_{15}e_{34}e_{25}e_{25} \\
                        &e_{13}e_{25}e_{34}e_{25}e_{25} \\};
\path[-] (m-3-1) edge (m-2-2) edge (m-3-2) edge (m-4-2) edge (m-5-2) edge (m-6-2); 
\path[-,red] (m-3-1) edge (m-5-2);
\end{scope}\end{tikzpicture}
\end{document} 

生产在此处输入图片描述

如何实现来自/到某个节点的所有边都有一个共同的起点/终点? 在此处输入图片描述

答案1

您插入的边多于必要边。您需要 4 个黑色边和 1 个红色边。正如 @Ignasi 所引用的,您可以将节点锚点更改为west并将更改为east

如果有必要,\path如果您认为某个位置不太好,只需使用另一个带有不同锚点的命令即可。例如,您可以使用southsouth west等等。

\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{shadows,matrix,arrows}

\begin{document}
    \begin{tikzpicture}\small
    \begin{scope}[->,shorten >=3pt,shorten <=3pt]
    \matrix (m) [matrix of math nodes,row sep=0.5cm, column sep=1cm,outer sep=0pt,inner sep=0pt]
    {   &                                                         \\
        & e_{12}e_{14}e_{25}e_{25}e_{25}                          \\
          e_{14}e_{15}e_{24}e_{25}&e_{12}e_{15}e_{24}e_{25}e_{25} \\
        & e_{13}e_{14}e_{35}e_{25}e_{25}                          \\
        & e_{13}e_{15}e_{34}e_{25}e_{25}                          \\
        & e_{13}e_{25}e_{34}e_{25}e_{25}                          \\
    };
    \path[-] (m-3-1.east) edge (m-2-2.west) edge (m-3-2.west) edge (m-4-2.west) edge (m-6-2.west); 
    \path[-,red] (m-3-1.east) edge (m-5-2.west);
    \end{scope}
    \end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

tikz-cd

\documentclass[10pt]{amsart}
\usepackage{tikz-cd}

\begin{document}
\begin{tikzcd}[row sep=2ex]
  &e_{12}e_{14}e_{25}e_{25}e_{25} \\
e_{14}e_{15}e_{24}e_{25}
  \ar[ur,dash,start anchor=real east,end anchor=real west]
  \ar[r,dash,start anchor=real east,end anchor=real west]
  \ar[dr,dash,start anchor=real east,end anchor=real west]
  \ar[ddr,dash,start anchor=real east,end anchor=real west,red]
  \ar[dddr,dash,start anchor=real east,end anchor=real west]
  &e_{12}e_{15}e_{24}e_{25}e_{25} \\
  &e_{13}e_{14}e_{35}e_{25}e_{25} \\
  &e_{13}e_{15}e_{34}e_{25}e_{25} \\
  &e_{13}e_{25}e_{34}e_{25}e_{25}
\end{tikzcd}
\end{document} 

在此处输入图片描述

由于所有箭头都具有相同的属性,因此可以在选项中将它们设置为\begin{tikzcd}(感谢 Gonzalo Medina 的建议):

\begin{tikzcd}[
  row sep=2ex,
  arrows=dash,
  start anchor=real east,
  end anchor=real west,
]
  &e_{12}e_{14}e_{25}e_{25}e_{25} \\
e_{14}e_{15}e_{24}e_{25}
    \ar[ur]
    \ar[r]
    \ar[dr]
    \ar[ddr,red]
    \ar[dddr]
  &e_{12}e_{15}e_{24}e_{25}e_{25} \\
  &e_{13}e_{14}e_{35}e_{25}e_{25} \\
  &e_{13}e_{15}e_{34}e_{25}e_{25} \\
  &e_{13}e_{25}e_{34}e_{25}e_{25}
\end{tikzcd}

答案3

只是为了好玩和练习,一个解决方案forest

\documentclass[10pt]{amsart}
\usepackage{forest}

\begin{document}

\begin{forest}
[$e_{14}e_{15}e_{24}e_{25}$, grow'=east, 
        for tree={parent anchor=east,child anchor=west}, l sep=.75cm 
    [$e_{12}e_{14}e_{25}e_{25}e_{25}$] 
    [$e_{12}e_{15}e_{24}e_{25}e_{25}$, calign with current]
    [$e_{13}e_{14}e_{35}e_{25}e_{25}$]
    [$e_{13}e_{15}e_{34}e_{25}e_{25}$, edge={red}]
    [$e_{13}e_{25}e_{34}e_{25}e_{25}$]]
\end{forest}

\end{document}

在此处输入图片描述

相关内容