LaTeX에서 이와 같은 블록 다이어그램을 그리는 방법

LaTeX에서 이와 같은 블록 다이어그램을 그리는 방법

다이어그램에 표시된 것과 유사한 블록 다이어그램을 그리려고 했지만 그릴 수 없습니다. 누구든지 그러한 블록 다이어그램을 그리는 방법을 제안해 주세요. 감사합니다

지금까지 노력했지만,

\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}

이런 종류의 출력이 pdf로 표시됩니다.잘못된 출력]1

내가 원하는 이 출력

답변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의 제안에 따라.

관련 정보