[Doxygen-develop] [PATCH] LaTeX reduced tableofcontents with LATEX_HIDE_INDICES=NO
Brought to you by:
dimitri
From: Michael M. <Mic...@tt...> - 2005-07-07 22:50:33
|
Hi there, I've been generating some beautiful LaTeX documentation but have found that the table of contents that LaTeX adds is sometimes a little big and flat! For example, if LATEX_HIDE_INDICES=NO, the generated table of contents duplicates the section indices, and additionally flattens out module documentation. The following is test input that illustrates this: /** \defgroup Group0 This is group 0. @{ */ /** \defgroup Group1 This is group 1. @{ */ /** \defgroup Group2 This is group 2. @{ */ /** \defgroup Group3 This is group 3. @{ */ int main(); /** @} */ /** @} */ /** @} */ /** @} */ With this, the modules index (page 5 if this is the only input file) looks like the following: Chapter 1 Module Index 1.1 Modules Here is a list of all modules: This is group 0. . . . . . . . . . . . . . . . . . . 3 This is group 1 . . . . . . . . . . . . . . . . . 4 This is group 2. . . . . . . . . . . . . . . . 5 This is group 3 . . . . . . . . . . . . . . 6 Perfect! But the main index (page 3) appears as the following: Contents 1 Module Index 1 This is group 0. . . . . . . . . . . . . . . . . . 3 This is group 1. . . . . . . . . . . . . . . . . . 4 This is group 2. . . . . . . . . . . . . . . . . . 5 This is group 3. . . . . . . . . . . . . . . . . . 6 2 Module Documentation 3 The hierarchy is lost on LaTeX, and these items are reproduced on page 3 under the Module Index in any case :) The following patch makes the LaTeX generated \tableofcontents limited to the top level headings only, such that only the main sections are bought out and the contents appears as the following: Contents 1 Module Index 1 2 Module Documentation 3 This also has the benefit of reducing the size of this document if the indices are very large. I've done this with the LaTeX command "\setcounter{tocdepth}{0}". The patch is stored at: http://www.mcternan.co.uk/Doxygen/hide-indices-small-toc-1.4.3.patch Also reproduced here: --- doxygen-1.4.3.orig/src/latexgen.cpp 2005-07-07 23:27:20.911176000 +0100 +++ doxygen-1.4.3/src/latexgen.cpp 2005-07-07 23:26:33.523035200 +0100 @@ -299,7 +299,21 @@ << "\\end{titlepage}" << endl; if (!Config_getBool("COMPACT_LATEX")) t << "\\clearemptydoublepage\n"; t << "\\pagenumbering{roman}\n"; + + // Generate the table of contents + if(Config_getBool("LATEX_HIDE_INDICES")) + { t << "\\tableofcontents\n"; + } + else + { + // Create top level only index; each section has its own detailed index + t << "\\newcounter{tocdepthbak}\n"; + t << "\\setcounter{tocdepthbak}{\\value{tocdepth}}\n"; + t << "\\setcounter{tocdepth}{0}\n"; + t << "\\tableofcontents\n"; + t << "\\setcounter{tocdepth}{\\value{tocdepthbak}}\n"; + } if (!Config_getBool("COMPACT_LATEX")) t << "\\clearemptydoublepage\n"; t << "\\pagenumbering{arabic}\n"; } Regards, Mike |