![LaTeX에서 이와 같은 블록 다이어그램을 그리는 방법](https://rvso.com/image/405356/LaTeX%EC%97%90%EC%84%9C%20%EC%9D%B4%EC%99%80%20%EA%B0%99%EC%9D%80%20%EB%B8%94%EB%A1%9D%20%EB%8B%A4%EC%9D%B4%EC%96%B4%EA%B7%B8%EB%9E%A8%EC%9D%84%20%EA%B7%B8%EB%A6%AC%EB%8A%94%20%EB%B0%A9%EB%B2%95.png)
다이어그램에 표시된 것과 유사한 블록 다이어그램을 그리려고 했지만 그릴 수 없습니다. 누구든지 그러한 블록 다이어그램을 그리는 방법을 제안해 주세요. 감사합니다
지금까지 노력했지만,
\usepackage{forest}
\useforestlibrary{edges}
\begin{forest}
for tree={draw, minimum width=2cm, minimum height=1cm, rounded corners},
forked edges,
[IDS for Automotive CAN Bus System [Deployment Strategy[ECU][CAN][Gateway]][Detection Approach[Specification Based][Anomaly Based[Machine Learning][Hybrid Based][Frequency Based]][Signature Based]][Attacking Technique[DoS][Replay]]]
\end{forest}
답변1
이는 상당 부분 다음과 같이 적용되었습니다.여기. for tree={folder, grow'=0}
폴더를 시작할 때마다 주입해야 합니다 . 트리가 너무 넓어서 루트 노드를 제외한 모든 텍스트 너비를 줄였습니다.
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{forest}
\useforestlibrary{edges}
\makeatletter
% remove the stray space https://tex.stackexchange.com/a/513549
\patchcmd{\pgfutilsolvetwotwoleqfloat}
{ \noexpand\pgfmathfloatdivide@}
{\noexpand\pgfmathfloatdivide@}
{}{}
\makeatother
\begin{document}
\noindent\begin{forest}
before typesetting nodes={
if={isodd(n_children("!r"))}{
for nodewalk/.wrap pgfmath arg={{fake=r,n=#1}{calign with current edge}}{int((n_children("!r")+1)/2)},
}{},
},
forked edges,
for tree={draw, minimum width=2cm, minimum height=1cm, rounded corners,
if level=0{}{text width=2cm}},
[IDS for Automotive CAN Bus System
[Deployment Strategy,for tree={folder, grow'=0}
[ECU]
[CAN]
[Gateway]
]
[Detection Approach
[Specification Based]
[Anomaly Based,for tree={folder, grow'=0}
[Machine Learning]
[Hybrid Based]
[Frequency Based]
]
[Signature Based]
]
[Attacking Technique,for tree={folder, grow'=0}
[DoS]
[Replay]
]
]
\end{forest}
\end{document}
showframe
단지 이 트리가 적합하다는 것을 보여주는 것뿐입니다(그러나 기하학 패키지를 로드하는 것만으로도 페이지가 조금 더 넓어집니다).
편집하다: tempcounta/.max={level}{tree},
@cfr 덕분에 사용되지 않은 항목이 제거되었습니다.
두 번째 편집: 다음에서 수정 사항이 추가되었습니다.https://tex.stackexchange.com/a/513549, @cfr의 제안에 따라.