
섹션, 장, 그림 등을 보여주는 라텍스 프로젝트의 트리 보기를 원합니다.
- Table of contents
- Introduction (1.0)
--- fig 1 fig one title
--- fig 2 fig two title
- Second section (2.0)
--- fig 3 fig three title
- First Subsection in section 2 (2.1)
- Conclusion (3.0)
- References (4.0)
단어 수 계산에 사용할 수 있는 texcount와 같이 이를 위해 사용할 수 있는 멋진 명령줄 도구가 있습니까?
답변1
실제로는 도구가 아닙니다. 죄송합니다. 하지만 매우 간단한 결과를 생성합니다.tree
\documentclass{article}
\newwrite\tvhandle%
\usepackage{pgffor}
\usepackage{xpatch}
\makeatletter
\newcounter{mylevel}
\newcommand{\writetv}[3]{%
\edef\mydef{\space}
\ifnum #3 > 0
\foreach \x in {1,...,#3}
{
\xdef\mydef{\mydef-}
}
\fi
\immediate\write\tvhandle{\mydef #1 #2}
}
\xapptocmd{\tableofcontents}{%
\addtocontents{tvaux}{\protect\writetv{}{\contentsname}{0}}%
}{}{}
\xapptocmd{\listoffigures}{%
\addtocontents{tvaux}{\protect\writetv{}{\listfigurename}{0}}%
}{}{}
\newcommand\starttreeview{%
\immediate\openout\tvhandle=\jobname.tv
\@starttoc{tvaux}%
\immediate\closeout\tvhandle
}
\xpatchcmd{\@sect}{%
\addcontentsline{toc}{#1}{%
\ifnum #2>\c@secnumdepth \else
\protect\numberline{\csname the#1\endcsname}%
\fi
#7}%
}{%
\addtocontents{tvaux}{\protect\writetv{\csname the#1\endcsname}{#7}{#2}}%
\addcontentsline{toc}{#1}{%
\ifnum #2>\c@secnumdepth \else
\protect\numberline{\csname the#1\endcsname}%
\fi
#7}%
}{}{}
\makeatother
\begin{document}
\starttreeview
\tableofcontents
\listoftables
\listoffigures
\section{first}
\subsection{first}
\subsubsection{first}
\paragraph{first}
\subparagraph{first}
\section{Second}
\subsection{second}
\subsubsection{second}
\paragraph{second}
\subparagraph{second}
\end{document}
\jobname.tv
파일 에 정렬되지 않은 '트리'(죄송하지만 아직 그림이 없음)가 생성됩니다.
Contents
List of Figures
-1 first
--1.1 first
---1.1.1 first
-2 Second
--2.1 second
---2.1.1 second