[Patch] LATEX_FOOTER
Mark de Wever <[email protected]>
| Newsgroups | gmane.text.doxygen.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I recently wanted to add the LaTeX output of Doxygen in the middle of a
manual. So I wanted to have a Doxygen generated refman.tex that only
adds the list of files needed to include the Doxygen output. With an
empty LATEX_HEADER file I could skip the automatic preamble, but alas
there was no LATEX_FOOTER option to avoid the generation of the final
part (\makeindex\end{document}).
So I wrote a small patch which adds a LATEX_FOOTER configuration option.
The option allows you to use a file to generate the final part of the
LaTeX file. If you deem it useful feel free to include it in Doxygen.
Regards,
Mark de Wever
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Doxygen-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/doxygen-develop
latex_footer_patch
(text/plain, 5.2 KB)
Index: src/latexgen.cpp
===================================================================
--- src/latexgen.cpp (revision 747)
+++ src/latexgen.cpp (working copy)
@@ -766,6 +766,12 @@
t << "\\definecolor{vhdlchar}{rgb}{0.0,0.0,0.0}\n";
}
+static void writeDefaultFooter(FTextStream &t)
+{
+ t << "\\printindex\n";
+ t << "\\end{document}\n";
+}
+
void LatexGenerator::writeHeaderFile(QFile &f)
{
FTextStream t(&f);
@@ -776,6 +782,12 @@
writeDefaultHeaderPart3(t);
}
+void LatexGenerator::writeFooterFile(QFile &f)
+{
+ FTextStream t(&f);
+ writeDefaultFooter(t);
+}
+
void LatexGenerator::writeStyleSheetFile(QFile &f)
{
FTextStream t(&f);
@@ -997,6 +1009,7 @@
//static bool compactLatex = Config_getBool("COMPACT_LATEX");
static bool sourceBrowser = Config_getBool("SOURCE_BROWSER");
static QCString latexHeader = Config_getString("LATEX_HEADER");
+ static QCString latexFooter = Config_getString("LATEX_FOOTER");
switch (is)
{
case isTitlePageStart:
@@ -1215,8 +1228,15 @@
case isPageDocumentation2:
break;
case isEndIndex:
- t << "\\printindex\n";
- t << "\\end{document}\n";
+ if (latexFooter.isEmpty())
+ {
+ writeDefaultFooter(t);
+ }
+ else
+ {
+ QCString footer = fileToString(latexFooter);
+ t << substituteKeywords(footer,0);
+ }
break;
}
}
Index: src/configoptions.cpp
===================================================================
--- src/configoptions.cpp (revision 747)
+++ src/configoptions.cpp (working copy)
@@ -1593,6 +1593,16 @@
cs->setWidgetType(ConfigString::File);
cs->addDependency("GENERATE_LATEX");
//----
+ cs = cfg->addString(
+ "LATEX_FOOTER",
+ "The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for\n"
+ "the generated latex document. The footer should contain everything after\n"
+ "the last chapter. If it is left blank doxygen will generate a\n"
+ "standard footer. Notice: only use this tag if you know what you are doing!"
+ );
+ cs->setWidgetType(ConfigString::File);
+ cs->addDependency("GENERATE_LATEX");
+ //----
cb = cfg->addBool(
"PDF_HYPERLINKS",
"If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated\n"
Index: src/latexgen.h
===================================================================
--- src/latexgen.h (revision 747)
+++ src/latexgen.h (working copy)
@@ -30,6 +30,7 @@
static void init();
static void writeStyleSheetFile(QFile &f);
static void writeHeaderFile(QFile &f);
+ static void writeFooterFile(QFile &f);
//OutputGenerator *copy();
//OutputGenerator *clone() { return new LatexGenerator(*this); }
Index: src/doxygen.cpp
===================================================================
--- src/doxygen.cpp (revision 747)
+++ src/doxygen.cpp (working copy)
@@ -9091,7 +9091,7 @@
msg("5) Use doxygen to generate a template style sheet file for RTF, HTML or Latex.\n");
msg(" RTF: %s -w rtf styleSheetFile\n",name);
msg(" HTML: %s -w html headerFile footerFile styleSheetFile [configFile]\n",name);
- msg(" LaTeX: %s -w latex headerFile styleSheetFile [configFile]\n\n",name);
+ msg(" LaTeX: %s -w latex headerFile footerFile styleSheetFile [configFile]\n\n",name);
msg("6) Use doxygen to generate an rtf extensions file\n");
msg(" RTF: %s -e rtf extensionsFile\n\n",name);
msg("If -s is specified the comments in the config file will be omitted.\n");
@@ -9382,11 +9382,11 @@
}
else if (stricmp(formatName,"latex")==0)
{
- if (optind+3<argc) // use config file to get settings
+ if (optind+4<argc) // use config file to get settings
{
- if (!Config::instance()->parse(argv[optind+3]))
+ if (!Config::instance()->parse(argv[optind+4]))
{
- err("error opening or reading configuration file %s!\n",argv[optind+3]);
+ err("error opening or reading configuration file %s!\n",argv[optind+4]);
exit(1);
}
Config::instance()->substituteEnvironmentVars();
@@ -9397,7 +9397,7 @@
{
Config::instance()->init();
}
- if (optind+2>=argc)
+ if (optind+3>=argc)
{
err("error: option \"-w latex\" does not have enough arguments\n");
cleanUpDoxygen();
@@ -9418,6 +9418,11 @@
f.close();
if (openOutputFile(argv[optind+2],f))
{
+ LatexGenerator::writeFooterFile(f);
+ }
+ f.close();
+ if (openOutputFile(argv[optind+3],f))
+ {
LatexGenerator::writeStyleSheetFile(f);
}
cleanUpDoxygen();
Index: doc/doxygen.1
===================================================================
--- doc/doxygen.1 (revision 747)
+++ doc/doxygen.1 (working copy)
@@ -31,7 +31,7 @@
HTML:
doxygen \fB\-w\fR html headerFile footerFile styleSheetFile [configFile]
.TP
-LaTeX: doxygen \fB\-w\fR latex headerFile styleSheetFile [configFile]
+LaTeX: doxygen \fB\-w\fR latex headerFile footerFile styleSheetFile [configFile]
.TP
5) Use doxygen to generate an rtf extensions file
.TP