Doxygen
Loading...
Searching...
No Matches
latexgen.cpp File Reference
#include "latexgen.h"
#include "cite.h"
#include "classlist.h"
#include "conceptdef.h"
#include "config.h"
#include "datetime.h"
#include "diagram.h"
#include "dirdef.h"
#include "docnode.h"
#include "docparser.h"
#include "dotcallgraph.h"
#include "dotclassgraph.h"
#include "dotdirdeps.h"
#include "dotgroupcollaboration.h"
#include "dotincldepgraph.h"
#include "doxygen.h"
#include "fileinfo.h"
#include "filename.h"
#include "groupdef.h"
#include "language.h"
#include "latexdocvisitor.h"
#include "message.h"
#include "moduledef.h"
#include "namespacedef.h"
#include "outputlist.h"
#include "pagedef.h"
#include "portable.h"
#include "resourcemgr.h"
#include "stringutil.h"
#include "utf8.h"
#include "util.h"
#include "version.h"
Include dependency graph for latexgen.cpp:

Go to the source code of this file.

Macros

#define COPYCHAR()

Functions

static DString substituteLatexKeywords (const DString &file, const DString &str, const DString &title)
static void writeLatexMakefile ()
static void writeMakeBat ()
static void writeDefaultStyleSheet (TextStream &t)
static DString extraLatexStyleSheet ()
static DString makeIndex ()
static DString latex_batchmode ()
static DString objectLinkToString (const DString &ref, const DString &f, const DString &anchor, const DString &text, bool insideTabbing, bool disableLinks)
static void processEntity (TextStream &t, bool pdfHyperlinks, const char *strForm, const char *strRepl)
void writeExtraLatexPackages (TextStream &t)
void writeLatexSpecialFormulaChars (TextStream &t)
void filterLatexString (TextStream &t, const DString &str, bool insideTabbing, bool insidePre, bool insideItem, bool insideTable, bool keepSpaces, const bool retainNewline)
DString convertToLaTeX (const DString &s, bool insideTabbing, bool keepSpaces)
DString latexEscapeLabelName (const DString &s)
DString latexEscapeIndexChars (const DString &s)
DString latexEscapePDFString (const DString &s)
DString latexFilterURL (const DString &s)
void latexWriteIndexItem (TextStream &m_t, const DString &s1, const DString &s2)

Variables

static DString g_header
static DString g_header_file
static DString g_footer
static DString g_footer_file
static const SelectionMarkerInfo latexMarkerInfo = { '%', "%%BEGIN ",8 ,"%%END ",6, "",0 }

Macro Definition Documentation

◆ COPYCHAR

#define COPYCHAR ( )
Value:
do { \
int bytes = getUTF8CharNumBytes(c); \
if (result.size() < static_cast<size_t>(i + bytes + 1)) \
{ \
result.resize(result.size() + 512); \
} \
for (int j=0; j<bytes && *p; j++) \
{ \
result[i++]=*p++; \
} \
m_col++; \
} while(0)
uint8_t getUTF8CharNumBytes(char c)
Returns the number of bytes making up a single UTF8 character given the first byte in the sequence.
Definition utf8.cpp:27

Referenced by LatexCodeGenerator::codify().

Function Documentation

◆ convertToLaTeX()

DString convertToLaTeX ( const DString & s,
bool insideTabbing,
bool keepSpaces )

Definition at line 2508 of file latexgen.cpp.

2509{
2510 TextStream t;
2511 filterLatexString(t,s,insideTabbing,false,false,false,keepSpaces);
2512 return t.str();
2513}
Text streaming class that buffers data.
Definition textstream.h:36
std::string str() const
Return the contents of the buffer as a std::string object.
Definition textstream.h:232
void filterLatexString(TextStream &t, const DString &str, bool insideTabbing, bool insidePre, bool insideItem, bool insideTable, bool keepSpaces, const bool retainNewline)

References filterLatexString(), and TextStream::str().

Referenced by LatexGenerator::endIndexSection(), objectLinkToString(), LatexGenerator::startIndexSection(), substituteLatexKeywords(), and LatexGenerator::writeInheritedSectionTitle().

◆ extraLatexStyleSheet()

DString extraLatexStyleSheet ( )
static

Definition at line 738 of file latexgen.cpp.

739{
740 DString result;
741 StringVector extraLatexStyles = Config_getList(LATEX_EXTRA_STYLESHEET);
742 for (const auto &fileName : extraLatexStyles)
743 {
744 if (!fileName.empty())
745 {
746 FileInfo fi(fileName);
747 if (fi.exists())
748 {
749 result += "\\usepackage{";
750 DString fn = fi.fileName();
752 {
753 // strip the extension, it will be added by the usepackage in the tex conversion process
755 }
756 else
757 {
758 result += fn;
759 }
760 result += "}\n";
761 }
762 }
763 }
764 return result;
765}
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
Minimal replacement for QFileInfo.
Definition fileinfo.h:26
#define Config_getList(name)
Definition config.h:38
std::vector< std::string > StringVector
Definition containers.h:33
#define LATEX_STYLE_EXTENSION
Definition latexgen.h:24
bool checkExtension(const DString &fName, const DString &ext)
Definition util.cpp:3932
DString stripExtensionGeneral(const DString &fName, const DString &ext)
Definition util.cpp:3951

References checkExtension(), Config_getList, FileInfo::exists(), FileInfo::fileName(), LATEX_STYLE_EXTENSION, and stripExtensionGeneral().

Referenced by substituteLatexKeywords().

◆ filterLatexString()

void filterLatexString ( TextStream & t,
const DString & str,
bool insideTabbing,
bool insidePre,
bool insideItem,
bool insideTable,
bool keepSpaces,
const bool retainNewline )

Definition at line 2361 of file latexgen.cpp.

