22 if(!
data_load(fileName, mapFormula)){
return;}
30 if(!
data_save(fileName, mapFormula)){
return;}
43 fs.open(fileName.c_str());
44 if(!fs.is_open())
return false;
46 fs <<
"\\documentclass[8pt]{article}\n";
48 fs <<
"\\documentclass[12pt]{article}\n";
50 fs <<
"\\usepackage[T1]{fontenc}\n\\usepackage[utf8]{inputenc}\n\\usepackage{lmodern}\n\n\n";
51 fs <<
"\\usepackage{calc}\n\n\n\\usepackage{amssymb}\n\\usepackage{color}\n\\usepackage{amsfonts}\n\\usepackage{bbm}\n\\pagestyle{empty}\n\n\n";
52 fs <<
"\\usepackage{amsmath}\n\\usepackage{esint}\n\n";
55 fs <<
"\\begin{document}\n\n";
56 fs <<
"\\def\\sgn{\\mathop{\\mathgroup\\symoperators sgn}\\nolimits}\n";
57 fs << fontColor <<
" ";
59 fs <<
"$" << mathContent <<
"$\n";
61 fs <<
"\\begin{"<<latexEnv<<
"}" << mathContent <<
"\\end{"<<latexEnv<<
"}\n";
63 fs <<
"\\end{document}\n";
73 PString command(CMAKE_INSTALL_PREFIX
"/share/PhoenixTex2Html/SCRIPTS/createTexDisplayMathpng.sh "+fileNamePng);
75 if(system(command.c_str()) != 0){
76 std::cerr <<
"lauchLatexToPng : can't call 'latex' to create file" << std::endl;
91 PString fileName(
"_tmp_file.tex");
93 std::cerr <<
"platexObj_createImageWithMathTex : can't save latex file '"<<fileName<<
"' for object " << objId << std::endl;
98 std::cerr <<
"platexObj_createImageWithMathTex : can't create directory '" << outputDir <<
"'" << std::endl;
101 PString fileNamePng(outputDir+
"/imgMath"+objIdStr+
".png");
103 std::cerr <<
"platexObj_createImageWithMathTex : can't save png file '"<<fileNamePng<<
"' for object " << objId << std::endl;
106 remove(fileName.c_str());
120 PMapFormula::iterator it(mapFormula.find(texContent));
121 if(it != mapFormula.end()){
129 fontColor =
"\\pagecolor{black}\\color{white}";
133 mapFormula[texContent] = outputFileName;
134 return outputFileName;
147 body +=
"$$\\begin{"+latexEnv+
"}"+obj.
getText()+
"\\end{"+latexEnv+
"}$$\n";
150 body +=
"<div class=\"formula\" /><img src=\"" + fileNamePng +
"\" alt=\"nothing\" /></div>";
163 body +=
"$"+obj.
getText()+
"$\n";
166 body +=
"<span class=\"inlineformula\" /><img src=\"" + fileNamePng +
"\" alt=\""+obj.
getText()+
"\" /></span>";
185 outputMode.
mapVar[
"${" + varName +
"}"] = value;
187 outputMode.
mapVar[
"${IS_" + varName +
"_BEGIN}"] =
"<!-- ";
188 outputMode.
mapVar[
"${IS_" + varName +
"_END}"] =
" -->";
190 outputMode.
mapVar[
"${IS_" + varName +
"_BEGIN}"] =
"";
191 outputMode.
mapVar[
"${IS_" + varName +
"_END}"] =
"";
204 outputMode.
mapVar[
"${BOOK_TABLE_OF_CONTENT}"] =
"";
208 bibliography =
"bibliography.html";
211 PString remoteMathjaxFile(
""), localMathjax(
"");
213 remoteMathjaxFile =
"load-mathjax.js";
216 localMathjax =
"MathJax.js";
240 const PPath & currentSourceFile,
size_t currentSourceLine)
242 outputMode.
mapVar[
"${PAGE_LINK}"] = pageLink;
243 outputMode.
mapVar[
"${PAGE_TITLE}"] = pageTitle;
244 outputMode.
mapVar[
"${PARENT_SECTION_TITLE}"] = parentSecTitle;
246 outputMode.
mapVar[
"${PREV_PAGE_TITLE}"] = prevSecTitle;
248 outputMode.
mapVar[
"${NEXT_PAGE_TITLE}"] = nextSecTitle;
#define LATEX_IMAGE_OUTPUT_DIR
long unsigned int getId() const
Gets the id of the PLatexObj.
const PString & getText() const
Gets the text of the PLatexObj.
Path of a directory or a file.
bool createDirectory(mode_t mode=0755) const
Create the current directory.
PPath getUnderPath(const PString &pathPart) const
Get path which is under the given pathPart ('some/dir/path' with 'dir' will return 'path')
PPath makeAbsolute() const
Make an absolute path of the given path.
PPath simplify() const
Remove extra dots from the path.
bool isFileExist() const
Say if the current file path does exist.
PString loadFileContent() const
Get the file content in a PString.
PPath getFileName() const
Get the name of the file, from last char to /.
std::string valueToString(const T &val)
Convert a type into a string.
bool data_load(FILE *iter, T &data)
Load data from a message.
bool data_save(FILE *iter, const T &data)
Save data in a message.
void dico_replace_nested_call(PString &out, const PNestedCall &call, const PMapKnownVar &mapKeyVariable, const PString &varBegin, const PString &varEnd)
Replace the nested call by the variables in map.
void dico_create_nested_call(PNestedCall &call, const PString &baseStr, const PString &varBegin, const PString &varEnd)
Create the nested calls of the input base string.
Output mode of the html backend.
bool isMathJaxMode
True to use the MathJax backend, false to use the latex backend.
PFullMenu fullMenu
Full menu for book theme.
PString bookGitlabUrl
Gitlab url of the current sources of the project.
PMapFormula mapFormula
Map of the formula which are already saved as png files.
PMapKnownVar mapVar
Map of output var which are use to fill the output themes.
bool isBookTheme
True to activate the book theme.
PString bookMasterProjectUrl
Master project url in book mode.
PString bookMail
Mail to be used to contact authors in book mode.
bool isBibliography
True if the generated web site has a bibliography, false otherwise.
bool isRemoteMathjax
True to activate mathjax but in remote mode (so no need to have mathjax in the generated site)
PString currentStyle
Current style to be used for the generated pages of the site.
PNestedCall themeCall
Parsed theme to be used.