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