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#include <cstdlib>
17
18#include "latexgen.h"
19#include "config.h"
20#include "message.h"
21#include "doxygen.h"
22#include "util.h"
23#include "stringutil.h"
24#include "diagram.h"
25#include "language.h"
26#include "version.h"
27#include "dot.h"
28#include "dotcallgraph.h"
29#include "dotclassgraph.h"
30#include "dotdirdeps.h"
32#include "dotincldepgraph.h"
33#include "pagedef.h"
34#include "docparser.h"
35#include "docnode.h"
36#include "latexdocvisitor.h"
37#include "dirdef.h"
38#include "cite.h"
39#include "groupdef.h"
40#include "classlist.h"
41#include "namespacedef.h"
42#include "filename.h"
43#include "resourcemgr.h"
44#include "portable.h"
45#include "fileinfo.h"
46#include "utf8.h"
47#include "datetime.h"
48#include "outputlist.h"
49#include "moduledef.h"
50
55static const SelectionMarkerInfo latexMarkerInfo = { '%', "%%BEGIN ",8 ,"%%END ",6, "",0 };
56
57static DString substituteLatexKeywords(const DString &file, const DString &str, const DString &title);
58
59LatexCodeGenerator::LatexCodeGenerator(TextStream *t,const DString &relPath,const DString &sourceFileName)
60 : m_t(t), m_relPath(relPath), m_sourceFileName(sourceFileName)
61{
62}
63
67
69{
70 m_relPath = path;
71}
72
77
79{
80 if (!str.empty())
81 {
82 const char *p=str.data();
83 char c = 0;
84 //char cs[5];
85 int tabSize = Config_getInt(TAB_SIZE);
86 static THREAD_LOCAL char *result = nullptr;
87 static THREAD_LOCAL int lresult = 0;
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 (lresult < (i + bytes + 1)) \
141 { \
142 lresult += 512; \
143 result = static_cast<char *>(realloc(result, lresult)); \
144 } \
145 for (int j=0; j<bytes && *p; j++) \
146 { \
147 result[i++]=*p++; \
148 } \
149 m_col++; \
150 } while(0)
151
152 // gather characters until we find whitespace or another special character
153 COPYCHAR();
154 while ((c=*p) &&
155 c!=0x0c && c!='\t' && c!='\n' && c!=' ' && c!='^'
156 )
157 {
158 COPYCHAR();
159 }
160 result[i]=0; // add terminator
161 filterLatexString(*m_t,result,
162 m_insideTabbing, // insideTabbing
163 true, // insidePre
164 false, // insideItem
165 m_usedTableLevel>0, // insideTable
166 false // keepSpaces
167 );
168 }
169 break;
170 }
171 }
172 }
173 }
174}
175
180
185
187{
188 m_hide = false;
189}
190
192{
193 m_stripIndentAmount = amount;
194}
195
197 const DString &ref,const DString &f,
198 const DString &anchor,const DString &name,
199 const DString &)
200{
201 if (m_hide) return;
202 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
203 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
204 size_t l = name.length();
205 if (ref.empty() && usePDFLatex && pdfHyperlinks)
206 {
207 *m_t << "\\doxymbox{\\hyperlink{";
208 if (!f.empty()) *m_t << stripPath(f);
209 if (!f.empty() && !anchor.empty()) *m_t << "_";
210 if (!anchor.empty()) *m_t << anchor;
211 *m_t << "}{";
212 codify(name);
213 *m_t << "}}";
214 }
215 else
216 {
217 codify(name);
218 }
219 m_col+=l;
220}
221
222void LatexCodeGenerator::writeLineNumber(const DString &ref,const DString &fileName,const DString &anchor,int l,bool writeLineAnchor)
223{
224 if (m_hide) return;
225 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
226 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
228 {
229 *m_t << "\\DoxyCodeLine{";
230 m_doxyCodeLineOpen = true;
231 }
232 if (Config_getBool(SOURCE_BROWSER))
233 {
234 DString lineNumber;
235 lineNumber.sprintf("%05d",l);
236
237 DString lineAnchor;
238 if (!m_sourceFileName.empty())
239 {
240 lineAnchor.sprintf("_l%05d",l);
242 }
243 bool showTarget = usePDFLatex && pdfHyperlinks && !lineAnchor.empty() && writeLineAnchor;
244 if (showTarget)
245 {
246 *m_t << "\\Hypertarget{" << stripPath(lineAnchor) << "}";
247 }
248 if (!fileName.empty())
249 {
250 writeCodeLink(CodeSymbolType::Default,ref,fileName,anchor,lineNumber,DString());
251 }
252 else
253 {
254 codify(lineNumber);
255 }
256 *m_t << "\\ ";
257 }
258 else
259 {
260 DString lineNumber;
261 lineNumber.sprintf("%05d",l);
262 codify(lineNumber);
263 *m_t << "\\ ";
264 }
265 m_col=0;
266}
267
268
270{
271 if (m_hide) return;
272 m_col=0;
274 {
275 *m_t << "\\DoxyCodeLine{";
276 m_doxyCodeLineOpen = true;
277 }
278}
279
281{
282 if (m_hide) return;
284 {
285 *m_t << "}";
286 m_doxyCodeLineOpen = false;
287 }
288 codify("\n");
289}
290
292{
293 if (m_hide) return;
294 *m_t << "\\textcolor{" << name << "}{";
295}
296
298{
299 if (m_hide) return;
300 *m_t << "}";
301}
302
304{
305 *m_t << "\n\\begin{" << style << "}{" << m_usedTableLevel << "}\n";
306}
307
309{
310 //endCodeLine checks is there is still an open code line, if so closes it.
311 bool wasHidden = m_hide;
312 m_hide = false;
313 endCodeLine();
314 m_hide = wasHidden;
315
316 *m_t << "\\end{" << style << "}\n";
317}
318
319
320//-------------------------------
321
328
341
343{
344 if (this!=&og)
345 {
346 m_dir = og.m_dir;
347 m_codeList = std::make_unique<OutputCodeList>(*og.m_codeList);
352 m_relPath = og.m_relPath;
353 m_indent = og.m_indent;
356 }
357 return *this;
358}
359
361
366
368{
369 bool generateBib = !CitationManager::instance().empty();
370 DString fileName=Config_getString(LATEX_OUTPUT)+"/Makefile";
371 std::ofstream f = Portable::openOutputStream(fileName);
372 if (!f.is_open())
373 {
374 term("Could not open file {} for writing\n",fileName);
375 }
376 TextStream t(&f);
377 // inserted by KONNO Akihisa <konno@researchers.jp> 2002-03-05
378 DString latex_command = theTranslator->latexCommandName().quoted();
379 DString mkidx_command = Config_getString(MAKEINDEX_CMD_NAME).quoted();
380 DString bibtex_command = "bibtex";
381 DString manual_file = "refman";
382 const int latex_count = 8;
383 // end insertion by KONNO Akihisa <konno@researchers.jp> 2002-03-05
384 t << "LATEX_CMD?=" << latex_command << "\n"
385 << "MKIDX_CMD?=" << mkidx_command << "\n"
386 << "BIBTEX_CMD?=" << bibtex_command << "\n"
387 << "LATEX_COUNT?=" << latex_count << "\n"
388 << "MANUAL_FILE?=" << manual_file << "\n"
389 << "\n";
390 if (!Config_getBool(USE_PDFLATEX)) // use plain old latex
391 {
392 t << "all: $(MANUAL_FILE).dvi\n"
393 << "\n"
394 << "ps: $(MANUAL_FILE).ps\n"
395 << "\n"
396 << "pdf: $(MANUAL_FILE).pdf\n"
397 << "\n"
398 << "ps_2on1: $(MANUAL_FILE).ps\n"
399 << "\n"
400 << "pdf_2on1: $(MANUAL_FILE).pdf\n"
401 << "\n"
402 << "$(MANUAL_FILE).ps: $(MANUAL_FILE).dvi\n"
403 << "\tdvips -o $(MANUAL_FILE).ps $(MANUAL_FILE).dvi\n"
404 << "\n";
405 t << "$(MANUAL_FILE).pdf: $(MANUAL_FILE).ps\n";
406 t << "\tps2pdf $(MANUAL_FILE).ps $(MANUAL_FILE).pdf\n\n";
407 t << "$(MANUAL_FILE).dvi: clean $(MANUAL_FILE).tex doxygen.sty\n"
408 << "\techo \"Running latex...\"\n"
409 << "\t$(LATEX_CMD) $(MANUAL_FILE).tex || \\\n"
410 << "\tif [ $$? != 0 ] ; then \\\n"
411 << "\t \\echo \"Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n"
412 << "\t false; \\\n"
413 << "\tfi\n"
414 << "\techo \"Running makeindex...\"\n"
415 << "\t$(MKIDX_CMD) $(MANUAL_FILE).idx\n";
416 if (generateBib)
417 {
418 t << "\techo \"Running bibtex...\"\n";
419 t << "\t$(BIBTEX_CMD) $(MANUAL_FILE)\n";
420 t << "\techo \"Rerunning latex....\"\n";
421 t << "\t$(LATEX_CMD) $(MANUAL_FILE).tex || \\\n"
422 << "\tif [ $$? != 0 ] ; then \\\n"
423 << "\t \\echo \"Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n"
424 << "\t false; \\\n"
425 << "\tfi\n";
426 }
427 t << "\techo \"Rerunning latex....\"\n"
428 << "\t$(LATEX_CMD) $(MANUAL_FILE).tex\n"
429 << "\tlatex_count=$(LATEX_COUNT) ; \\\n"
430 << "\twhile grep -E -s 'Rerun (LaTeX|to get cross-references right|to get bibliographical references right)' $(MANUAL_FILE).log && [ $$latex_count -gt 0 ] ;\\\n"
431 << "\t do \\\n"
432 << "\t echo \"Rerunning latex....\" ;\\\n"
433 << "\t $(LATEX_CMD) $(MANUAL_FILE).tex ; \\\n"
434 << "\t $(LATEX_CMD) $(MANUAL_FILE).tex || \\\n"
435 << "\t if [ $$? != 0 ] ; then \\\n"
436 << "\t \\echo \"Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n"
437 << "\t false; \\\n"
438 << "\t fi; \\\n"
439 << "\t latex_count=`expr $$latex_count - 1` ;\\\n"
440 << "\t done\n"
441 << "\t$(MKIDX_CMD) $(MANUAL_FILE).idx\n"
442 << "\t$(LATEX_CMD) $(MANUAL_FILE).tex || \\\n"
443 << "\tif [ $$? != 0 ] ; then \\\n"
444 << "\t \\echo \"Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n"
445 << "\t false; \\\n"
446 << "\tfi\n"
447 << "$(MANUAL_FILE).ps: $(MANUAL_FILE).ps\n"
448 << "\tpsnup -2 $(MANUAL_FILE).ps >$(MANUAL_FILE).ps\n"
449 << "\n"
450 << "$(MANUAL_FILE).pdf: $(MANUAL_FILE).ps\n"
451 << "\tps2pdf $(MANUAL_FILE).ps $(MANUAL_FILE).pdf\n";
452 }
453 else // use pdflatex for higher quality output
454 {
455 t << "all: $(MANUAL_FILE).pdf\n\n"
456 << "pdf: $(MANUAL_FILE).pdf\n\n";
457 t << "$(MANUAL_FILE).pdf: clean $(MANUAL_FILE).tex\n";
458 t << "\t$(LATEX_CMD) $(MANUAL_FILE) || \\\n"
459 << "\tif [ $$? != 0 ] ; then \\\n"
460 << "\t \\echo \"Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n"
461 << "\t false; \\\n"
462 << "\tfi\n";
463 t << "\t$(MKIDX_CMD) $(MANUAL_FILE).idx\n";
464 if (generateBib)
465 {
466 t << "\t$(BIBTEX_CMD) $(MANUAL_FILE)\n";
467 t << "\t$(LATEX_CMD) $(MANUAL_FILE) || \\\n"
468 << "\tif [ $$? != 0 ] ; then \\\n"
469 << "\t \\echo \"Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n"
470 << "\t false; \\\n"
471 << "\tfi\n";
472 }
473 t << "\t$(LATEX_CMD) $(MANUAL_FILE) || \\\n"
474 << "\tif [ $$? != 0 ] ; then \\\n"
475 << "\t \\echo \"Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n"
476 << "\t false; \\\n"
477 << "\tfi\n"
478 << "\tlatex_count=$(LATEX_COUNT) ; \\\n"
479 << "\twhile grep -E -s 'Rerun (LaTeX|to get cross-references right|to get bibliographical references right)' $(MANUAL_FILE).log && [ $$latex_count -gt 0 ] ;\\\n"
480 << "\t do \\\n"
481 << "\t echo \"Rerunning latex....\" ;\\\n"
482 << "\t $(LATEX_CMD) $(MANUAL_FILE) || \\\n"
483 << "\t if [ $$? != 0 ] ; then \\\n"
484 << "\t \\echo \"Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n"
485 << "\t false; \\\n"
486 << "\t fi; \\\n"
487 << "\t latex_count=`expr $$latex_count - 1` ;\\\n"
488 << "\t done\n"
489 << "\t$(MKIDX_CMD) $(MANUAL_FILE).idx\n"
490 << "\t$(LATEX_CMD) $(MANUAL_FILE) || \\\n"
491 << "\tif [ $$? != 0 ] ; then \\\n"
492 << "\t \\echo \"Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n"
493 << "\t false; \\\n"
494 << "\tfi\n";
495 }
496
497 t << "\n"
498 << "clean:\n"
499 << "\trm -f "
500 << "*.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out *.brf *.blg *.bbl $(MANUAL_FILE).pdf\n";
501}
502
503static void writeMakeBat()
504{
505#if defined(_MSC_VER)
506 DString dir=Config_getString(LATEX_OUTPUT);
507 DString fileName=dir+"/make.bat";
508 DString latex_command = theTranslator->latexCommandName().quoted();
509 DString mkidx_command = Config_getString(MAKEINDEX_CMD_NAME).quoted();
510 DString bibtex_command = "bibtex";
511 DString manual_file = "refman";
512 const int latex_count = 8;
513 bool generateBib = !CitationManager::instance().empty();
514 std::ofstream t = Portable::openOutputStream(fileName);
515 if (!t.is_open())
516 {
517 term("Could not open file {} for writing\n",fileName);
518 }
519 t << "pushd %~dp0\r\n";
520 t << "if not %errorlevel% == 0 goto :end1\r\n";
521 t << "\r\n";
522 t << "set ORG_LATEX_CMD=%LATEX_CMD%\r\n";
523 t << "set ORG_MKIDX_CMD=%MKIDX_CMD%\r\n";
524 t << "set ORG_BIBTEX_CMD=%BIBTEX_CMD%\r\n";
525 t << "set ORG_LATEX_COUNT=%LATEX_COUNT%\r\n";
526 t << "set ORG_MANUAL_FILE=%MANUAL_FILE%\r\n";
527 t << "if \"X\"%LATEX_CMD% == \"X\" set LATEX_CMD=" << latex_command << "\r\n";
528 t << "if \"X\"%MKIDX_CMD% == \"X\" set MKIDX_CMD=" << mkidx_command << "\r\n";
529 t << "if \"X\"%BIBTEX_CMD% == \"X\" set BIBTEX_CMD=" << bibtex_command << "\r\n";
530 t << "if \"X\"%LATEX_COUNT% == \"X\" set LATEX_COUNT=" << latex_count << "\r\n";
531 t << "if \"X\"%MANUAL_FILE% == \"X\" set MANUAL_FILE=" << manual_file << "\r\n";
532 t << "\r\n";
533 t << "del /s /f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out *.brf *.blg *.bbl %MANUAL_FILE%.pdf\r\n\r\n";
534 t << "\r\n";
535 if (!Config_getBool(USE_PDFLATEX)) // use plain old latex
536 {
537 t << "%LATEX_CMD% %MANUAL_FILE%.tex\r\n";
538 t << "@if ERRORLEVEL 1 goto :error\r\n";
539 t << "echo ----\r\n";
540 t << "%MKIDX_CMD% %MANUAL_FILE%.idx\r\n";
541 if (generateBib)
542 {
543 t << "%BIBTEX_CMD% %MANUAL_FILE%\r\n";
544 t << "echo ----\r\n";
545 t << "\t%LATEX_CMD% %MANUAL_FILE%.tex\r\n";
546 t << "@if ERRORLEVEL 1 goto :error\r\n";
547 }
548 t << "setlocal enabledelayedexpansion\r\n";
549 t << "set count=%LAT#EX_COUNT%\r\n";
550 t << ":repeat\r\n";
551 t << "set content=X\r\n";
552 t << "for /F \"tokens=*\" %%T in ( 'findstr /C:\"Rerun LaTeX\" %MANUAL_FILE%.log' ) do set content=\"%%~T\"\r\n";
553 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";
554 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";
555 t << "if !content! == X goto :skip\r\n";
556 t << "set /a count-=1\r\n";
557 t << "if !count! EQU 0 goto :skip\r\n\r\n";
558 t << "echo ----\r\n";
559 t << "%LATEX_CMD% %MANUAL_FILE%.tex\r\n";
560 t << "@if ERRORLEVEL 1 goto :error\r\n";
561 t << "goto :repeat\r\n";
562 t << ":skip\r\n";
563 t << "endlocal\r\n";
564 t << "%MKIDX_CMD% %MANUAL_FILE%.idx\r\n";
565 t << "%LATEX_CMD% %MANUAL_FILE%.tex\r\n";
566 t << "@if ERRORLEVEL 1 goto :error\r\n";
567 t << "dvips -o %MANUAL_FILE%.ps %MANUAL_FILE%.dvi\r\n";
569 t << " -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite "
570 "-sOutputFile=%MANUAL_FILE%.pdf -c save pop -f %MANUAL_FILE%.ps\r\n";
571 }
572 else // use pdflatex
573 {
574 t << "%LATEX_CMD% %MANUAL_FILE%\r\n";
575 t << "@if ERRORLEVEL 1 goto :error\r\n";
576 t << "echo ----\r\n";
577 t << "%MKIDX_CMD% %MANUAL_FILE%.idx\r\n";
578 if (generateBib)
579 {
580 t << "%BIBTEX_CMD% %MANUAL_FILE%\r\n";
581 t << "%LATEX_CMD% %MANUAL_FILE%\r\n";
582 t << "@if ERRORLEVEL 1 goto :error\r\n";
583 }
584 t << "echo ----\r\n";
585 t << "%LATEX_CMD% %MANUAL_FILE%\r\n";
586 t << "@if ERRORLEVEL 1 goto :error\r\n";
587 t << "\r\n";
588 t << "setlocal enabledelayedexpansion\r\n";
589 t << "set count=%LATEX_COUNT%\r\n";
590 t << ":repeat\r\n";
591 t << "set content=X\r\n";
592 t << "for /F \"tokens=*\" %%T in ( 'findstr /C:\"Rerun LaTeX\" %MANUAL_FILE%.log' ) do set content=\"%%~T\"\r\n";
593 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";
594 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";
595 t << "if !content! == X goto :skip\r\n";
596 t << "set /a count-=1\r\n";
597 t << "if !count! EQU 0 goto :skip\r\n\r\n";
598 t << "echo ----\r\n";
599 t << "%LATEX_CMD% %MANUAL_FILE%\r\n";
600 t << "@if ERRORLEVEL 1 goto :error\r\n";
601 t << "goto :repeat\r\n";
602 t << ":skip\r\n";
603 t << "endlocal\r\n";
604 t << "%MKIDX_CMD% %MANUAL_FILE%.idx\r\n";
605 t << "%LATEX_CMD% %MANUAL_FILE%\r\n";
606 t << "@if ERRORLEVEL 1 goto :error\r\n";
607 }
608 t<< "\r\n";
609 t << "goto :end\r\n";
610 t << ":error\r\n";
611 t << "@echo ===============\r\n";
612 t << "@echo Please consult %MANUAL_FILE%.log to see the error messages\r\n";
613 t << "@echo ===============\r\n";
614 t<< "\r\n";
615 t<< ":end\r\n";
616 t<< "@REM reset environment\r\n";
617 t<< "popd\r\n";
618 t<< "set LATEX_CMD=%ORG_LATEX_CMD%\r\n";
619 t<< "set ORG_LATEX_CMD=\r\n";
620 t<< "set MKIDX_CMD=%ORG_MKIDX_CMD%\r\n";
621 t<< "set ORG_MKIDX_CMD=\r\n";
622 t<< "set BIBTEX_CMD=%ORG_BIBTEX_CMD%\r\n";
623 t<< "set ORG_BIBTEX_CMD=\r\n";
624 t<< "set MANUAL_FILE=%ORG_MANUAL_FILE%\r\n";
625 t<< "set ORG_MANUAL_FILE=\r\n";
626 t<< "set LATEX_COUNT=%ORG_LATEX_COUNT%\r\n";
627 t<< "set ORG_LATEX_COUNT=\r\n";
628 t<< "\r\n";
629 t<< ":end1\r\n";
630#endif
631}
632
634{
635 DString dname = Config_getString(LATEX_OUTPUT);
636 Dir d(dname.str());
637 if (!d.exists() && !d.mkdir(dname.str()))
638 {
639 term("Could not create output directory {}\n",dname);
640 }
641
642 if (!Config_getString(LATEX_HEADER).empty())
643 {
644 g_header_file=Config_getString(LATEX_HEADER);
646 //printf("g_header='%s'\n",qPrint(g_header));
649 }
650 else
651 {
652 g_header_file = "header.tex";
655 checkBlocks(result,"<default header.tex>",latexMarkerInfo);
656 }
657 if (!Config_getString(LATEX_FOOTER).empty())
658 {
659 g_footer_file=Config_getString(LATEX_FOOTER);
661 //printf("g_footer='%s'\n",qPrint(g_footer));
664 }
665 else
666 {
667 g_footer_file = "footer.tex";
670 checkBlocks(result,"<default footer.tex>",latexMarkerInfo);
671 }
672
674 writeMakeBat();
675
676 createSubDirs(d);
677}
678
680{
681 DString dname = Config_getString(LATEX_OUTPUT);
682 Dir d(dname.str());
683 clearSubDirs(d);
684}
685
687{
688 t << ResourceMgr::instance().getAsString("doxygen.sty");
689}
690
692{
693 t << "% Latex header for doxygen " << getDoxygenVersion() << "\n";
694 t << ResourceMgr::instance().getAsString("header.tex");
695}
696
698{
699 t << "% Latex footer for doxygen " << getDoxygenVersion() << "\n";
700 t << ResourceMgr::instance().getAsString("footer.tex");
701}
702
704{
705 t << "% stylesheet for doxygen " << getDoxygenVersion() << "\n";
707}
708
709void LatexGenerator::startFile(const DString &name,bool,const DString &,const DString &,int,int hierarchyLevel)
710{
711#if 0
712 setEncoding(Config_getString(LATEX_OUTPUT_ENCODING));
713#endif
714 DString fileName=name;
715 m_hierarchyLevel = hierarchyLevel;
717 if (!fileName.endsWith(".tex") && !fileName.endsWith(".sty")) fileName+=".tex";
721}
722
728
729//void LatexGenerator::writeIndex()
730//{
731// startFile("refman.tex");
732//}
733
735{
736 m_t << "\\\\[1ex]\\large ";
737}
738
740{
741 DString result;
742 StringVector extraLatexStyles = Config_getList(LATEX_EXTRA_STYLESHEET);
743 for (const auto &fileName : extraLatexStyles)
744 {
745 if (!fileName.empty())
746 {
747 FileInfo fi(fileName);
748 if (fi.exists())
749 {
750 result += "\\usepackage{";
751 DString fn = fi.fileName();
753 {
754 // strip the extension, it will be added by the usepackage in the tex conversion process
756 }
757 else
758 {
759 result += fn;
760 }
761 result += "}\n";
762 }
763 }
764 }
765 return result;
766}
767
769{
770 DString result;
771 DString latex_mkidx_command = Config_getString(LATEX_MAKEINDEX_CMD);
772 if (!latex_mkidx_command.empty())
773 {
774 if (latex_mkidx_command[0] == '\\')
775 result += latex_mkidx_command;
776 else
777 result += "\\"+latex_mkidx_command;
778 }
779 else
780 {
781 result += "\\makeindex";
782 }
783 return result;
784}
785
787{
788 switch (Config_getEnum(LATEX_BATCHMODE))
789 {
790 case LATEX_BATCHMODE_t::NO: return "";
791 case LATEX_BATCHMODE_t::YES: return "\\batchmode";
792 case LATEX_BATCHMODE_t::BATCH: return "\\batchmode";
793 case LATEX_BATCHMODE_t::NON_STOP: return "\\nonstopmode";
794 case LATEX_BATCHMODE_t::SCROLL: return "\\scrollmode";
795 case LATEX_BATCHMODE_t::ERROR_STOP: return "\\errorstopmode";
796 }
797 return "";
798}
799
801 const DString &str,
802 const DString &title)
803{
804 bool compactLatex = Config_getBool(COMPACT_LATEX);
805 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
806 bool usePdfLatex = Config_getBool(USE_PDFLATEX);
807 DString paperType = Config_getEnumAsString(PAPER_TYPE);
808
809 DString style = Config_getString(LATEX_BIB_STYLE);
810 if (style.empty())
811 {
812 style="plainnat";
813 }
814
815 TextStream tg;
816 DString generatedBy;
817 auto timeStamp = Config_getEnum(TIMESTAMP);
818 switch (timeStamp)
819 {
820 case TIMESTAMP_t::YES:
821 case TIMESTAMP_t::DATETIME:
823 Config_getString(PROJECT_NAME));
824 break;
825 case TIMESTAMP_t::DATE:
827 Config_getString(PROJECT_NAME));
828 break;
829 case TIMESTAMP_t::NO:
830 generatedBy = theTranslator->trGeneratedBy();
831 break;
832 }
833 filterLatexString(tg, generatedBy,
834 false, // insideTabbing
835 false, // insidePre
836 false, // insideItem
837 false, // insideTable
838 false // keepSpaces
839 );
840 generatedBy = tg.str();
841
842 DString latexFontenc = theTranslator->latexFontenc();
843
844 DString latexEmojiDirectory = Config_getString(LATEX_EMOJI_DIRECTORY);
845 if (latexEmojiDirectory.empty()) latexEmojiDirectory = ".";
846 latexEmojiDirectory = substitute(latexEmojiDirectory,"\\","/");
847
848 TextStream tg1;
850 DString extraLatexPackages = tg1.str();
851
852 TextStream tg2;
854 DString latexSpecialFormulaChars = tg2.str();
855
856 DString formulaMacrofile = Config_getString(FORMULA_MACROFILE);
857 DString stripMacroFile;
858 if (!formulaMacrofile.empty())
859 {
860 FileInfo fi(formulaMacrofile.str());
861 formulaMacrofile=fi.absFilePath();
862 stripMacroFile = fi.fileName();
863 copyFile(formulaMacrofile,Config_getString(LATEX_OUTPUT) + "/" + stripMacroFile);
864 }
865
866 DString projectNumber = Config_getString(PROJECT_NUMBER);
867 DString projName = convertToLaTeX(Config_getString(PROJECT_NAME), false);
868 DString projBrief = convertToLaTeX(Config_getString(PROJECT_BRIEF),false);
869
870 // first substitute generic keywords then the LaTeX only keywords
871 DString result = substituteKeywords(file,str,
872 {
873 // keyword value getter
874 { "$title", [&]() { return !title.empty() ? title : projName; } },
875 { "$doxygenversion", [&]() { return getDoxygenVersion(); } },
876 { "$projectname", [&]() { return projName; } },
877 { "$projectnumber", [&]() { return convertToLaTeX(projectNumber,false); } },
878 { "$projectbrief", [&]() { return projBrief; } },
879 { "$projectlogo", [&]() { return stripPath(projectLogoFile()); } },
880 { "$logosize", [&]() { return projectLogoSize(); } },
881 { "$projecticon", [&]() { return stripPath(Config_getString(PROJECT_ICON)); } },
882 { "$langISO", [&]() { return theTranslator->trISOLang(); } },
883 { "$showdate", [&](const DString &fmt) { return showDate(fmt); } },
884
885 // keyword value getter
886 { "$datetime", [&]() { return dateToString(DateTimeType::DateTime); } },
887 { "$date", [&]() { return dateToString(DateTimeType::Date); } },
888 { "$time", [&]() { return dateToString(DateTimeType::Time); } },
889 { "$year", [&]() { return yearToString(); } },
890 { "$latexdocumentpre", [&]() { return theTranslator->latexDocumentPre(); } },
891 { "$latexdocumentpost", [&]() { return theTranslator->latexDocumentPost(); } },
892 { "$generatedby", [&]() { return generatedBy; } },
893 { "$latexbibstyle", [&]() { return style; } },
894 { "$latexcitereference", [&]() { return theTranslator->trCiteReferences(); } },
895 { "$latexbibfiles", [&]() { return CitationManager::instance().latexBibFiles(); } },
896 { "$papertype", [&]() { return paperType+"paper"; } },
897 { "$extralatexstylesheet", [&]() { return extraLatexStyleSheet(); } },
898 { "$languagesupport", [&]() { return theTranslator->latexLanguageSupportCommand(); } },
899 { "$latexfontenc", [&]() { return latexFontenc; } },
900 { "$latexfont", [&]() { return theTranslator->latexFont(); } },
901 { "$latexemojidirectory", [&]() { return latexEmojiDirectory; } },
902 { "$makeindex", [&]() { return makeIndex(); } },
903 { "$extralatexpackages", [&]() { return extraLatexPackages; } },
904 { "$latexspecialformulachars", [&]() { return latexSpecialFormulaChars; } },
905 { "$formulamacrofile", [&]() { return stripMacroFile; } },
906 { "$latex_batchmode", [&]() { return latex_batchmode(); } }
907 });
908
909 // remove conditional blocks
910 result = selectBlocks(result,
911 {
912 // marker is enabled
913 { "CITATIONS_PRESENT", !CitationManager::instance().empty() },
914 { "COMPACT_LATEX", compactLatex },
915 { "PDF_HYPERLINKS", pdfHyperlinks },
916 { "USE_PDFLATEX", usePdfLatex },
917 { "TIMESTAMP", timeStamp!=TIMESTAMP_t::NO },
918 { "LATEX_FONTENC", !latexFontenc.empty() },
919 { "FORMULA_MACROFILE", !formulaMacrofile.empty() },
920 { "PROJECT_NUMBER", !projectNumber.empty() }
922
923 result = removeEmptyLines(result.str());
924
925 return result;
926}
927
929{
930 bool compactLatex = Config_getBool(COMPACT_LATEX);
931 switch (is)
932 {
935 break;
937 break;
939 break;
941 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
942 m_t << "{"; //Module Index}\n"
943 break;
945 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
946 m_t << "{"; //Topic Index}\n"
947 break;
949 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
950 m_t << "{"; //Directory Index}\n"
951 break;
953 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
954 m_t << "{"; //Namespace Index}\n"
955 break;
957 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
958 m_t << "{"; //Concept Index}\n"
959 break;
961 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
962 m_t << "{"; //Hierarchical Index}\n"
963 break;
965 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
966 m_t << "{"; //Annotated Compound Index}\n"
967 break;
969 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
970 m_t << "{"; //Annotated File Index}\n"
971 break;
973 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
974 m_t << "{"; //Annotated Page Index}\n"
975 break;
977 {
978 for (const auto &gd : *Doxygen::groupLinkedMap)
979 {
980 if (!gd->isReference())
981 {
982 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
983 m_t << "{"; //Topic Documentation}\n";
984 break;
985 }
986 }
987 }
988 break;
990 {
991 for (const auto &mod : ModuleManager::instance().modules())
992 {
993 if (!mod->isReference() && mod->isPrimaryInterface())
994 {
995 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
996 m_t << "{"; //Topic Documentation}\n";
997 break;
998 }
999 }
1000 }
1001 break;
1003 {
1004 for (const auto &dd : *Doxygen::dirLinkedMap)
1005 {
1006 if (dd->isLinkableInProject())
1007 {
1008 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
1009 m_t << "{"; //Dir Documentation}\n";
1010 break;
1011 }
1012 }
1013 }
1014 break;
1016 {
1017 for (const auto &nd : *Doxygen::namespaceLinkedMap)
1018 {
1019 if (nd->isLinkableInProject() && !nd->isAlias())
1020 {
1021 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
1022 m_t << "{"; // Namespace Documentation}\n":
1023 break;
1024 }
1025 }
1026 }
1027 break;
1029 {
1030 for (const auto &cd : *Doxygen::conceptLinkedMap)
1031 {
1032 if (cd->isLinkableInProject() && !cd->isAlias())
1033 {
1034 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
1035 m_t << "{"; // Concept Documentation}\n":
1036 break;
1037 }
1038 }
1039 }
1040 break;
1042 {
1043 for (const auto &cd : *Doxygen::classLinkedMap)
1044 {
1045 if (cd->isLinkableInProject() &&
1046 !cd->isImplicitTemplateInstance() &&
1047 !cd->isEmbeddedInOuterScope() &&
1048 !cd->isAlias()
1049 )
1050 {
1051 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
1052 m_t << "{"; //Compound Documentation}\n";
1053 break;
1054 }
1055 }
1056 }
1057 break;
1059 {
1060 bool isFirst=true;
1061 for (const auto &fn : *Doxygen::inputNameLinkedMap)
1062 {
1063 for (const auto &fd : *fn)
1064 {
1065 if (fd->isLinkableInProject() || fd->generateSourceFile())
1066 {
1067 if (isFirst)
1068 {
1069 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
1070 m_t << "{"; //File Documentation}\n";
1071 isFirst=false;
1072 break;
1073 }
1074 }
1075 }
1076 }
1077 }
1078 break;
1080 {
1081 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
1082 m_t << "{"; //Example Documentation}\n";
1083 }
1084 break;
1086 break;
1088 break;
1090 break;
1091 }
1092}
1093
1095{
1096 switch (is)
1097 {
1099 break;
1101 break;
1103 {
1105 {
1106 writePageLink(Doxygen::mainPage->getOutputFileBase(), false);
1107 }
1108 }
1109 break;
1111 m_t << "}\n\\input{modules}\n";
1112 break;
1114 m_t << "}\n\\input{topics}\n";
1115 break;
1117 m_t << "}\n\\input{dirs}\n";
1118 break;
1120 m_t << "}\n\\input{namespaces}\n";
1121 break;
1123 m_t << "}\n\\input{concepts}\n";
1124 break;
1126 m_t << "}\n\\input{hierarchy}\n";
1127 break;
1129 m_t << "}\n\\input{annotated}\n";
1130 break;
1132 m_t << "}\n\\input{files}\n";
1133 break;
1135 m_t << "}\n\\input{pages}\n";
1136 break;
1138 {
1139 m_t << "}\n";
1140 for (const auto &gd : *Doxygen::groupLinkedMap)
1141 {
1142 if (!gd->isReference() && !gd->isASubGroup())
1143 {
1144 writePageLink(gd->getOutputFileBase(), false);
1145 }
1146 }
1147 }
1148 break;
1150 {
1151 m_t << "}\n";
1152 for (const auto &mod : ModuleManager::instance().modules())
1153 {
1154 if (!mod->isReference() && mod->isPrimaryInterface())
1155 {
1156 writePageLink(mod->getOutputFileBase(), false);
1157 }
1158 }
1159 }
1160 break;
1162 {
1163 bool found=false;
1164 for (const auto &dd : *Doxygen::dirLinkedMap)
1165 {
1166 if (dd->isLinkableInProject())
1167 {
1168 if (!found)
1169 {
1170 m_t << "}\n";
1171 found = true;
1172 }
1173 m_t << "\\input{" << dd->getOutputFileBase() << "}\n";
1174 }
1175 }
1176 }
1177 break;
1179 {
1180 bool found=false;
1181 for (const auto &nd : *Doxygen::namespaceLinkedMap)
1182 {
1183 if (nd->isLinkableInProject() && !nd->isAlias())
1184 {
1185 if (!found)
1186 {
1187 m_t << "}\n";
1188 found=true;
1189 }
1190 m_t << "\\input{" << nd->getOutputFileBase() << "}\n";
1191 }
1192 }
1193 }
1194 break;
1196 {
1197 bool found=false;
1198 for (const auto &cd : *Doxygen::conceptLinkedMap)
1199 {
1200 if (cd->isLinkableInProject() && !cd->isAlias())
1201 {
1202 if (!found)
1203 {
1204 m_t << "}\n";
1205 found=true;
1206 }
1207 m_t << "\\input{" << cd->getOutputFileBase() << "}\n";
1208 }
1209 }
1210 }
1211 break;
1213 {
1214 bool found=false;
1215 for (const auto &cd : *Doxygen::classLinkedMap)
1216 {
1217 if (cd->isLinkableInProject() &&
1218 !cd->isImplicitTemplateInstance() &&
1219 !cd->isEmbeddedInOuterScope() &&
1220 !cd->isAlias()
1221 )
1222 {
1223 if (!found)
1224 {
1225 m_t << "}\n"; // end doxysection or chapter title
1226 found=true;
1227 }
1228 m_t << "\\input{" << cd->getOutputFileBase() << "}\n";
1229 }
1230 }
1231 }
1232 break;
1234 {
1235 bool isFirst=true;
1236 for (const auto &fn : *Doxygen::inputNameLinkedMap)
1237 {
1238 for (const auto &fd : *fn)
1239 {
1240 if (fd->isLinkableInProject())
1241 {
1242 if (isFirst)
1243 {
1244 m_t << "}\n"; // end doxysection or chapter title
1245 }
1246 isFirst=false;
1247 m_t << "\\input{" << fd->getOutputFileBase() << "}\n";
1248 }
1249 if (fd->generateSourceFile())
1250 {
1251 if (isFirst)
1252 {
1253 m_t << "}\n"; // end doxysection or chapter title
1254 }
1255 isFirst=false;
1256 m_t << "\\input{" << fd->getSourceFileBase() << "}\n";
1257 }
1258 }
1259 }
1260 }
1261 break;
1263 {
1264 m_t << "}\n";
1265 for (const auto &pd : *Doxygen::exampleLinkedMap)
1266 {
1267 m_t << "\\input{" << pd->getOutputFileBase() << "}\n";
1268 }
1269 }
1270 break;
1272 {
1273 for (const auto &pd : *Doxygen::pageLinkedMap)
1274 {
1275 if (!pd->getGroupDef() && !pd->isReference() && !pd->hasParentPage()
1276 && pd->name() != "citelist" && Doxygen::mainPage.get() != pd.get())
1277 {
1278 writePageLink(pd->getOutputFileBase(), false);
1279 }
1280 }
1281 }
1282 break;
1284 break;
1287 break;
1288 }
1289}
1290
1291void LatexGenerator::writePageLink(const DString &name, bool /*first*/)
1292{
1293 //bool &compactLatex = Config_getBool(COMPACT_LATEX);
1294 // next is remove for bug615957
1295 //if (compactLatex || first) m_t << "\\input" ; else m_t << "\\include";
1296 m_t << "\\input" ;
1297 m_t << "{" << name << "}\n";
1298}
1299
1301{
1302 if (part > 0)
1303 return;
1304
1305 startPlainFile("doxygen.sty");
1307 endPlainFile();
1308
1309 /// an extension of the etoc package is required that is only available in the
1310 /// newer version. Providing the updated version to be used with older versions
1311 /// of LaTeX
1312 startPlainFile("etoc_doxygen.sty");
1313 m_t << ResourceMgr::instance().getAsString("etoc_doxygen.sty");
1314 endPlainFile();
1315}
1316
1318{
1319 m_t << "\n" << "\n";
1320}
1321
1323{
1324 m_t << "\n" << "\n";
1325}
1326
1328{
1329 m_t << text;
1330}
1331
1333{
1334 m_t << "\\item ";
1335 if (ref.empty() && !fn.empty())
1336 {
1337 m_t << "\\contentsline{section}{";
1338 }
1339}
1340
1342{
1343 if (ref.empty() && !fn.empty())
1344 {
1345 m_t << "}{\\pageref{" << stripPath(fn) << "}}{}\n";
1346 }
1347}
1348
1350 const DString &path,const DString &name)
1351{
1352 m_t << "\\item\\contentsline{section}\\textbf{ ";
1353 if (!path.empty()) docify(path);
1354 docify(name);
1355 m_t << "} ";
1356}
1357
1359{
1360 m_t << "\\item\\contentsline{section}{";
1361}
1362
1366
1368{
1369 m_t << " ";
1370 if (hasBrief) m_t << "\\\\*";
1371}
1372
1373void LatexGenerator::endIndexValue(const DString &name,bool /*hasBrief*/)
1374{
1375 //if (hasBrief) m_t << ")";
1376 m_t << "}{\\pageref{" << stripPath(name) << "}}{}\n";
1377}
1378
1379//void LatexGenerator::writeClassLink(const DString &,const DString &,
1380// const DString &,const DString &name)
1381//{
1382// m_t << "\\textbf{ ";
1383// docify(name);
1384// m_t << "}";
1385//}
1386
1388{
1389 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1390 if (!m_disableLinks && pdfHyperlinks)
1391 {
1392 m_t << "\\doxymbox{\\hyperlink{";
1393 if (!f.empty()) m_t << stripPath(f);
1394 if (!anchor.empty()) m_t << "_" << anchor;
1395 m_t << "}{";
1396 }
1397 else
1398 {
1399 m_t << "\\textbf{ ";
1400 }
1401}
1402
1404{
1405 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1406 if (!m_disableLinks && pdfHyperlinks)
1407 {
1408 m_t << "}";
1409 }
1410 m_t << "}";
1411}
1412
1413static DString objectLinkToString(const DString &ref, const DString &f,
1414 const DString &anchor, const DString &text,
1415 bool insideTabbing,bool disableLinks)
1416{
1417 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1418 DString result;
1419 if (!disableLinks && ref.empty() && pdfHyperlinks)
1420 {
1421 result += "\\doxymbox{\\hyperlink{";
1422 if (!f.empty()) result += stripPath(f);
1423 if (!f.empty() && !anchor.empty()) result += "_";
1424 if (!anchor.empty()) result += anchor;
1425 result += "}{";
1426 result += convertToLaTeX(text,insideTabbing);
1427 result += "}}";
1428 }
1429 else
1430 {
1431 result += "\\textbf{ ";
1432 result += convertToLaTeX(text,insideTabbing);
1433 result += "}";
1434 }
1435 return result;
1436}
1437
1438static void processEntity(TextStream &t, bool pdfHyperlinks, const char *strForm, const char *strRepl)
1439{
1440 if (pdfHyperlinks)
1441 {
1442 t << "\\texorpdfstring{";
1443 }
1444 t << strForm;
1445 if (pdfHyperlinks)
1446 {
1447 t << "}{" << strRepl << "}";
1448 }
1449}
1450
1452 const DString &anchor, const DString &text)
1453{
1455}
1456
1458{
1459 m_t << " \\doxyref{}{";
1460}
1461
1462void LatexGenerator::endPageRef(const DString &clname, const DString &anchor)
1463{
1464 m_t << "}{";
1465 if (!clname.empty()) m_t << clname;
1466 if (!anchor.empty()) m_t << "_" << anchor;
1467 m_t << "}";
1468}
1469
1470
1472{
1473 int hierarchyLevel = m_hierarchyLevel;
1474 if (Config_getBool(COMPACT_LATEX))
1475 {
1476 ++hierarchyLevel;
1477 }
1478
1479 if (hierarchyLevel < 0)
1480 m_t << "\\chapter{";
1481 else
1482 m_t << "\\doxy" << DString("sub").repeat(hierarchyLevel) << "section{";
1483}
1484
1486{
1487 m_t << "}\n";
1488
1489 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1490 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1491 if (usePDFLatex && pdfHyperlinks && !fileName.empty())
1492 {
1493 m_t << "\\hypertarget{" << stripPath(fileName) << "}{}";
1494 }
1495
1497 if (!fn.empty())
1498 {
1499 m_t << "\\label{" << fn << "}";
1500 }
1501 if (!name.empty())
1502 {
1504 }
1505}
1506
1507void LatexGenerator::startGroupHeader(const DString &,int extraIndentLevel)
1508{
1509 if (Config_getBool(COMPACT_LATEX))
1510 {
1511 extraIndentLevel++;
1512 }
1513
1514 if (extraIndentLevel>=3)
1515 {
1516 m_t << "\\doxysubparagraph*{";
1517 }
1518 else if (extraIndentLevel==2)
1519 {
1520 m_t << "\\doxyparagraph{";
1521 }
1522 else
1523 {
1524 extraIndentLevel += m_hierarchyLevel + 1;
1525 m_t << "\\doxy" << DString("sub").repeat(extraIndentLevel) << "section{";
1526 }
1527 m_disableLinks=true;
1528}
1529
1531{
1532 m_disableLinks=false;
1533 m_t << "}\n";
1534}
1535
1537{
1538 int l = m_hierarchyLevel + 1;
1539 if (Config_getBool(COMPACT_LATEX))
1540 {
1541 ++l;
1542 }
1543
1544 m_t << "\\doxysub" << DString("sub").repeat(l) << "section*{";
1545 m_disableLinks=true;
1546}
1547
1549{
1550 m_disableLinks=false;
1551 m_t << "}\n";
1552}
1553
1555 const DString &memname,
1556 const DString &,
1557 const DString &title,
1558 int memCount,
1559 int memTotal,
1560 bool showInline)
1561{
1562 if (!memname.empty() && memname[0]!='@')
1563 {
1564 latexWriteIndexItem(m_t,clname,memname);
1565 latexWriteIndexItem(m_t,memname,clname);
1566 }
1567 bool compactLatex = Config_getBool(COMPACT_LATEX);
1568 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1569 if (showInline)
1570 {
1571 m_t << "\\doxysubparagraph";
1572 }
1573 else if (compactLatex)
1574 {
1575 m_t << "\\doxyparagraph";
1576 }
1577 else
1578 {
1579 m_t << "\\doxy" << DString("sub").repeat(m_hierarchyLevel + 2) << "section";
1580 }
1581
1582 m_t << "{";
1583 if (pdfHyperlinks)
1584 {
1585 m_t << "\\texorpdfstring{";
1586 }
1587 m_t << latexEscapeIndexChars(title);
1588 if (pdfHyperlinks)
1589 {
1590 m_t << "}{" << latexEscapePDFString(title) << "}";
1591 }
1592 if (memTotal>1)
1593 {
1594 m_t << "\\hspace{0.1cm}{\\footnotesize\\ttfamily [" << memCount << "/" << memTotal << "]}";
1595 }
1596 m_t << "}";
1597 m_t << "\n{\\footnotesize\\ttfamily ";
1598 //m_disableLinks=true;
1599}
1600
1602{
1603 m_disableLinks=false;
1604 m_t << "}\n\n";
1605 //if (Config_getBool(COMPACT_LATEX)) m_t << "\\hfill";
1606}
1607
1609 const DString &anchor, const DString &,
1610 const DString &)
1611{
1612 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1613 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1614 if (m_insideTableEnv) m_t << "\\doxymbox{"; // see issue #6093
1615 if (usePDFLatex && pdfHyperlinks)
1616 {
1617 m_t << "\\Hypertarget{";
1618 if (!fName.empty()) m_t << stripPath(fName);
1619 if (!anchor.empty()) m_t << "_" << anchor;
1620 m_t << "}";
1621 }
1622}
1623
1624void LatexGenerator::endDoxyAnchor(const DString &/* fName */,const DString &/* anchor */)
1625{
1626}
1627
1628void LatexGenerator::addLabel(const DString &fName, const DString &anchor)
1629{
1630 m_t << "\\label{";
1631 if (!fName.empty()) m_t << stripPath(fName);
1632 if (!anchor.empty()) m_t << "_" << anchor;
1633 if (m_insideTableEnv) m_t << "}";
1634 m_t << "} \n";
1635}
1636
1637void LatexGenerator::writeAnchor(const DString &fName,const DString &name)
1638{
1639 //printf("LatexGenerator::writeAnchor(%s,%s)\n",fName,name);
1640 if (!fName.empty())
1641 {
1642 m_t << "\\label{" << stripPath(fName) << "_" << stripPath(name) << "}\n";
1643 }
1644 else
1645 {
1646 m_t << "\\label{" << stripPath(name) << "}\n";
1647 }
1648 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1649 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1650 if (usePDFLatex && pdfHyperlinks)
1651 {
1652 if (!fName.empty())
1653 {
1654 m_t << "\\Hypertarget{" << stripPath(fName) << "_" << stripPath(name) << "}\n";
1655 }
1656 else
1657 {
1658 m_t << "\\Hypertarget{" << stripPath(name) << "}\n";
1659 }
1660 }
1661}
1662
1663
1664//void LatexGenerator::writeLatexLabel(const DString &clName,const DString &anchor)
1665//{
1666// writeDoxyAnchor(0,clName,anchor,0);
1667//}
1668
1670{
1671 if (!s1.empty())
1672 {
1673 latexWriteIndexItem(m_t,s1,s2);
1674 }
1675}
1676
1677
1679{
1680 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1681 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1682 if (usePDFLatex && pdfHyperlinks)
1683 {
1684 m_t << "\\hypertarget{" << stripPath(lab) << "}{}";
1685 }
1686 m_t << "\\";
1687 if (Config_getBool(COMPACT_LATEX))
1688 {
1689 switch(type.level())
1690 {
1691 case SectionType::Page: m_t << "doxysubsection"; break;
1692 case SectionType::Section: m_t << "doxysubsubsection"; break;
1693 case SectionType::Subsection: m_t << "doxysubsubsubsection"; break;
1694 case SectionType::Subsubsection: m_t << "doxysubsubsubsubsection"; break;
1695 case SectionType::Paragraph: m_t << "doxysubsubsubsubsubsection"; break;
1696 case SectionType::Subparagraph: m_t << "doxysubsubsubsubsubsubsection"; break;
1697 case SectionType::Subsubparagraph: m_t << "doxysubsubsubsubsubsubsection"; break;
1698 default: ASSERT(0); break;
1699 }
1700 m_t << "{";
1701 }
1702 else
1703 {
1704 switch(type.level())
1705 {
1706 case SectionType::Page: m_t << "doxysection"; break;
1707 case SectionType::Section: m_t << "doxysubsection"; break;
1708 case SectionType::Subsection: m_t << "doxysubsubsection"; break;
1709 case SectionType::Subsubsection: m_t << "doxysubsubsubsection"; break;
1710 case SectionType::Paragraph: m_t << "doxysubsubsubsubsection"; break;
1711 case SectionType::Subparagraph: m_t << "doxysubsubsubsubsubsection"; break;
1712 case SectionType::Subsubparagraph: m_t << "doxysubsubsubsubsubsubsection"; break;
1713 default: ASSERT(0); break;
1714 }
1715 m_t << "{";
1716 }
1717}
1718
1720{
1721 m_t << "}\\label{" << lab << "}\n";
1722}
1723
1724
1726{
1728 m_codeGen->insideTabbing(), // insideTabbing
1729 false, // insidePre
1730 false, // insideItem
1731 m_codeGen->usedTableLevel()>0, // insideTable
1732 false // keepSpaces
1733 );
1734}
1735
1737{
1738 char cs[2];
1739 cs[0]=c;
1740 cs[1]=0;
1741 docify(cs);
1742}
1743
1745{
1746 //if (Config_getBool(COMPACT_LATEX)) m_t << "\\doxysubsubsection"; else m_t << "\\doxysubsection";
1747 //m_t << "{";
1748}
1749
1751 const DString &fileName,const DString &)
1752{
1754}
1755
1756
1758{
1759 if (indent==0)
1760 {
1761 m_t << "\\begin{tabbing}\n";
1762 m_t << "xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=\\kill\n";
1764 }
1765 m_indent=indent;
1766}
1767
1769{
1770 if (indent==0)
1771 {
1772 m_t << "\n" << "\\end{tabbing}";
1774 }
1775 m_indent=indent;
1776}
1777
1779{
1781 {
1782 m_t << "{\\footnotesize ";
1783 }
1784}
1785
1787{
1789 {
1790 m_t << "}\\\\";
1791 }
1792}
1793
1795{
1796 //printf("LatexGenerator::startMemberItem(%d)\n",annType);
1797 if (!m_codeGen->insideTabbing())
1798 {
1799 m_t << "\\item \n";
1801 }
1802}
1803
1805{
1806 if (m_codeGen->insideTabbing())
1807 {
1808 m_t << "\\\\";
1809 }
1810 m_templateMemberItem = false;
1811 m_t << "\n";
1812}
1813
1815{
1816 if (!m_codeGen->insideTabbing())
1817 {
1818 m_t << "\\begin{DoxyCompactList}\\small\\item\\em ";
1819 }
1820 else
1821 {
1822 for (int i=0;i<m_indent+2;i++) m_t << "\\>";
1823 m_t << "{\\em ";
1824 }
1825}
1826
1828{
1829 if (!m_codeGen->insideTabbing())
1830 {
1831 //m_t << "\\item\\end{DoxyCompactList}";
1832 m_t << "\\end{DoxyCompactList}";
1833 }
1834 else
1835 {
1836 m_t << "}\\\\\n";
1837 }
1838}
1839
1840
1842{
1843 //printf("writeNonBreakableSpace()\n");
1844 if (m_codeGen->insideTabbing())
1845 {
1846 m_t << "\\>";
1847 }
1848 else
1849 {
1850 m_t << "~";
1851 }
1852}
1853
1854// ----------------------------------------------
1855// nesting of functions below:
1856// startDescTable()
1857// - startDescTableRow()
1858// - startDescTableTitle()
1859// - endDescTableTitle()
1860// - startDescTableData()
1861// - endDescTableData()
1862// - endDescTableRow()
1863// - startDescTableRow()
1864// - ...
1865// - endDescTableRow()
1866// endDescTable()
1867
1868void LatexGenerator::startDescTable(const DString &title,const bool hasInits)
1869{
1871 m_t << "\\begin{DoxyEnumFields}[" << (hasInits?3:2) << "]{" << title << "}\n";
1872}
1873
1875{
1877 m_t << "\\end{DoxyEnumFields}\n";
1878}
1879
1881{
1882 // this is needed to prevent the \hypertarget, \label, and \index commands from messing up
1883 // the row height (based on http://tex.stackexchange.com/a/186102)
1884 m_t << "\\raisebox{\\heightof{T}}[0pt][0pt]{";
1885}
1886
1890
1892{
1893 m_t << "}";
1894}
1895
1899
1901{
1902 m_t << "&";
1903}
1904
1908
1910{
1911 m_t << "&";
1912}
1913
1915{
1916 m_t << "\\\\\n\\hline\n\n";
1917}
1918
1922
1923
1925{
1926 if (!m_codeGen->insideTabbing())
1927 {
1928 m_t << "\\begin{DoxyCompactItemize}\n";
1929 }
1930}
1931
1933{
1934 //printf("LatexGenerator::endMemberList(%d)\n",m_codeGen->InsideTabbing());
1935 if (!m_codeGen->insideTabbing())
1936 {
1937 m_t << "\\end{DoxyCompactItemize}\n";
1938 }
1939}
1940
1941
1943{
1944 if (hasHeader)
1945 {
1946 m_t << "\\begin{Indent}";
1947 m_t << "\\textbf{ ";
1948 }
1949 // changed back to rev 756 due to bug 660501
1950 //if (Config_getBool(COMPACT_LATEX))
1951 //{
1952 // m_t << "\\doxysubparagraph*{";
1953 //}
1954 //else
1955 //{
1956 // m_t << "\\doxyparagraph*{";
1957 //}
1958}
1959
1961{
1962 // changed back to rev 756 due to bug 660501
1963 if (hasHeader) m_t << "}\\par\n";
1964 //m_t << "}\n";
1965}
1966
1968{
1969 m_t << "{\\em ";
1970}
1971
1973{
1974 m_t << "}";
1975}
1976
1980
1982{
1983 if (hasHeader)m_t << "\\end{Indent}";
1984 m_t << "\n";
1985}
1986
1988{
1989 m_t << "\n" << "\n";
1990}
1991
1996
2000
2005
2009
2014
2018
2023
2027
2032
2034{
2035 m_t << "\\begin{Desc}\n\\item[";
2037 m_t << "]";
2038}
2039
2041{
2042 m_t << "\\end{Desc}\n";
2043}
2044
2046{
2047 /* start of ParameterType ParameterName list */
2048 if (openBracket) m_t << "(";
2049 m_t << "\\begin{DoxyParamCaption}";
2050}
2051
2055
2057{
2058 m_t << "\\item[{";
2059 if (!first && !key.empty()) docify(key);
2060}
2061
2063{
2064 m_t << "}]";
2065}
2066
2067void LatexGenerator::startParameterName(bool /*oneArgOnly*/)
2068{
2069 m_t << "{";
2070}
2071
2073{
2074 m_t << "}";
2075}
2076
2078{
2079 m_t << "{";
2080}
2081
2082void LatexGenerator::endParameterExtra(bool last,bool /*emptyList*/,bool closeBracket)
2083{
2084 m_t << "}";
2085 if (last)
2086 {
2087 m_t << "\\end{DoxyParamCaption}";
2088 if (closeBracket) m_t << ")";
2089 }
2090}
2091
2092void LatexGenerator::exceptionEntry(const DString &prefix,bool closeBracket)
2093{
2094 if (!prefix.empty())
2095 {
2096 m_t << " " << prefix << "(";
2097 }
2098 else if (closeBracket)
2099 {
2100 m_t << ")";
2101 }
2102 m_t << " ";
2103}
2104
2105void LatexGenerator::writeDoc(const IDocNodeAST *ast,const Definition *ctx,const MemberDef *,int,int)
2106{
2107 const DocNodeAST *astImpl = dynamic_cast<const DocNodeAST*>(ast);
2108 if (astImpl)
2109 {
2111 ctx?ctx->getDefFileExtension():DString(""),
2113 std::visit(visitor,astImpl->root);
2114 }
2115}
2116
2118{
2119 m_t << "\\begin{Desc}\n\\item[";
2120 docify(header);
2121 m_t << "]";
2122 m_t << "\\begin{description}\n";
2123}
2124
2126{
2127 m_t << "\\item[{\\em ";
2128}
2129
2133
2135{
2136 m_t << "} : {\\em ";
2137}
2138
2140{
2141 m_t << "}]";
2142}
2143
2147
2151
2153{
2154 m_t << "\\end{description}\n";
2155 m_t << "\\end{Desc}\n";
2156}
2157
2159{
2160 if (Config_getBool(COMPACT_LATEX))
2161 {
2162 m_t << "\\doxyparagraph*{";
2163 }
2164 else
2165 {
2166 m_t << "\\doxy" << DString("sub").repeat(m_hierarchyLevel + 1) << "section*{";
2167 }
2168}
2169
2171{
2172 m_t << "}\n";
2173}
2174
2176{
2177 if (m_codeGen->insideTabbing())
2178 {
2179 m_t << "\\\\\n";
2180 }
2181 else
2182 {
2183 m_t << "\\newline\n";
2184 }
2185}
2186
2188{
2190 if (isEnum)
2191 {
2192 m_t << "\\begin{DoxyEnumFields}{";
2194 }
2195 else
2196 {
2197 m_t << "\\begin{DoxyFields}{";
2199 }
2200 m_t << "}\n";
2201 m_insideTableEnv=true;
2202}
2203
2205{
2206 m_insideTableEnv=false;
2208 if (isEnum)
2209 {
2210 m_t << "\\end{DoxyEnumFields}\n";
2211 }
2212 else
2213 {
2214 m_t << "\\end{DoxyFields}\n";
2215 }
2216}
2217
2219{
2220 m_codeGen->setInsideTabbing(true); // to prevent \+ from causing unwanted breaks
2221}
2222
2224{
2225 m_t << "&\n";
2227}
2228
2230{
2231 m_codeGen->setInsideTabbing(true); // to prevent \+ from causing unwanted breaks
2232}
2233
2235{
2236 m_t << "&\n";
2238}
2239
2243
2245{
2246 m_t << "\\\\\n\\hline\n\n";
2247}
2248
2250{
2251 m_t << "\\hspace{0.3cm}";
2252}
2253
2254void LatexGenerator::writeLabel(const DString &l,bool isLast)
2255{
2256 m_t << "{\\ttfamily [" << l << "]}";
2257 if (!isLast) m_t << ", ";
2258}
2259
2261{
2262}
2263
2265 const DString &/*id*/,const DString &ref,
2266 const DString &file, const DString &anchor,
2267 const DString &title, const DString &name)
2268{
2269 if (Config_getBool(COMPACT_LATEX))
2270 {
2271 m_t << "\\doxyparagraph*{";
2272 }
2273 else
2274 {
2275 m_t << "\\doxy" << DString("sub").repeat(m_hierarchyLevel + 1) << "section*{";
2276 }
2278 objectLinkToString(ref, file, anchor, name, m_codeGen->insideTabbing(), m_disableLinks));
2279 m_t << "}\n";
2280}
2281
2283{
2284 int maxLevel = level + m_hierarchyLevel;
2285 m_t << "\\etocsetnexttocdepth{" << maxLevel << "}\n";
2286 m_t << "\\localtableofcontents\n";
2287}
2288
2290{
2291 m_t << "\\begin{DoxyEmbeddedDoc}[" << indent << "]\n";
2292}
2293
2295{
2296 m_t << "\\end{DoxyEmbeddedDoc}\n";
2297}
2298
2299//--------------------------------------------------------------------------------------------------
2300
2302{
2303 // User-specified packages
2304 StringVector extraPackages = Config_getList(EXTRA_PACKAGES);
2305 if (!extraPackages.empty())
2306 {
2307 t << "% Packages requested by user\n";
2308 for (const auto &pkgName : extraPackages)
2309 {
2310 if ((pkgName[0] == '[') || (pkgName[0] == '{'))
2311 t << "\\usepackage" << pkgName << "\n";
2312 else
2313 t << "\\usepackage{" << pkgName << "}\n";
2314 }
2315 t << "\n";
2316 }
2317}
2318
2320{
2321 unsigned char minus[4]; // Superscript minus
2322 unsigned char sup2[3]; // Superscript two
2323 unsigned char sup3[3];
2324 minus[0]= 0xE2;
2325 minus[1]= 0x81;
2326 minus[2]= 0xBB;
2327 minus[3]= 0;
2328 sup2[0]= 0xC2;
2329 sup2[1]= 0xB2;
2330 sup2[2]= 0;
2331 sup3[0]= 0xC2;
2332 sup3[1]= 0xB3;
2333 sup3[2]= 0;
2334
2335 t << "\\ifPDFTeX\n";
2336 t << "\\usepackage{newunicodechar}\n";
2337 // taken from the newunicodechar package and removed the warning message
2338 // actually forcing to redefine the unicode character
2339 t << " \\makeatletter\n"
2340 " \\def\\doxynewunicodechar#1#2{%\n"
2341 " \\@tempswafalse\n"
2342 " \\edef\\nuc@tempa{\\detokenize{#1}}%\n"
2343 " \\if\\relax\\nuc@tempa\\relax\n"
2344 " \\nuc@emptyargerr\n"
2345 " \\else\n"
2346 " \\edef\\@tempb{\\expandafter\\@car\\nuc@tempa\\@nil}%\n"
2347 " \\nuc@check\n"
2348 " \\if@tempswa\n"
2349 " \\@namedef{u8:\\nuc@tempa}{#2}%\n"
2350 " \\fi\n"
2351 " \\fi\n"
2352 " }\n"
2353 " \\makeatother\n";
2354
2355 t << " \\doxynewunicodechar{" << minus << "}{${}^{-}$}% Superscript minus\n"
2356 " \\doxynewunicodechar{" << sup2 << "}{${}^{2}$}% Superscript two\n"
2357 " \\doxynewunicodechar{" << sup3 << "}{${}^{3}$}% Superscript three\n"
2358 "\n";
2359 t << "\\fi\n";
2360}
2361
2363 bool insideTabbing,bool insidePre,bool insideItem,bool insideTable,bool keepSpaces, const bool retainNewline)
2364{
2365 if (str.empty()) return;
2366 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
2367 //printf("filterLatexString(%s) insideTabbing=%d\n",qPrint(str),insideTabbing);
2368 const char *p = str.data();
2369 unsigned char pc='\0';
2370
2371 while (*p)
2372 {
2373 unsigned char c=static_cast<unsigned char>(*p++);
2374
2375 if (insidePre)
2376 {
2377 switch(c)
2378 {
2379 case 0xef: // handle U+FFFD i.e. "Replacement character" caused by octal: 357 277 275 / hexadecimal 0xef 0xbf 0xbd
2380 // the LaTeX command \ucr has been defined in doxygen.sty
2381 if (static_cast<unsigned char>(*(p)) == 0xbf && static_cast<unsigned char>(*(p+1)) == 0xbd)
2382 {
2383 t << "{\\ucr}";
2384 p += 2;
2385 }
2386 else
2387 t << static_cast<char>(c);
2388 break;
2389 case '\\': t << "\\(\\backslash\\)"; 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 '-': t << "-\\/"; break;
2399 case '^': insideTable ? t << "\\string^" : t << static_cast<char>(c); break;
2400 case '~': t << "\\string~"; break;
2401 case '\n': if (retainNewline) t << "\\newline"; else t << ' ';
2402 break;
2403 case ' ': if (keepSpaces) t << "~"; else t << ' ';
2404 break;
2405 default:
2406 if (c<32) t << ' '; // non printable control character
2407 else t << static_cast<char>(c);
2408 break;
2409 }
2410 }
2411 else
2412 {
2413 switch(c)
2414 {
2415 case 0xef: // handle U+FFFD i.e. "Replacement character" caused by octal: 357 277 275 / hexadecimal 0xef 0xbf 0xbd
2416 // the LaTeX command \ucr has been defined in doxygen.sty
2417 if (static_cast<unsigned char>(*(p)) == 0xbf && static_cast<unsigned char>(*(p+1)) == 0xbd)
2418 {
2419 t << "{\\ucr}";
2420 p += 2;
2421 }
2422 else
2423 t << static_cast<char>(c);
2424 break;
2425 case '#': t << "\\+\\#"; break;
2426 case '$': t << "\\$"; break;
2427 case '%': t << "\\%"; break;
2428 case '^': processEntity(t,pdfHyperlinks,"$^\\wedge$","\\string^"); break;
2429 case '&': {
2430 // possibility to have a special symbol
2432 t,
2433 p-1,
2434 [](HtmlEntityMapper::SymType symType) { return HtmlEntityMapper::instance().latex(symType); },
2435 "\\&");
2436 }
2437 break;
2438 case '*': processEntity(t,pdfHyperlinks,"$\\ast$","*"); break;
2439 case '_': if (!insideTabbing && *p) t << "\\+";
2440 t << "\\_";
2441 if (!insideTabbing && *p) t << "\\+";
2442 break;
2443 case '{': t << "\\{"; break;
2444 case '}': t << "\\}"; break;
2445 case '<': t << "$<$"; break;
2446 case '>': t << "$>$"; break;
2447 case '|': processEntity(t,pdfHyperlinks,"$\\vert$","|"); break;
2448 case '~': processEntity(t,pdfHyperlinks,"$\\sim$","\\string~"); break;
2449 case '[': if (Config_getBool(PDF_HYPERLINKS) || insideItem)
2450 t << "\\+[";
2451 else
2452 t << "[";
2453 break;
2454 case ']': if (pc=='[') t << "$\\,$";
2455 if ((Config_getBool(PDF_HYPERLINKS) || insideItem) && *p)
2456 t << "]\\+";
2457 else
2458 t << "]";
2459 break;
2460 case '-': t << "-\\/";
2461 break;
2462 case '\\': t << "\\textbackslash{}";
2463 break;
2464 case '"': t << "\"{}";
2465 break;
2466 case '`': t << "\\`{}";
2467 break;
2468 case '\'': t << "\\textquotesingle{}";
2469 break;
2470 case '\n': if (retainNewline)
2471 {
2472 t << "\\newline";
2473 if (insideTable) t << " ";
2474 }
2475 else
2476 {
2477 t << ' ';
2478 }
2479 break;
2480 case ' ': if (keepSpaces) { if (insideTabbing) t << "\\>"; else t << '~'; } else t << ' ';
2481 break;
2482
2483 default:
2484 //if (!insideTabbing && forceBreaks && c!=' ' && *p!=' ')
2485 if (!insideTabbing &&
2486 ((c>='A' && c<='Z' && pc!=' ' && !(pc>='A' && pc <= 'Z') && pc!='\0' && *p) || (pc=='.' && isId(c)))
2487 )
2488 {
2489 t << "\\+";
2490 }
2491 if (c<32)
2492 {
2493 t << ' '; // non-printable control character
2494 }
2495 else
2496 {
2497 t << static_cast<char>(c);
2498 }
2499 if (!insideTabbing && *p && ((c==':' && *p!=':') || c=='/'))
2500 {
2501 t << "\\+";
2502 }
2503 }
2504 }
2505 pc = c;
2506 }
2507}
2508
2509DString convertToLaTeX(const DString &s,bool insideTabbing,bool keepSpaces)
2510{
2511 TextStream t;
2512 filterLatexString(t,s,insideTabbing,false,false,false,keepSpaces);
2513 return t.str();
2514}
2515
2517{
2518 //printf("latexEscapeLabelName(%s)\n",qPrint(s));
2519 if (s.empty()) return s;
2521 TextStream t;
2522 const char *p=s.data();
2523 char c = 0;
2524 while ((c=*p++))
2525 {
2526 switch (c)
2527 {
2528 case '|': t << "\\texttt{\"|}"; break;
2529 case '!': t << "\"!"; break;
2530 case '@': t << "\"@"; break;
2531 case '%': t << "\\%"; break;
2532 case '{': t << "\\lcurly{}"; break;
2533 case '}': t << "\\rcurly{}"; break;
2534 case '~': t << "````~"; break; // to get it a bit better in index together with other special characters
2535 // NOTE: adding a case here, means adding it to while below as well!
2536 default:
2537 {
2538 int i=0;
2539 // collect as long string as possible, before handing it to docify
2540 tmp[i++]=c;
2541 while ((c=*p) && c!='@' && c!='[' && c!=']' && c!='!' && c!='{' && c!='}' && c!='|')
2542 {
2543 tmp[i++]=c;
2544 p++;
2545 }
2546 tmp[i]=0;
2547 filterLatexString(t,tmp,
2548 true, // insideTabbing
2549 false, // insidePre
2550 false, // insideItem
2551 false, // insideTable
2552 false // keepSpaces
2553 );
2554 }
2555 break;
2556 }
2557 }
2558 return t.str();
2559}
2560
2562{
2563 //printf("latexEscapeIndexChars(%s)\n",qPrint(s));
2564 if (s.empty()) return s;
2566 TextStream t;
2567 const char *p=s.data();
2568 char c = 0;
2569 while ((c=*p++))
2570 {
2571 switch (c)
2572 {
2573 case '!': t << "\"!"; break;
2574 case '"': t << "\"\""; break;
2575 case '@': t << "\"@"; break;
2576 case '|': t << "\\texttt{\"|}"; break;
2577 case '[': t << "["; break;
2578 case ']': t << "]"; break;
2579 case '{': t << "\\lcurly{}"; break;
2580 case '}': t << "\\rcurly{}"; break;
2581 // NOTE: adding a case here, means adding it to while below as well!
2582 default:
2583 {
2584 int i=0;
2585 // collect as long string as possible, before handing it to docify
2586 tmp[i++]=c;
2587 while ((c=*p) && c!='"' && c!='@' && c!='[' && c!=']' && c!='!' && c!='{' && c!='}' && c!='|')
2588 {
2589 tmp[i++]=c;
2590 p++;
2591 }
2592 tmp[i]=0;
2593 filterLatexString(t,tmp,
2594 true, // insideTabbing
2595 false, // insidePre
2596 false, // insideItem
2597 false, // insideTable
2598 false // keepSpaces
2599 );
2600 }
2601 break;
2602 }
2603 }
2604 return t.str();
2605}
2606
2608{
2609 if (s.empty()) return s;
2610 TextStream t;
2611 const char *p=s.data();
2612 char c = 0;
2613 while ((c=*p++))
2614 {
2615 switch (c)
2616 {
2617 case '\\': t << "\\textbackslash{}"; 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 << "\\$"; break;
2625 case '^': t << "\\string^"; break;
2626 case '~': t << "\\string~"; break;
2627 default:
2628 t << c;
2629 break;
2630 }
2631 }
2632 return t.str();
2633}
2634
2636{
2637 constexpr auto hex = "0123456789ABCDEF";
2638 if (s.empty()) return s;
2639 TextStream t;
2640 const char *p=s.data();
2641 char c = 0;
2642 while ((c=*p++))
2643 {
2644 switch (c)
2645 {
2646 case '#': t << "\\#"; break;
2647 case '%': t << "\\%"; break;
2648 case '\\': t << "\\\\"; break;
2649 case '\n': break; // ignore
2650 default:
2651 if (c<0)
2652 {
2653 unsigned char id = static_cast<unsigned char>(c);
2654 t << "\\%" << hex[id>>4] << hex[id&0xF];
2655 }
2656 else
2657 {
2658 t << c;
2659 }
2660 break;
2661 }
2662 }
2663 return t.str();
2664}
2665
2666void latexWriteIndexItem(TextStream &m_t,const DString &s1,const DString &s2)
2667{
2668 if (!s1.empty())
2669 {
2670 m_t << "\\index{";
2671 m_t << latexEscapeLabelName(s1);
2672 m_t << "@{";
2673 m_t << latexEscapeIndexChars(s1);
2674 m_t << "}";
2675 if (!s2.empty())
2676 {
2677 m_t << "!";
2678 m_t << latexEscapeLabelName(s2);
2679 m_t << "@{";
2680 m_t << latexEscapeIndexChars(s2);
2681 m_t << "}";
2682 }
2683 m_t << "}\n";
2684 }
2685}
2686
2687
constexpr auto prefix
Definition anchor.cpp:44
static CitationManager & instance()
Definition cite.cpp:86
bool empty() const
return true if there are no citations.
Definition cite.cpp:116
DString latexBibFiles()
lists the bibtex cite files in a comma separated list
Definition cite.cpp:572
Class representing a built-in class diagram.
Definition diagram.h:31
void writeFigure(TextStream &t, const DString &path, const DString &file) const
Definition diagram.cpp:1065
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:89
DString()=default
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:153
DString quoted() const
Definition dstring.h:357
DString & prepend(const char *s)
Definition dstring.h:504
DString & sprintf(const char *format,...)
Definition dstring.cpp:29
@ ExplicitSize
Definition dstring.h:136
const std::string & str() const
Definition dstring.h:634
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:162
bool endsWith(const char *s) const
Definition dstring.h:606
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:156
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:75
bool mkdir(const std::string &path, bool acceptsAbsPath=true) const
Definition dir.cpp:295
bool exists() const
Definition dir.cpp:257
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:26
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:115
static ConceptLinkedMap * conceptLinkedMap
Definition doxygen.h:97
static std::unique_ptr< PageDef > mainPage
Definition doxygen.h:100
static FileNameLinkedMap * inputNameLinkedMap
Definition doxygen.h:104
static ClassLinkedMap * classLinkedMap
Definition doxygen.h:95
static PageLinkedMap * exampleLinkedMap
Definition doxygen.h:98
static PageLinkedMap * pageLinkedMap
Definition doxygen.h:99
static DirLinkedMap * dirLinkedMap
Definition doxygen.h:127
static GroupLinkedMap * groupLinkedMap
Definition doxygen.h:114
Minimal replacement for QFileInfo.
Definition fileinfo.h:23
bool exists() const
Definition fileinfo.cpp:30
std::string fileName() const
Definition fileinfo.cpp:118
std::string absFilePath() const
Definition fileinfo.cpp:101
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:28
int usedTableLevel() const
Definition latexgen.h:66
bool m_stripCodeComments
Definition latexgen.h:87
TextStream * m_t
Definition latexgen.h:80
void startCodeFragment(const DString &style) override
Definition latexgen.cpp:303
LatexCodeGenerator(TextStream *t, const DString &relPath, const DString &sourceFile)
Definition latexgen.cpp:59
void setStripIndentAmount(size_t amount) override
Definition latexgen.cpp:191
void setInsideTabbing(bool b)
Definition latexgen.h:70
void endFontClass() override
Definition latexgen.cpp:297
bool insideTabbing() const
Definition latexgen.h:71
void codify(const DString &text) override
Definition latexgen.cpp:78
void writeCodeLink(CodeSymbolType type, const DString &ref, const DString &file, const DString &anchor, const DString &name, const DString &tooltip) override
Definition latexgen.cpp:196
void setTextStream(TextStream *t)
Definition latexgen.h:32
void endSpecialComment() override
Definition latexgen.cpp:186
void stripCodeComments(bool b) override
Definition latexgen.cpp:176
size_t m_stripIndentAmount
Definition latexgen.h:89
DString m_relPath
Definition latexgen.h:81
void startCodeLine(int) override
Definition latexgen.cpp:269
void startSpecialComment() override
Definition latexgen.cpp:181
void decUsedTableLevel()
Definition latexgen.h:65
void startFontClass(const DString &) override
Definition latexgen.cpp:291
void writeLineNumber(const DString &, const DString &, const DString &, int, bool) override
Definition latexgen.cpp:222
void setRelativePath(const DString &path)
Definition latexgen.cpp:68
void endCodeFragment(const DString &style) override
Definition latexgen.cpp:308
void endCodeLine() override
Definition latexgen.cpp:280
DString m_sourceFileName
Definition latexgen.h:82
bool m_doxyCodeLineOpen
Definition latexgen.h:84
void setSourceFileName(const DString &sourceFileName)
Definition latexgen.cpp:73
void incUsedTableLevel()
Definition latexgen.h:64
Concrete visitor implementation for LaTeX output.
void endMemberItem(MemberItemType) override
void addCodeGen(OutputCodeList &list) override
Definition latexgen.cpp:362
void endIndexKey() override
void endInlineMemberDoc() override
void startMemberHeader(const DString &, int) override
void startProjectNumber() override
Definition latexgen.cpp:734
void cleanup() override
Definition latexgen.cpp:679
void startIndexSection(IndexSection) override
Definition latexgen.cpp:928
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:328
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:709
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:317
void endTitleHead(const DString &, const DString &name) override
static void writeFooterFile(TextStream &t)
Definition latexgen.cpp:697
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:703
void endMemberHeader() override
OutputType type() const override
Definition latexgen.h:111
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:331
void startPlainFile(const DString &name) override
Definition latexgen.h:316
void startInlineMemberDoc() override
void addLabel(const DString &, const DString &) override
void startCallGraph() override
void endMemberList() override
void endFile() override
Definition latexgen.cpp:723
void startExamples() override
void startIndexItem(const DString &ref, const DString &file) override
LatexGenerator & operator=(const LatexGenerator &)
Definition latexgen.cpp:342
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:324
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:329
void endMemberGroup(bool) override
bool m_firstDescItem
Definition latexgen.h:323
static void writeHeaderFile(TextStream &t)
Definition latexgen.cpp:691
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:330
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:633
void startMemberItem(const DString &, MemberItemType, const DString &) override
void startParameterType(bool, const DString &) override
DString m_relPath
Definition latexgen.h:325
void endPageRef(const DString &, const DString &) override
bool m_templateMemberItem
Definition latexgen.h:327
A model of a class/file/namespace member symbol.
Definition memberdef.h:48
static ModuleManager & instance()
Class representing a list of different code generators.
Definition outputlist.h:166
void add(OutputCodeIntfPtr &&p)
Definition outputlist.h:196
Abstract interface for output generators.
Definition outputgen.h:127
DString dir() const
Definition outputgen.cpp:52
TextStream m_t
Definition outputgen.h:116
DString fileName() const
Definition outputgen.cpp:57
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:69
virtual DString trGeneratedAt(const DString &date, const DString &projName)=0
virtual DString latexFontenc()
Definition translator.h:54
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:55
virtual DString latexDocumentPre()
Definition translator.h:64
virtual DString trGeneratedBy()=0
virtual DString trEnumerationValues()=0
virtual DString latexCommandName()
Definition translator.h:73
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:75
DString dateToString(DateTimeType includeTime)
Returns the current date, when includeTime is set also the time is provided.
Definition datetime.cpp:62
bool insideTable(const DocNodeVariant *n)
#define THREAD_LOCAL
Definition doxygen.h:30
DString substitute(const DString &s, const DString &src, const DString &dst)
substitute all occurrences of src in s by dst
Definition dstring.cpp:480
#define ASSERT(x)
Definition dstring.h:29
bool isId(int c)
Returns true if c is a valid character for an identifier.
Definition dstring.h:884
IndexSection
Definition index.h:32
@ isMainPage
Definition index.h:35
@ isTitlePageAuthor
Definition index.h:34
@ isFileIndex
Definition index.h:43
@ isFileDocumentation
Definition index.h:51
@ isPageDocumentation
Definition index.h:53
@ isDirDocumentation
Definition index.h:47
@ isModuleDocumentation
Definition index.h:45
@ isClassHierarchyIndex
Definition index.h:41
@ isModuleIndex
Definition index.h:36
@ isTopicIndex
Definition index.h:37
@ isConceptIndex
Definition index.h:40
@ isExampleDocumentation
Definition index.h:52
@ isClassDocumentation
Definition index.h:49
@ isPageIndex
Definition index.h:44
@ isCompoundIndex
Definition index.h:42
@ isEndIndex
Definition index.h:55
@ isConceptDocumentation
Definition index.h:50
@ isDirIndex
Definition index.h:38
@ isNamespaceIndex
Definition index.h:39
@ isNamespaceDocumentation
Definition index.h:48
@ isTitlePageStart
Definition index.h:33
@ isTopicDocumentation
Definition index.h:46
@ isPageDocumentation2
Definition index.h:54
Translator * theTranslator
Definition language.cpp:71
static DString extraLatexStyleSheet()
Definition latexgen.cpp:739
static DString substituteLatexKeywords(const DString &file, const DString &str, const DString &title)
Definition latexgen.cpp:800
static void writeLatexMakefile()
Definition latexgen.cpp:367
static DString latex_batchmode()
Definition latexgen.cpp:786
DString latexFilterURL(const DString &s)
static DString g_footer
Definition latexgen.cpp:53
DString latexEscapePDFString(const DString &s)
static const SelectionMarkerInfo latexMarkerInfo
Definition latexgen.cpp:55
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:503
static void writeDefaultStyleSheet(TextStream &t)
Definition latexgen.cpp:686
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:52
static DString makeIndex()
Definition latexgen.cpp:768
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:51
static DString g_footer_file
Definition latexgen.cpp:54
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:22
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 term(fmt,...)
Definition message.h:137
const char * ghostScriptCommand()
Definition portable.cpp:437
std::ofstream openOutputStream(const DString &name, bool append=false)
Definition portable.cpp:648
Definition message.h:144
Definition dstring.h:902
OutputCodeDefer< LatexCodeGenerator > LatexCodeGeneratorDefer
Definition outputlist.h:104
Portable versions of functions that are platform dependent.
Some helper functions for std::string.
std::string removeEmptyLines(const std::string &s)
Definition stringutil.h:181
CodeSymbolType
Definition types.h:481
Various UTF8 related helper functions.
size_t updateColumnCount(const char *s, size_t col)
Definition util.cpp:6083
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:5750
bool checkExtension(const DString &fName, const DString &ext)
Definition util.cpp:4255
DString showDate(const DString &fmt)
Definition util.cpp:2634
DString stripExtensionGeneral(const DString &fName, const DString &ext)
Definition util.cpp:4274
void clearSubDirs(const Dir &d)
Definition util.cpp:3063
void createSubDirs(const Dir &d)
Definition util.cpp:3036
void checkBlocks(const DString &s, const DString fileName, const SelectionMarkerInfo &markerInfo)
Definition util.cpp:5863
DString fileToString(const DString &name, bool filter, bool isSourceCode)
Definition util.cpp:1120
DString substituteKeywords(const DString &file, const DString &s, const KeywordSubstitutionList &keywords)
Definition util.cpp:2561
DString relativePathToRoot(const DString &name)
Definition util.cpp:2979
DString projectLogoFile()
Definition util.cpp:2647
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:5179
DString projectLogoSize()
Definition util.cpp:2666
DString stripPath(const DString &s)
Definition util.cpp:4289
A bunch of utility functions.