2363{
2364 if (str.empty()) return;
2365 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
2366 //printf("filterLatexString(%s) insideTabbing=%d\n",qPrint(str),insideTabbing);
2367 const char *p = str.data();
2368 unsigned char pc='\0';
2369
2370 while (*p)
2371 {
2372 unsigned char c=static_cast<unsigned char>(*p++);
2373
2374 if (insidePre)
2375 {
2376 switch(c)
2377 {
2378 case 0xef: // handle U+FFFD i.e. "Replacement character" caused by octal: 357 277 275 / hexadecimal 0xef 0xbf 0xbd
2379 // the LaTeX command \ucr has been defined in doxygen.sty
2380 if (static_cast<unsigned char>(*(p)) == 0xbf && static_cast<unsigned char>(*(p+1)) == 0xbd)
2381 {
2382 t << "{\\ucr}";
2383 p += 2;
2384 }
2385 else
2386 t << static_cast<char>(c);
2387 break;
2388 case '\\': t << "\\(\\backslash\\)"; break;
2389 case '{': t << "\\{"; break;
2390 case '}': t << "\\}"; break;
2391 case '_': t << "\\_"; break;
2392 case '&': t << "\\&"; break;
2393 case '%': t << "\\%"; break;
2394 case '#': t << "\\#"; break;
2395 case '$': t << "\\$"; break;
2396 case '"': t << "\"{}"; break;
2397 case '-': t << "-\\/"; break;
2398 case '^': insideTable ? t << "\\string^" : t << static_cast<char>(c); break;
2399 case '~': t << "\\string~"; break;
2400 case '\n': if (retainNewline) t << "\\newline"; else t << ' ';
2401 break;
2402 case ' ': if (keepSpaces) t << "~"; else t << ' ';
2403 break;
2404 default:
2405 if (c<32) t << ' '; // non printable control character
2406 else t << static_cast<char>(c);
2407 break;
2408 }
2409 }
2410 else
2411 {
2412 switch(c)
2413 {
2414 case 0xef: // handle U+FFFD i.e. "Replacement character" caused by octal: 357 277 275 / hexadecimal 0xef 0xbf 0xbd
2415 // the LaTeX command \ucr has been defined in doxygen.sty
2416 if (static_cast<unsigned char>(*(p)) == 0xbf && static_cast<unsigned char>(*(p+1)) == 0xbd)
2417 {
2418 t << "{\\ucr}";
2419 p += 2;
2420 }
2421 else
2422 t << static_cast<char>(c);
2423 break;
2424 case '#': t << "\\+\\#"; break;
2425 case '$': t << "\\$"; break;
2426 case '%': t << "\\%"; break;
2427 case '^': processEntity(t,pdfHyperlinks,"$^\\wedge$","\\string^"); break;
2428 case '&': {
2429 // possibility to have a special symbol
2431 t,
2432 p-1,
2433 [](HtmlEntityMapper::SymType symType) { return HtmlEntityMapper::instance().latex(symType); },
2434 "\\&");
2435 }
2436 break;
2437 case '*': processEntity(t,pdfHyperlinks,"$\\ast$","*"); break;
2438 case '_': if (!insideTabbing && *p) t << "\\+";
2439 t << "\\_";
2440 if (!insideTabbing && *p) t << "\\+";
2441 break;
2442 case '{': t << "\\{"; break;
2443 case '}': t << "\\}"; break;
2444 case '<': t << "$<$"; break;
2445 case '>': t << "$>$"; break;
2446 case '|': processEntity(t,pdfHyperlinks,"$\\vert$","|"); break;
2447 case '~': processEntity(t,pdfHyperlinks,"$\\sim$","\\string~"); break;
2448 case '[': if (Config_getBool(PDF_HYPERLINKS) || insideItem)
2449 t << "\\+[";
2450 else
2451 t << "[";
2452 break;
2453 case ']': if (pc=='[') t << "$\\,$";
2454 if ((Config_getBool(PDF_HYPERLINKS) || insideItem) && *p)
2455 t << "]\\+";
2456 else
2457 t << "]";
2458 break;
2459 case '-': t << "-\\/";
2460 break;
2461 case '\\': t << "\\textbackslash{}";
2462 break;
2463 case '"': t << "\"{}";
2464 break;
2465 case '`': t << "\\`{}";
2466 break;
2467 case '\'': t << "\\textquotesingle{}";
2468 break;
2469 case '\n': if (retainNewline)
2470 {
2471 t << "\\newline";
2472 if (insideTable) t << " ";
2473 }
2474 else
2475 {
2476 t << ' ';
2477 }
2478 break;
2479 case ' ': if (keepSpaces) { if (insideTabbing) t << "\\>"; else t << '~'; } else t << ' ';
2480 break;
2481
2482 default:
2483 //if (!insideTabbing && forceBreaks && c!=' ' && *p!=' ')
2484 if (!insideTabbing &&
2485 ((c>='A' && c<='Z' && pc!=' ' && !(pc>='A' && pc <= 'Z') && pc!='\0' && *p) || (pc=='.' && isId(c)))
2486 )
2487 {
2488 t << "\\+";
2489 }
2490 if (c<32)
2491 {
2492 t << ' '; // non-printable control character
2493 }
2494 else
2495 {
2496 t << static_cast<char>(c);
2497 }
2498 if (!insideTabbing && *p && ((c==':' && *p!=':') || c=='/'))
2499 {
2500 t << "\\+";
2501 }
2502 }
2503 }
2504 pc = c;
2505 }
2506}
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition dstring.h:157
const char * latex(SymType symb) const
Access routine to the LaTeX code of the HTML entity.
const char * writeHtmlEntity(T &result, const char *s, HtmlEntityMapperFunc &&mapper, const char *fallback)
Definition htmlentity.h:127
static HtmlEntityMapper & instance()
Returns the one and only instance of the HTML entity mapper.
#define Config_getBool(name)
Definition config.h:33
bool insideTable(const DocNodeVariant *n)
bool isId(char c)
Returns true if c is a valid character for an identifier.
Definition dstring.h:895
static void processEntity(TextStream &t, bool pdfHyperlinks, const char *strForm, const char *strRepl)

References Config_getBool, DString::data(), DString::empty(), insideTable(), HtmlEntityMapper::instance(), isId(), HtmlEntityMapper::latex(), processEntity(), and HtmlEntityMapper::writeHtmlEntity().

Referenced by LatexCodeGenerator::codify(), convertToLaTeX(), LatexGenerator::docify(), LatexDocVisitor::filter(), latexEscapeIndexChars(), latexEscapeLabelName(), and substituteLatexKeywords().

◆ latex_batchmode()

DString latex_batchmode ( )
static

Definition at line 785 of file latexgen.cpp.

786{
787 switch (Config_getEnum(LATEX_BATCHMODE))
788 {
789 case LATEX_BATCHMODE_t::NO: return "";
790 case LATEX_BATCHMODE_t::YES: return "\\batchmode";
791 case LATEX_BATCHMODE_t::BATCH: return "\\batchmode";
792 case LATEX_BATCHMODE_t::NON_STOP: return "\\nonstopmode";
793 case LATEX_BATCHMODE_t::SCROLL: return "\\scrollmode";
794 case LATEX_BATCHMODE_t::ERROR_STOP: return "\\errorstopmode";
795 }
796 return "";
797}
#define Config_getEnum(name)
Definition config.h:35

References Config_getEnum.

Referenced by substituteLatexKeywords().

◆ latexEscapeIndexChars()

DString latexEscapeIndexChars ( const DString & s)

Definition at line 2560 of file latexgen.cpp.

