在文件 formula.cpp 第 130 行定义.
136 term(
"Output directory '%s' does not exist!\n",
qPrint(path));
144 macroFile=fi.absFilePath();
145 stripMacroFile = fi.fileName();
154 std::ofstream f(texName.
str(),std::ofstream::out | std::ofstream::binary);
158 t <<
"\\documentclass{article}\n";
159 t <<
"\\usepackage{ifthen}\n";
160 t <<
"\\usepackage{epsfig}\n";
161 t <<
"\\usepackage[utf8]{inputenc}\n";
167 t <<
"\\input{" << stripMacroFile <<
"}\n";
169 t <<
"\\pagestyle{empty}\n";
170 t <<
"\\begin{document}\n";
171 for (
int i=0; i<(int)
p->formulas.size(); i++)
180 t <<
p->formulas[i].c_str() <<
"\n\\pagebreak\n\n";
181 formulasToGenerate.push_back(i);
185 t <<
"\\end{document}\n";
189 if (!formulasToGenerate.empty())
201 err(
"Problems running latex. Check your installation or look "
202 "for typos in _formulas.tex and check _formulas.log!\n");
210 (logFile.
find(
"Rerun to get cross-references right")==-1 && logFile.
find(
"Rerun LaTeX")==-1))
219 for (
int pageNum : formulasToGenerate)
221 msg(
"Generating image form_%d.%s for formula\n",pageNum,(format==
Format::Vector) ?
"svg" :
"png");
223 formBase.
sprintf(
"_form%d",pageNum);
226 sprintf(args,
"-q -D 600 -n 1 -p %d -o %s_tmp.ps _formulas.dvi",
227 pageIndex,
qPrint(formBase));
231 err(
"Problems running dvips. Check your installation!\n");
239 sprintf(args,
"-q -dBATCH -dNOPAUSE -P- -dNOSAFER -sDEVICE=bbox %s_tmp.ps 2>%s_tmp.epsi",
252 int x1=0,y1=0,x2=0,y2=0;
253 FileInfo fi((formBase+
"_tmp.epsi").str());
257 int i = eps.
find(
"%%BoundingBox:");
260 sscanf(eps.
data()+i,
"%%%%BoundingBox:%d %d %d %d",&x1,&y1,&x2,&y2);
264 err(
"Couldn't extract bounding box from %s_tmp.epsi",
qPrint(formBase));
270 double scaleFactor = 1.25;
272 if (zoomFactor<8 || zoomFactor>50) zoomFactor=10;
273 scaleFactor *= zoomFactor/10.0;
275 int width = (int)((x2-x1)*scaleFactor+0.5);
276 int height = (int)((y2-y1)*scaleFactor+0.5);
277 p->storeDisplaySize(pageNum,width,height);
282 sprintf(args,
"-q -dBATCH -dNOPAUSE -P- -dNOSAFER -sDEVICE=pdfwrite"
283 " -o %s_tmp.pdf -c \"[/CropBox [%d %d %d %d] /PAGES pdfmark\" -f %s_tmp.ps",
298 sprintf(args,
"%s_tmp.pdf form_%d.svg",
qPrint(formBase),pageNum);
302 err(
"Problems running pdf2svg. Check your installation!\n");
312 if (inkscapeVersion == -1)
314 err(
"Problems determining the version of inkscape. Check your installation!\n");
318 else if (inkscapeVersion == 0)
324 sprintf(args,
"--export-type=svg --export-filename=form_%d.svg %s_tmp.pdf 2>%s",pageNum,
qPrint(formBase),
Portable::devNull());
329 err(
"Problems running inkscape. Check your installation!\n");
338 err(
"Neither 'pdf2svg' nor 'inkscape' present for conversion of formula to 'svg'\n");
344 thisDir.
remove(formBase.
str()+
"_tmp.pdf");
350 sprintf(args,
"-q -dBATCH -dNOPAUSE -P- -dNOSAFER -sDEVICE=eps2write"
351 " -o %s_tmp.eps -f %s_tmp.ps",
qPrint(formBase),
qPrint(formBase));
363 std::ifstream epsIn(formBase.
str()+
"_tmp.eps",std::ifstream::in);
364 std::ofstream epsOut(formBase.
str()+
"_tmp_corr.eps",std::ofstream::out | std::ofstream::binary);
365 if (epsIn.is_open() && epsOut.is_open())
368 while (getline(epsIn,line))
370 if (line.rfind(
"%%BoundingBox",0)==0)
372 epsOut <<
"%%BoundingBox: " << x1 <<
" " << y1 <<
" " << x2 <<
" " << y2 <<
"\n";
374 else if (line.rfind(
"%%HiResBoundingBox",0)==0)
379 epsOut << line <<
"\n";
387 err(
"Problems correcting the eps files from %s_tmp.eps to %s_tmp_corr.eps\n",
400 sprintf(args,
"-q -dNOSAFER -dBATCH -dNOPAUSE -dEPSCrop -sDEVICE=pnggray -dGraphicsAlphaBits=4 -dTextAlphaBits=4 "
401 "-r%d -sOutputFile=form_%d.png %s_tmp_corr.eps",(
int)(scaleFactor*72),pageNum,
qPrint(formBase));
414 thisDir.
remove(formBase.
str()+
"_tmp.eps");
415 thisDir.
remove(formBase.
str()+
"_tmp_corr.eps");
422 thisDir.
remove(formBase.
str()+
"_tmp.ps");
423 thisDir.
remove(formBase.
str()+
"_tmp.epsi");
430 thisDir.
remove(
"_formulas.dvi");
431 thisDir.
remove(
"_formulas.log");
432 thisDir.
remove(
"_formulas.aux");
442 f.open(
"formula.repository",std::ofstream::out | std::ofstream::binary);
446 for (
int i=0; i<(int)
p->formulas.size(); i++)
448 DisplaySize size =
p->getDisplaySize(i);
449 t <<
"\\_form#" << i;
450 if (size.width!=-1 && size.height!=-1)
452 t <<
"=" << size.width <<
"x" << size.height;
454 t <<
":" <<
p->formulas[i].c_str() <<
"\n";
引用了 FileInfo::absFilePath(), Dir::absPath(), IndexList::addImageFile(), Portable::checkForExecutable(), Config_getInt, Config_getString, copyFile(), Dir::currentDirPath(), QCString::data(), determineInkscapeVersion(), Portable::devNull(), err(), FileInfo::exists(), Dir::exists(), FileInfo::fileName(), fileToString(), QCString::find(), TextStream::flush(), Portable::ghostScriptCommand(), FormulaManager::DisplaySize::height, Doxygen::indexList, QCString::isEmpty(), msg(), On, p, qPrint(), Dir::remove(), RM_TMP_FILES, Dir::setCurrent(), QCString::sprintf(), QCString::str(), Portable::system(), Portable::sysTimerStart(), Portable::sysTimerStop(), term(), Vector, FormulaManager::DisplaySize::width, writeExtraLatexPackages() , 以及 writeLatexSpecialFormulaChars().
被这些函数引用 generateOutput().