8
votes

I'm using Doxygen to generate documentation for my code. I need to make a PDF version of this and using Doxygen's LaTeX output appears to be the way to do it.

However I've run into a number of annoying problems, and not knowing anything about LaTeX previously haven't really got much of an idea on how to approach them, and the countless references for LaTeX related things are not much help...

I worked out how to create a custom style thing in a sty file and how to get Doxygen to use it. After a lot of searching I found out how to set the page margins etc. through this, and I'm guessing the perhaps this is the file I want for doing the other things I want, but I cant seem to find any commands for doign what I want :(

  1. The table of contents at the start of the document contains a lot of items Id rather it didn't as it makes the contents very long. Is there some way to limit this contents to just say the first two levels, rather than having entries for every single individual function, variable, etc.? Id quite like to keep all the bookmarks however. I did try the "COMPACT_LATEX" option but as well as removing items on the contents pages, it removed the bookmarks and the member lists at the start of each section, which I do really want to keep.

  2. Is there a way to change the order of things, like putting the full class description at the start of the section, rather than after all the members and attributes?

3

3 Answers

7
votes

Wow, that's kind of evil of Doxygen.

Okay, to get around the tocdepth counter problem, add the following line to your .sty file:

\AtBeginDocument{\setcounter{tocdepth}{2}}% or whatever level you want

You can set the PDF bookmarks depth to a separate value:

% requires you \usepackage{hyperref} first
\hypersetup{
  bookmarksdepth = section, % of whatever level you want
}

Also note that if you have a list of figures/tables, the tocdepth must be at least 2 for them to show up.

I don't see any way of rearranging those items within the LaTeX files---Doxygen just barfs them out there, so we can't do much. You'll have to poke around the Doxygen documentation to see if there's any way to specify the order I guess. (Here's hoping!)

2
votes

You're so close.

Googling on "latex contents level" brought me to LaTeX - customizing the depth of the table of contents for different parts of the thesis which suggests

\setcounter{tocdepth}{n}

where n starts at zero for only the highest level division. This is presumable defined in all the default styles, but is worth a try in doxygen.

1
votes

You could write a Perl/Awk script to simply delete the unwanted lines from the table of contents. For the file burble.tex, Latex will generate the file burble.toc, which will contain lines such as:

\contentsline {subsection}{Class F rewrites}{38}
\contentsline {subsection}{Class M rewrites}{39}
\contentsline {section}{\numberline {7}Definition and properties of the translation}{44}
\contentsline {paragraph}{Well-formedness}{54}

Simple regexes will identify which levels each line belongs to, and you can filter the file based on that. Once you have the table of contents the way you want it, insert \nofiles in the appropriate place (the style sheet?), which means that Latex will read the auxiliary files but not overwrite them.