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 (lresult < (i + bytes + 1)) \
{ \
lresult += 512; \
result = static_cast<char *>(realloc(result, lresult)); \
} \
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 2510 of file latexgen.cpp.

2511{
2512 TextStream t;
2513 filterLatexString(t,s,insideTabbing,false,false,false,keepSpaces);
2514 return t.str();
2515}
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 740 of file latexgen.cpp.

741{
742 DString result;
743 StringVector extraLatexStyles = Config_getList(LATEX_EXTRA_STYLESHEET);
744 for (const auto &fileName : extraLatexStyles)
745 {
746 if (!fileName.empty())
747 {
748 FileInfo fi(fileName);
749 if (fi.exists())
750 {
751 result += "\\usepackage{";
752 DString fn = fi.fileName();
754 {
755 // strip the extension, it will be added by the usepackage in the tex conversion process
757 }
758 else
759 {
760 result += fn;
761 }
762 result += "}\n";
763 }
764 }
765 }
766 return result;
767}
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:21
bool checkExtension(const DString &fName, const DString &ext)
Definition util.cpp:3926
DString stripExtensionGeneral(const DString &fName, const DString &ext)
Definition util.cpp:3945

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 2363 of file latexgen.cpp.

2365{
2366 if (str.empty()) return;
2367 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
2368 //printf("filterLatexString(%s) insideTabbing=%d\n",qPrint(str),insideTabbing);
2369 const char *p = str.data();
2370 unsigned char pc='\0';
2371
2372 while (*p)
2373 {
2374 unsigned char c=static_cast<unsigned char>(*p++);
2375
2376 if (insidePre)
2377 {
2378 switch(c)
2379 {
2380 case 0xef: // handle U+FFFD i.e. "Replacement character" caused by octal: 357 277 275 / hexadecimal 0xef 0xbf 0xbd
2381 // the LaTeX command \ucr has been defined in doxygen.sty
2382 if (static_cast<unsigned char>(*(p)) == 0xbf && static_cast<unsigned char>(*(p+1)) == 0xbd)
2383 {
2384 t << "{\\ucr}";
2385 p += 2;
2386 }
2387 else
2388 t << static_cast<char>(c);
2389 break;
2390 case '\\': t << "\\(\\backslash\\)"; 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 '"': t << "\"{}"; break;
2399 case '-': t << "-\\/"; break;
2400 case '^': insideTable ? t << "\\string^" : t << static_cast<char>(c); break;
2401 case '~': t << "\\string~"; break;
2402 case '\n': if (retainNewline) t << "\\newline"; else t << ' ';
2403 break;
2404 case ' ': if (keepSpaces) t << "~"; else t << ' ';
2405 break;
2406 default:
2407 if (c<32) t << ' '; // non printable control character
2408 else t << static_cast<char>(c);
2409 break;
2410 }
2411 }
2412 else
2413 {
2414 switch(c)
2415 {
2416 case 0xef: // handle U+FFFD i.e. "Replacement character" caused by octal: 357 277 275 / hexadecimal 0xef 0xbf 0xbd
2417 // the LaTeX command \ucr has been defined in doxygen.sty
2418 if (static_cast<unsigned char>(*(p)) == 0xbf && static_cast<unsigned char>(*(p+1)) == 0xbd)
2419 {
2420 t << "{\\ucr}";
2421 p += 2;
2422 }
2423 else
2424 t << static_cast<char>(c);
2425 break;
2426 case '#': t << "\\+\\#"; break;
2427 case '$': t << "\\$"; break;
2428 case '%': t << "\\%"; break;
2429 case '^': processEntity(t,pdfHyperlinks,"$^\\wedge$","\\string^"); break;
2430 case '&': {
2431 // possibility to have a special symbol
2433 t,
2434 p-1,
2435 [](HtmlEntityMapper::SymType symType) { return HtmlEntityMapper::instance().latex(symType); },
2436 "\\&");
2437 }
2438 break;
2439 case '*': processEntity(t,pdfHyperlinks,"$\\ast$","*"); break;
2440 case '_': if (!insideTabbing && *p) t << "\\+";
2441 t << "\\_";
2442 if (!insideTabbing && *p) t << "\\+";
2443 break;
2444 case '{': t << "\\{"; break;
2445 case '}': t << "\\}"; break;
2446 case '<': t << "$<$"; break;
2447 case '>': t << "$>$"; break;
2448 case '|': processEntity(t,pdfHyperlinks,"$\\vert$","|"); break;
2449 case '~': processEntity(t,pdfHyperlinks,"$\\sim$","\\string~"); break;
2450 case '[': if (Config_getBool(PDF_HYPERLINKS) || insideItem)
2451 t << "\\+[";
2452 else
2453 t << "[";
2454 break;
2455 case ']': if (pc=='[') t << "$\\,$";
2456 if ((Config_getBool(PDF_HYPERLINKS) || insideItem) && *p)
2457 t << "]\\+";
2458 else
2459 t << "]";
2460 break;
2461 case '-': t << "-\\/";
2462 break;
2463 case '\\': t << "\\textbackslash{}";
2464 break;
2465 case '"': t << "\"{}";
2466 break;
2467 case '`': t << "\\`{}";
2468 break;
2469 case '\'': t << "\\textquotesingle{}";
2470 break;
2471 case '\n': if (retainNewline)
2472 {
2473 t << "\\newline";
2474 if (insideTable) t << " ";
2475 }
2476 else
2477 {
2478 t << ' ';
2479 }
2480 break;
2481 case ' ': if (keepSpaces) { if (insideTabbing) t << "\\>"; else t << '~'; } else t << ' ';
2482 break;
2483
2484 default:
2485 //if (!insideTabbing && forceBreaks && c!=' ' && *p!=' ')
2486 if (!insideTabbing &&
2487 ((c>='A' && c<='Z' && pc!=' ' && !(pc>='A' && pc <= 'Z') && pc!='\0' && *p) || (pc=='.' && isId(c)))
2488 )
2489 {
2490 t << "\\+";
2491 }
2492 if (c<32)
2493 {
2494 t << ' '; // non-printable control character
2495 }
2496 else
2497 {
2498 t << static_cast<char>(c);
2499 }
2500 if (!insideTabbing && *p && ((c==':' && *p!=':') || c=='/'))
2501 {
2502 t << "\\+";
2503 }
2504 }
2505 }
2506 pc = c;
2507 }
2508}
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 787 of file latexgen.cpp.

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

