对于一本书,我希望有一个可视化的目录,以径向树状图或思维导图的形式直观地显示部分、章节(也许是部分)。
理想情况下,如果能有某种工具来解析我的文件并创建可用于制作图表的层次结构模式,那就太好了book.toc
。我在谷歌上搜索过“解析 latex 目录”,但一无所获。对这部分有什么想法吗?
到目前为止,我使用 tikz 和思维导图手动创建了这个初步尝试,仅显示部分和章节。并且我想知道如何进一步调整它,因为我对 tikz 的经验有限,而对思维导图则一无所知。
\documentclass[12pt, oneside]{standalone}
\usepackage{tikz}
\usetikzlibrary{mindmap}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[grow cyclic, text width=2cm, align=flush center, every node/.style=concept, concept color=orange!60,
level 1/.style={level distance=7cm,sibling angle=120},
level 2/.style={level distance=4cm,sibling angle=45}]
\node{\textbf{ Discrete Data Analysis with R}} [clockwise from=60] % root node
child [concept color=teal!60] { node {I. Geting Started}
child [concept color=teal!30] { node {1 Introduction}}
child [concept color=teal!30] { node {2 Working with Categorical Data}}
child [concept color=teal!30] { node {3 Discrete Distributions}}
}
child [concept color=yellow!80] { node [concept] {II. Exploratory Methods} [clockwise from=60]
child [concept color=yellow!40] { node {4 Two-way Contingency Tables}}
child [concept color=yellow!40] { node {5 Mosaic Displays}}
child [concept color=yellow!40] { node {6 Correspondence Analysis}}
}
child [concept color=green!50] { node {III. Model-building Methods} [counterclockwise from=90]
child [concept color=green!30] { node {7 Logistic Regression Models}}
child [concept color=green!30] { node {8 Polytomous Responses}}
child [concept color=green!30] { node {9 Loglinear and Logit Models}}
child [concept color=green!30] { node {10 Extending Loglinear Models}}
child [concept color=green!30] { node {11 Generalized Linear Models}}
};
\end{tikzpicture}
\end{document}
结果如下。我想将其修改为
- 把中心节点弄大一点,这样我就可以用 \Large 打印书名
- 旋转第一部分和第二部分的 3 个章节节点,使得中间的节点与中心节点的连接线对齐。
这可能会使图表变得混乱,但有没有办法用节点之间的线来表示章节之间的联系?例如,我如何在节点之间创建链接(线或箭头)- 第 5 章和第 9 章
- 第 3 章和第 11 章
答案1
这个问题的 ToC 部分已经有了很好的答案。这里,我只关注创建额外的连接和对齐节点。
我们可以用
[clockwise from=x]
从角度 开始子节点x
。对于青色组,父节点位于60
。子节点之间相隔 角度,45
共有 3 个子节点。因此,为了确保中间子节点与 对齐60
,我们需要从 开始45+60=105
。对于黄色组,角度位于-60
。同样,有三个子节点之间相隔45
。因此,为了确保对齐,我们需要从 开始45-60=-15
。
如果我们为第 3、5、9 和 11 章的节点命名,那么我们就可以使用它们来绘制它们之间的连接。为了使这些连接与图像的其余部分保持一致,我们希望使用相同类型的连接条。例如:
\path (ch3) to[circle connection bar switch color=from (col1!30) to (col3!30)] (ch11);
将从第 3 章到第 11 章建立适当的联系。
但是,这会造成混乱,切断根节点,这可能不是我们想要的。为了避免这种情况,我们可以使用库backgrounds
来绘制连接在后面思维导图的其余部分绘制完成后,绘制图表的其余部分。
完整代码:
\documentclass[12pt,tikz,border=5pt]{standalone}
\usetikzlibrary{mindmap,backgrounds}
\colorlet{col1}{teal}
\colorlet{col2}{yellow}
\colorlet{col3}{green}
\begin{document}
\begin{tikzpicture}[grow cyclic, text width=2cm, align=flush center, every node/.style=concept, concept color=orange!60,
level 1/.style={level distance=7cm,sibling angle=120},
level 2/.style={level distance=4cm,sibling angle=45}]
\node{\textbf{ Discrete Data Analysis with R}} [clockwise from=60] % root node
child [concept color=col1!60] { node {I. Geting Started}
[clockwise from=105]
child [concept color=col1!30] { node {1 Introduction}}
child [concept color=col1!30] { node {2 Working with Categorical Data}}
child [concept color=col1!30] { node (ch3) {3 Discrete Distributions}}
}
child [concept color=col2!80] { node [concept] {II. Exploratory Methods} [clockwise from=60]
[clockwise from=-15]
child [concept color=col2!40] { node {4 Two-way Contingency Tables}}
child [concept color=col2!40] { node (ch5) {5 Mosaic Displays}}
child [concept color=col2!40] { node {6 Correspondence Analysis}}
}
child [concept color=col3!50] { node {III. Model-building Methods} [counterclockwise from=90]
child [concept color=col3!30] { node {7 Logistic Regression Models}}
child [concept color=col3!30] { node {8 Polytomous Responses}}
child [concept color=col3!30] { node (ch9) {9 Loglinear and Logit Models}}
child [concept color=col3!30] { node {10 Extending Loglinear Models}}
child [concept color=col3!30] { node (ch11) {11 Generalized Linear Models}}
};
\begin{scope}[on background layer]
\path (ch5) to[circle connection bar switch color=from (col2!40) to (col3!30)] (ch9);
\path (ch3) to[circle connection bar switch color=from (col1!30) to (col3!30)] (ch11);
\end{scope}
\end{tikzpicture}
\end{document}
答案2
这是一种可能性,利用强大的etoc
包和 TikZ 树(这是包文档中介绍的“分子”样式的变体)。在此示例中,提供了章节、节和小节,但可以轻松调整以包括部分(我刚刚在问题中读到这一点);只显示数字,但也可以修改为包括标题(这似乎不是一个好主意,因为目录太大了)。目录完全超链接:
\documentclass[dvipsnames]{book}
\usepackage{tikz}
\usepackage{etoc}
\usetikzlibrary{trees}
\usepackage[colorlinks=true,linkcolor=white]{hyperref}
\newtoks\treetok
\newtoks\tmptok
\newcommand*\appendtotok[2]{% #1=toks variable, #2=macro, expands once #2
#1\expandafter\expandafter\expandafter
{\expandafter\the\expandafter #1#2}}
\newtoks\parttok
\newtoks\chaptertok
\newtoks\sectiontok
\newtoks\subsectiontok
\newcommand*\treenode {}
\newcommand*{\appendchildtree}[2]{% token list t1 becomes: t1 child {t2}
\edef\tmp{\the#1 child {\the#2}}%
#1\expandafter{\tmp}%
}
\newcommand*{\preparetreenode}{%
\tmptok\expandafter{\etocthelinkednumber}%
\edef\treenode{node {\the\tmptok}}%
}
\etocsetstyle{chapter}
{\etocskipfirstprefix}
{\appendchildtree\treetok\chaptertok}
{\preparetreenode
\chaptertok\expandafter{\treenode}}
{\appendchildtree\treetok\chaptertok}
\etocsetstyle{section}
{\etocskipfirstprefix}
{\appendchildtree\chaptertok\sectiontok}
{\preparetreenode
\sectiontok\expandafter{\treenode}}
{\appendchildtree\chaptertok\sectiontok}
\etocsetstyle{subsection}
{\etocskipfirstprefix}
{\appendchildtree\sectiontok\subsectiontok}
{\preparetreenode
\subsectiontok\expandafter{\treenode}}
{\appendchildtree\sectiontok\subsectiontok}
\etocsettocstyle
{\treetok{\node[text width=2cm,align=center] {\hyperref[part:overview]{Discrete data analysis with R}}}}
{\global\appendtotok\treetok{ ;}}
\begin{document}
\begin{figure}
\centering
\etocsetnexttocdepth{subsection}
\tableofcontents
\label{toc:molecule}
\begin{tikzpicture}[
grow cyclic,
level 1/.style={
text width=1.5cm,
align=center,
level distance=3cm,
sibling angle=90
},
level 2/.style={
text width=1cm,
align=center,
level distance=2cm,
sibling angle=72
},
level 3/.style={
text width=0.7cm,
align=center,
level distance=2cm,
sibling angle=50
},
every node/.style={
ball color=teal!90,
circle,text=white
},
edge from parent path={
[very thick,color=teal] (\tikzparentnode) --(\tikzchildnode)}
]
\the\treetok
\end{tikzpicture}
\end{figure}
\chapter{Test chapter one}
\section{Section one one}
\subsection{Subsection one one one}
\subsection{Subsection one one two}
\section{Section one two}
\subsection{Subsection one two one}
\subsection{Subsection one two two}
\chapter{Test chapter two}
\section{Section two one}
\subsection{Subsection two one one}
\subsection{Subsection two one two}
\section{Section two two}
\subsection{Subsection two two one}
\subsection{Subsection two two two}
\section{Section two three}
\subsection{Subsection two three one}
\subsection{Subsection two three two}
\chapter{Test chapter three}
\section{Section three one}
\subsection{Subsection three one one}
\subsection{Subsection three one two}
\chapter{Test chapter four}
\section{Section four one}
\subsection{Subsection four one one}
\subsection{Subsection four one two}
\subsection{Subsection four one three}
\section{Section four two}
\subsection{Subsection four two one}
\subsection{Subsection four two two}
\subsection{Subsection four two three}
\end{document}
这是试图准确模仿原始设计。
我们只需要零件和部分。有一些注释试图解释该过程,它是上述通用过程的专业化和定制。
\documentclass[12pt,oneside, tikz, ignorerest=false]{standalone}
\usepackage{tikz}
\usetikzlibrary{mindmap}
\pagestyle{empty}
\usepackage{etoc}
% \usepackage{hyperref}% if links are wanted
\begin{document}
\newtoks\treetok
\newtoks\parttok
\newtoks\sectiontok
\newcommand*\treenode {} % just to check we don't overwrite something
\newcommand*\tmprotate {} % just to check we don't overwrite something
\newcommand*\tmpoption {} % just to check we don't overwrite something
\newcommand*\tmpstuff {} % just to check we don't overwrite something
\newcommand*\appendtotok[2]{% #1=toks variable, #2=macro, expands once #2
#1\expandafter\expandafter\expandafter{\expandafter\the\expandafter #1#2}}
\newcommand*{\appendchildtree}[3]{%
% this is to construct "t1 child [concept color= #3]{t2}" from #1=t1 and #2=t2
% t1 and t2 are two toks variable (not macros)
% #3 = for example teal!60
\edef\tmpstuff {\the#1 child [concept color = #3]{\the#2}}%
#1\expandafter {\tmpstuff }%
}
\newcounter{partco}
\etocsetstyle{part}
{}
{}
{\toks0 \expandafter{\etocthelinkednumber}%
\toks2 \expandafter{\etocthelinkedname }%
\stepcounter{partco}%
\ifcase\value{partco}%
\or \def\tmpoption {}%
\def\tmprotate {}% first
\or \def\tmpoption {[concept]}%
\def\tmprotate {[clockwise from = 60]}% second
\else\def\tmpoption {}%
\def\tmprotate {[counterclockwise from = 90]}% third and higher
\fi
% define the part node
\edef\treenode{node \tmpoption {\the\toks0. \the\toks2} \tmprotate }%
% this is a starting point which will be filled it by the section children
\parttok\expandafter{\treenode}}
{}
\etocsetstyle{section}
{}
{}
{\toks0 \expandafter{\etocthelinkednumber}%
\toks2 \expandafter{\etocthelinkedname }%
% define the section node
\edef\treenode {node {\the\toks0 \space\the\toks2}}
\sectiontok\expandafter{\treenode}%
% update current part tree with this section node, adding the correct color
\ifcase\value{partco}%
\or \appendchildtree\parttok\sectiontok {teal!30}% first
\or \appendchildtree\parttok\sectiontok {yellow!40}% second
\else\appendchildtree\parttok\sectiontok {green!30}% third etc...
\fi }
% This updates the global tree with the data from the
% part and all its children sections
{\ifcase\value{partco}%
\or \appendchildtree\treetok\parttok {teal!60}% first
\or \appendchildtree\treetok\parttok {yellow!80}% second
\else\appendchildtree\treetok\parttok {green!50}% third and next ...
\fi
}
\etocsettocstyle
{\treetok{\node{\textbf{Discrete Data Analysis with R}} [clockwise from=60]}}
{\global\appendtotok\treetok{ ;}}
% The \global above is mandatory because etoc always typesets TOC inside a group
\tableofcontents
% \showthe\treetok % debugging
\begin{tikzpicture}[grow cyclic, text width=2cm,
align=flush center,
every node/.style=concept,
concept color=orange!60,
level 1/.style={level distance=7cm,sibling angle=120},
level 2/.style={level distance=4cm,sibling angle=45}]
\the\treetok
\end{tikzpicture}
\part {Getting Started}
\section {Introduction}
\section {Working with Categorical Data}
\section {Discrete Distributions}
\part {Exploratory Methods}
\section {Two-way Contingency Tables}
\section {Mosaic Displays}
\section {Correspondence Analysis}
\part {Model-building Methods}
\section {Logistic Regression Models}
\section {Polytomous Responses}
\section {Loglinear and Logit Models}
\section {Extending Loglinear Models}
\section {Generalized Linear Models}
\end{document}
对上述代码进行修改,允许在节点之间画线来表示互连;每个部分节点都有命名part-#
,每个部分节点也都这样命名section-#
,节点名称可用于绘制任意路径:
\documentclass[12pt,oneside, tikz, ignorerest=false]{standalone}
\usepackage{tikz}
\usetikzlibrary{mindmap}
\pagestyle{empty}
\usepackage{etoc}
% \usepackage{hyperref}% if links are wanted
\begin{document}
\newtoks\treetok
\newtoks\parttok
\newtoks\sectiontok
\newcommand*\treenode {} % just to check we don't overwrite something
\newcommand*\tmprotate {} % just to check we don't overwrite something
\newcommand*\tmpoption {} % just to check we don't overwrite something
\newcommand*\tmpstuff {} % just to check we don't overwrite something
\newcommand*\appendtotok[2]{% #1=toks variable, #2=macro, expands once #2
#1\expandafter\expandafter\expandafter{\expandafter\the\expandafter #1#2}}
\newcommand*{\appendchildtree}[3]{%
% this is to construct "t1 child [concept color= #3]{t2}" from #1=t1 and #2=t2
% t1 and t2 are two toks variable (not macros)
% #3 = for example teal!60
\edef\tmpstuff {\the#1 child [concept color = #3]{\the#2}}%
#1\expandafter {\tmpstuff }%
}
\newcounter{partco}
% auxiliary counters to name part and section nodes
\newcounter{tmppart}
\newcounter{tmpsection}
\etocsetstyle{part}
{}
{\stepcounter{tmppart}}
{\toks0 \expandafter{\etocthelinkednumber}%
\toks2 \expandafter{\etocthelinkedname }%
\stepcounter{partco}%
\ifcase\value{partco}%
\or \def\tmpoption {[name=part-\thetmppart]}%
\def\tmprotate {}% first
\or \def\tmpoption {[concept,name=part-\thetmppart]}%
\def\tmprotate {[clockwise from = 60]}% second
\else\def\tmpoption {[name=part-\thetmppart]}%
\def\tmprotate {[counterclockwise from = 90]}% third and higher
\fi
% define the part node
\edef\treenode{node \tmpoption {\the\toks0. \the\toks2} \tmprotate }%
% this is a starting point which will be filled it by the section children
\parttok\expandafter{\treenode}}
{}
\etocsetstyle{section}
{}
{\stepcounter{tmpsection}}
{\toks0 \expandafter{\etocthelinkednumber}%
\toks2 \expandafter{\etocthelinkedname }%
% define the section node
\edef\treenode {node [name=section-\thetmpsection] {\the\toks0 \space\the\toks2}}
\sectiontok\expandafter{\treenode}%
% update current part tree with this section node, adding the correct color
\ifcase\value{partco}%
\or \appendchildtree\parttok\sectiontok {teal!30}% first
\or \appendchildtree\parttok\sectiontok {yellow!40}% second
\else\appendchildtree\parttok\sectiontok {green!30}% third etc...
\fi }
% This updates the global tree with the data from the
% part and all its children sections
{\ifcase\value{partco}%
\or \appendchildtree\treetok\parttok {teal!60}% first
\or \appendchildtree\treetok\parttok {yellow!80}% second
\else\appendchildtree\treetok\parttok {green!50}% third and next ...
\fi
}
\etocsettocstyle
{\treetok{\node{\textbf{Discrete Data Analysis with R}} [clockwise from=60]}}
{\global\appendtotok\treetok{ ;}}
% The \global above is mandatory because etoc always typesets TOC inside a group
\tableofcontents
% \showthe\treetok % debugging
\begin{tikzpicture}[grow cyclic, text width=2cm,
align=flush center,
every node/.style=concept,
concept color=orange!60,
level 1/.style={level distance=7cm,sibling angle=120},
level 2/.style={level distance=4cm,sibling angle=45}]
\the\treetok
\draw[teal,line width=2pt,dashed]
(section-1) to[out=210,in=35] (section-7);
\draw[green!50,line width=2pt,dashed]
(section-11) to[out=-40,in=210] (section-6);
\end{tikzpicture}
\part {Getting Started}
\section {Introduction}
\section {Working with Categorical Data}
\section {Discrete Distributions}
\part {Exploratory Methods}
\section {Two-way Contingency Tables}
\section {Mosaic Displays}
\section {Correspondence Analysis}
\part {Model-building Methods}
\section {Logistic Regression Models}
\section {Polytomous Responses}
\section {Loglinear and Logit Models}
\section {Extending Loglinear Models}
\section {Generalized Linear Models}
\end{document}
答案3
我不知道您的问题是否仍然与目录的解析有关,无论如何,这是朝这个方向迈出的一种进步。
在实践中,人们发现将目录显示为mindmap
目录通常需要一些手动调整。因此,我提供了自动构建树的方法TikZ
,其所有node
和都child
在括号内正确代理。
然后用户将根据需要手动定制节点,但至少整体结构的提取是自动的。
这个想法是用来etoc
做这件事并将内容写入文件。(编译两次原始 tex 源)。示例:
编辑制作 \OutputTOCasTreeData
添加换行符和缩进,以便更好地辨认经过两次编译后发现的数据 file.tocastree
\documentclass{book}
\usepackage{etoc}
\newcommand*\appendtotok[2]{%
% #1=toks variable, #2=macro, redefines #1 to be
% <contents of #1><contents of #2>
#1\expandafter\expandafter\expandafter {\expandafter\the\expandafter #1#2}}
\newtoks\treetok
\newtoks\parttok
\newtoks\chaptertok
\newtoks\sectiontok
\newtoks\subsectiontok
\newcommand*\treenode {}
\newcommand*\tmp {}% or any other name, just making sure nothing is
% overwritten
\newcommand*\leftindentation {}
\newcommand*\indentmore
{\expandafter\def\expandafter\leftindentation\expandafter
{\leftindentation\space\space\space\space\space\space\space\space}}
\newcommand*\indentless
{\expandafter\def\expandafter\leftindentation\expandafter
{\romannumeral0\romannumeral0\romannumeral0\romannumeral0%
\romannumeral0\romannumeral0\romannumeral0\romannumeral0%
\leftindentation}}
% or with a \gobblefour or \gobbleeight but I hesitated with an \edef for the
% \indentmore, then the \romannumeral is better
\newcommand*{\appendchildtree}[2]{%
% token list t1=#1 becomes: t1 child {t2} with t2=#2
% #1 and #2 are toks variables not macros
\edef\tmp{\the#1^^J%
\leftindentation child { \the#2^^J%
\leftindentation }}%
#1\expandafter{\tmp}%
}
% we use here e-TeX \unexpanded for simplicity sake.
\newcommand*{\preparetreenode}{%
\edef\treenode{node {\unexpanded\expandafter{\etocthelinkednumber}.
\unexpanded\expandafter{\etocthelinkedname}}}}
\newwrite\TOCasTree
\newcommand*{\OutputTOCasTreeData}{%
\begingroup
% a priori, no need to reset \parttok, \chaptertok etc...
% even in case of multiple uses, as the TOC of etoc always
% works in a group, and we even created another one to hide
% our redefinitions of line styles done here
%
\etocsetnexttocdepth{subsection}% this is surely overkill, in practice
% fewer levels can be organized as a tree display.
% These things may look strange, but they are general enough to allow all
% possibilities: sections without subsections, chapters without sections etc...
\etocsetstyle{part}
{\etocskipfirstprefix}
{\appendchildtree\treetok\parttok}
{\preparetreenode
\parttok\expandafter{\treenode}}
{\appendchildtree\treetok\parttok}
%
\etocsetstyle{chapter}
{\indentmore\etocskipfirstprefix}
{\appendchildtree\parttok\chaptertok}%
{\preparetreenode
\chaptertok\expandafter{\treenode}}
{\appendchildtree\parttok\chaptertok
\indentless}%
%
\etocsetstyle{section}
{\indentmore\etocskipfirstprefix}
{\appendchildtree\chaptertok\sectiontok}
{\preparetreenode
\sectiontok\expandafter{\treenode}}
{\appendchildtree\chaptertok\sectiontok\indentless}
%
\etocsetstyle{subsection}
{\indentmore\etocskipfirstprefix}
{\appendchildtree\sectiontok\subsectiontok}
{\preparetreenode
\subsectiontok\expandafter{\treenode}}
{\appendchildtree\sectiontok\subsectiontok\indentless}
%
\etocsettocstyle
{\treetok{\node {MY TOC AS TREE}}}
{\global\appendtotok\treetok{ ;}}
\etocinline
\tableofcontents %
% one can also do \localtableofcontents but one must change the
% top level style to do \appendchildtree\treetok: here it is done
% by style for Parts. If we do a local table of contents of a Part,
% we must let Chapters do what Parts do above.
%
% (this can surely be automatized but I have not looked into it)
%
% perhaps one could have \OutputTOCasTreeData with an argument,
% so we can use the commands for various \localtableofcontents
% each one being written to a file.
\immediate\openout\TOCasTree=\jobname.toctree
\immediate\write\TOCasTree{\the\treetok}
\endgroup
}
\begin{document}
% standard table of contents:
\tableofcontents
% write TOC to a file in TikZ Tree format.
% Then one can customize it by hand.
% Using etoc depth tags (and naturally tocdepth) one can also
% trim before hand the data we are interested or not interested in.
\OutputTOCasTreeData
% compile twice at least to get the .toctree file.
\part{ONE}
\chapter{Test chapter one}
\section{Section one one}
\subsection{Subsection one one one}
\subsection{Subsection one one two}
\section{Section one two}
\subsection{Subsection one two one}
\subsection{Subsection one two two}
\chapter{Test chapter two}
\section{Section two one}
\subsection{Subsection two one one}
\subsection{Subsection two one two}
\section{Section two two}
\subsection{Subsection two two one}
\subsection{Subsection two two two}
\section{Section two three}
\subsection{Subsection two three one}
\subsection{Subsection two three two}
\part{TWO}
\chapter{Test chapter three}
\section{Section three one}
\subsection{Subsection three one one}
\subsection{Subsection three one two}
\chapter{Test chapter four}
\section{Section four one}
\subsection{Subsection four one one}
\subsection{Subsection four one two}
\subsection{Subsection four one three}
\section{Section four two}
\subsection{Subsection four two one}
\subsection{Subsection four two two}
\subsection{Subsection four two three}
\end{document}
以下是生成的带扩展名的文件的内容toctree
:
对于这个问题,数据已被手动格式化,添加了换行符和空格
这是原始输出。
\node {MY TOC AS TREE}
child { node {I. ONE}
child { node {1. Test chapter one}
child { node {1.1. Section one one}
child { node {1.1.1. Subsection one one one}
}
child { node {1.1.2. Subsection one one two}
}
}
child { node {1.2. Section one two}
child { node {1.2.1. Subsection one two one}
}
child { node {1.2.2. Subsection one two two}
}
}
}
child { node {2. Test chapter two}
child { node {2.1. Section two one}
child { node {2.1.1. Subsection two one one}
}
child { node {2.1.2. Subsection two one two}
}
}
child { node {2.2. Section two two}
child { node {2.2.1. Subsection two two one}
}
child { node {2.2.2. Subsection two two two}
}
}
child { node {2.3. Section two three}
child { node {2.3.1. Subsection two three one}
}
child { node {2.3.2. Subsection two three two}
}
}
}
}
child { node {II. TWO}
child { node {3. Test chapter three}
child { node {3.1. Section three one}
child { node {3.1.1. Subsection three one one}
}
child { node {3.1.2. Subsection three one two}
}
}
}
child { node {4. Test chapter four}
child { node {4.1. Section four one}
child { node {4.1.1. Subsection four one one}
}
child { node {4.1.2. Subsection four one two}
}
child { node {4.1.3. Subsection four one three}
}
}
child { node {4.2. Section four two}
child { node {4.2.1. Subsection four two one}
}
child { node {4.2.2. Subsection four two two}
}
child { node {4.2.3. Subsection four two three}
}
}
}
} ;
可以增强代码,以便向文件写入除了这些节点之外的更多数据。
但总的来说,自动完成所有工作并不容易。etoc 的行样式有点复杂,但这可以满足所有可能性:没有节的章节,或没有小节的节,等等……
实际上,etoc
“深度标签”可用于预先将目录限制在人们感兴趣的内容上。
如果hyperref
正在使用,节点将是超链接,全部已设置好。