views:

969

answers:

3

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?

+1  A: 

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.

dmckee
I tried putting that in my style sheet but it didn't have any effect. After searching around a bit more I found that Doxygen is putting "\setcounter{tocdepth}{3}" just after a "\makeindex" command, which is is turn after the inclusion of custom packages. So I'm back to editing the file every time Doxygen generates it unless there is something to stop Doxygen adding that, or prevent latex letting any latter ones override mine?
Fire Lancer
IT also effects the depth of bookmarks, which id like to keep if possible since the collapsible tree structure makes it more suited for the full list. However everything I've found seems to treat them the same :(
Fire Lancer
Many of us who use LaTeX for documentation use make files for controlling publication, with custom scripts doing bits of sed and awk (and other utilities) to do the sort of editing you describe. Of course many of us are long-time Unix/Linux users for whom this is as natural as breathing and the approach may not fit your needs or background.
High Performance Mark
I'm sorry it doesn't do it. I'm out of advice.
dmckee
+1  A: 

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.

Charles Stewart
+2  A: 

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

godbyk
+1 This should get around the issue with dmckee's suggestion, and is more robust than my suggestion. Who knows, maybe it even works...
Charles Stewart