編集

編集

これは、MS Word でカスタマイズしたフローチャート (独自のもの) を LaTeX に取り込む方法についてのよい質問だと思います。World ファイルを添付して、それを LaTeX で変換しようとしています。LaTeX の「タイプ」として保存しても機能せず、意味不明な PDF が生成されました。では、最善の方法は何でしょうか。

ここに画像の説明を入力してください

ここに Word ファイルを添付する方法がわかりません。そのため、そのスナップショットを載せました。

一つの方法はこれをLaTeXで再入力することですが、私はそれをする自信がありません(この矢印を持つことに困難を感じます)明らかに、これを図としてLaTeXソースファイルに取り込むと、フォントが紙の他のものと一致しません。したがって、私はそれを変換したいと思います(おそらく最も簡単な方法として)

答え1

アランの答えedge pathは正常に動作しますが、現在のバージョンの Forest では、 を最初から定義する必要はありません。代わりに、edgesオプション を指定してライブラリを使用できます。さらに、は何も行わないため (古いバージョンの Forest でも) をforked edges削除し、ではなくおよびアンカーを使用してコードをより柔軟にすることができます。growth parent anchor=eastparentchildreneastwest

parent anchor=children,
child anchor=parent,
forked edges,
edge={->,>=latex},

実際、grow=eastそれだけで十分なので、仕様を完全に削除することができparent anchorますchild anchor

これにより、Alan が回答で示したのと同じ出力の次のコードが得られます。

\documentclass[tikz,multi,border=10pt]{standalone}
\usepackage[edges]{forest}
\begin{document}
\begin{forest}
  for tree={
    grow=east,
    math content,
    edge={->,>=latex},
  },
  forked edges
  [\tau>\tau^0
    [A_x<\tau<A_l
    ]
    [D
      [E]
      [F]
    ]
    [\tau<A_x
      [{\zeta^n=\zeta^n-1}
      ]
    ]
  ]
\end{forest}
\end{document}

しかし、よく見ると、この行はもっと良くなる可能性があることがわかります。

変態の矢

のデフォルトの定義forked edges

  forked edges/.style={
    for tree={parent anchor=children},
    for descendants={child anchor=parent,forked edge}
  },

forked edgeそこで、次の再定義を追加して、ノードに複数の子がある場合にのみ が使用されるように再定義してみましょう。

\forestset{
  forked edges/.style={
    for tree={parent anchor=children},
    for descendants={
      child anchor=parent,
      if={n_children("!u")==1}{}{
        forked edge
      },
    }
  },
}

これの方が良い:

あまり変態ではない

ただし、矢印はまだ斜めになっており、完全に水平ではありません。必要なのは、edge path子が 1 つだけの場合の代替手段を定義することです。

デフォルトのエッジは、親ノードの親アンカー から子(!u.parent anchor)ノードの子アンカー に描画されます(.child anchor)。矢印の始点を と水平に揃えます(.child anchor)。(もちろん、終点を親の親アンカーに揃えることもできます。)

\forestset{
  forked edges/.style={
    for tree={parent anchor=children},
    for descendants={
      child anchor=parent,
      if={n_children("!u")==1}{
        edge path'={
          (!u.parent anchor |- .child anchor) -- (.child anchor)
        },
      }{
        forked edge,
      },
    }
  },
}

これにより、求めている水平矢印が生成されます。

曲がっていない矢

ただし、これは最善の解決策ではない可能性があります。親ノードと子ノードのサイズがあまりにも異なる場合、奇妙な配置になる可能性があります。そのため、代わりに Forest に子を親に揃えるように指示して、子の子アンカーが親の親アンカーと揃うようにする必要があります。

\forestset{
  forked edges/.style={
    for tree={parent anchor=children},
    for descendants={
      child anchor=parent,
      if={n_children("!u")==1}{
        !u.calign=child edge,
      }{
        forked edge,
      },
    }
  },
}

うまくいきます。

現時点では、結果は次のようになります。

暫定ツリー

これはよりよい方法ですが、親に奇数の子がいる場合に、中間の子を親に揃えることができれば便利です。たとえば、Dのエッジがルート ノードから描画された線に揃えられている場合などです。