References Config_getEnum.

Referenced by substituteLatexKeywords().

◆ latexEscapeIndexChars()

DString latexEscapeIndexChars ( const DString & s)

Definition at line 2562 of file latexgen.cpp.

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

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

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 2608 of file latexgen.cpp.

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

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

Referenced by LatexGenerator::startMemberDoc().

◆ latexFilterURL()

DString latexFilterURL ( const DString & s)

Definition at line 2636 of file latexgen.cpp.

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

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 2667 of file latexgen.cpp.

2668{
2669 if (!s1.empty())
2670 {
2671 m_t << "\\index{";
2672 m_t << latexEscapeLabelName(s1);
2673 m_t << "@{";
2674 m_t << latexEscapeIndexChars(s1);
2675 m_t << "}";
2676 if (!s2.empty())
2677 {
2678 m_t << "!";
2679 m_t << latexEscapeLabelName(s2);
2680 m_t << "@{";
2681 m_t << latexEscapeIndexChars(s2);
2682 m_t << "}";
2683 }
2684 m_t << "}\n";
2685 }
2686}
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 769 of file latexgen.cpp.

770{
771 DString result;
772 DString latex_mkidx_command = Config_getString(LATEX_MAKEINDEX_CMD);
773 if (!latex_mkidx_command.empty())
774 {
775 if (latex_mkidx_command[0] == '\\')
776 result += latex_mkidx_command;
777 else
778 result += "\\"+latex_mkidx_command;
779 }
780 else
781 {
782 result += "\\makeindex";
783 }
784 return result;
785}
#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 1414 of file latexgen.cpp.

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

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 1439 of file latexgen.cpp.

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

Referenced by filterLatexString().

◆ substituteLatexKeywords()

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

Definition at line 801 of file latexgen.cpp.

