
이는 디렉토리 목록과 약간 다릅니다.예제그리고TikZ의 트리 명령을 나열하는 디렉토리 그리기그 점에서 파일 간의 링크를 보여주는 최종 구조에 주석을 달고 싶습니다. 트리의 노드를 다시 참조하는 방법이 필요하며 다음이 내 옵션인 것 같습니다.
- 환경 을 사용하여 노드에 주석을 추가하는 데
tabbing
활용하는 트리 구조를 레이아웃합니다 .tikzmark
- 환경 내에서
graphs
또는 라이브러리를 사용하십시오 .trees
tikzpicture
- 이전 설정(1 또는 2)과 일부 조합하여
dirtree
및 패키지를 사용합니다 .forest
방법1원하는 출력을 얻었지만 및를 사용하여 트리가 한 페이지 이상으로 확장되면 주석이 모두 혼란스러워졌습니다 multicols
.minipage
이를 개선하지 않았습니다 현재 방법을 고민 중입니다2그리고 그것이 실패하면 시도할 것이다삼.
tree layout
내 희망 은 TikZ 그래프 드로잉을 사용하여 그린 다음 트리의 하위 레이어가
trees
TikZ 라이브러리 라이브러리를 사용하는 두 번째 레이아웃에서와 같이 상위 항목 사이에 중첩될 수 있습니다.루프 스페이스의 dirtree
열쇠,
, 그리고 그들 주위의 팬에 대칭적으로 퍼지지 않습니다.
내 가정은 아마도 오류였을 것입니다. 그래프 그리기 라이브러리를 사용하면 하위 그래프를 원하는 위치로 조작할 수 있을 것이라는 것이었습니다. 그러나 graphs
및 의 인터페이스는 graphdrawing
다른 TikZ 라이브러리와 달리 다소 분리되어 있는 것 같습니다. 제가 겪은 사례는 다음과 같습니다
- 키
tries
는 일부 레이아웃을 올바르게 가져오지만 하위 그래프를 사용하는 경우 중단됩니다. - 설정은
grow down sep
올바른 구조를 제공하지만 추가로 조정하는 방법을 알 수 없으며 하위 그래프 레이아웃에서는 무시됩니다. - 을 사용하면
tree layout
하위 그래프가 허용되지만 배치를 크게 제어할 수는 없습니다.
아래 코드는 첫 번째 이미지를 생성합니다. 그 안에는 첫 번째 하위 레이어에 대한 너지 값을 지정합니다. 이 값은 예상대로 다음 하위 레이어를 오프셋하지만 해당 노드인 오른쪽 상단의 부동 사각형은 오프셋하지 않습니다. 가장 낮은 레이어의 잘못된 화살표에서 볼 수 있듯이 팬텀 값을 제공하려는 시도도 실패합니다.
\documentclass[tikz]{standalone}%
\usepackage{tikz}%
%
\usepackage{luatex85}%
\usepackage{menukeys}%
\usetikzlibrary{graphs}%
\usetikzlibrary{graphdrawing}%
\usegdlibrary{trees}%
\usegdlibrary{layered}%
\usegdlibrary{circular}%
%
\makeatletter
\newcount\dirtree@lvl
\newcount\dirtree@plvl
\newcount\dirtree@clvl
\def\dirtree@growth{%
\ifnum\tikznumberofcurrentchild=1\relax
\global\advance\dirtree@plvl by 1
\expandafter\xdef\csname dirtree@p@\the\dirtree@plvl\endcsname{\the\dirtree@lvl}
\fi
\global\advance\dirtree@lvl by 1\relax
\dirtree@clvl=\dirtree@lvl
\advance\dirtree@clvl by -\csname dirtree@p@\the\dirtree@plvl\endcsname
\pgf@xa=\tikzleveldistance
\pgf@ya=-\tikzsiblingdistance
\pgf@ya=\dirtree@clvl\pgf@ya
\pgftransformshift{\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}%
\ifnum\tikznumberofcurrentchild=\tikznumberofchildren
\global\advance\dirtree@plvl by -1
\fi
}
%
\tikzset{
dirtree/.style={
growth function=\dirtree@growth,
level distance =1.2em,
sibling distance =1.2em,
growth parent anchor=west,
% every node/.style={anchor=west},
% every parent node/.style={anchor=south west},
every child node/.style={anchor=west},
edge from parent path={(\tikzparentnode.south west) ++(0.5*\tikzleveldistance,0) |- (\tikzchildnode\tikzchildanchor)}
}
}
\makeatother
%
\newmenumacro{\nixpath}[/]{hyphenatepathswithfolder}
\newmenumacro{\nixfile}[/]{hyphenatepaths}
\newmenumacro{\winpath}[bslash]{hyphenatepathswithfolder}
\newmenumacro{\winfile}[bslash]{hyphenatepaths}
%
\begin{document}%
\normalsize%
\begin{tikzpicture}%
\graph [tree layout, grow'=right]
{"00"/"\winpath{E:\CheatSheets\Algorithms}" ->
{"01"/"\winpath{Genetic}";
"02"/"\winpath{Linear_Programming}" ->
{"03"/"\winpath{build}";
"04"/"\winfile{Affine_Scaling.pseudo.tex}"};
"05"/"\winpath{build}";
"06"/"\winfile{Algorithms.tex}";
"07"/"\winfile{Genetic.tex}";
"08"/"\winfile{input.tex}";
"09"/"\winfile{input2.tex}";
"10"/"\winfile{input3.tex}"}};%
\end{tikzpicture}%
\begin{tikzpicture}%
\node (00) {\winpath{E:\CheatSheets\Algorithms}}[dirtree]
child {node (01) {\winpath{Genetic}}}
child {node (02) {\winpath{Linear_Programming}}
child {node (03) {\winpath{build}}}
child {node (04) {\winfile{Affine_Scaling.pseudo.tex}}}}
child {node (05) {\winpath{build}}}
child {node (06) {\winfile{Algorithms.tex}}}
child {node (07) {\winfile{Genetic.tex}}}
child {node (08) {\winfile{input.tex}}}
child {node (09) {\winfile{input2.tex}}}
child {node (10) {\winfile{input3.tex}}} ;%
\graph [use existing nodes]
{06 ->[in=0, out=0, looseness=3] {04 }};%
\end{tikzpicture}%
\end{document}
또한 라인 사양을 사용하고 싶지만 |-
키 내에서 설정할 수 없는 것 같습니다 /tikz/graphs/edges
. 내 이해는 가장자리가 / / 명령과 to[...]
비교하여 명령 으로 그려지는 것입니다 . 효과적으로 드로잉 메커니즘을 에서 로 "다운그레이드"하고 싶습니다 .--
|-
-|
to[...]
|-
Tikz 3.0 트리 그래프를 사용한 포크 다운 에지 스타일비슷한 질문을 합니다. pgfmanual 버전 3.0.1a의 섹션 70 라이브러리 topath
에서는 직선을 사용할 수 있지만 to[line]
팔꿈치에 대해서는 언급하지 않습니다.
현재 저는 두 가지를 모두 시도하고 있습니다 trees
. graph
전자는 레이아웃을, 후자는 주석을 작성합니다.
제 생각에 가장 중요한 질문은 "하위 그래프를 살짝 누르는 것 이상으로 하위 그래프의 배치를 제어하는 방법"입니다. 이것이 실제로 가능합니까? 매뉴얼을 읽으면 그렇게 믿게 되지만 그렇게 하는 방법에 대한 좋은 예를 찾을 수 없었고 layered layout
, tree layout
및 graphdrawing
섹션을 아주 철저하게 살펴보았습니다.