
Me gustaría obtener una vista de árbol de un proyecto de látex que muestre elementos como secciones, capítulos y figuras.
- 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)
¿Existe una buena herramienta de línea de comandos disponible para esto, como texcount, que está disponible para recuentos de palabras?
Respuesta1
Realmente no es una herramienta, lo siento, pero genera una muy simple.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}
Esto produce un 'árbol' no alineado (lo siento, aún no hay figuras) en el \jobname.tv
archivo
Contents
List of Figures
-1 first
--1.1 first
---1.1.1 first
-2 Second
--2.1 second
---2.1.1 second