804{
805 bool compactLatex = Config_getBool(COMPACT_LATEX);
806 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
807 bool usePdfLatex = Config_getBool(USE_PDFLATEX);
808 DString paperType = Config_getEnumAsString(PAPER_TYPE);
809
810 DString style = Config_getString(LATEX_BIB_STYLE);
811 if (style.empty())
812 {
813 style="plainnat";
814 }
815
816 TextStream tg;
817 DString generatedBy;
818 auto timeStamp = Config_getEnum(TIMESTAMP);
819 switch (timeStamp)
820 {
821 case TIMESTAMP_t::YES:
822 case TIMESTAMP_t::DATETIME:
824 Config_getString(PROJECT_NAME));
825 break;
826 case TIMESTAMP_t::DATE:
828 Config_getString(PROJECT_NAME));
829 break;
830 case TIMESTAMP_t::NO:
831 generatedBy = theTranslator->trGeneratedBy();
832 break;
833 }
834 filterLatexString(tg, generatedBy,
835 false, // insideTabbing
836 false, // insidePre
837 false, // insideItem
838 false, // insideTable
839 false // keepSpaces
840 );
841 generatedBy = tg.str();
842
843 DString latexFontenc = theTranslator->latexFontenc();
844
845 DString latexEmojiDirectory = Config_getString(LATEX_EMOJI_DIRECTORY);
846 if (latexEmojiDirectory.empty()) latexEmojiDirectory = ".";
847 latexEmojiDirectory = substitute(latexEmojiDirectory,"\\","/");
848
849 TextStream tg1;
851 DString extraLatexPackages = tg1.str();
852
853 TextStream tg2;
855 DString latexSpecialFormulaChars = tg2.str();
856
857 DString formulaMacrofile = Config_getString(FORMULA_MACROFILE);
858 DString stripMacroFile;
859 if (!formulaMacrofile.empty())
860 {
861 FileInfo fi(formulaMacrofile.str());
862 formulaMacrofile=fi.absFilePath();
863 stripMacroFile = fi.fileName();
864 copyFile(formulaMacrofile,Config_getString(LATEX_OUTPUT) + "/" + stripMacroFile);
865 }
866
867 DString projectNumber = Config_getString(PROJECT_NUMBER);
868 DString projName = convertToLaTeX(Config_getString(PROJECT_NAME), false);
869 DString projBrief = convertToLaTeX(Config_getString(PROJECT_BRIEF),false);
870
871 // first substitute generic keywords then the LaTeX only keywords
872 DString result = substituteKeywords(file,str,
873 {
874 // keyword value getter
875 { "$title", [&]() { return !title.empty() ? title : projName; } },
876 { "$doxygenversion", [&]() { return getDoxygenVersion(); } },
877 { "$projectname", [&]() { return projName; } },
878 { "$projectnumber", [&]() { return convertToLaTeX(projectNumber,false); } },
879 { "$projectbrief", [&]() { return projBrief; } },
880 { "$projectlogo", [&]() { return stripPath(projectLogoFile()); } },
881 { "$logosize", [&]() { return projectLogoSize(); } },
882 { "$projecticon", [&]() { return stripPath(Config_getString(PROJECT_ICON)); } },
883 { "$langISO", [&]() { return theTranslator->trISOLang(); } },
884 { "$showdate", [&](const DString &fmt) { return showDate(fmt); } },
885
886 // keyword value getter
887 { "$datetime", [&]() { return dateToString(DateTimeType::DateTime); } },
888 { "$date", [&]() { return dateToString(DateTimeType::Date); } },
889 { "$time", [&]() { return dateToString(DateTimeType::Time); } },
890 { "$year", [&]() { return yearToString(); } },
891 { "$latexdocumentpre", [&]() { return theTranslator->latexDocumentPre(); } },
892 { "$latexdocumentpost", [&]() { return theTranslator->latexDocumentPost(); } },
893 { "$generatedby", [&]() { return generatedBy; } },
894 { "$latexbibstyle", [&]() { return style; } },
895 { "$latexcitereference", [&]() { return theTranslator->trCiteReferences(); } },
896 { "$latexbibfiles", [&]() { return CitationManager::instance().latexBibFiles(); } },
897 { "$papertype", [&]() { return paperType+"paper"; } },
898 { "$extralatexstylesheet", [&]() { return extraLatexStyleSheet(); } },
899 { "$languagesupport", [&]() { return theTranslator->latexLanguageSupportCommand(); } },
900 { "$latexfontenc", [&]() { return latexFontenc; } },
901 { "$latexfont", [&]() { return theTranslator->latexFont(); } },
902 { "$latexemojidirectory", [&]() { return latexEmojiDirectory; } },
903 { "$makeindex", [&]() { return makeIndex(); } },
904 { "$extralatexpackages", [&]() { return extraLatexPackages; } },
905 { "$latexspecialformulachars", [&]() { return latexSpecialFormulaChars; } },
906 { "$formulamacrofile", [&]() { return stripMacroFile; } },
907 { "$latex_batchmode", [&]() { return latex_batchmode(); } }
908 });
909
910 // remove conditional blocks
911 result = selectBlocks(result,
912 {
913 // marker is enabled
914 { "CITATIONS_PRESENT", !CitationManager::instance().empty() },
915 { "COMPACT_LATEX", compactLatex },
916 { "PDF_HYPERLINKS", pdfHyperlinks },
917 { "USE_PDFLATEX", usePdfLatex },
918 { "TIMESTAMP", timeStamp!=TIMESTAMP_t::NO },
919 { "LATEX_FONTENC", !latexFontenc.empty() },
920 { "FORMULA_MACROFILE", !formulaMacrofile.empty() },
921 { "PROJECT_NUMBER", !projectNumber.empty() }
923
924 result = removeEmptyLines(result.str());
925
926 return result;
927}
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:740
static DString latex_batchmode()
Definition latexgen.cpp:787
static const SelectionMarkerInfo latexMarkerInfo
Definition latexgen.cpp:56
void writeExtraLatexPackages(TextStream &t)
static DString makeIndex()
Definition latexgen.cpp:769
void writeLatexSpecialFormulaChars(TextStream &t)
Definition message.h:146
std::string removeEmptyLines(const std::string &s)
Definition stringutil.h:181
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:5001
DString showDate(const DString &fmt)
Definition util.cpp:2567
DString substituteKeywords(const DString &file, const DString &s, const KeywordSubstitutionList &keywords)
Definition util.cpp:2494
DString projectLogoFile()
Definition util.cpp:2580
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:4619
DString projectLogoSize()
Definition util.cpp:2599

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 687 of file latexgen.cpp.

688{
689 t << ResourceMgr::instance().getAsString("doxygen.sty");
690}
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 2302 of file latexgen.cpp.

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

References Config_getList.

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

◆ writeLatexMakefile()

void writeLatexMakefile ( )
static

Definition at line 368 of file latexgen.cpp.

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

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

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

◆ writeMakeBat()

void writeMakeBat ( )
static

Definition at line 504 of file latexgen.cpp.

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