これは少しトリッキーですが、それほどではありません。このcalign=child edgeトリックをもう一度使用して、中間の子をその親の「プライマリ」子として設定できます。

これを環境の先頭のプリアンブルに追加できますforest

\begin{forest}
  for tree={
    ...
    if={isodd(n_children())}{
      calign primary child/.pgfmath={(n_children()+1)/2},
      calign=child edge,
    }{},
  },

実際、ちょうど 1 つの子を持つノードは奇数の子を持つため、forked edgesいずれにしても直線の矢印が得られるため、 の再定義を削除することもできます。

最終ツリー

\documentclass[tikz,multi,border=10pt]{standalone}
\usepackage[edges]{forest}
\begin{document}
\begin{forest}
  for tree={
    grow=east,
    math content,
    edge={->,>=latex},
    if={isodd(n_children())}{
      calign primary child/.pgfmath={(n_children()+1)/2},
      calign=child edge,
    }{}
  },
  forked edges
  [\tau>\tau^0
    [A_x<\tau<A_l
    ]
    [D
      [E]
      [F]
    ]
    [\tau<A_x
      [{\zeta^n=\zeta^n-1}
      ]
    ]
  ]
\end{forest}
\end{document}

ギリシャのコードを恥ずかしげもなく盗むマルコ:

\begin{forest}
  for tree={
    grow'=east,
    math content,
    edge={->,>=latex},
    if={isodd(n_children())}{
      calign primary child/.pgfmath={(n_children()+1)/2},
      calign=child edge,
    }{}
  },
  forked edges
  [\tau>\tau^0
    [\tau<A_x
      [{\zeta^n=\zeta^{n-1}}]
      [{\zeta^n=\zeta^{n-1}}]
      [{\zeta^n=\zeta^{n-1}}]
    ]
    [A_x<\tau<A_l
      [\sigma<C_{a}(T-A_{x})
        [{\zeta^n=\zeta^{n-1}}]
        [{\zeta^n=\zeta^{n-1}}]
        [{\zeta^n=\zeta^{n-1}}]
      ]
      [\sigma>C_{a}(T-A_{x})
        [{\xi^{n}=\frac{\xi^{0}}{2}\cos \left ( a_{A}\left (\Gamma-A_{x}-\frac{\sigma}{C_{a}}  \right ) \right )}]
        [{\xi_{s}^{n}=\xi_{s}^{n}-\frac{\xi_{s}^{n}}{\xi_{s}^{n}}-(\xi^{0}-\xi^{n})}]
        [{\xi_{s}^{n}=\xi_{s}^{n}-\frac{\xi_{s}^{n}}{\xi_{s}^{n}}-(\xi^{0}-\xi^{n})}]
      ]
    ]
  ]
\end{forest}

もっと木

編集

コードは、[[<something>]]空のノードを生成し、次に を持つノードを生成するため、「ギャップ」を生成します[<something>]。空のノードを削除するには、 と記述するだけです[<something>]

