summaryrefslogtreecommitdiffstats
path: root/src/formula.cpp
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2019-08-27 14:55:47 (GMT)
committeralbert-github <albert.tests@gmail.com>2019-08-27 14:55:47 (GMT)
commitfd3b60caa8bb99bec81b74d74f394c6043091c76 (patch)
tree1558814875abeb800fbf4bb92cfa146680460a9a /src/formula.cpp
parent3d4eb56c5fc8135129e7dd748e2df7a4757195a7 (diff)
downloadDoxygen-fd3b60caa8bb99bec81b74d74f394c6043091c76.zip
Doxygen-fd3b60caa8bb99bec81b74d74f394c6043091c76.tar.gz
Doxygen-fd3b60caa8bb99bec81b74d74f394c6043091c76.tar.bz2
Create possibility to define LaTeX commands for formulas
To be able to have building bocks for formulas one can create a `\newcommand` (or when one wants to change a command `\renewcommand`). Due to the different handling of LaTeX commands in pure LaTeX code (latex output and formulas converted to images) and MathJax it is necessary to transform LaTeX commands to the MathJax equivalent. This is done in a transparent way by providing the new commands in a file and add this verbatim to the pure LaTeX code and to translate the `\newcommand` and `\renewcomamnd` to MathJax macros.
Diffstat (limited to 'src/formula.cpp')
-rw-r--r--src/formula.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/formula.cpp b/src/formula.cpp
index 1c5042e..f79bd47 100644
--- a/src/formula.cpp
+++ b/src/formula.cpp
@@ -53,6 +53,15 @@ void FormulaList::generateBitmaps(const char *path)
// store the original directory
if (!d.exists()) { err("Output dir %s does not exist!\n",path); exit(1); }
QCString oldDir = QDir::currentDirPath().utf8();
+ QCString macroFile = Config_getString(FORMULA_MACROFILE);
+ QCString stripMacroFile;
+ if (!macroFile.isEmpty())
+ {
+ QFileInfo fi(macroFile);
+ macroFile=fi.absFilePath().utf8();
+ stripMacroFile = fi.fileName().data();
+ }
+
// go to the html output directory (i.e. path)
QDir::setCurrent(d.absPath());
QDir thisDir;
@@ -74,6 +83,11 @@ void FormulaList::generateBitmaps(const char *path)
t << "\\usepackage[utf8]{inputenc}" << endl; // looks like some older distributions with newunicode package 1.1 need this option.
writeExtraLatexPackages(t);
writeLatexSpecialFormulaChars(t);
+ if (!macroFile.isEmpty())
+ {
+ copyFile(macroFile,stripMacroFile);
+ t << "\\input{" << stripMacroFile << "}" << endl;
+ }
t << "\\pagestyle{empty}" << endl;
t << "\\begin{document}" << endl;
int page=0;