Question

I am using doxygen to generate a PDF of my code documentation. The PDF has very big margins when using PAPER_TYPE = letter. It looks OK when using a4wide but I would like to have more control over it. I want to use a package called geometry but can't figure out where to add code like this:

\usepackage[top=2.9cm,left=2in,bottom=1in,right=1in]{geometry}

I would like to not have to change the doxygen-generated tex files if possible.

Was it helpful?

Solution

In your Doxyfile, add or edit the EXTRA_PACKAGES line:

EXTRA_PACKAGES = mydoxy

Then create a new file called mydoxy.sty:

\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{mydoxy}[2009/12/29 v1.0.0 csmithmaui's Doxygen style]
\RequirePackage[top=2.9cm,left=2in,bottom=1in,right=1in]{geometry}
% any other custom stuff can go here
\endinput

Drop that mydoxy.sty where LaTeX can find it.

The EXTRA_PACKAGES line will tell Doxygen to add \usepackage{mydoxy} to the preamble of the .tex files it generates. This will cause LaTeX to look for a file named mydoxy.sty. In the mydoxy.sty file that we've created, we can add whatever LaTeX code we like (before the \endinput line). Feel free to drop any other customizations you like in this style file.

Note that I haven't tested this, and I'm making a number of assumptions that may be false. But it should at least get you started.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top