Doxygen
Loading...
Searching...
No Matches
latexgen.cpp
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2023 by Dimitri van Heesch.
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation under the terms of the GNU General Public License is hereby
7 * granted. No representations are made about the suitability of this software
8 * for any purpose. It is provided "as is" without express or implied warranty.
9 * See the GNU General Public License for more details.
10 *
11 * Documents produced by Doxygen are derivative works derived from the
12 * input used in their production; they are not affected by this license.
13 *
14 */
15
16// own header
17#include "latexgen.h"
18
19// other headers
20#include "cite.h"
21#include "classlist.h"
22#include "conceptdef.h"
23#include "config.h"
24#include "datetime.h"
25#include "diagram.h"
26#include "dirdef.h"
27#include "docnode.h"
28#include "docparser.h"
29#include "dotcallgraph.h"
30#include "dotclassgraph.h"
31#include "dotdirdeps.h"
33#include "dotincldepgraph.h"
34#include "doxygen.h"
35#include "fileinfo.h"
36#include "filename.h"
37#include "groupdef.h"
38#include "language.h"
39#include "latexdocvisitor.h"
40#include "message.h"
41#include "moduledef.h"
42#include "namespacedef.h"
43#include "outputlist.h"
44#include "pagedef.h"
45#include "portable.h"
46#include "resourcemgr.h"
47#include "stringutil.h"
48#include "utf8.h"
49#include "util.h"
50#include "version.h"
51
56static const SelectionMarkerInfo latexMarkerInfo = { '%', "%%BEGIN ",8 ,"%%END ",6, "",0 };
57
58static DString substituteLatexKeywords(const DString &file, const DString &str, const DString &title);
59
60LatexCodeGenerator::LatexCodeGenerator(TextStream *t,const DString &relPath,const DString &sourceFileName)
61 : m_t(t), m_relPath(relPath), m_sourceFileName(sourceFileName)
62{
63}
64
68
70{
71 m_relPath = path;
72}
73
78
80{
81 if (!str.empty())
82 {
83 const char *p=str.data();
84 char c = 0;
85 //char cs[5];
86 int tabSize = Config_getInt(TAB_SIZE);
87 static THREAD_LOCAL std::vector<char> result;
88 if (m_hide) // only update column count
89 {
91 }
92 else // actually output content and keep track of m_col
93 {
94 while ((c=*p))
95 {
96 switch(c)
97 {
98 case 0x0c: p++; // remove ^L
99 break;
100 case ' ': if (m_col>=m_stripIndentAmount)
101 {
102 *m_t << (m_doxyCodeLineOpen ? "\\ " : " ");
103 }
104 m_col++;
105 p++;
106 break;
107 case '^': *m_t <<"\\string^";
108 m_col++;
109 p++;
110 break;
111 case '`': *m_t <<"\\`{}";
112 m_col++;
113 p++;
114 break;
115 case '\t': {
116 int spacesToNextTabStop = tabSize - (m_col%tabSize);
117 while (spacesToNextTabStop--)
118 {
120 {
121 *m_t << (m_doxyCodeLineOpen ? "\\ " : " ");
122 }
123 m_col++;
124 }
125 p++;
126 }
127 break;
128 case '\n': *m_t << '\n';
129 m_col=0;
130 p++;
131 break;
132 default:
133 {
134 int i=0;
135
136#undef COPYCHAR
137// helper macro to copy a single utf8 character, dealing with multibyte chars.
138#define COPYCHAR() do { \
139 int bytes = getUTF8CharNumBytes(c); \
140 if (result.size() < static_cast<size_t>(i + bytes + 1)) \
141 { \
142 result.resize(result.size() + 512); \
143 } \
144 for (int j=0; j<bytes && *p; j++) \
145 { \
146 result[i++]=*p++; \
147 } \
148 m_col++; \
149 } while(0)
150
151 // gather characters until we find whitespace or another special character
152 COPYCHAR();
153 while ((c=*p) &&
154 c!=0x0c && c!='\t' && c!='\n' && c!=' ' && c!='^'
155 )
156 {
157 COPYCHAR();
158 }
159 result[i]=0; // add terminator
160 filterLatexString(*m_t, result.data(),
161 m_insideTabbing, // insideTabbing
162 true, // insidePre
163 false, // insideItem
164 m_usedTableLevel>0, // insideTable
165 false // keepSpaces
166 );
167 }
168 break;
169 }
170 }
171 }
172 }
173}
174
179
184
186{
187 m_hide = false;
188}
189
191{
192 m_stripIndentAmount = amount;
193}
194
196 const DString &ref,const DString &f,
197 const DString &anchor,const DString &name,
198 const DString &)
199{
200 if (m_hide) return;
201 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
202 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
203 size_t l = name.length();
204 if (ref.empty() && usePDFLatex && pdfHyperlinks)
205 {
206 *m_t << "\\doxymbox{\\hyperlink{";
207 if (!f.empty()) *m_t << stripPath(f);
208 if (!f.empty() && !anchor.empty()) *m_t << "_";
209 if (!anchor.empty()) *m_t << anchor;
210 *m_t << "}{";
211 codify(name);
212 *m_t << "}}";
213 }
214 else
215 {
216 codify(name);
217 }
218 m_col+=l;
219}
220
221void LatexCodeGenerator::writeLineNumber(const DString &ref,const DString &fileName,const DString &anchor,int l,bool writeLineAnchor)
222{
223 if (m_hide) return;
224 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
225 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
227 {
228 *m_t << "\\DoxyCodeLine{";
229 m_doxyCodeLineOpen = true;
230 }
231 if (Config_getBool(SOURCE_BROWSER))
232 {
233 DString lineNumber;
234 lineNumber.sprintf("%05d",l);
235
236 DString lineAnchor;
237 if (!m_sourceFileName.empty())
238 {
239 lineAnchor.sprintf("_l%05d",l);
241 }
242 bool showTarget = usePDFLatex && pdfHyperlinks && !lineAnchor.empty() && writeLineAnchor;
243 if (showTarget)
244 {
245 *m_t << "\\Hypertarget{" << stripPath(lineAnchor) << "}";
246 }
247 if (!fileName.empty())
248 {
249 writeCodeLink(CodeSymbolType::Default,ref,fileName,anchor,lineNumber,DString());
250 }
251 else
252 {
253 codify(lineNumber);
254 }
255 *m_t << "\\ ";
256 }
257 else
258 {
259 DString lineNumber;
260 lineNumber.sprintf("%05d",l);
261 codify(lineNumber);
262 *m_t << "\\ ";
263 }
264 m_col=0;
265}
266
267
269{
270 if (m_hide) return;
271 m_col=0;
273 {
274 *m_t << "\\DoxyCodeLine{";
275 m_doxyCodeLineOpen = true;
276 }
277}
278
280{
281 if (m_hide) return;
283 {
284 *m_t << "}";
285 m_doxyCodeLineOpen = false;
286 }
287 codify("\n");
288}
289
291{
292 if (m_hide) return;
293 *m_t << "\\textcolor{" << name << "}{";
294}
295
297{
298 if (m_hide) return;
299 *m_t << "}";
300}
301
303{
304 *m_t << "\n\\begin{" << style << "}{" << m_usedTableLevel << "}\n";
305}
306
308{
309 //endCodeLine checks is there is still an open code line, if so closes it.
310 bool wasHidden = m_hide;
311 m_hide = false;
312 endCodeLine();
313 m_hide = wasHidden;
314
315 *m_t << "\\end{" << style << "}\n";
316}
317
318
319//-------------------------------
320
327
340
342{
343 if (this!=&og)
344 {
345 m_dir = og.m_dir;
346 m_codeList = std::make_unique<OutputCodeList>(*og.m_codeList);
351 m_relPath = og.m_relPath;
352 m_indent = og.m_indent;
355 }
356 return *this;
357}
358
360
365
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}
501
502static void writeMakeBat()
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}
631
633{
634 DString dname = Config_getString(LATEX_OUTPUT);
635 Dir d(dname.str());
636 if (!d.exists() && !d.mkdir(dname.str()))
637 {
638 term("Could not create output directory {}\n",dname);
639 }
640
641 if (!Config_getString(LATEX_HEADER).empty())
642 {
643 g_header_file=Config_getString(LATEX_HEADER);
645 //printf("g_header='%s'\n",qPrint(g_header));
648 }
649 else
650 {
651 g_header_file = "header.tex";
654 checkBlocks(result,"<default header.tex>",latexMarkerInfo);
655 }
656 if (!Config_getString(LATEX_FOOTER).empty())
657 {
658 g_footer_file=Config_getString(LATEX_FOOTER);
660 //printf("g_footer='%s'\n",qPrint(g_footer));
663 }
664 else
665 {
666 g_footer_file = "footer.tex";
669 checkBlocks(result,"<default footer.tex>",latexMarkerInfo);
670 }
671
673 writeMakeBat();
674
675 createSubDirs(d);
676}
677
679{
680 DString dname = Config_getString(LATEX_OUTPUT);
681 Dir d(dname.str());
682 clearSubDirs(d);
683}
684
686{
687 t << ResourceMgr::instance().getAsString("doxygen.sty");
688}
689
691{
692 t << "% Latex header for doxygen " << getDoxygenVersion() << "\n";
693 t << ResourceMgr::instance().getAsString("header.tex");
694}
695
697{
698 t << "% Latex footer for doxygen " << getDoxygenVersion() << "\n";
699 t << ResourceMgr::instance().getAsString("footer.tex");
700}
701
703{
704 t << "% stylesheet for doxygen " << getDoxygenVersion() << "\n";
706}
707
708void LatexGenerator::startFile(const DString &name,bool,const DString &,const DString &,int,int hierarchyLevel)
709{
710#if 0
711 setEncoding(Config_getString(LATEX_OUTPUT_ENCODING));
712#endif
713 DString fileName=name;
714 m_hierarchyLevel = hierarchyLevel;
716 if (!fileName.endsWith(".tex") && !fileName.endsWith(".sty")) fileName+=".tex";
720}
721
727
728//void LatexGenerator::writeIndex()
729//{
730// startFile("refman.tex");
731//}
732
734{
735 m_t << "\\\\[1ex]\\large ";
736}
737
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}
766
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}
784
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}
798
800 const DString &str,
801 const DString &title)
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}
926
928{
929 bool compactLatex = Config_getBool(COMPACT_LATEX);
930 switch (is)
931 {
934 break;
936 break;
938 break;
940 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
941 m_t << "{"; //Module Index}\n"
942 break;
944 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
945 m_t << "{"; //Topic Index}\n"
946 break;
948 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
949 m_t << "{"; //Directory Index}\n"
950 break;
952 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
953 m_t << "{"; //Namespace Index}\n"
954 break;
956 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
957 m_t << "{"; //Concept Index}\n"
958 break;
960 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
961 m_t << "{"; //Hierarchical Index}\n"
962 break;
964 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
965 m_t << "{"; //Annotated Compound Index}\n"
966 break;
968 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
969 m_t << "{"; //Annotated File Index}\n"
970 break;
972 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
973 m_t << "{"; //Annotated Page Index}\n"
974 break;
976 {
977 for (const auto &gd : *Doxygen::groupLinkedMap)
978 {
979 if (!gd->isReference())
980 {
981 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
982 m_t << "{"; //Topic Documentation}\n";
983 break;
984 }
985 }
986 }
987 break;
989 {
990 for (const auto &mod : ModuleManager::instance().modules())
991 {
992 if (!mod->isReference() && mod->isPrimaryInterface())
993 {
994 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
995 m_t << "{"; //Topic Documentation}\n";
996 break;
997 }
998 }
999 }
1000 break;
1002 {
1003 for (const auto &dd : *Doxygen::dirLinkedMap)
1004 {
1005 if (dd->isLinkableInProject())
1006 {
1007 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
1008 m_t << "{"; //Dir Documentation}\n";
1009 break;
1010 }
1011 }
1012 }
1013 break;
1015 {
1016 for (const auto &nd : *Doxygen::namespaceLinkedMap)
1017 {
1018 if (nd->isLinkableInProject() && !nd->isAlias())
1019 {
1020 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
1021 m_t << "{"; // Namespace Documentation}\n":
1022 break;
1023 }
1024 }
1025 }
1026 break;
1028 {
1029 for (const auto &cd : *Doxygen::conceptLinkedMap)
1030 {
1031 if (cd->isLinkableInProject() && !cd->isAlias())
1032 {
1033 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
1034 m_t << "{"; // Concept Documentation}\n":
1035 break;
1036 }
1037 }
1038 }
1039 break;
1041 {
1042 for (const auto &cd : *Doxygen::classLinkedMap)
1043 {
1044 if (cd->isLinkableInProject() &&
1045 !cd->isImplicitTemplateInstance() &&
1046 !cd->isEmbeddedInOuterScope() &&
1047 !cd->isAlias()
1048 )
1049 {
1050 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
1051 m_t << "{"; //Compound Documentation}\n";
1052 break;
1053 }
1054 }
1055 }
1056 break;
1058 {
1059 bool isFirst=true;
1060 for (const auto &fn : *Doxygen::inputNameLinkedMap)
1061 {
1062 for (const auto &fd : *fn)
1063 {
1064 if (fd->isLinkableInProject() || fd->generateSourceFile())
1065 {
1066 if (isFirst)
1067 {
1068 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
1069 m_t << "{"; //File Documentation}\n";
1070 isFirst=false;
1071 break;
1072 }
1073 }
1074 }
1075 }
1076 }
1077 break;
1079 {
1080 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
1081 m_t << "{"; //Example Documentation}\n";
1082 }
1083 break;
1085 break;
1087 break;
1089 break;
1090 }
1091}
1092
1094{
1095 switch (is)
1096 {
1098 break;
1100 break;
1102 {
1104 {
1105 writePageLink(Doxygen::mainPage->getOutputFileBase(), false);
1106 }
1107 }
1108 break;
1110 m_t << "}\n\\input{modules}\n";
1111 break;
1113 m_t << "}\n\\input{topics}\n";
1114 break;
1116 m_t << "}\n\\input{dirs}\n";
1117 break;
1119 m_t << "}\n\\input{namespaces}\n";
1120 break;
1122 m_t << "}\n\\input{concepts}\n";
1123 break;
1125 m_t << "}\n\\input{hierarchy}\n";
1126 break;
1128 m_t << "}\n\\input{annotated}\n";
1129 break;
1131 m_t << "}\n\\input{files}\n";
1132 break;
1134 m_t << "}\n\\input{pages}\n";
1135 break;
1137 {
1138 m_t << "}\n";
1139 for (const auto &gd : *Doxygen::groupLinkedMap)
1140 {
1141 if (!gd->isReference() && !gd->isASubGroup())
1142 {
1143 writePageLink(gd->getOutputFileBase(), false);
1144 }
1145 }
1146 }
1147 break;
1149 {
1150 m_t << "}\n";
1151 for (const auto &mod : ModuleManager::instance().modules())
1152 {
1153 if (!mod->isReference() && mod->isPrimaryInterface())
1154 {
1155 writePageLink(mod->getOutputFileBase(), false);
1156 }
1157 }
1158 }
1159 break;
1161 {
1162 bool found=false;
1163 for (const auto &dd : *Doxygen::dirLinkedMap)
1164 {
1165 if (dd->isLinkableInProject())
1166 {
1167 if (!found)
1168 {
1169 m_t << "}\n";
1170 found = true;
1171 }
1172 m_t << "\\input{" << dd->getOutputFileBase() << "}\n";
1173 }
1174 }
1175 }
1176 break;
1178 {
1179 bool found=false;
1180 for (const auto &nd : *Doxygen::namespaceLinkedMap)
1181 {
1182 if (nd->isLinkableInProject() && !nd->isAlias())
1183 {
1184 if (!found)
1185 {
1186 m_t << "}\n";
1187 found=true;
1188 }
1189 m_t << "\\input{" << nd->getOutputFileBase() << "}\n";
1190 }
1191 }
1192 }
1193 break;
1195 {
1196 bool found=false;
1197 for (const auto &cd : *Doxygen::conceptLinkedMap)
1198 {
1199 if (cd->isLinkableInProject() && !cd->isAlias())
1200 {
1201 if (!found)
1202 {
1203 m_t << "}\n";
1204 found=true;
1205 }
1206 m_t << "\\input{" << cd->getOutputFileBase() << "}\n";
1207 }
1208 }
1209 }
1210 break;
1212 {
1213 bool found=false;
1214 for (const auto &cd : *Doxygen::classLinkedMap)
1215 {
1216 if (cd->isLinkableInProject() &&
1217 !cd->isImplicitTemplateInstance() &&
1218 !cd->isEmbeddedInOuterScope() &&
1219 !cd->isAlias()
1220 )
1221 {
1222 if (!found)
1223 {
1224 m_t << "}\n"; // end doxysection or chapter title
1225 found=true;
1226 }
1227 m_t << "\\input{" << cd->getOutputFileBase() << "}\n";
1228 }
1229 }
1230 }
1231 break;
1233 {
1234 bool isFirst=true;
1235 for (const auto &fn : *Doxygen::inputNameLinkedMap)
1236 {
1237 for (const auto &fd : *fn)
1238 {
1239 if (fd->isLinkableInProject())
1240 {
1241 if (isFirst)
1242 {
1243 m_t << "}\n"; // end doxysection or chapter title
1244 }
1245 isFirst=false;
1246 m_t << "\\input{" << fd->getOutputFileBase() << "}\n";
1247 }
1248 if (fd->generateSourceFile())
1249 {
1250 if (isFirst)
1251 {
1252 m_t << "}\n"; // end doxysection or chapter title
1253 }
1254 isFirst=false;
1255 m_t << "\\input{" << fd->getSourceFileBase() << "}\n";
1256 }
1257 }
1258 }
1259 }
1260 break;
1262 {
1263 m_t << "}\n";
1264 for (const auto &pd : *Doxygen::exampleLinkedMap)
1265 {
1266 m_t << "\\input{" << pd->getOutputFileBase() << "}\n";
1267 }
1268 }
1269 break;
1271 {
1272 for (const auto &pd : *Doxygen::pageLinkedMap)
1273 {
1274 if (!pd->getGroupDef() && !pd->isReference() && !pd->hasParentPage()
1275 && pd->name() != "citelist" && Doxygen::mainPage.get() != pd.get())
1276 {
1277 writePageLink(pd->getOutputFileBase(), false);
1278 }
1279 }
1280 }
1281 break;
1283 break;
1286 break;
1287 }
1288}
1289
1290void LatexGenerator::writePageLink(const DString &name, bool /*first*/)
1291{
1292 //bool &compactLatex = Config_getBool(COMPACT_LATEX);
1293 // next is remove for bug615957
1294 //if (compactLatex || first) m_t << "\\input" ; else m_t << "\\include";
1295 m_t << "\\input" ;
1296 m_t << "{" << name << "}\n";
1297}
1298
1300{
1301 if (part > 0)
1302 return;
1303
1304 startPlainFile("doxygen.sty");
1306 endPlainFile();
1307
1308 /// an extension of the etoc package is required that is only available in the
1309 /// newer version. Providing the updated version to be used with older versions
1310 /// of LaTeX
1311 startPlainFile("etoc_doxygen.sty");
1312 m_t << ResourceMgr::instance().getAsString("etoc_doxygen.sty");
1313 endPlainFile();
1314}
1315
1317{
1318 m_t << "\n" << "\n";
1319}
1320
1322{
1323 m_t << "\n" << "\n";
1324}
1325
1327{
1328 m_t << text;
1329}
1330
1332{
1333 m_t << "\\item ";
1334 if (ref.empty() && !fn.empty())
1335 {
1336 m_t << "\\contentsline{section}{";
1337 }
1338}
1339
1341{
1342 if (ref.empty() && !fn.empty())
1343 {
1344 m_t << "}{\\pageref{" << stripPath(fn) << "}}{}\n";
1345 }
1346}
1347
1349 const DString &path,const DString &name)
1350{
1351 m_t << "\\item\\contentsline{section}\\textbf{ ";
1352 if (!path.empty()) docify(path);
1353 docify(name);
1354 m_t << "} ";
1355}
1356
1358{
1359 m_t << "\\item\\contentsline{section}{";
1360}
1361
1365
1367{
1368 m_t << " ";
1369 if (hasBrief) m_t << "\\\\*";
1370}
1371
1372void LatexGenerator::endIndexValue(const DString &name,bool /*hasBrief*/)
1373{
1374 //if (hasBrief) m_t << ")";
1375 m_t << "}{\\pageref{" << stripPath(name) << "}}{}\n";
1376}
1377
1378//void LatexGenerator::writeClassLink(const DString &,const DString &,
1379// const DString &,const DString &name)
1380//{
1381// m_t << "\\textbf{ ";
1382// docify(name);
1383// m_t << "}";
1384//}
1385
1387{
1388 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1389 if (!m_disableLinks && pdfHyperlinks)
1390 {
1391 m_t << "\\doxymbox{\\hyperlink{";
1392 if (!f.empty()) m_t << stripPath(f);
1393 if (!anchor.empty()) m_t << "_" << anchor;
1394 m_t << "}{";
1395 }
1396 else
1397 {
1398 m_t << "\\textbf{ ";
1399 }
1400}
1401
1403{
1404 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1405 if (!m_disableLinks && pdfHyperlinks)
1406 {
1407 m_t << "}";
1408 }
1409 m_t << "}";
1410}
1411
1412static DString objectLinkToString(const DString &ref, const DString &f,
1413 const DString &anchor, const DString &text,
1414 bool insideTabbing,bool disableLinks)
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}
1436
1437static void processEntity(TextStream &t, bool pdfHyperlinks, const char *strForm, const char *strRepl)
1438{
1439 if (pdfHyperlinks)
1440 {
1441 t << "\\texorpdfstring{";
1442 }
1443 t << strForm;
1444 if (pdfHyperlinks)
1445 {
1446 t << "}{" << strRepl << "}";
1447 }
1448}
1449
1451 const DString &anchor, const DString &text)
1452{
1454}
1455
1457{
1458 m_t << " \\doxyref{}{";
1459}
1460
1461void LatexGenerator::endPageRef(const DString &clname, const DString &anchor)
1462{
1463 m_t << "}{";
1464 if (!clname.empty()) m_t << clname;
1465 if (!anchor.empty()) m_t << "_" << anchor;
1466 m_t << "}";
1467}
1468
1469
1471{
1472 int hierarchyLevel = m_hierarchyLevel;
1473 if (Config_getBool(COMPACT_LATEX))
1474 {
1475 ++hierarchyLevel;
1476 }
1477
1478 if (hierarchyLevel < 0)
1479 m_t << "\\chapter{";
1480 else
1481 m_t << "\\" << LatexSections::name(hierarchyLevel) << "{";
1482}
1483
1485{
1486 m_t << "}\n";
1487
1488 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1489 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1490 if (usePDFLatex && pdfHyperlinks && !fileName.empty())
1491 {
1492 m_t << "\\hypertarget{" << stripPath(fileName) << "}{}";
1493 }
1494
1496 if (!fn.empty())
1497 {
1498 m_t << "\\label{" << fn << "}";
1499 }
1500 if (!name.empty())
1501 {
1503 }
1504}
1505
1506void LatexGenerator::startGroupHeader(const DString &,int extraIndentLevel)
1507{
1508 if (Config_getBool(COMPACT_LATEX))
1509 {
1510 extraIndentLevel++;
1511 }
1512
1513 if (extraIndentLevel>=3)
1514 {
1515 m_t << "\\doxysubparagraph*{";
1516 }
1517 else if (extraIndentLevel==2)
1518 {
1519 m_t << "\\doxyparagraph{";
1520 }
1521 else
1522 {
1523 extraIndentLevel += m_hierarchyLevel + 1;
1524 m_t << "\\" << LatexSections::name(extraIndentLevel) << "{";
1525 }
1526 m_disableLinks=true;
1527}
1528
1530{
1531 m_disableLinks=false;
1532 m_t << "}\n";
1533}
1534
1536{
1537 int l = m_hierarchyLevel + 1;
1538 if (Config_getBool(COMPACT_LATEX))
1539 {
1540 ++l;
1541 }
1542
1543 m_t << "\\" << LatexSections::name(l+1) << "*{";
1544 m_disableLinks=true;
1545}
1546
1548{
1549 m_disableLinks=false;
1550 m_t << "}\n";
1551}
1552
1554 const DString &memname,
1555 const DString &,
1556 const DString &title,
1557 int memCount,
1558 int memTotal,
1559 bool showInline)
1560{
1561 if (!memname.empty() && memname[0]!='@')
1562 {
1563 latexWriteIndexItem(m_t,clname,memname);
1564 latexWriteIndexItem(m_t,memname,clname);
1565 }
1566 bool compactLatex = Config_getBool(COMPACT_LATEX);
1567 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1568 if (showInline)
1569 {
1570 m_t << "\\doxysubparagraph";
1571 }
1572 else if (compactLatex)
1573 {
1574 m_t << "\\doxyparagraph";
1575 }
1576 else
1577 {
1579 }
1580
1581 m_t << "{";
1582 if (pdfHyperlinks)
1583 {
1584 m_t << "\\texorpdfstring{";
1585 }
1586 m_t << latexEscapeIndexChars(title);
1587 if (pdfHyperlinks)
1588 {
1589 m_t << "}{" << latexEscapePDFString(title) << "}";
1590 }
1591 if (memTotal>1)
1592 {
1593 m_t << "\\hspace{0.1cm}{\\footnotesize\\ttfamily [" << memCount << "/" << memTotal << "]}";
1594 }
1595 m_t << "}";
1596 m_t << "\n{\\footnotesize\\ttfamily ";
1597 //m_disableLinks=true;
1598}
1599
1601{
1602 m_disableLinks=false;
1603 m_t << "}\n\n";
1604 //if (Config_getBool(COMPACT_LATEX)) m_t << "\\hfill";
1605}
1606
1608 const DString &anchor, const DString &,
1609 const DString &)
1610{
1611 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1612 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1613 if (m_insideTableEnv) m_t << "\\doxymbox{"; // see issue #6093
1614 if (usePDFLatex && pdfHyperlinks)
1615 {
1616 m_t << "\\Hypertarget{";
1617 if (!fName.empty()) m_t << stripPath(fName);
1618 if (!anchor.empty()) m_t << "_" << anchor;
1619 m_t << "}";
1620 }
1621}
1622
1623void LatexGenerator::endDoxyAnchor(const DString &/* fName */,const DString &/* anchor */)
1624{
1625}
1626
1627void LatexGenerator::addLabel(const DString &fName, const DString &anchor)
1628{
1629 m_t << "\\label{";
1630 if (!fName.empty()) m_t << stripPath(fName);
1631 if (!anchor.empty()) m_t << "_" << anchor;
1632 if (m_insideTableEnv) m_t << "}";
1633 m_t << "} \n";
1634}
1635
1636void LatexGenerator::writeAnchor(const DString &fName,const DString &name)
1637{
1638 //printf("LatexGenerator::writeAnchor(%s,%s)\n",fName,name);
1639 if (!fName.empty())
1640 {
1641 m_t << "\\label{" << stripPath(fName) << "_" << stripPath(name) << "}\n";
1642 }
1643 else
1644 {
1645 m_t << "\\label{" << stripPath(name) << "}\n";
1646 }
1647 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1648 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1649 if (usePDFLatex && pdfHyperlinks)
1650 {
1651 if (!fName.empty())
1652 {
1653 m_t << "\\Hypertarget{" << stripPath(fName) << "_" << stripPath(name) << "}\n";
1654 }
1655 else
1656 {
1657 m_t << "\\Hypertarget{" << stripPath(name) << "}\n";
1658 }
1659 }
1660}
1661
1662
1663//void LatexGenerator::writeLatexLabel(const DString &clName,const DString &anchor)
1664//{
1665// writeDoxyAnchor(0,clName,anchor,0);
1666//}
1667
1669{
1670 if (!s1.empty())
1671 {
1672 latexWriteIndexItem(m_t,s1,s2);
1673 }
1674}
1675
1676
1678{
1679 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1680 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1681 if (usePDFLatex && pdfHyperlinks)
1682 {
1683 m_t << "\\hypertarget{" << stripPath(lab) << "}{}";
1684 }
1685 m_t << "\\";
1686 if (Config_getBool(COMPACT_LATEX))
1687 {
1688 switch(type.level())
1689 {
1690 case SectionType::Page: m_t << "doxysubsection"; break;
1691 case SectionType::Section: m_t << "doxysubsubsection"; break;
1692 case SectionType::Subsection: m_t << "doxysubsubsubsection"; break;
1693 case SectionType::Subsubsection: m_t << "doxysubsubsubsubsection"; break;
1694 case SectionType::Paragraph: m_t << "doxysubsubsubsubsubsection"; break;
1695 case SectionType::Subparagraph: m_t << "doxysubsubsubsubsubsubsection"; break;
1696 case SectionType::Subsubparagraph: m_t << "doxysubsubsubsubsubsubsection"; break;
1697 default: ASSERT(0); break;
1698 }
1699 m_t << "{";
1700 }
1701 else
1702 {
1703 switch(type.level())
1704 {
1705 case SectionType::Page: m_t << "doxysection"; break;
1706 case SectionType::Section: m_t << "doxysubsection"; break;
1707 case SectionType::Subsection: m_t << "doxysubsubsection"; break;
1708 case SectionType::Subsubsection: m_t << "doxysubsubsubsection"; break;
1709 case SectionType::Paragraph: m_t << "doxysubsubsubsubsection"; break;
1710 case SectionType::Subparagraph: m_t << "doxysubsubsubsubsubsection"; break;
1711 case SectionType::Subsubparagraph: m_t << "doxysubsubsubsubsubsubsection"; break;
1712 default: ASSERT(0); break;
1713 }
1714 m_t << "{";
1715 }
1716}
1717
1719{
1720 m_t << "}\\label{" << lab << "}\n";
1721}
1722
1723
1725{
1727 m_codeGen->insideTabbing(), // insideTabbing
1728 false, // insidePre
1729 false, // insideItem
1730 m_codeGen->usedTableLevel()>0, // insideTable
1731 false // keepSpaces
1732 );
1733}
1734
1736{
1737 char cs[2];
1738 cs[0]=c;
1739 cs[1]=0;
1740 docify(cs);
1741}
1742
1744{
1745 //if (Config_getBool(COMPACT_LATEX)) m_t << "\\doxysubsubsection"; else m_t << "\\doxysubsection";
1746 //m_t << "{";
1747}
1748
1750 const DString &fileName,const DString &)
1751{
1753}
1754
1755
1757{
1758 if (indent==0)
1759 {
1760 m_t << "\\begin{tabbing}\n";
1761 m_t << "xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=\\kill\n";
1763 }
1764 m_indent=indent;
1765}
1766
1768{
1769 if (indent==0)
1770 {
1771 m_t << "\n" << "\\end{tabbing}";
1773 }
1774 m_indent=indent;
1775}
1776
1778{
1780 {
1781 m_t << "{\\footnotesize ";
1782 }
1783}
1784
1786{
1788 {
1789 m_t << "}\\\\";
1790 }
1791}
1792
1794{
1795 //printf("LatexGenerator::startMemberItem(%d)\n",annType);
1796 if (!m_codeGen->insideTabbing())
1797 {
1798 m_t << "\\item \n";
1800 }
1801}
1802
1804{
1805 if (m_codeGen->insideTabbing())
1806 {
1807 m_t << "\\\\";
1808 }
1809 m_templateMemberItem = false;
1810 m_t << "\n";
1811}
1812
1814{
1815 if (!m_codeGen->insideTabbing())
1816 {
1817 m_t << "\\begin{DoxyCompactList}\\small\\item\\em ";
1818 }
1819 else
1820 {
1821 for (int i=0;i<m_indent+2;i++) m_t << "\\>";
1822 m_t << "{\\em ";
1823 }
1824}
1825
1827{
1828 if (!m_codeGen->insideTabbing())
1829 {
1830 //m_t << "\\item\\end{DoxyCompactList}";
1831 m_t << "\\end{DoxyCompactList}";
1832 }
1833 else
1834 {
1835 m_t << "}\\\\\n";
1836 }
1837}
1838
1839
1841{
1842 //printf("writeNonBreakableSpace()\n");
1843 if (m_codeGen->insideTabbing())
1844 {
1845 m_t << "\\>";
1846 }
1847 else
1848 {
1849 m_t << "~";
1850 }
1851}
1852
1853// ----------------------------------------------
1854// nesting of functions below:
1855// startDescTable()
1856// - startDescTableRow()
1857// - startDescTableTitle()
1858// - endDescTableTitle()
1859// - startDescTableData()
1860// - endDescTableData()
1861// - endDescTableRow()
1862// - startDescTableRow()
1863// - ...
1864// - endDescTableRow()
1865// endDescTable()
1866
1867void LatexGenerator::startDescTable(const DString &title,const bool hasInits)
1868{
1870 m_t << "\\begin{DoxyEnumFields}[" << (hasInits?3:2) << "]{" << title << "}\n";
1871}
1872
1874{
1876 m_t << "\\end{DoxyEnumFields}\n";
1877}
1878
1880{
1881 // this is needed to prevent the \hypertarget, \label, and \index commands from messing up
1882 // the row height (based on http://tex.stackexchange.com/a/186102)
1883 m_t << "\\raisebox{\\heightof{T}}[0pt][0pt]{";
1884}
1885
1889
1891{
1892 m_t << "}";
1893}
1894
1898
1900{
1901 m_t << "&";
1902}
1903
1907
1909{
1910 m_t << "&";
1911}
1912
1914{
1915 m_t << "\\\\\n\\hline\n\n";
1916}
1917
1921
1922
1924{
1925 if (!m_codeGen->insideTabbing())
1926 {
1927 m_t << "\\begin{DoxyCompactItemize}\n";
1928 }
1929}
1930
1932{
1933 //printf("LatexGenerator::endMemberList(%d)\n",m_codeGen->InsideTabbing());
1934 if (!m_codeGen->insideTabbing())
1935 {
1936 m_t << "\\end{DoxyCompactItemize}\n";
1937 }
1938}
1939
1940
1942{
1943 if (hasHeader)
1944 {
1945 m_t << "\\begin{Indent}";
1946 m_t << "\\textbf{ ";
1947 }
1948 // changed back to rev 756 due to bug 660501
1949 //if (Config_getBool(COMPACT_LATEX))
1950 //{
1951 // m_t << "\\doxysubparagraph*{";
1952 //}
1953 //else
1954 //{
1955 // m_t << "\\doxyparagraph*{";
1956 //}
1957}
1958
1960{
1961 // changed back to rev 756 due to bug 660501
1962 if (hasHeader) m_t << "}\\par\n";
1963 //m_t << "}\n";
1964}
1965
1967{
1968 m_t << "{\\em ";
1969}
1970
1972{
1973 m_t << "}";
1974}
1975
1979
1981{
1982 if (hasHeader)m_t << "\\end{Indent}";
1983 m_t << "\n";
1984}
1985
1987{
1988 m_t << "\n" << "\n";
1989}
1990
1995
1999
2004
2008
2013
2017
2022
2026
2031
2033{
2034 m_t << "\\begin{Desc}\n\\item[";
2036 m_t << "]";
2037}
2038
2040{
2041 m_t << "\\end{Desc}\n";
2042}
2043
2045{
2046 /* start of ParameterType ParameterName list */
2047 if (openBracket) m_t << "(";
2048 m_t << "\\begin{DoxyParamCaption}";
2049}
2050
2054
2056{
2057 m_t << "\\item[{";
2058 if (!first && !key.empty()) docify(key);
2059}
2060
2062{
2063 m_t << "}]";
2064}
2065
2066void LatexGenerator::startParameterName(bool /*oneArgOnly*/)
2067{
2068 m_t << "{";
2069}
2070
2072{
2073 m_t << "}";
2074}
2075
2077{
2078 m_t << "{";
2079}
2080
2081void LatexGenerator::endParameterExtra(bool last,bool /*emptyList*/,bool closeBracket)
2082{
2083 m_t << "}";
2084 if (last)
2085 {
2086 m_t << "\\end{DoxyParamCaption}";
2087 if (closeBracket) m_t << ")";
2088 }
2089}
2090
2091void LatexGenerator::exceptionEntry(const DString &prefix,bool closeBracket)
2092{
2093 if (!prefix.empty())
2094 {
2095 m_t << " " << prefix << "(";
2096 }
2097 else if (closeBracket)
2098 {
2099 m_t << ")";
2100 }
2101 m_t << " ";
2102}
2103
2104void LatexGenerator::writeDoc(const IDocNodeAST *ast,const Definition *ctx,const MemberDef *,int,int)
2105{
2106 const DocNodeAST *astImpl = dynamic_cast<const DocNodeAST*>(ast);
2107 if (astImpl)
2108 {
2110 ctx?ctx->getDefFileExtension():DString(""),
2112 std::visit(visitor,astImpl->root);
2113 }
2114}
2115
2117{
2118 m_t << "\\begin{Desc}\n\\item[";
2119 docify(header);
2120 m_t << "]";
2121 m_t << "\\begin{description}\n";
2122}
2123
2125{
2126 m_t << "\\item[{\\em ";
2127}
2128
2132
2134{
2135 m_t << "} : {\\em ";
2136}
2137
2139{
2140 m_t << "}]";
2141}
2142
2146
2150
2152{
2153 m_t << "\\end{description}\n";
2154 m_t << "\\end{Desc}\n";
2155}
2156
2158{
2159 if (Config_getBool(COMPACT_LATEX))
2160 {
2161 m_t << "\\doxyparagraph*{";
2162 }
2163 else
2164 {
2165 m_t << "\\" << LatexSections::name(m_hierarchyLevel + 1) << "*{";
2166 }
2167}
2168
2170{
2171 m_t << "}\n";
2172}
2173
2175{
2176 if (m_codeGen->insideTabbing())
2177 {
2178 m_t << "\\\\\n";
2179 }
2180 else
2181 {
2182 m_t << "\\newline\n";
2183 }
2184}
2185
2187{
2189 if (isEnum)
2190 {
2191 m_t << "\\begin{DoxyEnumFields}{";
2193 }
2194 else
2195 {
2196 m_t << "\\begin{DoxyFields}{";
2198 }
2199 m_t << "}\n";
2200 m_insideTableEnv=true;
2201}
2202
2204{
2205 m_insideTableEnv=false;
2207 if (isEnum)
2208 {
2209 m_t << "\\end{DoxyEnumFields}\n";
2210 }
2211 else
2212 {
2213 m_t << "\\end{DoxyFields}\n";
2214 }
2215}
2216
2218{
2219 m_codeGen->setInsideTabbing(true); // to prevent \+ from causing unwanted breaks
2220}
2221
2223{
2224 m_t << "&\n";
2226}
2227
2229{
2230 m_codeGen->setInsideTabbing(true); // to prevent \+ from causing unwanted breaks
2231}
2232
2234{
2235 m_t << "&\n";
2237}
2238
2242
2244{
2245 m_t << "\\\\\n\\hline\n\n";
2246}
2247
2249{
2250 m_t << "\\hspace{0.3cm}";
2251}
2252
2253void LatexGenerator::writeLabel(const DString &l,bool isLast)
2254{
2255 m_t << "{\\ttfamily [" << l << "]}";
2256 if (!isLast) m_t << ", ";
2257}
2258
2260{
2261}
2262
2264 const DString &/*id*/,const DString &ref,
2265 const DString &file, const DString &anchor,
2266 const DString &title, const DString &name)
2267{
2268 if (Config_getBool(COMPACT_LATEX))
2269 {
2270 m_t << "\\doxyparagraph*{";
2271 }
2272 else
2273 {
2274 m_t << "\\" << LatexSections::name(m_hierarchyLevel + 1) << "*{";
2275 }
2277 objectLinkToString(ref, file, anchor, name, m_codeGen->insideTabbing(), m_disableLinks));
2278 m_t << "}\n";
2279}
2280
2282{
2283 int maxLevel = level + m_hierarchyLevel;
2284 m_t << "\\DoxyTOC{\\etocsetnexttocdepth{" << maxLevel << "}";
2285 m_t << "\\localtableofcontents}\n";
2286}
2287
2289{
2290 m_t << "\\begin{DoxyEmbeddedDoc}[" << indent << "]\n";
2291}
2292
2294{
2295 m_t << "\\end{DoxyEmbeddedDoc}\n";
2296}
2297
2298//--------------------------------------------------------------------------------------------------
2299
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}
2317
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}
2360
2362 bool insideTabbing,bool insidePre,bool insideItem,bool insideTable,bool keepSpaces, const bool retainNewline)
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}
2507
2508DString convertToLaTeX(const DString &s,bool insideTabbing,bool keepSpaces)
2509{
2510 TextStream t;
2511 filterLatexString(t,s,insideTabbing,false,false,false,keepSpaces);
2512 return t.str();
2513}
2514
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}
2559
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}
2605
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}
2633
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}
2664
2665void latexWriteIndexItem(TextStream &m_t,const DString &s1,const DString &s2)
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}
2685
2686
constexpr auto prefix
Definition anchor.cpp:47
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
Class representing a built-in class diagram.
Definition diagram.h:29
void writeFigure(TextStream &t, const DString &path, const DString &file) const
Definition diagram.cpp:1067
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
DString quoted() const
Definition dstring.h:352
DString & prepend(const char *s)
Definition dstring.h:515
DString & sprintf(const char *format,...)
Definition dstring.cpp:34
@ ExplicitSize
Definition dstring.h:131
const std::string & str() const
Definition dstring.h:645
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
bool endsWith(const char *s) const
Definition dstring.h:617
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:151
The common base class of all entity definitions found in the sources.
Definition definition.h:77
virtual DString getDefFileExtension() const =0
Class representing a directory in the file system.
Definition dir.h:73
bool mkdir(const std::string &path, bool acceptsAbsPath=true) const
Definition dir.cpp:301
bool exists() const
Definition dir.cpp:263
Class representing the abstract syntax tree of a documentation block.
Definition docnode.h:1471
DocNodeVariant root
Definition docnode.h:1496
Representation of an call graph.
DString writeGraph(TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const DString &path, const DString &fileName, const DString &relPath, bool writeImageMap=true, int graphId=-1)
Representation of a class inheritance or dependency graph.
DString writeGraph(TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const DString &path, const DString &fileName, const DString &relPath, bool TBRank=true, bool imageMap=true, int graphId=-1)
Representation of an directory dependency graph.
Definition dotdirdeps.h:27
DString writeGraph(TextStream &out, GraphOutputFormat gf, EmbeddedOutputFormat ef, const DString &path, const DString &fileName, const DString &relPath, bool writeImageMap=true, int graphId=-1, bool linkRelations=true)
Representation of a group collaboration graph.
DString writeGraph(TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const DString &path, const DString &fileName, const DString &relPath, bool writeImageMap=true, int graphId=-1)
Representation of an include dependency graph.
DString writeGraph(TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const DString &path, const DString &fileName, const DString &relPath, bool writeImageMap=true, int graphId=-1)
static NamespaceLinkedMap * namespaceLinkedMap
Definition doxygen.h:108
static ConceptLinkedMap * conceptLinkedMap
Definition doxygen.h:90
static std::unique_ptr< PageDef > mainPage
Definition doxygen.h:93
static FileNameLinkedMap * inputNameLinkedMap
Definition doxygen.h:97
static ClassLinkedMap * classLinkedMap
Definition doxygen.h:88
static PageLinkedMap * exampleLinkedMap
Definition doxygen.h:91
static PageLinkedMap * pageLinkedMap
Definition doxygen.h:92
static DirLinkedMap * dirLinkedMap
Definition doxygen.h:120
static GroupLinkedMap * groupLinkedMap
Definition doxygen.h:107
Minimal replacement for QFileInfo.
Definition fileinfo.h:26
bool exists() const
Definition fileinfo.cpp:34
std::string fileName() const
Definition fileinfo.cpp:122
std::string absFilePath() const
Definition fileinfo.cpp:105
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.
opaque representation of the abstract syntax tree (AST)
Definition docparser.h:50
Generator for LaTeX code fragments.
Definition latexgen.h:30
int usedTableLevel() const
Definition latexgen.h:68
bool m_stripCodeComments
Definition latexgen.h:89
TextStream * m_t
Definition latexgen.h:82
void startCodeFragment(const DString &style) override
Definition latexgen.cpp:302
LatexCodeGenerator(TextStream *t, const DString &relPath, const DString &sourceFile)
Definition latexgen.cpp:60
void setStripIndentAmount(size_t amount) override
Definition latexgen.cpp:190
void setInsideTabbing(bool b)
Definition latexgen.h:72
void endFontClass() override
Definition latexgen.cpp:296
bool insideTabbing() const
Definition latexgen.h:73
void codify(const DString &text) override
Definition latexgen.cpp:79
void writeCodeLink(CodeSymbolType type, const DString &ref, const DString &file, const DString &anchor, const DString &name, const DString &tooltip) override
Definition latexgen.cpp:195
void setTextStream(TextStream *t)
Definition latexgen.h:34
void endSpecialComment() override
Definition latexgen.cpp:185
void stripCodeComments(bool b) override
Definition latexgen.cpp:175
size_t m_stripIndentAmount
Definition latexgen.h:91
DString m_relPath
Definition latexgen.h:83
void startCodeLine(int) override
Definition latexgen.cpp:268
void startSpecialComment() override
Definition latexgen.cpp:180
void decUsedTableLevel()
Definition latexgen.h:67
void startFontClass(const DString &) override
Definition latexgen.cpp:290
void writeLineNumber(const DString &, const DString &, const DString &, int, bool) override
Definition latexgen.cpp:221
void setRelativePath(const DString &path)
Definition latexgen.cpp:69
void endCodeFragment(const DString &style) override
Definition latexgen.cpp:307
void endCodeLine() override
Definition latexgen.cpp:279
DString m_sourceFileName
Definition latexgen.h:84
bool m_doxyCodeLineOpen
Definition latexgen.h:86
void setSourceFileName(const DString &sourceFileName)
Definition latexgen.cpp:74
void incUsedTableLevel()
Definition latexgen.h:66
Concrete visitor implementation for LaTeX output.
void endMemberItem(MemberItemType) override
void addCodeGen(OutputCodeList &list) override
Definition latexgen.cpp:361
void endIndexKey() override
void endInlineMemberDoc() override
void startMemberHeader(const DString &, int) override
void startProjectNumber() override
Definition latexgen.cpp:733
void cleanup() override
Definition latexgen.cpp:678
void startIndexSection(IndexSection) override
Definition latexgen.cpp:927
void writeInheritedSectionTitle(const DString &, const DString &, const DString &, const DString &, const DString &, const DString &) override
void endParameterList() override
void endMemberDescription() override
std::unique_ptr< OutputCodeList > m_codeList
Definition latexgen.h:330
void endDirDepGraph(DotDirDeps &g) override
void endDescTable() override
void startMemberGroup() override
void endInlineHeader() override
void endGroupHeader(int) override
void writeAnchor(const DString &fileName, const DString &name) override
void startTextLink(const DString &, const DString &) override
void writeChar(char c) override
void endDescTableInit() override
void docify(const DString &text) override
void startParameterName(bool) override
void writePageLink(const DString &, bool) override
void endParameterType() override
void startPageRef() override
void startFile(const DString &name, bool isSource, const DString &manName, const DString &title, int id, int hierarchyLevel) override
Definition latexgen.cpp:708
void endLabels() override
void endIndexValue(const DString &, bool) override
void endSection(const DString &, SectionType) override
void endIndexSection(IndexSection) override
void startMemberDoc(const DString &, const DString &, const DString &, const DString &, int, int, bool) override
void exceptionEntry(const DString &, bool) override
void startConstraintType() override
void startClassDiagram() override
void endInlineMemberType() override
void startDescTableTitle() override
void endInclDepGraph(DotInclDepGraph &) override
void writeNonBreakableSpace(int) override
void startTitleHead(const DString &) override
void startMemberGroupDocs() override
void startDescTable(const DString &title, const bool hasInits) override
void endDescTableTitle() override
void startMemberDescription(const DString &, const DString &, bool) override
void startInclDepGraph() override
void lastIndexPage() override
void endExamples() override
void startLocalToc(int level) override
void startAnonTypeScope(int) override
void endPlainFile() override
Definition latexgen.h:319
void endTitleHead(const DString &, const DString &name) override
static void writeFooterFile(TextStream &t)
Definition latexgen.cpp:696
void startParameterList(bool) override
void endMemberDoc(bool) override
void endConstraintType() override
void startDescTableRow() override
void endAnonTypeScope(int) override
void endConstraintList() override
void startDotGraph() override
void endParameterExtra(bool last, bool one, bool bracket) override
void startSection(const DString &, const DString &, SectionType) override
void startConstraintList(const DString &) override
void endDescTableData() override
void endIndexItem(const DString &ref, const DString &file) override
void startGroupCollaboration() override
void startLabels() override
void endMemberGroupHeader(bool) override
static void writeStyleSheetFile(TextStream &t)
Definition latexgen.cpp:702
void endMemberHeader() override
OutputType type() const override
Definition latexgen.h:113
void lineBreak(const DString &style=DString()) override
void endConstraintDocs() override
void startIndexKey() override
void startMemberGroupHeader(const DString &, bool) override
void startConstraintParam() override
void endInlineMemberName() override
void startMemberTemplateParams() override
void startInlineMemberType() override
void writeStartAnnoItem(const DString &type, const DString &file, const DString &path, const DString &name) override
int m_hierarchyLevel
Definition latexgen.h:333
void startPlainFile(const DString &name) override
Definition latexgen.h:318
void startInlineMemberDoc() override
void addLabel(const DString &, const DString &) override
void startCallGraph() override
void endMemberList() override
void endFile() override
Definition latexgen.cpp:722
void startExamples() override
void startIndexItem(const DString &ref, const DString &file) override
LatexGenerator & operator=(const LatexGenerator &)
Definition latexgen.cpp:341
void startDirDepGraph() override
void endTextLink() override
void endEmbeddedDoc() override
void startMemberList() override
void startDescTableData() override
void endDescTableRow() override
void startConstraintDocs() override
void endMemberGroupDocs() override
void endMemberTemplateParams(const DString &, const DString &) override
void startDescTableInit() override
void addIndexItem(const DString &, const DString &) override
void endMemberDocSimple(bool) override
void endParameterName() override
void startGroupHeader(const DString &, int) override
void startMemberDocSimple(bool) override
void endCallGraph(DotCallGraph &) override
void endGroupCollaboration(DotGroupCollaboration &g) override
void startParagraph(const DString &classDef) override
bool m_disableLinks
Definition latexgen.h:326
void startInlineHeader() override
void endConstraintParam() override
void endDotGraph(DotClassGraph &) override
void writeString(const DString &text) override
void startParameterExtra() override
LatexCodeGenerator * m_codeGen
Definition latexgen.h:331
void endMemberGroup(bool) override
bool m_firstDescItem
Definition latexgen.h:325
static void writeHeaderFile(TextStream &t)
Definition latexgen.cpp:690
void startEmbeddedDoc(size_t) override
void endParagraph() override
void writeObjectLink(const DString &ref, const DString &file, const DString &anchor, const DString &name) override
void endClassDiagram(const ClassDiagram &, const DString &, const DString &) override
bool m_insideTableEnv
Definition latexgen.h:332
void writeStyleInfo(int part) override
void endDoxyAnchor(const DString &, const DString &) override
void startIndexValue(bool) override
void writeLabel(const DString &l, bool isLast) override
void startInlineMemberName() override
void startDoxyAnchor(const DString &, const DString &, const DString &, const DString &, const DString &) override
void writeDoc(const IDocNodeAST *node, const Definition *ctx, const MemberDef *, int id, int sectionLevel) override
static void init()
Definition latexgen.cpp:632
void startMemberItem(const DString &, MemberItemType, const DString &) override
void startParameterType(bool, const DString &) override
DString m_relPath
Definition latexgen.h:327
void endPageRef(const DString &, const DString &) override
bool m_templateMemberItem
Definition latexgen.h:329
A model of a class/file/namespace member symbol.
Definition memberdef.h:45
static ModuleManager & instance()
Class representing a list of different code generators.
Definition outputlist.h:162
void add(OutputCodeIntfPtr &&p)
Definition outputlist.h:192
Abstract interface for output generators.
Definition outputgen.h:124
Base class for shared implementation for all output generators.
Definition outputgen.h:96
DString dir() const
Definition outputgen.cpp:48
TextStream m_t
Definition outputgen.h:113
DString fileName() const
Definition outputgen.cpp:53
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.
static constexpr int Section
Definition section.h:33
static constexpr int Subsection
Definition section.h:34
static constexpr int Subsubsection
Definition section.h:35
constexpr int level() const
Definition section.h:46
static constexpr int Page
Definition section.h:31
static constexpr int Paragraph
Definition section.h:36
static constexpr int Subsubparagraph
Definition section.h:38
static constexpr int Subparagraph
Definition section.h:37
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
virtual DString trCompoundMembers()=0
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 trInheritedFrom(const DString &members, const DString &what)=0
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
virtual DString trEnumerationValues()=0
virtual DString latexCommandName()
Definition translator.h:71
virtual DString trExamples()=0
#define Config_getInt(name)
Definition config.h:34
#define Config_getList(name)
Definition config.h:38
#define Config_getEnumAsString(name)
Definition config.h:36
#define Config_getBool(name)
Definition config.h:33
#define Config_getString(name)
Definition config.h:32
#define Config_getEnum(name)
Definition config.h:35
std::vector< std::string > StringVector
Definition containers.h:33
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
bool insideTable(const DocNodeVariant *n)
#define THREAD_LOCAL
Definition doxygen.h:29
DString substitute(const DString &s, const DString &src, const DString &dst)
substitute all occurrences of src in s by dst
Definition dstring.cpp:485
bool isId(char c)
Returns true if c is a valid character for an identifier.
Definition dstring.h:895
IndexSection
Definition index.h:31
@ isMainPage
Definition index.h:34
@ isTitlePageAuthor
Definition index.h:33
@ isFileIndex
Definition index.h:42
@ isFileDocumentation
Definition index.h:50
@ isPageDocumentation
Definition index.h:52
@ isDirDocumentation
Definition index.h:46
@ isModuleDocumentation
Definition index.h:44
@ isClassHierarchyIndex
Definition index.h:40
@ isModuleIndex
Definition index.h:35
@ isTopicIndex
Definition index.h:36
@ isConceptIndex
Definition index.h:39
@ isExampleDocumentation
Definition index.h:51
@ isClassDocumentation
Definition index.h:48
@ isPageIndex
Definition index.h:43
@ isCompoundIndex
Definition index.h:41
@ isEndIndex
Definition index.h:54
@ isConceptDocumentation
Definition index.h:49
@ isDirIndex
Definition index.h:37
@ isNamespaceIndex
Definition index.h:38
@ isNamespaceDocumentation
Definition index.h:47
@ isTitlePageStart
Definition index.h:32
@ isTopicDocumentation
Definition index.h:45
@ isPageDocumentation2
Definition index.h:53
Translator * theTranslator
Definition language.cpp:76
static DString extraLatexStyleSheet()
Definition latexgen.cpp:738
static DString substituteLatexKeywords(const DString &file, const DString &str, const DString &title)
Definition latexgen.cpp:799
static void writeLatexMakefile()
Definition latexgen.cpp:366
static DString latex_batchmode()
Definition latexgen.cpp:785
DString latexFilterURL(const DString &s)
static DString g_footer
Definition latexgen.cpp:54
DString latexEscapePDFString(const DString &s)
static const SelectionMarkerInfo latexMarkerInfo
Definition latexgen.cpp:56
DString latexEscapeIndexChars(const DString &s)
#define COPYCHAR()
DString latexEscapeLabelName(const DString &s)
static void processEntity(TextStream &t, bool pdfHyperlinks, const char *strForm, const char *strRepl)
static void writeMakeBat()
Definition latexgen.cpp:502
static void writeDefaultStyleSheet(TextStream &t)
Definition latexgen.cpp:685
void filterLatexString(TextStream &t, const DString &str, bool insideTabbing, bool insidePre, bool insideItem, bool insideTable, bool keepSpaces, const bool retainNewline)
void writeExtraLatexPackages(TextStream &t)
static DString g_header_file
Definition latexgen.cpp:53
static DString makeIndex()
Definition latexgen.cpp:767
void latexWriteIndexItem(TextStream &m_t, const DString &s1, const DString &s2)
static DString objectLinkToString(const DString &ref, const DString &f, const DString &anchor, const DString &text, bool insideTabbing, bool disableLinks)
void writeLatexSpecialFormulaChars(TextStream &t)
static DString g_header
Definition latexgen.cpp:52
static DString g_footer_file
Definition latexgen.cpp:55
DString convertToLaTeX(const DString &s, bool insideTabbing, bool keepSpaces)
void latexWriteIndexItem(TextStream &t, const DString &r1, const DString &s2="")
#define LATEX_STYLE_EXTENSION
Definition latexgen.h:24
DString latexEscapePDFString(const DString &s)
DString latexEscapeIndexChars(const DString &s)
DString convertToLaTeX(const DString &s, bool insideTabbing, bool keepSpaces=false)
void filterLatexString(TextStream &t, const DString &str, bool insideTabbing, bool insidePre, bool insideItem, bool insideTable, bool keepSpaces, const bool retainNewline=false)
#define ASSERT(x)
Definition message.h:142
#define term(fmt,...)
Definition message.h:137
const char * name(int level)
Definition latexgen.h:368
const char * ghostScriptCommand()
Definition portable.cpp:453
std::ofstream openOutputStream(const DString &name, bool append=false)
Definition portable.cpp:681
Definition message.h:146
Definition dstring.h:913
size_t updateColumnCount(const char *s, size_t col)
Definition outputgen.cpp:58
OutputCodeDefer< LatexCodeGenerator > LatexCodeGeneratorDefer
Definition outputlist.h:100
Portable versions of functions that are platform dependent.
Some helper functions for std::string.
std::string removeEmptyLines(const std::string &s)
Definition stringutil.h:193
CodeSymbolType
Definition types.h:481
Various UTF8 related helper functions.
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:5029
bool checkExtension(const DString &fName, const DString &ext)
Definition util.cpp:3935
DString showDate(const DString &fmt)
Definition util.cpp:2576
DString stripExtensionGeneral(const DString &fName, const DString &ext)
Definition util.cpp:3954
void clearSubDirs(const Dir &d)
Definition util.cpp:3005
void createSubDirs(const Dir &d)
Definition util.cpp:2978
void checkBlocks(const DString &s, const DString fileName, const SelectionMarkerInfo &markerInfo)
Definition util.cpp:5142
DString fileToString(const DString &name, bool filter, bool isSourceCode)
Definition util.cpp:1058
DString substituteKeywords(const DString &file, const DString &s, const KeywordSubstitutionList &keywords)
Definition util.cpp:2503
DString relativePathToRoot(const DString &name)
Definition util.cpp:2921
DString projectLogoFile()
Definition util.cpp:2589
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:4632
DString projectLogoSize()
Definition util.cpp:2608
DString stripPath(const DString &s)
Definition util.cpp:3969
A bunch of utility functions.