
안녕하세요. 저는 Latex에서 의사결정 트리를 만들려고 노력 중입니다. 현재로서는 그 트리가 있습니다.
하지만 내 트리는 아마도 중요할 것이므로 노드가 왼쪽에 더 가깝지만 수직 차원에는 있지 않기를 바랍니다. 그렇게:
그리고 [오른쪽 위]로 위치를 정의할 때 노드 거리를 변경하면 둘 다 변경되고 수직으로 너무 가까우면 다른 노드가 서로 부딪치게 됩니다(오른쪽에 일부 노드가 겹치는 것으로 알고 있습니다. 수정하겠습니다. 지금은 제 문제가 아닙니다.)
여기 내 코드가 있습니다
\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{fullpage}
\usepackage{listings}
\usepackage{booktabs}
\usepackage{tikz-cd}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,shapes}
\begin{document}
\tikzstyle{block3} = [rectangle, draw, fill=white, text width=4cm, text centered, rounded corners, minimum height=4em]
\begin{tikzpicture}[node distance = 4cm, auto]
\node [block3] (MDS) {Y a-t-il eu MDS ? };
\node [block3, above right of=MDS, node distance = 8cm] (Jeune) {Jeune \\ Plus ou moins de 25 ans ? };
\node [block3, above right of=Jeune] (Jeune_Non) {Non Jeune \\ Problème};
\node [block3, below right of=Jeune] (Jeune_Oui) {Jeune};
\node [block3, above right of =Jeune_Oui](18) {18 ans dans l'année N};
\node [block3, right of =Jeune_Oui](21) {jusqu'à 21 ans en N };
\node [block3, below right of =Jeune_Oui](25) {jusqu'à 25 ans en N \\ Si étudiant N-1, possible avec les parents \\ EEC : EOCCUA 4};
\node [block3, below right of=MDS, node distance = 8cm] (MDS_Oui) {Personne avec un MDS};
\end{tikzpicture}
\end{document}
요약하면 내 문제는 내 노드를 오른쪽 아래 또는 위에 배치할 때 대각선에 있고(예: 시계의 1시 반) 12시 반이나 1시 반에 노드를 원한다는 것입니다.
답변1
를 지정할 수 있습니다 xshift
.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\begin{document}
\tikzstyle{block3}=[rectangle,draw,fill=white,text width=4cm,text centered,rounded corners,minimum height=4em]
\begin{tikzpicture}[node distance=4cm,auto]
\node [block3](MDS){Y a-t-il eu MDS ?};
\node [block3,above of=MDS,xshift=3cm,node distance=4cm](Jeune){Jeune \\ Plus ou moins de 25 ans ?};
\node [block3,above right of=Jeune](Jeune_Non){Non Jeune \\ Problème};
\node [block3,below right of=Jeune](Jeune_Oui){Jeune};
\node[block3,above right of=Jeune_Oui](18){18 ans dans l'année N};
\node[block3,right of=Jeune_Oui](21){jusqu'à 21 ans en N };
\node[block3,below right of=Jeune_Oui](25){jusqu'à 25 ans en N \\ Si étudiant N-1,possible avec les parents \\ EEC : EOCCUA 4};
\node [block3,below of=MDS,xshift=3cm,node distance=4cm](MDS_Oui){Personne avec un MDS};
\end{tikzpicture}
\end{document}