EIDT

EIDT

내 소프트웨어는 일부 문서를 자동으로 생성합니다. 문서에 추가하는 요소 중 하나는 여기에 설명된 스타일의 트리입니다.

(간단한) 디렉토리 트리 만들기

트리가 클 수 있으므로 여러 페이지에 걸쳐 있습니다. 페이지를 나눌 위치를 트리에 수동으로 알려주는 방법이 있습니다.

적절한 수직 정렬을 사용하여 숲 나무를 두 나무로 어떻게 분할합니까?

하지만 제가 정말로 원하는 것은 트리가 자동으로 페이지 나누기를 하는 것입니다. Tikz Forest로 이 작업을 수행할 수 있는 방법이 있나요?

산림 코드의 예는 다음과 같습니다.

\documentclass[english,10pt,oneside,table,xcdraw]{book}

\usepackage{lmodern}
\usepackage[lgr,T1]{fontenc}
\usepackage{geometry}
\usepackage[utf8]{inputenc}
\usepackage{forest}
\usepackage{longtable}
\usepackage{tikz}
\usetikzlibrary{calc,shapes,shapes.arrows,arrows,trees,shadows,backgrounds,positioning}

\forestset{
  nodeStyle/.style={
    before typesetting nodes={
      edge=#1,
      for ancestors={
        edge=#1,
        #1,
      },
      #1,
    }
  },
  my edge label/.style={
    edge label={
      node [midway, fill=white, font=\scriptsize] {#1}
    }
  }
}

\begin{document}
\newcolumntype{C}[1]{>{\centering}p{#1}}
\newcolumntype{M}{>{\begin{varwidth}{4cm}}l<{\end{varwidth}}} %M is for Maximal column

\definecolor{tempColor}{rgb}{0.2,1,0.2}
\begin{figure}
\begin{center}
\par\medskip
{
  \footnotesize
  \begin{forest}
  for tree=
  {
    if level=0{align=center}
    {
      % allow multi-line text and set alignment
      align={@{}C{50mm}@{}},
    },
    grow'=0,
    font=\sffamily\bfseries,
    edge path=
    {
      \noexpand\path [draw, \forestoption{edge}] (!u.south west) +(7.5pt,0) |- (.child anchor) \forestoption{edge label};
    },
    before typesetting nodes=
    {
      if n=1
      {
        insert before={[,phantom]}
      }
      {}
    },
    parent anchor=south,
    child anchor=west,
    anchor=west,
    calign=first,
    inner xsep=7pt,
    edge={ultra thick, rounded corners=2pt},
    fill=white,
    rounded corners=2pt,
    fit=band,
    before computing xy={l=15pt},
  }
[{TypeData}
   [{ModelType}
   ]
   [{StationType},drop shadow
      [{StationConfig},fill=lightgray
      ]
      [{StationConfig},drop shadow,fill=lightgray[child, font=\sffamily, align=left][child, font=\sffamily, align=left][child, font=\sffamily, align=left]
      ]
      [{StationConfig},drop shadow,fill=lightgray[child, font=\sffamily, align=left][child, font=\sffamily, align=left][child, font=\sffamily, align=left]
      ]
      [{StationConfig},drop shadow,fill=lightgray[child, font=\sffamily, align=left][child, font=\sffamily, align=left][child, font=\sffamily, align=left]
      ]
      [{StationConfig},drop shadow,fill=lightgray[child, font=\sffamily, align=left][child, font=\sffamily, align=left][child, font=\sffamily, align=left]
      ]
      [{StationConfig},drop shadow,fill=lightgray[child, font=\sffamily, align=left][child, font=\sffamily, align=left][child, font=\sffamily, align=left]
      ]
      [{StationConfig}
      ]
      [{StationConfig}
      ]
      [{StationConfig}
      ]
      [{StationConfig}
      ]
      [{StationConfig}
      ]
      [{StationConfig}
      ]
      [{StationConfig}
      ]
      [{StationConfig}
      ]
      [{StationConfig}
      ]
      [{StationConfig}
      ]
      [{StationConfig}
      ]
      [{StationConfig}
      ]
      [{StationConfig},drop shadow,fill=lightgray[child, font=\sffamily, align=left][child, font=\sffamily, align=left][child, font=\sffamily, align=left]
      ]
      [{StationConfig},drop shadow,fill=lightgray[child, font=\sffamily, align=left][child, font=\sffamily, align=left][child, font=\sffamily, align=left]
      ]
      [{StationConfig},drop shadow,fill=lightgray[child, font=\sffamily, align=left][child, font=\sffamily, align=left][child, font=\sffamily, align=left]
      ]
      [{StationConfig},drop shadow,fill=lightgray[child, font=\sffamily, align=left][child, font=\sffamily, align=left][child, font=\sffamily, align=left]
      ]
      [{StationConfig},drop shadow,fill=lightgray[child, font=\sffamily, align=left][child, font=\sffamily, align=left][child, font=\sffamily, align=left]
      ]
      [{StationConfig},drop shadow,fill=lightgray[child, font=\sffamily, align=left][child, font=\sffamily, align=left][child, font=\sffamily, align=left]
      ]
      [{StationConfig},drop shadow,fill=lightgray[child, font=\sffamily, align=left][child, font=\sffamily, align=left][child, font=\sffamily, align=left]
      ]
      [{StationConfig},drop shadow,fill=lightgray[child, font=\sffamily, align=left][child, font=\sffamily, align=left][child, font=\sffamily, align=left]
      ]
      [{StationConfig}
      ]
      [{StationConfig}
      ]
      [{StationConfig}
      ]  
   ]
   [{SecondType}
   ]
]
  \end{forest}
}
\caption{ }
\end{center}
\end{figure}
\end{document}

답변1

문제가 컴파일 오류인 경우를 제외하고 항상 완전하고 작동하는 코드를 게시하세요. 코드를 컴파일하도록 설득하는 것은 추측에 의한 연습이었습니다. 이런 이유로 내가 깨닫지도 못하는 방식으로 코드를 변경했을 수도 있습니다.

귀하의 서문에 대한 내 추측은 다음과 같습니다.

\documentclass[a4paper]{article}
\usepackage{geometry,array}
\usepackage{forest}
\usetikzlibrary{shadows}
\newcolumntype{C}[1]{@{}>{\centering\arraybackslash}m{#1}@{}}

분명히 이것은 추측할 때만 예상되는 귀하의 것과 동일하지 않을 수 있습니다. 아래 답변은 이것이 귀하의 서문이라는 가정을 기반으로 합니다.

문제가 단순히 자동화 문제라면 귀하의 예가 수동 방법을 보여줄 것으로 기대합니다. 의심스러운 마음을 갖고 있기 때문에, 이유는 모르더라도 그렇지 않다는 것을 알고 계시리라 생각합니다.

물론 이 중 어느 것도 그다지 도움이 되지는 않습니다. 이는 귀하의 질문에 소요될 수 있는 시간이 로드할 패키지를 파악하고 C.


좋아요. 따라서 연결한 질문에 대한 답변에 제공된 코드는 아래쪽으로 자라는 나무를 분할하는 데만 사용할 수 있습니다. 당신의 것은 동쪽으로 자랍니다.

더욱이 최소한 거기에 있는 예제 중 일부(예: mind)는 콘솔에서 TeX의 프롬프트에 응답하거나 forest.sty.

따라서 프롬프트를 닫을 수 있도록 명령줄에서 컴파일해야 할 수도 있습니다. 오류가 없습니다. TeX는 \show당신이 추가 도움을 요청하면 알려줄 무언가를 보내는 것입니다. 따라서 오류를 무시하는 것에 대해 걱정할 필요가 없습니다. 당신은 그것이 당신에게 보여주고 싶은 것을 보여주기만 하면 됩니다.

다음 코드는 다음을 수행합니다.

  • Forest 2의 스타일을 사용하도록 코드를 업데이트하므로 folder이 스타일의 나무를 더 쉽게 그릴 수 있습니다.
  • dir tree해당 스타일의 특정 취향에 맞는 스타일을 제공합니다 .
  • split dir here=<text>연결된 스타일과 유사하게 현재 노드에서 트리를 분할하는 스타일을 제공합니다 split here=<text>.

스타일 정의는 링크된 질문에 대한 답변에 포함되어 있고 아래 설명에 표시된 대로 Sašo 코드를 적용한 내용을 기반으로 합니다.

제한사항:

  • 자동으로 분할되는 것은 없습니다.
  • 이상한 일을 하면 분할이 제대로 작동하지 않습니다. 여기서 '이상하다'는 대략 '분할이 제대로 작동하지 않게 만드는 일'을 의미합니다.
  • 덜 이상한 작업을 수행하더라도 분할 후 현재 노드 조판의 형제 항목에 그려진 모든 가장자리가 분할 후 손실됩니다.
  • 트리당 하나의 분할만 지원됩니다(다중 분할 버전은 아래 참조).
  • 분할은 노드의 기본 '선형 순서'에 따라 달라지므로 next node선형 순서의 노드는 분할 후 그려야 하는 첫 번째 노드이고 해당 순서의 모든 노드와 그 이후의 노드만 그려야 합니다. 그 분할 이후에 그려졌습니다.

암호:

\documentclass[a4paper]{article}
\usepackage{geometry,array}
\usepackage[edges]{forest}
\usetikzlibrary{shadows}
\newcolumntype{C}[1]{@{}>{\centering\arraybackslash}m{#1}@{}}
\forestset{%
  dir tree/.style={%
    for tree={%
      folder,
      grow'=0,
      if level=0{align=center}
      {
        align={C{50mm}},
      },
      font=\sffamily\bfseries\footnotesize,
      inner xsep=7pt,
      edge={ultra thick, rounded corners=2pt},
      fill=white,
      rounded corners=2pt,
      drop shadow,
    },
  },
}
% addaswyd o gôd Sašo Živanović: https://tex.stackexchange.com/a/296771/
\def\hiddenparcommand{\par}
\forestset{%
  declare toks register={split here interject},
  declare toks register={split here node},
  declare toks register={split resume here node},
  split here interject={},
  split here node={},
  split resume here node={},
  to widest/.style={
    tikz+={\path (\forestregister{tempdima}, \forestoption{y}) -- (\forestregister{tempdimb}, \forestoption{y});},
  },
  split dir here/.style={%
    split here node/.option=name,
    split here interject={#1},
    split dir tree,
    delay={
      for next node={split dir resume here},
    },
  },
  split dir resume here/.style={%
    split resume here node/.option=name,
  },
  split dir tree/.code={%
    \forestset{%
      draw tree stage/.style={
        for root'={
          tempdima/.min={x()+min_x()}{tree},
          tempdimb/.max={x()+max_x()}{tree},
          for tree={%
            to widest,
            if name/.wrap pgfmath arg={{####1}{label={[text=gray, anchor=north, font=\scriptsize]below:{[cont.]}}}{}}{split_here_node},
            if name/.wrap pgfmath arg={{####1}{edge={densely dotted, gray}, label={[font=\scriptsize, anchor=south, text=gray]above:{[cont.]}}}{}}{split_resume_here_node},
          },
        },
        for nodewalk/.wrap pgfmath arg={{draw tree processing order/.style={name=####1,preceding nodes}}{}}{split_here_node},
        for root'={draw tree},
        TeX/.wrap pgfmath arg={\hiddenparcommand ####1\hiddenparcommand}{split_here_interject},
        for nodewalk/.wrap pgfmath arg={{draw tree processing order/.style={name=####1,following nodes}}{}}{split_resume_here_node},
        for root'={draw tree},
      },
    }
  }
}
\begin{document}
\begin{forest}
  dir tree,
  before drawing tree={
    for tree={
      tikz+/.wrap 2 pgfmath args={\node [anchor=west, font=\footnotesize, text=red] at (.east) {L:#1; n:#2};}{level()}{n()}
    }
  }
  [TypeData
    [ModelData
    ]
    [StationData
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig, split dir here=continued
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
   ]
   [StationData
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
    ]
  ]
\end{forest}
\end{document}

결과:

분할 디렉토리 트리

내 생각에는 이러한 수정 사항을 적용하는 것이 그리 어렵지 않을 것 같습니다.여러 분할을 허용하는 실험 코드에, 위의 내용이 Sašo의 단일 분할 전략을 스타일화하기 위해 작성한 코드를 수정하는 것과 같은 방식입니다.

예를 들어 (나중에편집하다) 다음은 다중 분할에 대한 실험적 개념 증명 코드의 수정된 버전입니다(분할은 특별한 의미가 없으므로 반드시 페이지 나누기를 포함하지는 않습니다).

% ateb: https://tex.stackexchange.com/a/339790/ addaswyd o gwestiwn DiB: https://tex.stackexchange.com/q/339669/
\documentclass[a4paper]{article}
\usepackage{geometry,array}
\usepackage[edges]{forest}
\usetikzlibrary{shadows}
\newcolumntype{C}[1]{@{}>{\centering\arraybackslash}m{#1}@{}}
\forestset{%
  dir tree/.style={%
    for tree={%
      folder,
      grow'=0,
      if level=0{align=center}
      {
        align={C{50mm}},
      },
      font=\sffamily\bfseries\footnotesize,
      inner xsep=7pt,
      edge={ultra thick, rounded corners=2pt},
      fill=white,
      rounded corners=2pt,
      drop shadow,
    },
  },
}
% addaswyd o gôd Sašo Živanović: https://tex.stackexchange.com/a/296771/
\def\hiddenparcommand{\par}
\newcommand\otherhiddenparcommand{\par\noindent}
\newcommand\hiddencommacommand{, }
\forestset{%
  declare keylist register={split here ids},
  declare keylist register={split here interjects},
  declare toks register=split here toks,
  split here ids={},
  split here interjects={},
  to widest/.style={
    tikz+={\path (\forestregister{tempdima}, \forestoption{y}) -- (\forestregister{tempdimb}, \forestoption{y});},
  },
  hide commas/.style={%
    split here toks+={\hiddencommacommand},
    split here toks+={#1},
  },
  split dir here/.style={%
    split dir tree pre,
    delay={%
      !next.split dir tree post,
    },
    before drawing tree={%
      split here ids+/.option=id,
      !next.split resume here ids+/.option=id,
    },
    split={#1}{,}{split here toks,hide commas},
    split here interjects/.register=split here toks,
    split dir tree
  },
  split dir tree pre/.style={%
    label={[text=gray, anchor=north, font=\scriptsize]below:{[cont.]}{}},
  },
  split dir tree post/.style={%
    label={[font=\scriptsize, anchor=south, text=gray]above:{[cont.]}{}},
  },
  split dir tree/.code={%
    \forestset{%
      draw tree stage/.style={
        for root'={
          tempdima/.min={x()+min_x()}{tree},
          tempdimb/.max={x()+max_x()}{tree},
          for tree={%
            to widest,
          },
        },
        tempcountb'=-1,
        do until={%
          strequal((split_here_ids),"")
        }{%
          tempkeylistb'={},
          tempkeylista'={},
          split register={split here ids}{,}{tempcounta,tempkeylistb+},
          split register={split here interjects}{,}{temptoksa,tempkeylista+},
          split here ids'/.register=tempkeylistb,
          split here interjects'/.register=tempkeylista,
        % Sašo Živanović: http://chat.stackexchange.com/transcript/message/28484520#28484520
          for nodewalk/.wrap 2 pgfmath args={%
            {%
              draw tree processing order/.style={%
                filter={tree}{(id()<=########1)&&(id()>########2)}%
              }%
            }{}%
          }{tempcounta}{tempcountb},
          for root'={draw tree},
          TeX/.wrap pgfmath arg={\otherhiddenparcommand ########1\hiddenparcommand}{temptoksa},
          tempcountb'/.register=tempcounta,
        },
        for nodewalk/.wrap pgfmath arg={%
          {%
            draw tree processing order/.style={%
              filter={tree}{id()>=####1}%
            }%
          }{}%
        }{(tempcountb)+1},
        for root'={draw tree},
      },
    }
  },
}
\begin{document}
\begin{forest}
  dir tree,
  [TypeData
    [ModelData
    ]
    [StationData
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig, split dir here=continued
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
   ]
   [StationData
      [StationConfig
      ]
      [StationConfig, split dir here=more to come
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig, split dir here=last part coming up
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
    ]
  ]
\end{forest}
\end{document}

다중 분할 개념 증명

난 당신을 생각~할 것 같다그런 다음 자동화할 수 있습니다. 나무가 항상 새 페이지에서 시작될 수 있으므로 y각 노드를 텍스트 블록의 높이와 비교할 수 있다면 더 쉬울 것입니다 . 그래서 그것이 옵션이라면, 나는 그것을 조사해 볼 것을 제안할 것 같습니다. 그렇지 않으면 텍스트 블록이 얼마나 남아 있는지 알아내는 방법을 검색할 수도 있습니다. 하지만 그것은 산림과 관련된 문제가 아닌 것 같습니다.

그러나 나는 시뮬레이션할 수는 있지만 손실된 가장자리를 복원하는 깔끔한 방법이 있을 것이라고 생각하지 않습니다. 그것들을 가장자리로 복원하려면 트리의 구조를 방해해야 할 것 같습니다. 이를 시뮬레이션하려면 x상위 값을 저장한 다음 Ti를 사용하여 좌표를 생성하면 됩니다 .케이Z를 선택하고 분할 후 거기에서 그립니다.

그래도 이 작업을 수행하려면 단계별로 해결하는 것이 좋습니다. 가장자리를 복원해야 하는 경우(확실하지 않음) 먼저 이를 수행한 다음 다중 분할이 필요한 경우 다중 분할 사례를 수정해 보십시오. 그런 다음에야 자동화하려고 생각하고 첫 번째 인스턴스에서 트리당 새 페이지 시나리오에 집중할 것입니다. 비록 결국에는 그것을 피하기를 원하더라도(둘 중 어느 쪽도 확실하지 않습니다). 내 생각에는 이 모든 것(해당되는 경우 새 페이지가 없는 부분은 제외)이 포레스트에서 가능해야 한다고 생각합니다. 물론 이는 어느 정도 지식을 바탕으로 한 추측에 지나지 않습니다. (Sašo는 확실히 말할 수 있고 어쨌든 더 나은 아이디어를 가지고 있을 것입니다.)

EIDT

이렇게 하면 트리가 자동으로 분할되고 누락된 가장자리를 복원하려고 시도합니다. 복원된 모서리가 있는 서로 다른 노드에 대해 서로 다른 옵션을 사용하는 것을 배제 edge하고 지정된 edge label.

버그 수정 2023-12-04이제 마음에 드는 대로 두 개의 나무를 그릴 수 있으며, 매우 많은 경우에 오류가 발생하지 않습니다.

% ateb: https://tex.stackexchange.com/a/326884/ i gwestiwn Amir: https://tex.stackexchange.com/q/326875/
% agenir y fersiwn hwn Forest 2017/02/02 v2.1.4
\documentclass[a4paper]{article}
\usepackage{geometry,array}
\usepackage[edges]{forest}
\usetikzlibrary{shadows}
\newcolumntype{C}[1]{@{}>{\centering\arraybackslash}m{#1}@{}}
\forestset{%
  dir tree/.style={%
    for tree={%
      folder,
      grow'=0,
      if level=0{align=center}
      {
        align={C{50mm}},
      },
      font=\sffamily\bfseries\footnotesize,
      inner xsep=7pt,
      edge={ultra thick, rounded corners=2pt},
      fill=white,
      rounded corners=2pt,
      drop shadow,
    },
  },
}
% addaswyd o gôd Sašo Živanović: https://tex.stackexchange.com/a/296771/
\def\hiddenparcommand{\par}
\newcommand\otherhiddenparcommand{\par\noindent}
\newcommand\hiddencommacommand{, }
\forestset{%
  declare keylist register={split here ids},
  split here ids={},
  declare keylist register={split here interjects}, the tree parts
  split here interjects={},
  declare keylist={split here auto siblings}{},
  declare toks register=split here toks,
  declare dimen register=tmpdima,
  tmpdima'=0pt,
  declare dimen register=tmpdimb,
  tmpdimb'=0pt,
  declare dimen register=tmpdimc,
  tmpdimc'=0pt,
  to widest/.style={
    tikz+={\path (\forestregister{tempdima}, \forestoption{y}) -- (\forestregister{tempdimb}, \forestoption{y});},
  },
  hide commas/.style={%
    split here toks+={\hiddencommacommand},
    split here toks+={#1},
  },
  split dir tree pre/.style={%
    label={[text=gray, anchor=north, font=\scriptsize]below:{[cont.]}{}},
  },
  split dir tree post/.style={%
    label={[font=\scriptsize, anchor=south, text=gray]above:{[cont.]}{}},
  },
  split dir tree auto post/.style={
    split dir tree post,
    tempkeylistc'={},
    tmpdimb/.option=y,
    for nodewalk={
      while={
        > ORw2+d _+d < On=! & {y}{tmpdimb}{##2-##1} {\textheight-#1} {n'}{1}%
      }{
        next,
        tempkeylistc/.option=name
      }%
    }{},
    split here auto siblings/.register=tempkeylistc,
    tikz+/.process={
      OOw2{edge}{id}
      {
        \path [##1] (!u.parent anchor |- .north) ++(\forestregister{folder indent},1ex) coordinate (before ##2) |- (.child anchor);
        \edef\tempa{\foresteoption{split here auto siblings}}
        \foreach \i in \tempa \path [##1] (before ##2) |- ({forest cs:\i.child anchor});
      }
    },
  },
  split dir tree/.code={
    \forestset{
      draw tree stage/.style={
        for root'={
          tempdima/.min={
            >OOw2+d{x}{min x}{####1+####2}%
          }{tree},
          tempdimb/.max={
            >OOw2+d{x}{max x}{####1+####2}%
          }{tree},
          for tree={
            to widest,
          },
        },
        tempcountb'=-1,
        until={
          strequal((split_here_ids),"")
        }{
          tempkeylistb'={},
          tempkeylista'={},
          split register={split here ids}{,}{tempcounta,tempkeylistb+},
          split register={split here interjects}{,}{temptoksa,tempkeylista+},
          split here ids'/.register=tempkeylistb,
          split here interjects'/.register=tempkeylista,
          for nodewalk={
            draw tree processing order/.style={
              filter={tree}{> ORw+n< OR> & {id}{tempcounta}{########1+1}{id}{tempcountb}}%
            }
          }{},
          for root'={draw tree},
          TeX/.process={Rw{temptoksa}{\otherhiddenparcommand ####1\hiddenparcommand}},
          tempcountb'/.register=tempcounta,
        },
        for nodewalk={
          draw tree processing order/.style={
            filter={tree}{>OR>{id}{tempcountb}}
          }
        }{},
        for root'={draw tree},
      },
    }%
  },
  split dir here auto/.style n args=2{
    split dir tree pre,
    !next node.split dir tree auto post=#2,
    split here ids+/.option=id,
    split={#1}{,}{split here toks,hide commas},
    split here interjects/.register=split here toks,
  },
  split dir tree auto/.style={
    split dir tree,
    before drawing tree={
      tempdima/.max={y}{tree},
      tempdimc/.register=tempdima,
      tempdimd/.min={y}{tree},
      tempdima-/.register=tempdimd,
      tempdimb'=\textheight,
      tmpdima'=10ex,
      tmpdimc'=\pagetotal,
      while={
        >RR>{tempdima}{tempdimb}
      }{
        for nodewalk={
          root',
          until={
            > ROw2+d RRw2+d > {tempdimc}{y}{##1-##2} {tmpdima}{tmpdimc}{\textheight-##2-##1}
          }{next node},
          if nodewalk valid={previous node}{%
            previous node,
            split dir here auto/.process={R_w2{tmpdima}{continued}{{##2}{##1}}},
            next node,
          }{},
          tempdima/.option=y,
          tempdimc/.register=tempdima,
          tempdima-/.register=tempdimd,
          tmpdima'=15ex,
          tmpdimc'=0pt
        }{},
      },
    },
  },
}
\begin{document}
\begin{forest}
  dir tree,
  split dir tree auto,
  [TypeData
    [ModelData
    ]
    [StationData
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
   ]
   [StationData
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
    ]
   [StationData
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
      [StationConfig
      ]
    ]
  ]
\end{forest}
\end{document}

자동 분할 디렉터리 트리

관련 정보