2561{
2562 //printf("latexEscapeIndexChars(%s)\n",qPrint(s));
2563 if (s.empty()) return s;
2565 TextStream t;
2566 const char *p=s.data();
2567 char c = 0;
2568 while ((c=*p++))
2569 {
2570 switch (c)
2571 {
2572 case '!': t << "\"!"; break;
2573 case '"': t << "\"\""; break;
2574 case '@': t << "\"@"; break;
2575 case '|': t << "\\texttt{\"|}"; break;
2576 case '[': t << "["; break;
2577 case ']': t << "]"; break;
2578 case '{': t << "\\lcurly{}"; break;
2579 case '}': t << "\\rcurly{}"; break;
2580 // NOTE: adding a case here, means adding it to while below as well!
2581 default:
2582 {
2583 int i=0;
2584 // collect as long string as possible, before handing it to docify
2585 tmp[i++]=c;
2586 while ((c=*p) && c!='"' && c!='@' && c!='[' && c!=']' && c!='!' && c!='{' && c!='}' && c!='|')
2587 {
2588 tmp[i++]=c;
2589 p++;
2590 }
2591 tmp[i]=0;
2592 filterLatexString(t,tmp,
2593 true, // insideTabbing
2594 false, // insidePre
2595 false, // insideItem
2596 false, // insideTable
2597 false // keepSpaces
2598 );
2599 }
2600 break;
2601 }
2602 }
2603 return t.str();
2604}
@ ExplicitSize
Definition dstring.h:131
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:151

References DString::data(), DString::empty(), DString::ExplicitSize, filterLatexString(), DString::length(), and TextStream::str().

Referenced by latexWriteIndexItem(), and LatexGenerator::startMemberDoc().

◆ latexEscapeLabelName()

DString latexEscapeLabelName ( const DString & s)

Definition at line 2515 of file latexgen.cpp.

2516{
2517 //printf("latexEscapeLabelName(%s)\n",qPrint(s));
2518 if (s.empty()) return s;
2520 TextStream t;
2521 const char *p=s.data();
2522 char c = 0;
2523 while ((c=*p++))
2524 {
2525 switch (c)
2526 {
2527 case '|': t << "\\texttt{\"|}"; break;
2528 case '!': t << "\"!"; break;
2529 case '@': t << "\"@"; break;
2530 case '%': t << "\\%"; break;
2531 case '{': t << "\\lcurly{}"; break;
2532 case '}': t << "\\rcurly{}"; break;
2533 case '~': t << "````~"; break; // to get it a bit better in index together with other special characters
2534 // NOTE: adding a case here, means adding it to while below as well!
2535 default:
2536 {
2537 int i=0;
2538 // collect as long string as possible, before handing it to docify
2539 tmp[i++]=c;
2540 while ((c=*p) && c!='@' && c!='[' && c!=']' && c!='!' && c!='{' && c!='}' && c!='|')
2541 {
2542 tmp[i++]=c;
2543 p++;
2544 }
2545 tmp[i]=0;
2546 filterLatexString(t,tmp,
2547 true, // insideTabbing
2548 false, // insidePre
2549 false, // insideItem
2550 false, // insideTable
2551 false // keepSpaces
2552 );
2553 }
2554 break;
2555 }
2556 }
2557 return t.str();
2558}

References DString::data(), DString::empty(), DString::ExplicitSize, filterLatexString(), DString::length(), and TextStream::str().

Referenced by latexWriteIndexItem().

◆ latexEscapePDFString()

DString latexEscapePDFString ( const DString & s)

Definition at line 2606 of file latexgen.cpp.

2607{
2608 if (s.empty()) return s;
2609 TextStream t;
2610 const char *p=s.data();
2611 char c = 0;
2612 while ((c=*p++))
2613 {
2614 switch (c)
2615 {
2616 case '\\': t << "\\textbackslash{}"; break;
2617 case '{': t << "\\{"; break;
2618 case '}': t << "\\}"; break;
2619 case '_': t << "\\_"; break;
2620 case '%': t << "\\%"; break;
2621 case '&': t << "\\&"; break;
2622 case '#': t << "\\#"; break;
2623 case '$': t << "\\$"; break;
2624 case '^': t << "\\string^"; break;
2625 case '~': t << "\\string~"; break;
2626 default:
2627 t << c;
2628 break;
2629 }
2630 }
2631 return t.str();
2632}

References DString::data(), DString::empty(), and TextStream::str().

Referenced by LatexGenerator::startMemberDoc().

◆ latexFilterURL()

DString latexFilterURL ( const DString & s)

Definition at line 2634 of file latexgen.cpp.

2635{
2636 constexpr auto hex = "0123456789ABCDEF";
2637 if (s.empty()) return s;
2638 TextStream t;
2639 const char *p=s.data();
2640 char c = 0;
2641 while ((c=*p++))
2642 {
2643 switch (c)
2644 {
2645 case '#': t << "\\#"; break;
2646 case '%': t << "\\%"; break;
2647 case '\\': t << "\\\\"; break;
2648 case '\n': break; // ignore
2649 default:
2650 if (static_cast<signed char>(c)<0)
2651 {
2652 unsigned char id = static_cast<unsigned char>(c);
2653 t << "\\%" << hex[id>>4] << hex[id&0xF];
2654 }
2655 else
2656 {
2657 t << c;
2658 }
2659 break;
2660 }
2661 }
2662 return t.str();
2663}

References DString::data(), DString::empty(), and TextStream::str().

Referenced by LatexDocVisitor::operator()(), and LatexDocVisitor::operator()().

◆ latexWriteIndexItem()

void latexWriteIndexItem ( TextStream & m_t,
const DString & s1,
const DString & s2 )

Definition at line 2665 of file latexgen.cpp.

2666{
2667 if (!s1.empty())
2668 {
2669 m_t << "\\index{";
2670 m_t << latexEscapeLabelName(s1);
2671 m_t << "@{";
2672 m_t << latexEscapeIndexChars(s1);
2673 m_t << "}";
2674 if (!s2.empty())
2675 {
2676 m_t << "!";
2677 m_t << latexEscapeLabelName(s2);
2678 m_t << "@{";
2679 m_t << latexEscapeIndexChars(s2);
2680 m_t << "}";
2681 }
2682 m_t << "}\n";
2683 }
2684}
DString latexEscapeIndexChars(const DString &s)
DString latexEscapeLabelName(const DString &s)

References DString::empty(), latexEscapeIndexChars(), and latexEscapeLabelName().

Referenced by LatexGenerator::addIndexItem(), LatexGenerator::endTitleHead(), LatexDocVisitor::operator()(), and LatexGenerator::startMemberDoc().

◆ makeIndex()

DString makeIndex ( )
static

Definition at line 767 of file latexgen.cpp.