\documentclass{article}
\usepackage{forest-1}
\begin{document}
\begin{forest}
  for tree={
    grow=east,
    parent anchor=east,
    child anchor=west,
    math content,
    edge={->, >={latex}},
    edge path={\noexpand\path[\forestoption{edge}] (!u.parent anchor) -- +(5pt,0pt) |- (.child anchor) \forestoption{edge label};}
  }
  [T>T^0
    [T>A_f
      [C_a(T-A_f) <\sigma <C_a (T-A_s)
          [  {\zeta_s^n=\zeta_s^0-\frac{\zeta_s^0}{\zeta^0}(\zeta^0-\zeta^n)} ]
          [  {\zeta_T^n=\zeta_T^0-\frac{\zeta_T^0}{\zeta^0}(\zeta^0-\zeta^n)} ]
          [{\zeta^n=\frac{\zeta^0}{2}(cos \big (\alpha_A(T-A_s-\frac{\sigma}{C_a})\big )+1)} ]
      ]
      [\sigma<C_a(T-A_s)
        [  {\zeta^n=\zeta^{n-1}} ]
        [  {\zeta_s^n=\zeta_s^{n-1}} ]
        [  {\zeta_T^n=\zeta_T^{n-1}} ]
      ]
    ]
    [A_s<T<A_f
      [\sigma<C_a(T-A_s)
            [  {\zeta_s^n=\zeta_s^0-\frac{\zeta_s^0}{\zeta^0}(\zeta^0-\zeta^n)} ]
            [  {\zeta_T^n=\zeta_T^0-\frac{\zeta_T^0}{\zeta^0}(\zeta^0-\zeta^n)} ]
            [{\zeta^n=\frac{\zeta^0}{2}(cos \big (\alpha_A(T-A_s-\frac{\sigma}{C_a})\big )+1)}]
        [\sigma>C_a(T-A_s)
            [  {\zeta^n=\zeta^{n-1}} ]
            [  {\zeta_s^n=\zeta_s^{n-1}} ]
            [  {\zeta_T^n=\zeta_T^{n-1}} ]
        ]
      ]
    ]
    [T<A_s
      [  {\zeta^n=\zeta^{n-1}} ]
      [  {\zeta_s^n=\zeta_s^{n-1}} ]
      [  {\zeta_T^n=\zeta_T^{n-1}} ]
    ]
  ]
\end{forest}
\end{document}

ギャップが少ない

バージョン1では、するparent anchor=east, child anchor=westを変更するには、と を指定する必要がありedge pathます。 はありませんforked edges。また、 は 2.01 より前のバージョンではバグがあるため、子が 1 つしかない場合にキンクを取り除くのは簡単でcalign=child edgeはありません。それでも可能ですが、バグを回避するよりも更新する方がはるかに簡単です。ツリーに子が 1 つもない場合は問題になりませんが、他のツリーがある場合は問題になる可能性があります。同様の理由で、エッジを揃えるのも簡単ではありません。edge pathこれを機能させるには、 で何かを行う必要があります。

一方、現在のパッケージでは、ツリーを次のように簡単に調整でき、コードもシンプルになります。

整列したツリー

\documentclass{article}
\usepackage[edges]{forest}
\begin{document}
\begin{forest}
  for tree={
    grow'=east,
    math content,
    edge={->,>=latex},
    if={isodd(n_children())}{
      calign primary child/.pgfmath={(n_children()+1)/2},
      calign=child edge,
    }{}
  },
  forked edges
  [T>T^0
    [T>A_f
      [C_a(T-A_f) <\sigma <C_a (T-A_s)
          [  {\zeta_s^n=\zeta_s^0-\frac{\zeta_s^0}{\zeta^0}(\zeta^0-\zeta^n)} ]
          [  {\zeta_T^n=\zeta_T^0-\frac{\zeta_T^0}{\zeta^0}(\zeta^0-\zeta^n)} ]
          [{\zeta^n=\frac{\zeta^0}{2}(cos \big (\alpha_A(T-A_s-\frac{\sigma}{C_a})\big )+1)} ]
      ]
      [\sigma<C_a(T-A_s)
        [  {\zeta^n=\zeta^{n-1}} ]
        [  {\zeta_s^n=\zeta_s^{n-1}} ]
        [  {\zeta_T^n=\zeta_T^{n-1}} ]
      ]
    ]
    [A_s<T<A_f
      [\sigma<C_a(T-A_s)
            [  {\zeta_s^n=\zeta_s^0-\frac{\zeta_s^0}{\zeta^0}(\zeta^0-\zeta^n)} ]
            [  {\zeta_T^n=\zeta_T^0-\frac{\zeta_T^0}{\zeta^0}(\zeta^0-\zeta^n)} ]
            [{\zeta^n=\frac{\zeta^0}{2}(cos \big (\alpha_A(T-A_s-\frac{\sigma}{C_a})\big )+1)}, calign with current]
        [\sigma>C_a(T-A_s)
            [  {\zeta^n=\zeta^{n-1}} ]
            [  {\zeta_s^n=\zeta_s^{n-1}} ]
            [  {\zeta_T^n=\zeta_T^{n-1}} ]
        ]
      ]
    ]
    [T<A_s
      [  {\zeta^n=\zeta^{n-1}} ]
      [  {\zeta_s^n=\zeta_s^{n-1}} ]
      [  {\zeta_T^n=\zeta_T^{n-1}} ]
    ]
  ]
