
MS Word의 사용자 정의된 순서도(자신의 것)를 LaTeX로 가져오는 방법에 대한 좋은 질문이라고 생각합니다. 글쎄요, 저는 World 파일을 첨부했고, 그것을 LaTex로 변환하려고 합니다. "유형" LaTeX로 저장이 작동하지 않고 말도 안되는 PDF를 생성했습니다. 그렇다면 가장 좋은 방법은 무엇일까요?
여기에 워드 파일을 첨부하는 방법을 모르겠습니다. 그래서 그 스냅샷을 올렸습니다.
한 가지 방법은 이것을 LaTeX에서 다시 입력하는 것입니다. 하지만 그렇게 할 자신이 없습니다. (이 화살표를 갖는 것이 어려움을 느낍니다.) 분명히, 이것을 LaTeX 소스 파일에 그림으로 가져오면 글꼴이 다른 항목과 일치하지 않습니다. 종이. 그러므로 나는 그것을 (아마도 가장 간단한 방법으로) 변환하고 싶습니다.
답변1
앨런의 대답edge path
잘 작동하지만 현재 버전의 Forest에서는 처음부터 정의할 필요가 없습니다 . 대신 edges
옵션과 함께 라이브러리를 사용할 수 있습니다 forked edges
. 또한 growth parent anchor=east
아무 작업도 수행하지 않으므로 제거할 수 있으며(이전 버전의 Forest에서도) 및 대신 parent
및 앵커를 사용하여 코드를 더욱 유연하게 만들 수 있습니다 .children
east
west
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
정확히 한 명의 자녀가 있는 경우에 대한 대안을 정의하는 것입니다.
기본 가장자리는 상위 노드의 상위 앵커에서 (!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
또한 calign=child edge
2.01 이전 버전에서는 버그가 있어서 자식이 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}