768{
769 DString result;
770 DString latex_mkidx_command = Config_getString(LATEX_MAKEINDEX_CMD);
771 if (!latex_mkidx_command.empty())
772 {
773 if (latex_mkidx_command[0] == '\\')
774 result += latex_mkidx_command;
775 else
776 result += "\\"+latex_mkidx_command;
777 }
778 else
779 {
780 result += "\\makeindex";
781 }
782 return result;
783}
#define Config_getString(name)
Definition config.h:32

References Config_getString, and DString::empty().

Referenced by substituteLatexKeywords().

◆ objectLinkToString()

DString objectLinkToString ( const DString & ref,
const DString & f,
const DString & anchor,
const DString & text,
bool insideTabbing,
bool disableLinks )
static

Definition at line 1412 of file latexgen.cpp.

1415{
1416 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1417 DString result;
1418 if (!disableLinks && ref.empty() && pdfHyperlinks)
1419 {
1420 result += "\\doxymbox{\\hyperlink{";
1421 if (!f.empty()) result += stripPath(f);
1422 if (!f.empty() && !anchor.empty()) result += "_";
1423 if (!anchor.empty()) result += anchor;
1424 result += "}{";
1425 result += convertToLaTeX(text,insideTabbing);
1426 result += "}}";
1427 }
1428 else
1429 {
1430 result += "\\textbf{ ";
1431 result += convertToLaTeX(text,insideTabbing);
1432 result += "}";
1433 }
1434 return result;
1435}
DString convertToLaTeX(const DString &s, bool insideTabbing, bool keepSpaces)
DString stripPath(const DString &s)
Definition util.cpp:3966

References Config_getBool, convertToLaTeX(), DString::empty(), and stripPath().

Referenced by LatexGenerator::writeInheritedSectionTitle(), and LatexGenerator::writeObjectLink().

◆ processEntity()

void processEntity ( TextStream & t,
bool pdfHyperlinks,
const char * strForm,
const char * strRepl )
static

Definition at line 1437 of file latexgen.cpp.

1438{
1439 if (pdfHyperlinks)
1440 {
1441 t << "\\texorpdfstring{";
1442 }
1443 t << strForm;
1444 if (pdfHyperlinks)
1445 {
1446 t << "}{" << strRepl << "}";
1447 }
1448}

Referenced by filterLatexString().

◆ substituteLatexKeywords()

DString substituteLatexKeywords ( const DString & file,
const DString & str,
const DString & title )
static

Definition at line 799 of file latexgen.cpp.

