diff options
author | albert-github <albert.tests@gmail.com> | 2014-11-29 14:31:57 (GMT) |
---|---|---|
committer | albert-github <albert.tests@gmail.com> | 2014-11-29 14:31:57 (GMT) |
commit | fd91442bcc5a20ba298a024ee2cc375ec4f1714d (patch) | |
tree | 64bf2ef54067018960ed07cde8a3b363b1e36498 | |
parent | 200b828ead9f6bb5b2f6f99919837d5828a250e4 (diff) | |
download | Doxygen-fd91442bcc5a20ba298a024ee2cc375ec4f1714d.zip Doxygen-fd91442bcc5a20ba298a024ee2cc375ec4f1714d.tar.gz Doxygen-fd91442bcc5a20ba298a024ee2cc375ec4f1714d.tar.bz2 |
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
-rw-r--r-- | src/config.xml | 23 | ||||
-rw-r--r-- | src/doxygen.cpp | 28 | ||||
-rw-r--r-- | src/latexgen.cpp | 25 | ||||
-rw-r--r-- | src/latexgen.h | 2 | ||||
-rw-r--r-- | src/util.cpp | 20 | ||||
-rw-r--r-- | src/util.h | 4 |
6 files changed, 92 insertions, 10 deletions
diff --git a/src/config.xml b/src/config.xml index d46b8ef..9bce7eb 100644 --- a/src/config.xml +++ b/src/config.xml @@ -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 @@ -2537,6 +2537,19 @@ EXTRA_PACKAGES=times ]]> </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> <option type='list' id='LATEX_EXTRA_FILES' format='file' depends='GENERATE_LATEX'> <docs> <![CDATA[ diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 821ebc5..f0a8719 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -9162,6 +9162,33 @@ static void readTagFile(Entry *root,const char *tl) } //---------------------------------------------------------------------------- +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() { QCString &htmlStyleSheet = Config_getString("HTML_STYLESHEET"); @@ -11365,6 +11392,7 @@ void generateOutput() g_outputList->add(new LatexGenerator); LatexGenerator::init(); + copyLatexStyleSheet(); // copy static stuff copyExtraFiles("LATEX_EXTRA_FILES","LATEX_OUTPUT"); } diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 874b485..12bd8ae 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -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" diff --git a/src/latexgen.h b/src/latexgen.h index f68612d..60c649a 100644 --- a/src/latexgen.h +++ b/src/latexgen.h @@ -22,6 +22,8 @@ class QFile; +static const char *latexStyleExtension = ".sty"; + /** Generator for LaTeX output. */ class LatexGenerator : public OutputGenerator { diff --git a/src/util.cpp b/src/util.cpp index 64e63c8..c813636 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -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); |