I would like to get a tree-view of a latex project showing things like sections, chapters, figures.

- 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)

Is there a nice command line tool which is available for this such as texcount is available for wordcounts.

  • Probably, but… where you want that tree to be displayed? If it's in a terminal and you're using Unix, then tree is your friend to list your files (but then you'll have to put your figures in separate files). If it's in an IDE as TexStudio, then by playing a bit with the options, you should be able to do that too. If it's in your document, you could achieve that by modifying the tableofcontents command, I guess. – Clément Feb 5 '16 at 15:24
  • @Clément: I don't believe tree is correct here. I think, the tool should analyze the .toc and .tof files, most likely? – user31729 Feb 5 '16 at 15:26
  • I have modified the example a bit. I was looking for the structure LaTeX see's it as via a unix command line option rather than a Unix tree or using an IDE. Doing something with tableofcontents seems quite smart. Ideally there would be a working solution much like there is for wordcount with texcount. – henry.oswald Feb 5 '16 at 15:32

Not really a tool, sorry, but generating a very simple tree





  \ifnum #3 > 0
  \foreach \x in {1,...,#3}
  \immediate\write\tvhandle{\mydef #1 #2}




    \ifnum #2>\c@secnumdepth \else
    \protect\numberline{\csname the#1\endcsname}%
  \addtocontents{tvaux}{\protect\writetv{\csname the#1\endcsname}{#7}{#2}}%
    \ifnum #2>\c@secnumdepth \else
    \protect\numberline{\csname the#1\endcsname}%














This produces an unaligned 'tree' (sorry, no figures yet) in the \jobname.tv file

  List of Figures
 -1 first
 --1.1 first
 ---1.1.1 first
 -2 Second
 --2.1 second
 ---2.1.1 second
  • Patching \@ssect would provide the functionality for \section* etc. as well -- \tableofcontents etc. would make an entry automatically then and do not have to be patched separately. – user31729 Feb 5 '16 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.