Latex default fonts
Alexis Praga <[email protected]> Thu, 26 Apr 2012 18:44:40 +0200
| Newsgroups | gmane.text.doxygen.devel |
|---|---|
| Message-ID | <CAH3o9gxur0hUNFisone6zAkLCf0epS4U5bJf6wOaVBSY+6Rigg@mail.gmail.com> |
Hi, I have posted on the user mailing list asking how to configure doxygen for using latex's default fonts (computer modern). While waiting an answer, I made a patch adding an option about the fonts in the configuration file (see attached file). The output looks correct in my small documentation but tell me if there is any mistakes ( it is my first patch :p ). I plan to use it so it would be nice to have it in the mainline. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Doxygen-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/doxygen-develop
latex_default_fonts.diff
(application/octet-stream, 6.6 KB)
Index: src/doxygen_bst.h
===================================================================
--- src/doxygen_bst.h (revision 811)
+++ src/doxygen_bst.h (working copy)
@@ -1,5 +1,5 @@
+" % $Id: html-btxbst.doc 1.5 2010/12/08 19:02:34 dds Exp $\n"
" % \n"
-" % \n"
" % This file is either \"html-btxbst.doc\" or was derived from\n"
" % \"html-btxbst.doc\" using cpp. \"html-btxbst.doc\" itself was edited\n"
" % from \"btxbst.doc\" and \"named.bst\".\n"
Index: src/latexgen.cpp
===================================================================
--- src/latexgen.cpp (revision 811)
+++ src/latexgen.cpp (working copy)
@@ -257,6 +257,7 @@
// part 1
QCString paperName;
+
if (Config_getBool("LATEX_BATCHMODE")) t << "\\batchmode" << endl;
QCString &paperType=Config_getEnum("PAPER_TYPE");
if (paperType=="a4wide")
@@ -323,7 +324,7 @@
t << sLanguageSupportCommand << endl;
}
t << "\\usepackage{mathptmx}\n";
- t << "\\usepackage[scaled=.90]{helvet}\n";
+ if (!Config_getBool("LATEX_DEFAULT_FONTS")) t << "\\usepackage[scaled=.90]{helvet}\n";
t << "\\usepackage{courier}\n";
t << "\\usepackage{sectsty}\n";
t << "\\usepackage[titles]{tocloft}\n";
@@ -347,9 +348,12 @@
}
t << "\\makeindex\n"
"\\setcounter{tocdepth}{3}\n"
- "\\renewcommand{\\footrulewidth}{0.4pt}\n"
- "\\renewcommand{\\familydefault}{\\sfdefault}\n"
- "\\hfuzz=15pt\n" // allow a bit of overflow to go unnoticed
+ "\\renewcommand{\\footrulewidth}{0.4pt}\n";
+
+ if (!Config_getBool("LATEX_DEFAULT_FONTS"))
+ t << "\\renewcommand{\\familydefault}{\\sfdefault}\n";
+
+ t << "\\hfuzz=15pt\n" // allow a bit of overflow to go unnoticed
"\\setlength{\\emergencystretch}{15pt}\n"
"\\hbadness=750\n"
"\\tolerance=750\n"
@@ -417,7 +421,8 @@
"\\RequirePackage{multirow}\n"
"\\RequirePackage[table]{xcolor}\n\n";
- t << "% Use helvetica font instead of times roman\n"
+ if (!Config_getBool("LATEX_DEFAULT_FONTS"))
+ t << "% Use helvetica font instead of times roman\n"
"\\RequirePackage{helvet}\n"
"\\RequirePackage{sectsty}\n"
"\\RequirePackage{tocloft}\n"
@@ -864,7 +869,11 @@
t << "{\\end{xtabular*}\\par}\n";
t << "\\newcommand{\\entrylabel}[1]{\n";
t << " {\\parbox[b]{\\labelwidth-4pt}{\\makebox[0pt][l]{%\n";
- t << " \\usefont{OT1}{phv}{bc}{n}\\color{darkgray}#1}\\vspace{1.5\\baselineskip}}}}\n";
+ if (Config_getBool("LATEX_DEFAULT_FONTS"))
+ t << " \\usefont{OT1}{cmr}{b}{n}";
+ else
+ t << " \\usefont{OT1}{phv}{bc}{n}\\color{darkgray}";
+ t << "#1}\\vspace{1.5\\baselineskip}}}}\n";
t << "\\newenvironment{Desc}\n";
t << "{\\begin{list}{}\n";
t << " {\n";
@@ -916,17 +925,21 @@
// \sloppy should not be used, see bug 563698
//t << "\\sloppy\n";
t << "\\usepackage[T1]{fontenc}\n";
- t << "\\makeatletter\n";
- t << "\\renewcommand{\\paragraph}{\\@startsection{paragraph}{4}{0ex}%\n";
- t << " {-1.0ex}%\n";
- t << " {1.0ex}%\n";
- t << " {\\usefont{OT1}{phv}{bc}{n}\\color{darkgray}}}\n";
- t << "\\renewcommand{\\subparagraph}{\\@startsection{subparagraph}{5}{0ex}%\n";
- t << " {-1.0ex}%\n";
- t << " {1.0ex}%\n";
- t << " {\\usefont{OT1}{phv}{bc}{n}\\color{darkgray}}}\n";
- t << "\\makeatother\n";
- t << "\\allsectionsfont{\\usefont{OT1}{phv}{bc}{n}\\selectfont\\color{darkgray}}\n";
+
+ if (!Config_getBool("LATEX_DEFAULT_FONTS"))
+ {
+ t << "\\makeatletter\n";
+ t << "\\renewcommand{\\paragraph}{\\@startsection{paragraph}{4}{0ex}%\n";
+ t << " {-1.0ex}%\n";
+ t << " {1.0ex}%\n";
+ t << " {\\usefont{OT1}{phv}{bc}{n}\\color{darkgray}}}\n";
+ t << "\\renewcommand{\\subparagraph}{\\@startsection{subparagraph}{5}{0ex}%\n";
+ t << " {-1.0ex}%\n";
+ t << " {1.0ex}%\n";
+ t << " {\\usefont{OT1}{phv}{bc}{n}\\color{darkgray}}}\n";
+ t << "\\makeatother\n";
+ t << "\\allsectionsfont{\\usefont{OT1}{phv}{bc}{n}\\selectfont\\color{darkgray}}\n";
+ }
t << "\\stepcounter{secnumdepth}\n";
t << "\\stepcounter{tocdepth}\n";
t << "\\definecolor{comment}{rgb}{0.5,0.0,0.0}\n";
Index: src/configoptions.cpp
===================================================================
--- src/configoptions.cpp (revision 811)
+++ src/configoptions.cpp (working copy)
@@ -1723,6 +1723,14 @@
cs->setWidgetType(ConfigString::File);
cs->addDependency("GENERATE_LATEX");
//----
+ cb = cfg->addBool(
+ "LATEX_DEFAULT_FONTS",
+ "The LATEX_DEFAULT_FONTS tag let you choose between LaTeX default fonts\n"
+ "(Computer Modern) or Doxygen fonts (Helvetica).",
+ FALSE
+ );
+ cb->addDependency("GENERATE_LATEX");
+ //----
cs = cfg->addString(
"LATEX_FOOTER",
"The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for\n"
Index: src/config.xml
===================================================================
--- src/config.xml (revision 811)
+++ src/config.xml (working copy)
@@ -1167,6 +1167,10 @@
the first chapter. If it is left blank doxygen will generate a
standard header. Notice: only use this tag if you know what you are doing!
' defval='' depends='GENERATE_LATEX'/>
+ <option type='bool' id='LATEX_DEFAULT_FONTS' docs='
+The LATEX_DEFAULT_FONTS tag let you choose between LaTeX default fonts
+(Computer Modern) or Doxygen fonts (Helvetica).
+' defval='0' depends='GENERATE_LATEX'/>
<option type='string' id='LATEX_FOOTER' format='file' docs='
The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
the generated latex document. The footer should contain everything after
Index: doc/config.doc
===================================================================
--- doc/config.doc (revision 811)
+++ doc/config.doc (working copy)
@@ -192,7 +192,9 @@
\refitem cfg_latex_bib_style LATEX_BIB_STYLE
\refitem cfg_latex_cmd_name LATEX_CMD_NAME
\refitem cfg_latex_footer LATEX_FOOTER
+\refitem cfg_latex_default_fonts LATEX_DEFAULT_FONTS
\refitem cfg_latex_header LATEX_HEADER
+\refitem cfg latex_default_header LATEX_DEFAULT_HEADER
\refitem cfg_latex_hide_indices LATEX_HIDE_INDICES
\refitem cfg_latex_output LATEX_OUTPUT
\refitem cfg_latex_source_code LATEX_SOURCE_CODE
@@ -1908,6 +1910,12 @@
the version number of doxygen, the project name (see \c PROJECT_NAME), or the
project number (see \c PROJECT_NUMBER).
+\anchor cfg_latex_default_fonts
+<dt>\c LATEX_DEFAULT_FONTS <dd>
+ \addindex LATEX_DEFAULT_FONT
+ If the \c LATEX_DEFAULT_FONTS tag is set to \c YES doxygen output uses \f$\mbox{\LaTeX}\f$
+ default fonts instead of Helvetica
+
\anchor cfg_latex_footer
<dt>\c LATEX_FOOTER <dd>
\addindex LATEX_FOOTER