\end{forest}
\end{document}

答え2

これを実行するのはそれほど難しくありませんforest。次の例を参考にして始めてください。

\documentclass{article}
\usepackage{forest}
\begin{document}

\begin{forest}for tree={
    grow=east
    parent anchor=east,
    child anchor=west,
    math content,
    edge path={\noexpand\path[\forestoption{edge},->, >={latex}] 
         (!u.parent anchor) -- +(5pt,0pt) |- (.child anchor)
         \forestoption{edge label};}}
[\tau>\tau^0  [A_x<\tau<A_l ] [D [E ] [F ]][\tau<A_x [  {\zeta^n=\zeta^n-1} ]]]
\end{forest}
\end{document}

コードの出力

答え3

これはまったく正しいアプローチではないと思いますが、私は専門家ではないので、これが私が知っている唯一の方法です。

\documentclass[border=0.5cm]{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    % \draw [help lines] (0,0) grid (13,13);
    \draw [thick] (0,0) -- (0,10);
    \draw [thick,-latex] (0,5) -- + (0.5,0) node [right] {$A<T<A_{f}$};
    \draw [thick,-latex] (2.8,5) -- + (0.5,0);
    \draw [thick] (3.3,3.5) -- (3.3,6.5);
    \draw [thick,-latex] (3.3,3.5) -- + (0.5,0) node [right] {$\sigma<C_{a}(T-A_{x})$};
    \draw [thick,-latex] (3.3,6.5) -- + (0.5,0) node [right] {$\sigma>C_{a}(T-A_{x})$};
    \draw [thick,-latex] (0,10) -- + (0.5,0) node [right] {$T<A$};
    \draw [thick,-latex] (1.8,10) -- + + (0.5,0);
    \draw [thick] (2.3,9) -- (2.3,11);
    \draw [thick,-latex] (2.3,9) -- + (0.5,0) node [right] {$\xi^{n}=\xi^{n-1}$};
    \draw [thick,-latex] (2.3,10) -- + (0.5,0) node [right] {$\xi^{n}=\xi^{n-1}$};
    \draw [thick,-latex] (2.3,11) -- + (0.5,0) node [right] {$\xi_{T}^{n}=\xi_{T}^{n-1}$};
    \draw [thick,-latex] (6.5,6.5) -- + (0.5,0);
    \draw [thick] (7,5.8) -- + (0,1.4);
    \draw [thick,-latex] (7,5.8) -- + (0.5,0) node [right] {$\xi^{n}=\xi^{n-1}$};
    \draw [thick,-latex] (7,6.5) -- + (0.5,0) node [right] {$\xi^{n}=\xi^{n-1}$};
    \draw [thick,-latex] (7,7.2) -- + (0.5,0) node [right] {$\xi_{T}^{n}=\xi_{T}^{n-1}$};
    \draw [thick,-latex] (6.5,3.5) -- + (0.5,0);
    \draw [thick] (7,2.5) -- + (0,2);
    \draw [thick,-latex] (7,2.5) -- + (0.5,0) node [right] {$\xi^{n}=\frac{\xi^{0}}{2}\cos \left ( a_{A}\left (\Gamma-A_{x}-\frac{\sigma}{C_{a}}  \right ) \right )$};
    \draw [thick,-latex] (7,3.5) -- + (0.5,0) node [right] {$\xi_{s}^{n}=\xi_{s}^{n}-\frac{\xi_{s}^{n}}{\xi_{s}^{n}}-(\xi^{0}-\xi^{n})$};
    \draw [thick,-latex] (7,4.5) -- + (0.5,0) node [right] {$\xi_{s}^{n}=\xi_{s}^{n}-\frac{\xi_{s}^{n}}{\xi_{s}^{n}}-(\xi^{0}-\xi^{n})$};
\end{tikzpicture}
\end{document}

ここに画像の説明を入力してください

関連情報