802{
803 bool compactLatex = Config_getBool(COMPACT_LATEX);
804 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
805 bool usePdfLatex = Config_getBool(USE_PDFLATEX);
806 DString paperType = Config_getEnumAsString(PAPER_TYPE);
807
808 DString style = Config_getString(LATEX_BIB_STYLE);
809 if (style.empty())
810 {
811 style="plainnat";
812 }
813
814 TextStream tg;
815 DString generatedBy;
816 auto timeStamp = Config_getEnum(TIMESTAMP);
817 switch (timeStamp)
818 {
819 case TIMESTAMP_t::YES:
820 case TIMESTAMP_t::DATETIME:
822 Config_getString(PROJECT_NAME));
823 break;
824 case TIMESTAMP_t::DATE:
826 Config_getString(PROJECT_NAME));
827 break;
828 case TIMESTAMP_t::NO:
829 generatedBy = theTranslator->trGeneratedBy();
830 break;
831 }
832 filterLatexString(tg, generatedBy,
833 false, // insideTabbing
834 false, // insidePre
835 false, // insideItem
836 false, // insideTable
837 false // keepSpaces
838 );
839 generatedBy = tg.str();
840
841 DString latexFontenc = theTranslator->latexFontenc();
842
843 DString latexEmojiDirectory = Config_getString(LATEX_EMOJI_DIRECTORY);
844 if (latexEmojiDirectory.empty()) latexEmojiDirectory = ".";
845 latexEmojiDirectory = substitute(latexEmojiDirectory,"\\","/");
846
847 TextStream tg1;
849 DString extraLatexPackages = tg1.str();
850
851 TextStream tg2;
853 DString latexSpecialFormulaChars = tg2.str();
854
855 DString formulaMacrofile = Config_getString(FORMULA_MACROFILE);
856 DString stripMacroFile;
857 if (!formulaMacrofile.empty())
858 {
859 FileInfo fi(formulaMacrofile.str());
860 formulaMacrofile=fi.absFilePath();
861 stripMacroFile = fi.fileName();
862 copyFile(formulaMacrofile,Config_getString(LATEX_OUTPUT) + "/" + stripMacroFile);
863 }
864
865 DString projectNumber = Config_getString(PROJECT_NUMBER);
866 DString projName = convertToLaTeX(Config_getString(PROJECT_NAME), false);
867 DString projBrief = convertToLaTeX(Config_getString(PROJECT_BRIEF),false);
868
869 // first substitute generic keywords then the LaTeX only keywords
870 DString result = substituteKeywords(file,str,
871 {
872 // keyword value getter
873 { "$title", [&]() { return !title.empty() ? title : projName; } },
874 { "$doxygenversion", [&]() { return getDoxygenVersion(); } },
875 { "$projectname", [&]() { return projName; } },
876 { "$projectnumber", [&]() { return convertToLaTeX(projectNumber,false); } },
877 { "$projectbrief", [&]() { return projBrief; } },
878 { "$projectlogo", [&]() { return stripPath(projectLogoFile()); } },
879 { "$logosize", [&]() { return projectLogoSize(); } },
880 { "$projecticon", [&]() { return stripPath(Config_getString(PROJECT_ICON)); } },
881 { "$langISO", [&]() { return theTranslator->trISOLang(); } },
882 { "$showdate", [&](const DString &fmt) { return showDate(fmt); } },
883
884 // keyword value getter
885 { "$datetime", [&]() { return dateToString(DateTimeType::DateTime); } },
886 { "$date", [&]() { return dateToString(DateTimeType::Date); } },
887 { "$time", [&]() { return dateToString(DateTimeType::Time); } },
888 { "$year", [&]() { return yearToString(); } },
889 { "$latexdocumentpre", [&]() { return theTranslator->latexDocumentPre(); } },
890 { "$latexdocumentpost", [&]() { return theTranslator->latexDocumentPost(); } },
891 { "$generatedby", [&]() { return generatedBy; } },
892 { "$latexbibstyle", [&]() { return style; } },
893 { "$latexcitereference", [&]() { return theTranslator->trCiteReferences(); } },
894 { "$latexbibfiles", [&]() { return CitationManager::instance().latexBibFiles(); } },
895 { "$papertype", [&]() { return paperType+"paper"; } },
896 { "$extralatexstylesheet", [&]() { return extraLatexStyleSheet(); } },
897 { "$languagesupport", [&]() { return theTranslator->latexLanguageSupportCommand(); } },
898 { "$latexfontenc", [&]() { return latexFontenc; } },
899 { "$latexfont", [&]() { return theTranslator->latexFont(); } },
900 { "$latexemojidirectory", [&]() { return latexEmojiDirectory; } },
901 { "$makeindex", [&]() { return makeIndex(); } },
902 { "$extralatexpackages", [&]() { return extraLatexPackages; } },
903 { "$latexspecialformulachars", [&]() { return latexSpecialFormulaChars; } },
904 { "$formulamacrofile", [&]() { return stripMacroFile; } },
905 { "$latex_batchmode", [&]() { return latex_batchmode(); } }
906 });
907
908 // remove conditional blocks
909 result = selectBlocks(result,
910 {
911 // marker is enabled
912 { "CITATIONS_PRESENT", !CitationManager::instance().empty() },
913 { "COMPACT_LATEX", compactLatex },
914 { "PDF_HYPERLINKS", pdfHyperlinks },
915 { "USE_PDFLATEX", usePdfLatex },
916 { "TIMESTAMP", timeStamp!=TIMESTAMP_t::NO },
917 { "LATEX_FONTENC", !latexFontenc.empty() },
918 { "FORMULA_MACROFILE", !formulaMacrofile.empty() },
919 { "PROJECT_NUMBER", !projectNumber.empty() }
921
922 result = removeEmptyLines(result.str());
923
924 return result;
925}
static CitationManager & instance()
Definition cite.cpp:90
bool empty() const
return true if there are no citations.
Definition cite.cpp:120
DString latexBibFiles()
lists the bibtex cite files in a comma separated list
Definition cite.cpp:576
const std::string & str() const
Definition dstring.h:645
virtual DString latexDocumentPost()
Definition translator.h:67
virtual DString trGeneratedAt(const DString &date, const DString &projName)=0
virtual DString latexFontenc()
Definition translator.h:52
virtual DString trCiteReferences()=0
virtual DString latexLanguageSupportCommand()=0
virtual DString trISOLang()=0
virtual DString latexFont()
Definition translator.h:53
virtual DString latexDocumentPre()
Definition translator.h:62
virtual DString trGeneratedBy()=0
#define Config_getEnumAsString(name)
Definition config.h:36
DString yearToString()
Returns the current year as a string.
Definition datetime.cpp:77
DString dateToString(DateTimeType includeTime)
Returns the current date, when includeTime is set also the time is provided.
Definition datetime.cpp:64
DString substitute(const DString &s, const DString &src, const DString &dst)
substitute all occurrences of src in s by dst
Definition dstring.cpp:485
Translator * theTranslator
Definition language.cpp:76
static DString extraLatexStyleSheet()
Definition latexgen.cpp:738
static DString latex_batchmode()
Definition latexgen.cpp:785
static const SelectionMarkerInfo latexMarkerInfo
Definition latexgen.cpp:56
void writeExtraLatexPackages(TextStream &t)
static DString makeIndex()
Definition latexgen.cpp:767
void writeLatexSpecialFormulaChars(TextStream &t)
Definition message.h:146
std::string removeEmptyLines(const std::string &s)
Definition stringutil.h:193
DString selectBlocks(const DString &s, const SelectionBlockList &blockList, const SelectionMarkerInfo &markerInfo)
remove disabled blocks and all block markers from s and return the result as a string
Definition util.cpp:5022
DString showDate(const DString &fmt)
Definition util.cpp:2573
DString substituteKeywords(const DString &file, const DString &s, const KeywordSubstitutionList &keywords)
Definition util.cpp:2500
DString projectLogoFile()
Definition util.cpp:2586
bool copyFile(const DString &src, const DString &dest)
Copies the contents of file with name src to the newly created file with name dest.
Definition util.cpp:4625
DString projectLogoSize()
Definition util.cpp:2605

References FileInfo::absFilePath(), Config_getBool, Config_getEnum, Config_getEnumAsString, Config_getString, convertToLaTeX(), copyFile(), Date, DateTime, dateToString(), CitationManager::empty(), DString::empty(), extraLatexStyleSheet(), FileInfo::fileName(), filterLatexString(), CitationManager::instance(), latex_batchmode(), CitationManager::latexBibFiles(), Translator::latexDocumentPost(), Translator::latexDocumentPre(), Translator::latexFont(), Translator::latexFontenc(), Translator::latexLanguageSupportCommand(), latexMarkerInfo, makeIndex(), projectLogoFile(), projectLogoSize(), removeEmptyLines(), selectBlocks(), showDate(), DString::str(), TextStream::str(), stripPath(), substitute(), substituteKeywords(), theTranslator, Time, Translator::trCiteReferences(), Translator::trGeneratedAt(), Translator::trGeneratedBy(), Translator::trISOLang(), writeExtraLatexPackages(), writeLatexSpecialFormulaChars(), and yearToString().

Referenced by LatexGenerator::endIndexSection(), LatexGenerator::init(), and LatexGenerator::startIndexSection().

◆ writeDefaultStyleSheet()

void writeDefaultStyleSheet ( TextStream & t)
static

Definition at line 685 of file latexgen.cpp.

686{
687 t << ResourceMgr::instance().getAsString("doxygen.sty");
688}
static ResourceMgr & instance()
Returns the one and only instance of this class.
DString getAsString(const DString &name) const
Gets the resource data as a C string.

References ResourceMgr::getAsString(), and ResourceMgr::instance().

Referenced by LatexGenerator::writeStyleInfo(), and LatexGenerator::writeStyleSheetFile().

◆ writeExtraLatexPackages()

void writeExtraLatexPackages ( TextStream & t)

Definition at line 2300 of file latexgen.cpp.

2301{
2302 // User-specified packages
2303 StringVector extraPackages = Config_getList(EXTRA_PACKAGES);
2304 if (!extraPackages.empty())
2305 {
2306 t << "% Packages requested by user\n";
2307 for (const auto &pkgName : extraPackages)
2308 {
2309 if ((pkgName[0] == '[') || (pkgName[0] == '{'))
2310 t << "\\usepackage" << pkgName << "\n";
2311 else
2312 t << "\\usepackage{" << pkgName << "}\n";
2313 }
2314 t << "\n";
2315 }
2316}

References Config_getList.

Referenced by FormulaManager::createLatexFile(), and substituteLatexKeywords().

◆ writeLatexMakefile()

void writeLatexMakefile ( )
static

Definition at line 366 of file latexgen.cpp.

367{
368 bool generateBib = !CitationManager::instance().empty();
369 DString fileName=Config_getString(LATEX_OUTPUT)+"/Makefile";
370 std::ofstream f = Portable::openOutputStream(fileName);
371 if (!f.is_open())
372 {
373 term("Could not open file {} for writing\n",fileName);
374 }
375 TextStream t(&f);
376 // inserted by KONNO Akihisa <konno@researchers.jp> 2002-03-05
377 DString latex_command = theTranslator->latexCommandName().quoted();
378 DString mkidx_command = Config_getString(MAKEINDEX_CMD_NAME).quoted();
379 DString bibtex_command = "bibtex";
380 DString manual_file = "refman";
381 const int latex_count = 8;
382 // end insertion by KONNO Akihisa <konno@researchers.jp> 2002-03-05
383 t << "LATEX_CMD?=" << latex_command << "\n"
384 << "MKIDX_CMD?=" << mkidx_command << "\n"
385 << "BIBTEX_CMD?=" << bibtex_command << "\n"
386 << "LATEX_COUNT?=" << latex_count << "\n"
387 << "MANUAL_FILE?=" << manual_file << "\n"
388 << "\n";
389 if (!Config_getBool(USE_PDFLATEX)) // use plain old latex
390 {
391 t << "all: $(MANUAL_FILE).dvi\n"
392 << "\n"
393 << "ps: $(MANUAL_FILE).ps\n"
394 << "\n"
395 << "pdf: $(MANUAL_FILE).pdf\n"
396 << "\n"
397 << "ps_2on1: $(MANUAL_FILE).ps\n"
398 << "\n"
399 << "pdf_2on1: $(MANUAL_FILE).pdf\n"
400 << "\n"
401 << "$(MANUAL_FILE).ps: $(MANUAL_FILE).dvi\n"
402 << "\tdvips -o $(MANUAL_FILE).ps $(MANUAL_FILE).dvi\n"
403 << "\n";
404 t << "$(MANUAL_FILE).pdf: $(MANUAL_FILE).ps\n";
405 t << "\tps2pdf $(MANUAL_FILE).ps $(MANUAL_FILE).pdf\n\n";
406 t << "$(MANUAL_FILE).dvi: clean $(MANUAL_FILE).tex doxygen.sty\n"
407 << "\techo \"Running latex...\"\n"
408 << "\t$(LATEX_CMD) $(MANUAL_FILE).tex || \\\n"
409 << "\tif [ $$? != 0 ] ; then \\\n"
410 << "\t \\echo \"Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n"
411 << "\t false; \\\n"
412 << "\tfi\n"
413 << "\techo \"Running makeindex...\"\n"
414 << "\t$(MKIDX_CMD) $(MANUAL_FILE).idx\n";
415 if (generateBib)
416 {
417 t << "\techo \"Running bibtex...\"\n";
418 t << "\t$(BIBTEX_CMD) $(MANUAL_FILE)\n";
419 t << "\techo \"Rerunning latex....\"\n";
420 t << "\t$(LATEX_CMD) $(MANUAL_FILE).tex || \\\n"
421 << "\tif [ $$? != 0 ] ; then \\\n"
422 << "\t \\echo \"Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n"
423 << "\t false; \\\n"
424 << "\tfi\n";
425 }
426 t << "\techo \"Rerunning latex....\"\n"
427 << "\t$(LATEX_CMD) $(MANUAL_FILE).tex\n"
428 << "\tlatex_count=$(LATEX_COUNT) ; \\\n"
429 << "\twhile grep -E -s 'Rerun (LaTeX|to get cross-references right|to get bibliographical references right)' $(MANUAL_FILE).log && [ $$latex_count -gt 0 ] ;\\\n"
430 << "\t do \\\n"
431 << "\t echo \"Rerunning latex....\" ;\\\n"
432 << "\t $(LATEX_CMD) $(MANUAL_FILE).tex ; \\\n"
433 << "\t $(LATEX_CMD) $(MANUAL_FILE).tex || \\\n"
434 << "\t if [ $$? != 0 ] ; then \\\n"
435 << "\t \\echo \"Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n"
436 << "\t false; \\\n"
437 << "\t fi; \\\n"
438 << "\t latex_count=`expr $$latex_count - 1` ;\\\n"
439 << "\t done\n"
440 << "\t$(MKIDX_CMD) $(MANUAL_FILE).idx\n"
441 << "\t$(LATEX_CMD) $(MANUAL_FILE).tex || \\\n"
442 << "\tif [ $$? != 0 ] ; then \\\n"
443 << "\t \\echo \"Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n"
444 << "\t false; \\\n"
445 << "\tfi\n"
446 << "$(MANUAL_FILE).ps: $(MANUAL_FILE).ps\n"
447 << "\tpsnup -2 $(MANUAL_FILE).ps >$(MANUAL_FILE).ps\n"
448 << "\n"
449 << "$(MANUAL_FILE).pdf: $(MANUAL_FILE).ps\n"
450 << "\tps2pdf $(MANUAL_FILE).ps $(MANUAL_FILE).pdf\n";
451 }
452 else // use pdflatex for higher quality output
453 {
454 t << "all: $(MANUAL_FILE).pdf\n\n"
455 << "pdf: $(MANUAL_FILE).pdf\n\n";
456 t << "$(MANUAL_FILE).pdf: clean $(MANUAL_FILE).tex\n";
457 t << "\t$(LATEX_CMD) $(MANUAL_FILE) || \\\n"
458 << "\tif [ $$? != 0 ] ; then \\\n"
459 << "\t \\echo \"Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n"
460 << "\t false; \\\n"
461 << "\tfi\n";
462 t << "\t$(MKIDX_CMD) $(MANUAL_FILE).idx\n";
463 if (generateBib)
464 {
465 t << "\t$(BIBTEX_CMD) $(MANUAL_FILE)\n";
466 t << "\t$(LATEX_CMD) $(MANUAL_FILE) || \\\n"
467 << "\tif [ $$? != 0 ] ; then \\\n"
468 << "\t \\echo \"Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n"
469 << "\t false; \\\n"
470 << "\tfi\n";
471 }
472 t << "\t$(LATEX_CMD) $(MANUAL_FILE) || \\\n"
473 << "\tif [ $$? != 0 ] ; then \\\n"
474 << "\t \\echo \"Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n"
475 << "\t false; \\\n"
476 << "\tfi\n"
477 << "\tlatex_count=$(LATEX_COUNT) ; \\\n"
478 << "\twhile grep -E -s 'Rerun (LaTeX|to get cross-references right|to get bibliographical references right)' $(MANUAL_FILE).log && [ $$latex_count -gt 0 ] ;\\\n"
479 << "\t do \\\n"
480 << "\t echo \"Rerunning latex....\" ;\\\n"
481 << "\t $(LATEX_CMD) $(MANUAL_FILE) || \\\n"
482 << "\t if [ $$? != 0 ] ; then \\\n"
483 << "\t \\echo \"Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n"
484 << "\t false; \\\n"
485 << "\t fi; \\\n"
486 << "\t latex_count=`expr $$latex_count - 1` ;\\\n"
487 << "\t done\n"
488 << "\t$(MKIDX_CMD) $(MANUAL_FILE).idx\n"
489 << "\t$(LATEX_CMD) $(MANUAL_FILE) || \\\n"
490 << "\tif [ $$? != 0 ] ; then \\\n"
491 << "\t \\echo \"Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n"
492 << "\t false; \\\n"
493 << "\tfi\n";
494 }
495
496 t << "\n"
497 << "clean:\n"
498 << "\trm -f "
499 << "*.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out *.brf *.blg *.bbl $(MANUAL_FILE).pdf\n";
500}
DString quoted() const
Definition dstring.h:352
virtual DString latexCommandName()
Definition translator.h:71
#define term(fmt,...)
Definition message.h:137
std::ofstream openOutputStream(const DString &name, bool append=false)
Definition portable.cpp:681

References Config_getBool, Config_getString, CitationManager::empty(), CitationManager::instance(), Translator::latexCommandName(), Portable::openOutputStream(), DString::quoted(), term, and theTranslator.

Referenced by LatexGenerator::init().

◆ writeLatexSpecialFormulaChars()

void writeLatexSpecialFormulaChars ( TextStream & t)

Definition at line 2318 of file latexgen.cpp.

2319{
2320 unsigned char minus[4]; // Superscript minus
2321 unsigned char sup2[3]; // Superscript two
2322 unsigned char sup3[3];
2323 minus[0]= 0xE2;
2324 minus[1]= 0x81;
2325 minus[2]= 0xBB;
2326 minus[3]= 0;
2327 sup2[0]= 0xC2;
2328 sup2[1]= 0xB2;
2329 sup2[2]= 0;
2330 sup3[0]= 0xC2;
2331 sup3[1]= 0xB3;
2332 sup3[2]= 0;
2333
2334 t << "\\ifPDFTeX\n";
2335 t << "\\usepackage{newunicodechar}\n";
2336 // taken from the newunicodechar package and removed the warning message
2337 // actually forcing to redefine the unicode character
2338 t << " \\makeatletter\n"
2339 " \\def\\doxynewunicodechar#1#2{%\n"
2340 " \\@tempswafalse\n"
2341 " \\edef\\nuc@tempa{\\detokenize{#1}}%\n"
2342 " \\if\\relax\\nuc@tempa\\relax\n"
2343 " \\nuc@emptyargerr\n"
2344 " \\else\n"
2345 " \\edef\\@tempb{\\expandafter\\@car\\nuc@tempa\\@nil}%\n"
2346 " \\nuc@check\n"
2347 " \\if@tempswa\n"
2348 " \\@namedef{u8:\\nuc@tempa}{#2}%\n"
2349 " \\fi\n"
2350 " \\fi\n"
2351 " }\n"
2352 " \\makeatother\n";
2353
2354 t << " \\doxynewunicodechar{" << minus << "}{${}^{-}$}% Superscript minus\n"
2355 " \\doxynewunicodechar{" << sup2 << "}{${}^{2}$}% Superscript two\n"
2356 " \\doxynewunicodechar{" << sup3 << "}{${}^{3}$}% Superscript three\n"
2357 "\n";
2358 t << "\\fi\n";
2359}

Referenced by FormulaManager::createLatexFile(), and substituteLatexKeywords().

◆ writeMakeBat()

void writeMakeBat ( )
static

Definition at line 502 of file latexgen.cpp.

503{
504#if defined(_MSC_VER)
505 DString dir=Config_getString(LATEX_OUTPUT);
506 DString fileName=dir+"/make.bat";
507 DString latex_command = theTranslator->latexCommandName().quoted();
508 DString mkidx_command = Config_getString(MAKEINDEX_CMD_NAME).quoted();
509 DString bibtex_command = "bibtex";
510 DString manual_file = "refman";
511 const int latex_count = 8;
512 bool generateBib = !CitationManager::instance().empty();
513 std::ofstream t = Portable::openOutputStream(fileName);
514 if (!t.is_open())
515 {
516 term("Could not open file {} for writing\n",fileName);
517 }
518 t << "pushd %~dp0\r\n";
519 t << "if not %errorlevel% == 0 goto :end1\r\n";
520 t << "\r\n";
521 t << "set ORG_LATEX_CMD=%LATEX_CMD%\r\n";
522 t << "set ORG_MKIDX_CMD=%MKIDX_CMD%\r\n";
523 t << "set ORG_BIBTEX_CMD=%BIBTEX_CMD%\r\n";
524 t << "set ORG_LATEX_COUNT=%LATEX_COUNT%\r\n";
525 t << "set ORG_MANUAL_FILE=%MANUAL_FILE%\r\n";
526 t << "if \"X\"%LATEX_CMD% == \"X\" set LATEX_CMD=" << latex_command << "\r\n";
527 t << "if \"X\"%MKIDX_CMD% == \"X\" set MKIDX_CMD=" << mkidx_command << "\r\n";
528 t << "if \"X\"%BIBTEX_CMD% == \"X\" set BIBTEX_CMD=" << bibtex_command << "\r\n";
529 t << "if \"X\"%LATEX_COUNT% == \"X\" set LATEX_COUNT=" << latex_count << "\r\n";
530 t << "if \"X\"%MANUAL_FILE% == \"X\" set MANUAL_FILE=" << manual_file << "\r\n";
531 t << "\r\n";
532 t << "del /s /f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out *.brf *.blg *.bbl %MANUAL_FILE%.pdf\r\n\r\n";
533 t << "\r\n";
534 if (!Config_getBool(USE_PDFLATEX)) // use plain old latex
535 {
536 t << "%LATEX_CMD% %MANUAL_FILE%.tex\r\n";
537 t << "@if ERRORLEVEL 1 goto :error\r\n";
538 t << "echo ----\r\n";
539 t << "%MKIDX_CMD% %MANUAL_FILE%.idx\r\n";
540 if (generateBib)
541 {
542 t << "%BIBTEX_CMD% %MANUAL_FILE%\r\n";
543 t << "echo ----\r\n";
544 t << "\t%LATEX_CMD% %MANUAL_FILE%.tex\r\n";
545 t << "@if ERRORLEVEL 1 goto :error\r\n";
546 }
547 t << "setlocal enabledelayedexpansion\r\n";
548 t << "set count=%LAT#EX_COUNT%\r\n";
549 t << ":repeat\r\n";
550 t << "set content=X\r\n";
551 t << "for /F \"tokens=*\" %%T in ( 'findstr /C:\"Rerun LaTeX\" %MANUAL_FILE%.log' ) do set content=\"%%~T\"\r\n";
552 t << "if !content! == X for /F \"tokens=*\" %%T in ( 'findstr /C:\"Rerun to get cross-references right\" %MANUAL_FILE%.log' ) do set content=\"%%~T\"\r\n";
553 t << "if !content! == X for /F \"tokens=*\" %%T in ( 'findstr /C:\"Rerun to get bibliographical references right\" %MANUAL_FILE%.log' ) do set content=\"%%~T\"\r\n";
554 t << "if !content! == X goto :skip\r\n";
555 t << "set /a count-=1\r\n";
556 t << "if !count! EQU 0 goto :skip\r\n\r\n";
557 t << "echo ----\r\n";
558 t << "%LATEX_CMD% %MANUAL_FILE%.tex\r\n";
559 t << "@if ERRORLEVEL 1 goto :error\r\n";
560 t << "goto :repeat\r\n";
561 t << ":skip\r\n";
562 t << "endlocal\r\n";
563 t << "%MKIDX_CMD% %MANUAL_FILE%.idx\r\n";
564 t << "%LATEX_CMD% %MANUAL_FILE%.tex\r\n";
565 t << "@if ERRORLEVEL 1 goto :error\r\n";
566 t << "dvips -o %MANUAL_FILE%.ps %MANUAL_FILE%.dvi\r\n";
568 t << " -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite "
569 "-sOutputFile=%MANUAL_FILE%.pdf -c save pop -f %MANUAL_FILE%.ps\r\n";
570 }
571 else // use pdflatex
572 {
573 t << "%LATEX_CMD% %MANUAL_FILE%\r\n";
574 t << "@if ERRORLEVEL 1 goto :error\r\n";
575 t << "echo ----\r\n";
576 t << "%MKIDX_CMD% %MANUAL_FILE%.idx\r\n";
577 if (generateBib)
578 {
579 t << "%BIBTEX_CMD% %MANUAL_FILE%\r\n";
580 t << "%LATEX_CMD% %MANUAL_FILE%\r\n";
581 t << "@if ERRORLEVEL 1 goto :error\r\n";
582 }
583 t << "echo ----\r\n";
584 t << "%LATEX_CMD% %MANUAL_FILE%\r\n";
585 t << "@if ERRORLEVEL 1 goto :error\r\n";
586 t << "\r\n";
587 t << "setlocal enabledelayedexpansion\r\n";
588 t << "set count=%LATEX_COUNT%\r\n";
589 t << ":repeat\r\n";
590 t << "set content=X\r\n";
591 t << "for /F \"tokens=*\" %%T in ( 'findstr /C:\"Rerun LaTeX\" %MANUAL_FILE%.log' ) do set content=\"%%~T\"\r\n";
592 t << "if !content! == X for /F \"tokens=*\" %%T in ( 'findstr /C:\"Rerun to get cross-references right\" %MANUAL_FILE%.log' ) do set content=\"%%~T\"\r\n";
593 t << "if !content! == X for /F \"tokens=*\" %%T in ( 'findstr /C:\"Rerun to get bibliographical references right\" %MANUAL_FILE%.log' ) do set content=\"%%~T\"\r\n";
594 t << "if !content! == X goto :skip\r\n";
595 t << "set /a count-=1\r\n";
596 t << "if !count! EQU 0 goto :skip\r\n\r\n";
597 t << "echo ----\r\n";
598 t << "%LATEX_CMD% %MANUAL_FILE%\r\n";
599 t << "@if ERRORLEVEL 1 goto :error\r\n";
600 t << "goto :repeat\r\n";
601 t << ":skip\r\n";
602 t << "endlocal\r\n";
603 t << "%MKIDX_CMD% %MANUAL_FILE%.idx\r\n";
604 t << "%LATEX_CMD% %MANUAL_FILE%\r\n";
605 t << "@if ERRORLEVEL 1 goto :error\r\n";
606 }
607 t<< "\r\n";
608 t << "goto :end\r\n";
609 t << ":error\r\n";
610 t << "@echo ===============\r\n";
611 t << "@echo Please consult %MANUAL_FILE%.log to see the error messages\r\n";
612 t << "@echo ===============\r\n";
613 t<< "\r\n";
614 t<< ":end\r\n";
615 t<< "@REM reset environment\r\n";
616 t<< "popd\r\n";
617 t<< "set LATEX_CMD=%ORG_LATEX_CMD%\r\n";
618 t<< "set ORG_LATEX_CMD=\r\n";
619 t<< "set MKIDX_CMD=%ORG_MKIDX_CMD%\r\n";
620 t<< "set ORG_MKIDX_CMD=\r\n";
621 t<< "set BIBTEX_CMD=%ORG_BIBTEX_CMD%\r\n";
622 t<< "set ORG_BIBTEX_CMD=\r\n";
623 t<< "set MANUAL_FILE=%ORG_MANUAL_FILE%\r\n";
624 t<< "set ORG_MANUAL_FILE=\r\n";
625 t<< "set LATEX_COUNT=%ORG_LATEX_COUNT%\r\n";
626 t<< "set ORG_LATEX_COUNT=\r\n";
627 t<< "\r\n";
628 t<< ":end1\r\n";
629#endif
630}
const char * ghostScriptCommand()
Definition portable.cpp:453

References Config_getBool, Config_getString, CitationManager::empty(), Portable::ghostScriptCommand(), CitationManager::instance(), Translator::latexCommandName(), Portable::openOutputStream(), DString::quoted(), term, and theTranslator.

Referenced by LatexGenerator::init().

Variable Documentation

◆ g_footer

DString g_footer
static

Definition at line 54 of file latexgen.cpp.

Referenced by LatexGenerator::endIndexSection(), and LatexGenerator::init().

◆ g_footer_file

DString g_footer_file
static

Definition at line 55 of file latexgen.cpp.

Referenced by LatexGenerator::endIndexSection(), and LatexGenerator::init().

◆ g_header

DString g_header
static

Definition at line 52 of file latexgen.cpp.

Referenced by LatexGenerator::init(), and LatexGenerator::startIndexSection().

◆ g_header_file

DString g_header_file
static

Definition at line 53 of file latexgen.cpp.

Referenced by LatexGenerator::init(), and LatexGenerator::startIndexSection().

◆ latexMarkerInfo

const SelectionMarkerInfo latexMarkerInfo = { '%', "%%BEGIN ",8 ,"%%END ",6, "",0 }
static

Definition at line 56 of file latexgen.cpp.

Referenced by LatexGenerator::init(), and substituteLatexKeywords().