Commit fd91442b authored by albert-github's avatar albert-github

Bug 687576 - Add support for LATEX_EXTRA_STYLESHEET

Added the possibility for  LATEX_EXTRA_STYLESHEET analogous to  HTML_EXTRA_STYLESHEET. Special attention has been paid to the extension as ".sty" is automatically added by the \usepackage
parent 200b828e
......@@ -1797,13 +1797,13 @@ doxygen -w html new_header.html new_footer.html new_stylesheet.css YourConfigFil
since it does not replace the standard style sheet and is therefore more
robust against future updates. Doxygen will copy the style sheet files to
the output directory.
\note The order of the extra stylesheet files is of importance (e.g. the last
stylesheet in the list overrules the setting of the previous ones in the list).
\note The order of the extra style sheet files is of importance (e.g. the last
style sheet in the list overrules the setting of the previous ones in the list).
]]>
</docs>
<docs doxywizard='0' doxyfile='0'>
<![CDATA[
Here is an example stylesheet that gives the contents area a fixed width:
Here is an example style sheet that gives the contents area a fixed width:
\verbatim
body {
background-color: #CCC;
......@@ -1858,7 +1858,7 @@ hr.footer {
<docs>
<![CDATA[
The \c HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
Doxygen will adjust the colors in the stylesheet and background images
Doxygen will adjust the colors in the style sheet and background images
according to this color. Hue is specified as an angle on a colorwheel,
see http://en.wikipedia.org/wiki/Hue for more information.
For instance the value 0 represents red, 60 is yellow, 120 is green,
......@@ -2173,7 +2173,7 @@ The \c DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
Windows users are probably better off using the HTML help feature.
Via custom stylesheets (see \ref cfg_html_extra_stylesheet "HTML_EXTRA_STYLESHEET")
Via custom style sheets (see \ref cfg_html_extra_stylesheet "HTML_EXTRA_STYLESHEET")
one can further \ref doxygen_finetune "fine-tune" the look of the index.
As an example, the default style sheet generated by doxygen has an
example that shows how to put an image at the root of the tree instead of
......@@ -2534,6 +2534,19 @@ EXTRA_PACKAGES=times
used inside the footer.
<br>Note: Only use a user-defined footer if you know what you are doing!
]]>
</docs>
</option>
<option type='list' id='LATEX_EXTRA_STYLESHEET' format='file' defval='' depends='GENERATE_LATEX'>
<docs>
<![CDATA[
The \c LATEX_EXTRA_STYLESHEET tag can be used to specify additional
user-defined \f$\mbox{\LaTeX}\f$ style sheets that are included after the standard
style sheets created by doxygen. Using this option one can overrule
certain style aspects. Doxygen will copy the style sheet files to
the output directory.
\note The order of the extra style sheet files is of importance (e.g. the last
style sheet in the list overrules the setting of the previous ones in the list).
]]>
</docs>
</option>
......
......@@ -9161,6 +9161,33 @@ static void readTagFile(Entry *root,const char *tl)
parseTagFile(root,fi.absFilePath().utf8());
}
//----------------------------------------------------------------------------
static void copyLatexStyleSheet()
{
QStrList latexExtraStyleSheet = Config_getList("LATEX_EXTRA_STYLESHEET");
for (uint i=0; i<latexExtraStyleSheet.count(); ++i)
{
QCString fileName(latexExtraStyleSheet.at(i));
if (!fileName.isEmpty())
{
QFileInfo fi(fileName);
if (!fi.exists())
{
err("Style sheet '%s' specified by LATEX_EXTRA_STYLESHEET does not exist!\n",fileName.data());
}
else
{
QCString destFileName = Config_getString("LATEX_OUTPUT")+"/"+fi.fileName().data();
if (!checkExtension(fi.fileName().data(), latexStyleExtension))
{
destFileName += latexStyleExtension;
}
copyFile(fileName, destFileName);
}
}
}
}
//----------------------------------------------------------------------------
static void copyStyleSheet()
{
......@@ -11365,6 +11392,7 @@ void generateOutput()
g_outputList->add(new LatexGenerator);
LatexGenerator::init();
copyLatexStyleSheet();
// copy static stuff
copyExtraFiles("LATEX_EXTRA_FILES","LATEX_OUTPUT");
}
......
......@@ -269,8 +269,29 @@ static void writeDefaultHeaderPart1(FTextStream &t)
t << "% Packages required by doxygen\n"
"\\usepackage{fixltx2e}\n" // for \textsubscript
"\\usepackage{calc}\n"
"\\usepackage{doxygen}\n"
"\\usepackage{graphicx}\n"
"\\usepackage{doxygen}\n";
QStrList extraLatexStyle = Config_getList("LATEX_EXTRA_STYLESHEET");
for (uint i=0; i<extraLatexStyle.count(); ++i)
{
QCString fileName(extraLatexStyle.at(i));
if (!fileName.isEmpty())
{
QFileInfo fi(fileName);
if (fi.exists())
{
if (checkExtension(fi.fileName().data(), latexStyleExtension))
{
// strip the extension, it will be added by the usepackage in the tex conversion process
t << "\\usepackage{" << stripExtensionGeneral(fi.fileName().data(), latexStyleExtension) << "}\n";
}
else
{
t << "\\usepackage{" << fi.fileName().utf8() << "}\n";
}
}
}
}
t << "\\usepackage{graphicx}\n"
"\\usepackage[utf8]{inputenc}\n"
"\\usepackage{makeidx}\n"
"\\usepackage{multicol}\n"
......
......@@ -22,6 +22,8 @@
class QFile;
static const char *latexStyleExtension = ".sty";
/** Generator for LaTeX output. */
class LatexGenerator : public OutputGenerator
{
......
......@@ -6559,16 +6559,30 @@ QCString rtfFormatBmkStr(const char *name)
return *tag;
}
QCString stripExtension(const char *fName)
bool checkExtension(const char *fName, const char *ext)
{
return (QCString(fName).right(QCString(ext).length())==ext);
}
//QCString stripExtension(const char *fName, const char *ext)
QCString stripExtensionGeneral(const char *fName, const char *ext)
{
QCString result=fName;
if (result.right(Doxygen::htmlFileExtension.length())==Doxygen::htmlFileExtension)
//if (result.right(Doxygen::htmlFileExtension.length())==Doxygen::htmlFileExtension)
//{
//result=result.left(result.length()-Doxygen::htmlFileExtension.length());
//}
if (result.right(QCString(ext).length())==QCString(ext))
{
result=result.left(result.length()-Doxygen::htmlFileExtension.length());
result=result.left(result.length()-QCString(ext).length());
}
return result;
}
QCString stripExtension(const char *fName)
{
return stripExtensionGeneral(fName, Doxygen::htmlFileExtension);
}
void replaceNamespaceAliases(QCString &scope,int i)
{
......
......@@ -340,6 +340,10 @@ QCString rtfFormatBmkStr(const char *name);
QCString linkToText(SrcLangExt lang,const char *link,bool isFileName);
bool checkExtension(const char *fName, const char *ext);
QCString stripExtensionGeneral(const char *fName, const char *ext);
QCString stripExtension(const char *fName);
void replaceNamespaceAliases(QCString &scope,int i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment