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 "diagram.h"
24#include "language.h"
25#include "version.h"
26#include "dot.h"
27#include "dotcallgraph.h"
28#include "dotclassgraph.h"
29#include "dotdirdeps.h"
31#include "dotincldepgraph.h"
32#include "pagedef.h"
33#include "docparser.h"
34#include "docnode.h"
35#include "latexdocvisitor.h"
36#include "dirdef.h"
37#include "cite.h"
38#include "groupdef.h"
39#include "classlist.h"
40#include "namespacedef.h"
41#include "filename.h"
42#include "resourcemgr.h"
43#include "portable.h"
44#include "fileinfo.h"
45#include "utf8.h"
46#include "datetime.h"
47#include "portable.h"
48#include "outputlist.h"
49#include "moduledef.h"
50
55static const SelectionMarkerInfo latexMarkerInfo = { '%', "%%BEGIN ",8 ,"%%END ",6, "",0 };
56
57static QCString substituteLatexKeywords(const QCString &file, const QCString &str, const QCString &title);
58
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.isEmpty())
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 QCString &ref,const QCString &f,
198 const QCString &anchor,const QCString &name,
199 const QCString &)
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.isEmpty() && usePDFLatex && pdfHyperlinks)
206 {
207 *m_t << "\\mbox{\\hyperlink{";
208 if (!f.isEmpty()) *m_t << stripPath(f);
209 if (!f.isEmpty() && !anchor.isEmpty()) *m_t << "_";
210 if (!anchor.isEmpty()) *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 QCString &ref,const QCString &fileName,const QCString &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{";
231 }
232 if (Config_getBool(SOURCE_BROWSER))
233 {
234 QCString lineNumber;
235 lineNumber.sprintf("%05d",l);
236
237 QCString lineAnchor;
238 if (!m_sourceFileName.isEmpty())
239 {
240 lineAnchor.sprintf("_l%05d",l);
242 }
243 bool showTarget = usePDFLatex && pdfHyperlinks && !lineAnchor.isEmpty() && writeLineAnchor;
244 if (showTarget)
245 {
246 *m_t << "\\Hypertarget{" << stripPath(lineAnchor) << "}";
247 }
248 if (!fileName.isEmpty())
249 {
250 writeCodeLink(CodeSymbolType::Default,ref,fileName,anchor,lineNumber,QCString());
251 }
252 else
253 {
254 codify(lineNumber);
255 }
256 *m_t << "\\ ";
257 }
258 else
259 {
260 QCString 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{";
277 }
278}
279
281{
282 if (m_hide) return;
284 {
285 *m_t << "}";
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);
349 m_codeGen->setTextStream(&m_t);
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().isEmpty();
370 QCString 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 QCString latex_command = theTranslator->latexCommandName().quoted();
379 QCString mkidx_command = Config_getString(MAKEINDEX_CMD_NAME).quoted();
380 QCString bibtex_command = "bibtex";
381 QCString 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 QCString dir=Config_getString(LATEX_OUTPUT);
507 QCString fileName=dir+"/make.bat";
508 QCString latex_command = theTranslator->latexCommandName().quoted();
509 QCString mkidx_command = Config_getString(MAKEINDEX_CMD_NAME).quoted();
510 QCString bibtex_command = "bibtex";
511 QCString manual_file = "refman";
512 const int latex_count = 8;
513 bool generateBib = !CitationManager::instance().isEmpty();
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 QCString 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).isEmpty())
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).isEmpty())
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 QCString 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 QCString &name,bool,const QCString &,const QCString &,int,int hierarchyLevel)
710{
711#if 0
712 setEncoding(Config_getString(LATEX_OUTPUT_ENCODING));
713#endif
714 QCString fileName=name;
715 m_hierarchyLevel = hierarchyLevel;
717 if (!fileName.endsWith(".tex") && !fileName.endsWith(".sty")) fileName+=".tex";
719 m_codeGen->setRelativePath(m_relPath);
720 m_codeGen->setSourceFileName(stripPath(fileName));
721}
722
724{
725 endPlainFile();
726 m_codeGen->setSourceFileName("");
727}
728
729//void LatexGenerator::writeIndex()
730//{
731// startFile("refman.tex");
732//}
733
735{
736 m_t << "\\\\[1ex]\\large ";
737}
738
740{
741 QCString result;
742 const 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 QCString 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 QCString result;
771 QCString latex_mkidx_command = Config_getString(LATEX_MAKEINDEX_CMD);
772 if (!latex_mkidx_command.isEmpty())
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 QCString &str,
802 const QCString &title)
803{
804 bool compactLatex = Config_getBool(COMPACT_LATEX);
805 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
806 bool usePdfLatex = Config_getBool(USE_PDFLATEX);
807 QCString paperType = Config_getEnumAsString(PAPER_TYPE);
808
809 QCString style = Config_getString(LATEX_BIB_STYLE);
810 if (style.isEmpty())
811 {
812 style="plainnat";
813 }
814
815 TextStream tg;
816 QCString generatedBy;
817 auto timeStamp = Config_getEnum(TIMESTAMP);
818 switch (timeStamp)
819 {
820 case TIMESTAMP_t::YES:
821 case TIMESTAMP_t::DATETIME:
822 generatedBy = theTranslator->trGeneratedAt(dateToString(DateTimeType::DateTime),
823 Config_getString(PROJECT_NAME));
824 break;
825 case TIMESTAMP_t::DATE:
826 generatedBy = theTranslator->trGeneratedAt(dateToString(DateTimeType::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 QCString latexFontenc = theTranslator->latexFontenc();
843
844 QCString latexEmojiDirectory = Config_getString(LATEX_EMOJI_DIRECTORY);
845 if (latexEmojiDirectory.isEmpty()) latexEmojiDirectory = ".";
846 latexEmojiDirectory = substitute(latexEmojiDirectory,"\\","/");
847
848 TextStream tg1;
850 QCString extraLatexPackages = tg1.str();
851
852 TextStream tg2;
854 QCString latexSpecialFormulaChars = tg2.str();
855
856 QCString formulaMacrofile = Config_getString(FORMULA_MACROFILE);
857 QCString stripMacroFile;
858 if (!formulaMacrofile.isEmpty())
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 QCString projectNumber = Config_getString(PROJECT_NUMBER);
867
868 // first substitute generic keywords
869 QCString result = substituteKeywords(file,str,title,
870 convertToLaTeX(Config_getString(PROJECT_NAME),false),
871 convertToLaTeX(projectNumber,false),
872 convertToLaTeX(Config_getString(PROJECT_BRIEF),false));
873
874 // additional LaTeX only keywords
875 result = substituteKeywords(file,result,
876 {
877 // keyword value getter
878 { "$datetime", [&]() { return dateToString(DateTimeType::DateTime); } },
879 { "$date", [&]() { return dateToString(DateTimeType::Date); } },
880 { "$time", [&]() { return dateToString(DateTimeType::Time); } },
881 { "$year", [&]() { return yearToString(); } },
882 { "$latexdocumentpre", [&]() { return theTranslator->latexDocumentPre(); } },
883 { "$latexdocumentpost", [&]() { return theTranslator->latexDocumentPost(); } },
884 { "$generatedby", [&]() { return generatedBy; } },
885 { "$latexbibstyle", [&]() { return style; } },
886 { "$latexcitereference", [&]() { return theTranslator->trCiteReferences(); } },
887 { "$latexbibfiles", [&]() { return CitationManager::instance().latexBibFiles(); } },
888 { "$papertype", [&]() { return paperType+"paper"; } },
889 { "$extralatexstylesheet", [&]() { return extraLatexStyleSheet(); } },
890 { "$languagesupport", [&]() { return theTranslator->latexLanguageSupportCommand(); } },
891 { "$latexfontenc", [&]() { return latexFontenc; } },
892 { "$latexfont", [&]() { return theTranslator->latexFont(); } },
893 { "$latexemojidirectory", [&]() { return latexEmojiDirectory; } },
894 { "$makeindex", [&]() { return makeIndex(); } },
895 { "$extralatexpackages", [&]() { return extraLatexPackages; } },
896 { "$latexspecialformulachars", [&]() { return latexSpecialFormulaChars; } },
897 { "$formulamacrofile", [&]() { return stripMacroFile; } },
898 { "$latex_batchmode", [&]() { return latex_batchmode(); } }
899 });
900
901 // remove conditional blocks
902 result = selectBlocks(result,
903 {
904 // marker is enabled
905 { "CITATIONS_PRESENT", !CitationManager::instance().isEmpty() },
906 { "COMPACT_LATEX", compactLatex },
907 { "PDF_HYPERLINKS", pdfHyperlinks },
908 { "USE_PDFLATEX", usePdfLatex },
909 { "TIMESTAMP", timeStamp!=TIMESTAMP_t::NO },
910 { "LATEX_FONTENC", !latexFontenc.isEmpty() },
911 { "FORMULA_MACROFILE", !formulaMacrofile.isEmpty() },
912 { "PROJECT_NUMBER", !projectNumber.isEmpty() }
914
915 result = removeEmptyLines(result);
916
917 return result;
918}
919
921{
922 bool compactLatex = Config_getBool(COMPACT_LATEX);
923 switch (is)
924 {
927 break;
929 break;
931 break;
933 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
934 m_t << "{"; //Module Index}\n"
935 break;
937 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
938 m_t << "{"; //Topic Index}\n"
939 break;
941 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
942 m_t << "{"; //Directory Index}\n"
943 break;
945 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
946 m_t << "{"; //Namespace Index}\n"
947 break;
949 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
950 m_t << "{"; //Concept Index}\n"
951 break;
953 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
954 m_t << "{"; //Hierarchical Index}\n"
955 break;
957 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
958 m_t << "{"; //Annotated Compound Index}\n"
959 break;
961 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
962 m_t << "{"; //Annotated File Index}\n"
963 break;
965 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
966 m_t << "{"; //Annotated Page Index}\n"
967 break;
969 {
970 for (const auto &gd : *Doxygen::groupLinkedMap)
971 {
972 if (!gd->isReference())
973 {
974 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
975 m_t << "{"; //Topic Documentation}\n";
976 break;
977 }
978 }
979 }
980 break;
982 {
983 for (const auto &mod : ModuleManager::instance().modules())
984 {
985 if (!mod->isReference() && mod->isPrimaryInterface())
986 {
987 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
988 m_t << "{"; //Topic Documentation}\n";
989 break;
990 }
991 }
992 }
993 break;
995 {
996 for (const auto &dd : *Doxygen::dirLinkedMap)
997 {
998 if (dd->isLinkableInProject())
999 {
1000 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
1001 m_t << "{"; //Dir Documentation}\n";
1002 break;
1003 }
1004 }
1005 }
1006 break;
1008 {
1009 for (const auto &nd : *Doxygen::namespaceLinkedMap)
1010 {
1011 if (nd->isLinkableInProject() && !nd->isAlias())
1012 {
1013 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
1014 m_t << "{"; // Namespace Documentation}\n":
1015 break;
1016 }
1017 }
1018 }
1019 break;
1021 {
1022 for (const auto &cd : *Doxygen::conceptLinkedMap)
1023 {
1024 if (cd->isLinkableInProject() && !cd->isAlias())
1025 {
1026 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
1027 m_t << "{"; // Concept Documentation}\n":
1028 break;
1029 }
1030 }
1031 }
1032 break;
1034 {
1035 for (const auto &cd : *Doxygen::classLinkedMap)
1036 {
1037 if (cd->isLinkableInProject() &&
1038 !cd->isImplicitTemplateInstance() &&
1039 !cd->isEmbeddedInOuterScope() &&
1040 !cd->isAlias()
1041 )
1042 {
1043 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
1044 m_t << "{"; //Compound Documentation}\n";
1045 break;
1046 }
1047 }
1048 }
1049 break;
1051 {
1052 bool isFirst=TRUE;
1053 for (const auto &fn : *Doxygen::inputNameLinkedMap)
1054 {
1055 for (const auto &fd : *fn)
1056 {
1057 if (fd->isLinkableInProject() || fd->generateSourceFile())
1058 {
1059 if (isFirst)
1060 {
1061 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
1062 m_t << "{"; //File Documentation}\n";
1063 isFirst=FALSE;
1064 break;
1065 }
1066 }
1067 }
1068 }
1069 }
1070 break;
1072 {
1073 if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter";
1074 m_t << "{"; //Example Documentation}\n";
1075 }
1076 break;
1078 break;
1080 break;
1082 break;
1083 }
1084}
1085
1087{
1088 switch (is)
1089 {
1091 break;
1093 break;
1095 {
1097 {
1098 writePageLink(Doxygen::mainPage->getOutputFileBase(), FALSE);
1099 }
1100 }
1101 break;
1103 m_t << "}\n\\input{modules}\n";
1104 break;
1106 m_t << "}\n\\input{topics}\n";
1107 break;
1109 m_t << "}\n\\input{dirs}\n";
1110 break;
1112 m_t << "}\n\\input{namespaces}\n";
1113 break;
1115 m_t << "}\n\\input{concepts}\n";
1116 break;
1118 m_t << "}\n\\input{hierarchy}\n";
1119 break;
1121 m_t << "}\n\\input{annotated}\n";
1122 break;
1124 m_t << "}\n\\input{files}\n";
1125 break;
1127 m_t << "}\n\\input{pages}\n";
1128 break;
1130 {
1131 m_t << "}\n";
1132 for (const auto &gd : *Doxygen::groupLinkedMap)
1133 {
1134 if (!gd->isReference() && !gd->isASubGroup())
1135 {
1136 writePageLink(gd->getOutputFileBase(), FALSE);
1137 }
1138 }
1139 }
1140 break;
1142 {
1143 m_t << "}\n";
1144 for (const auto &mod : ModuleManager::instance().modules())
1145 {
1146 if (!mod->isReference() && mod->isPrimaryInterface())
1147 {
1148 writePageLink(mod->getOutputFileBase(), FALSE);
1149 }
1150 }
1151 }
1152 break;
1154 {
1155 bool found=FALSE;
1156 for (const auto &dd : *Doxygen::dirLinkedMap)
1157 {
1158 if (dd->isLinkableInProject())
1159 {
1160 if (!found)
1161 {
1162 m_t << "}\n";
1163 found = TRUE;
1164 }
1165 m_t << "\\input{" << dd->getOutputFileBase() << "}\n";
1166 }
1167 }
1168 }
1169 break;
1171 {
1172 bool found=FALSE;
1173 for (const auto &nd : *Doxygen::namespaceLinkedMap)
1174 {
1175 if (nd->isLinkableInProject() && !nd->isAlias())
1176 {
1177 if (!found)
1178 {
1179 m_t << "}\n";
1180 found=true;
1181 }
1182 m_t << "\\input{" << nd->getOutputFileBase() << "}\n";
1183 }
1184 }
1185 }
1186 break;
1188 {
1189 bool found=FALSE;
1190 for (const auto &cd : *Doxygen::conceptLinkedMap)
1191 {
1192 if (cd->isLinkableInProject() && !cd->isAlias())
1193 {
1194 if (!found)
1195 {
1196 m_t << "}\n";
1197 found=true;
1198 }
1199 m_t << "\\input{" << cd->getOutputFileBase() << "}\n";
1200 }
1201 }
1202 }
1203 break;
1205 {
1206 bool found=FALSE;
1207 for (const auto &cd : *Doxygen::classLinkedMap)
1208 {
1209 if (cd->isLinkableInProject() &&
1210 !cd->isImplicitTemplateInstance() &&
1211 !cd->isEmbeddedInOuterScope() &&
1212 !cd->isAlias()
1213 )
1214 {
1215 if (!found)
1216 {
1217 m_t << "}\n"; // end doxysection or chapter title
1218 found=TRUE;
1219 }
1220 m_t << "\\input{" << cd->getOutputFileBase() << "}\n";
1221 }
1222 }
1223 }
1224 break;
1226 {
1227 bool isFirst=TRUE;
1228 for (const auto &fn : *Doxygen::inputNameLinkedMap)
1229 {
1230 for (const auto &fd : *fn)
1231 {
1232 if (fd->isLinkableInProject())
1233 {
1234 if (isFirst)
1235 {
1236 m_t << "}\n"; // end doxysection or chapter title
1237 }
1238 isFirst=FALSE;
1239 m_t << "\\input{" << fd->getOutputFileBase() << "}\n";
1240 }
1241 if (fd->generateSourceFile())
1242 {
1243 if (isFirst)
1244 {
1245 m_t << "}\n"; // end doxysection or chapter title
1246 }
1247 isFirst=FALSE;
1248 m_t << "\\input{" << fd->getSourceFileBase() << "}\n";
1249 }
1250 }
1251 }
1252 }
1253 break;
1255 {
1256 m_t << "}\n";
1257 for (const auto &pd : *Doxygen::exampleLinkedMap)
1258 {
1259 m_t << "\\input{" << pd->getOutputFileBase() << "}\n";
1260 }
1261 }
1262 break;
1264 {
1265 for (const auto &pd : *Doxygen::pageLinkedMap)
1266 {
1267 if (!pd->getGroupDef() && !pd->isReference() && !pd->hasParentPage()
1268 && pd->name() != "citelist" && Doxygen::mainPage.get() != pd.get())
1269 {
1270 writePageLink(pd->getOutputFileBase(), FALSE);
1271 }
1272 }
1273 }
1274 break;
1276 break;
1279 break;
1280 }
1281}
1282
1283void LatexGenerator::writePageLink(const QCString &name, bool /*first*/)
1284{
1285 //bool &compactLatex = Config_getBool(COMPACT_LATEX);
1286 // next is remove for bug615957
1287 //if (compactLatex || first) m_t << "\\input" ; else m_t << "\\include";
1288 m_t << "\\input" ;
1289 m_t << "{" << name << "}\n";
1290}
1291
1293{
1294 if (part > 0)
1295 return;
1296
1297 startPlainFile("doxygen.sty");
1299 endPlainFile();
1300
1301 /// an extension of the etoc package is required that is only available in the
1302 /// newer version. Providing the updated version to be used with older versions
1303 /// of LaTeX
1304 startPlainFile("etoc_doxygen.sty");
1305 m_t << ResourceMgr::instance().getAsString("etoc_doxygen.sty");
1306 endPlainFile();
1307}
1308
1310{
1311 m_t << "\n" << "\n";
1312}
1313
1315{
1316 m_t << "\n" << "\n";
1317}
1318
1320{
1321 m_t << text;
1322}
1323
1325{
1326 m_t << "\\item ";
1327 if (ref.isEmpty() && !fn.isEmpty())
1328 {
1329 m_t << "\\contentsline{section}{";
1330 }
1331}
1332
1334{
1335 if (ref.isEmpty() && !fn.isEmpty())
1336 {
1337 m_t << "}{\\pageref{" << stripPath(fn) << "}}{}\n";
1338 }
1339}
1340
1342 const QCString &path,const QCString &name)
1343{
1344 m_t << "\\item\\contentsline{section}\\textbf{ ";
1345 if (!path.isEmpty()) docify(path);
1346 docify(name);
1347 m_t << "} ";
1348}
1349
1351{
1352 m_t << "\\item\\contentsline{section}{";
1353}
1354
1358
1360{
1361 m_t << " ";
1362 if (hasBrief) m_t << "\\\\*";
1363}
1364
1365void LatexGenerator::endIndexValue(const QCString &name,bool /*hasBrief*/)
1366{
1367 //if (hasBrief) m_t << ")";
1368 m_t << "}{\\pageref{" << stripPath(name) << "}}{}\n";
1369}
1370
1371//void LatexGenerator::writeClassLink(const QCString &,const QCString &,
1372// const QCString &,const QCString &name)
1373//{
1374// m_t << "\\textbf{ ";
1375// docify(name);
1376// m_t << "}";
1377//}
1378
1380{
1381 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1382 if (!m_disableLinks && pdfHyperlinks)
1383 {
1384 m_t << "\\mbox{\\hyperlink{";
1385 if (!f.isEmpty()) m_t << stripPath(f);
1386 if (!anchor.isEmpty()) m_t << "_" << anchor;
1387 m_t << "}{";
1388 }
1389 else
1390 {
1391 m_t << "\\textbf{ ";
1392 }
1393}
1394
1396{
1397 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1398 if (!m_disableLinks && pdfHyperlinks)
1399 {
1400 m_t << "}";
1401 }
1402 m_t << "}";
1403}
1404
1405static QCString objectLinkToString(const QCString &ref, const QCString &f,
1406 const QCString &anchor, const QCString &text,
1407 bool insideTabbing,bool disableLinks)
1408{
1409 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1410 QCString result;
1411 if (!disableLinks && ref.isEmpty() && pdfHyperlinks)
1412 {
1413 result += "\\mbox{\\hyperlink{";
1414 if (!f.isEmpty()) result += stripPath(f);
1415 if (!f.isEmpty() && !anchor.isEmpty()) result += "_";
1416 if (!anchor.isEmpty()) result += anchor;
1417 result += "}{";
1418 result += convertToLaTeX(text,insideTabbing);
1419 result += "}}";
1420 }
1421 else
1422 {
1423 result += "\\textbf{ ";
1424 result += convertToLaTeX(text,insideTabbing);
1425 result += "}";
1426 }
1427 return result;
1428}
1429
1430static void processEntity(TextStream &t, bool pdfHyperlinks, const char *strForm, const char *strRepl)
1431{
1432 if (pdfHyperlinks)
1433 {
1434 t << "\\texorpdfstring{";
1435 }
1436 t << strForm;
1437 if (pdfHyperlinks)
1438 {
1439 t << "}{" << strRepl << "}";
1440 }
1441}
1442
1444 const QCString &anchor, const QCString &text)
1445{
1446 m_t << objectLinkToString(ref,f,anchor,text,m_codeGen->insideTabbing(),m_disableLinks);
1447}
1448
1450{
1451 m_t << " \\doxyref{}{";
1452}
1453
1454void LatexGenerator::endPageRef(const QCString &clname, const QCString &anchor)
1455{
1456 m_t << "}{";
1457 if (!clname.isEmpty()) m_t << clname;
1458 if (!anchor.isEmpty()) m_t << "_" << anchor;
1459 m_t << "}";
1460}
1461
1462
1464{
1465 int hierarchyLevel = m_hierarchyLevel;
1466 if (Config_getBool(COMPACT_LATEX))
1467 {
1468 ++hierarchyLevel;
1469 }
1470
1471 if (hierarchyLevel < 0)
1472 m_t << "\\chapter{";
1473 else
1474 m_t << "\\doxy" << QCString("sub").repeat(hierarchyLevel) << "section{";
1475}
1476
1478{
1479 m_t << "}\n";
1480
1481 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1482 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1483 if (usePDFLatex && pdfHyperlinks && !fileName.isEmpty())
1484 {
1485 m_t << "\\hypertarget{" << stripPath(fileName) << "}{}";
1486 }
1487
1489 if (!fn.isEmpty())
1490 {
1491 m_t << "\\label{" << fn << "}";
1492 }
1493 if (!name.isEmpty())
1494 {
1495 m_t << "\\index{";
1496 m_t << latexEscapeLabelName(name);
1497 m_t << "@{";
1498 m_t << latexEscapeIndexChars(name);
1499 m_t << "}}\n";
1500 }
1501}
1502
1503void LatexGenerator::startGroupHeader(const QCString &,int extraIndentLevel)
1504{
1505 if (Config_getBool(COMPACT_LATEX))
1506 {
1507 extraIndentLevel++;
1508 }
1509
1510 if (extraIndentLevel>=3)
1511 {
1512 m_t << "\\doxysubparagraph*{";
1513 }
1514 else if (extraIndentLevel==2)
1515 {
1516 m_t << "\\doxyparagraph{";
1517 }
1518 else
1519 {
1520 extraIndentLevel += m_hierarchyLevel + 1;
1521 m_t << "\\doxy" << QCString("sub").repeat(extraIndentLevel) << "section{";
1522 }
1524}
1525
1527{
1529 m_t << "}\n";
1530}
1531
1533{
1534 int l = m_hierarchyLevel + 1;
1535 if (Config_getBool(COMPACT_LATEX))
1536 {
1537 ++l;
1538 }
1539
1540 m_t << "\\doxysub" << QCString("sub").repeat(l) << "section*{";
1542}
1543
1545{
1547 m_t << "}\n";
1548}
1549
1551 const QCString &memname,
1552 const QCString &,
1553 const QCString &title,
1554 int memCount,
1555 int memTotal,
1556 bool showInline)
1557{
1558 if (!memname.isEmpty() && memname[0]!='@')
1559 {
1560 m_t << "\\index{";
1561 if (!clname.isEmpty())
1562 {
1563 m_t << latexEscapeLabelName(clname);
1564 m_t << "@{";
1565 m_t << latexEscapeIndexChars(clname);
1566 m_t << "}!";
1567 }
1568 m_t << latexEscapeLabelName(memname);
1569 m_t << "@{";
1570 m_t << latexEscapeIndexChars(memname);
1571 m_t << "}}\n";
1572
1573 m_t << "\\index{";
1574 m_t << latexEscapeLabelName(memname);
1575 m_t << "@{";
1576 m_t << latexEscapeIndexChars(memname);
1577 m_t << "}";
1578 if (!clname.isEmpty())
1579 {
1580 m_t << "!";
1581 m_t << latexEscapeLabelName(clname);
1582 m_t << "@{";
1583 m_t << latexEscapeIndexChars(clname);
1584 m_t << "}";
1585 }
1586 m_t << "}\n";
1587 }
1588 bool compactLatex = Config_getBool(COMPACT_LATEX);
1589 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1590 if (showInline)
1591 {
1592 m_t << "\\doxysubparagraph";
1593 }
1594 else if (compactLatex)
1595 {
1596 m_t << "\\doxyparagraph";
1597 }
1598 else
1599 {
1600 m_t << "\\doxy" << QCString("sub").repeat(m_hierarchyLevel + 2) << "section";
1601 }
1602
1603 m_t << "{";
1604 if (pdfHyperlinks)
1605 {
1606 m_t << "\\texorpdfstring{";
1607 }
1608 m_t << latexEscapeIndexChars(title);
1609 if (pdfHyperlinks)
1610 {
1611 m_t << "}{" << latexEscapePDFString(title) << "}";
1612 }
1613 if (memTotal>1)
1614 {
1615 m_t << "\\hspace{0.1cm}{\\footnotesize\\ttfamily [" << memCount << "/" << memTotal << "]}";
1616 }
1617 m_t << "}";
1618 m_t << "\n{\\footnotesize\\ttfamily ";
1619 //m_disableLinks=TRUE;
1620}
1621
1623{
1625 m_t << "}\n\n";
1626 //if (Config_getBool(COMPACT_LATEX)) m_t << "\\hfill";
1627}
1628
1630 const QCString &anchor, const QCString &,
1631 const QCString &)
1632{
1633 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1634 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1635 if (m_insideTableEnv) m_t << "\\mbox{"; // see issue #6093
1636 if (usePDFLatex && pdfHyperlinks)
1637 {
1638 m_t << "\\Hypertarget{";
1639 if (!fName.isEmpty()) m_t << stripPath(fName);
1640 if (!anchor.isEmpty()) m_t << "_" << anchor;
1641 m_t << "}";
1642 }
1643}
1644
1645void LatexGenerator::endDoxyAnchor(const QCString &/* fName */,const QCString &/* anchor */)
1646{
1647}
1648
1649void LatexGenerator::addLabel(const QCString &fName, const QCString &anchor)
1650{
1651 m_t << "\\label{";
1652 if (!fName.isEmpty()) m_t << stripPath(fName);
1653 if (!anchor.isEmpty()) m_t << "_" << anchor;
1654 if (m_insideTableEnv) m_t << "}";
1655 m_t << "} \n";
1656}
1657
1658void LatexGenerator::writeAnchor(const QCString &fName,const QCString &name)
1659{
1660 //printf("LatexGenerator::writeAnchor(%s,%s)\n",fName,name);
1661 m_t << "\\label{" << stripPath(name) << "}\n";
1662 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1663 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1664 if (usePDFLatex && pdfHyperlinks)
1665 {
1666 if (!fName.isEmpty())
1667 {
1668 m_t << "\\Hypertarget{" << stripPath(fName) << "_" << stripPath(name) << "}\n";
1669 }
1670 else
1671 {
1672 m_t << "\\Hypertarget{" << stripPath(name) << "}\n";
1673 }
1674 }
1675}
1676
1677
1678//void LatexGenerator::writeLatexLabel(const QCString &clName,const QCString &anchor)
1679//{
1680// writeDoxyAnchor(0,clName,anchor,0);
1681//}
1682
1684{
1685 if (!s1.isEmpty())
1686 {
1687 m_t << "\\index{";
1689 m_t << "@{";
1691 m_t << "}";
1692 if (!s2.isEmpty())
1693 {
1694 m_t << "!";
1696 m_t << "@{";
1698 m_t << "}";
1699 }
1700 m_t << "}";
1701 }
1702}
1703
1704
1706{
1707 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1708 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1709 if (usePDFLatex && pdfHyperlinks)
1710 {
1711 m_t << "\\hypertarget{" << stripPath(lab) << "}{}";
1712 }
1713 m_t << "\\";
1714 if (Config_getBool(COMPACT_LATEX))
1715 {
1716 switch(type.level())
1717 {
1718 case SectionType::Page: m_t << "doxysubsection"; break;
1719 case SectionType::Section: m_t << "doxysubsubsection"; break;
1720 case SectionType::Subsection: m_t << "doxysubsubsubsection"; break;
1721 case SectionType::Subsubsection: m_t << "doxysubsubsubsubsection"; break;
1722 case SectionType::Paragraph: m_t << "doxysubsubsubsubsubsection"; break;
1723 case SectionType::Subparagraph: m_t << "doxysubsubsubsubsubsubsection"; break;
1724 case SectionType::Subsubparagraph: m_t << "doxysubsubsubsubsubsubsection"; break;
1725 default: ASSERT(0); break;
1726 }
1727 m_t << "{";
1728 }
1729 else
1730 {
1731 switch(type.level())
1732 {
1733 case SectionType::Page: m_t << "doxysection"; break;
1734 case SectionType::Section: m_t << "doxysubsection"; break;
1735 case SectionType::Subsection: m_t << "doxysubsubsection"; break;
1736 case SectionType::Subsubsection: m_t << "doxysubsubsubsection"; break;
1737 case SectionType::Paragraph: m_t << "doxysubsubsubsubsection"; break;
1738 case SectionType::Subparagraph: m_t << "doxysubsubsubsubsubsection"; break;
1739 case SectionType::Subsubparagraph: m_t << "doxysubsubsubsubsubsubsection"; break;
1740 default: ASSERT(0); break;
1741 }
1742 m_t << "{";
1743 }
1744}
1745
1747{
1748 m_t << "}\\label{" << lab << "}\n";
1749}
1750
1751
1753{
1755 m_codeGen->insideTabbing(), // insideTabbing
1756 false, // insidePre
1757 false, // insideItem
1758 m_codeGen->usedTableLevel()>0, // insideTable
1759 false // keepSpaces
1760 );
1761}
1762
1764{
1765 char cs[2];
1766 cs[0]=c;
1767 cs[1]=0;
1768 docify(cs);
1769}
1770
1772{
1773 //if (Config_getBool(COMPACT_LATEX)) m_t << "\\doxysubsubsection"; else m_t << "\\doxysubsection";
1774 //m_t << "{";
1775}
1776
1778 const QCString &fileName,const QCString &)
1779{
1781}
1782
1783
1785{
1786 if (indent==0)
1787 {
1788 m_t << "\\begin{tabbing}\n";
1789 m_t << "xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=\\kill\n";
1790 m_codeGen->setInsideTabbing(true);
1791 }
1792 m_indent=indent;
1793}
1794
1796{
1797 if (indent==0)
1798 {
1799 m_t << "\n" << "\\end{tabbing}";
1800 m_codeGen->setInsideTabbing(false);
1801 }
1802 m_indent=indent;
1803}
1804
1806{
1808 {
1809 m_t << "{\\footnotesize ";
1810 }
1811}
1812
1814{
1816 {
1817 m_t << "}\\\\";
1818 }
1819}
1820
1822{
1823 //printf("LatexGenerator::startMemberItem(%d)\n",annType);
1824 if (!m_codeGen->insideTabbing())
1825 {
1826 m_t << "\\item \n";
1828 }
1829}
1830
1832{
1833 if (m_codeGen->insideTabbing())
1834 {
1835 m_t << "\\\\";
1836 }
1838 m_t << "\n";
1839}
1840
1842{
1843 if (!m_codeGen->insideTabbing())
1844 {
1845 m_t << "\\begin{DoxyCompactList}\\small\\item\\em ";
1846 }
1847 else
1848 {
1849 for (int i=0;i<m_indent+2;i++) m_t << "\\>";
1850 m_t << "{\\em ";
1851 }
1852}
1853
1855{
1856 if (!m_codeGen->insideTabbing())
1857 {
1858 //m_t << "\\item\\end{DoxyCompactList}";
1859 m_t << "\\end{DoxyCompactList}";
1860 }
1861 else
1862 {
1863 m_t << "}\\\\\n";
1864 }
1865}
1866
1867
1869{
1870 //printf("writeNonBreakableSpace()\n");
1871 if (m_codeGen->insideTabbing())
1872 {
1873 m_t << "\\>";
1874 }
1875 else
1876 {
1877 m_t << "~";
1878 }
1879}
1880
1881// ----------------------------------------------
1882// nesting of functions below:
1883// startDescTable()
1884// - startDescTableRow()
1885// - startDescTableTitle()
1886// - endDescTableTitle()
1887// - startDescTableData()
1888// - endDescTableData()
1889// - endDescTableRow()
1890// - startDescTableRow()
1891// - ...
1892// - endDescTableRow()
1893// endDescTable()
1894
1895void LatexGenerator::startDescTable(const QCString &title,const bool hasInits)
1896{
1897 m_codeGen->incUsedTableLevel();
1898 m_t << "\\begin{DoxyEnumFields}[" << (hasInits?3:2) << "]{" << title << "}\n";
1899}
1900
1902{
1903 m_codeGen->decUsedTableLevel();
1904 m_t << "\\end{DoxyEnumFields}\n";
1905}
1906
1908{
1909 // this is needed to prevent the \hypertarget, \label, and \index commands from messing up
1910 // the row height (based on http://tex.stackexchange.com/a/186102)
1911 m_t << "\\raisebox{\\heightof{T}}[0pt][0pt]{";
1912}
1913
1917
1919{
1920 m_t << "}";
1921}
1922
1926
1928{
1929 m_t << "&";
1930}
1931
1935
1937{
1938 m_t << "&";
1939}
1940
1942{
1943 m_t << "\\\\\n\\hline\n\n";
1944}
1945
1949
1950
1952{
1953 if (!m_codeGen->insideTabbing())
1954 {
1955 m_t << "\\begin{DoxyCompactItemize}\n";
1956 }
1957}
1958
1960{
1961 //printf("LatexGenerator::endMemberList(%d)\n",m_codeGen->InsideTabbing());
1962 if (!m_codeGen->insideTabbing())
1963 {
1964 m_t << "\\end{DoxyCompactItemize}\n";
1965 }
1966}
1967
1968
1970{
1971 if (hasHeader) m_t << "\\begin{Indent}";
1972 m_t << "\\textbf{ ";
1973 // changed back to rev 756 due to bug 660501
1974 //if (Config_getBool(COMPACT_LATEX))
1975 //{
1976 // m_t << "\\doxysubparagraph*{";
1977 //}
1978 //else
1979 //{
1980 // m_t << "\\doxyparagraph*{";
1981 //}
1982}
1983
1985{
1986 // changed back to rev 756 due to bug 660501
1987 m_t << "}\\par\n";
1988 //m_t << "}\n";
1989}
1990
1992{
1993 m_t << "{\\em ";
1994}
1995
1997{
1998 m_t << "}";
1999}
2000
2004
2006{
2007 if (hasHeader)m_t << "\\end{Indent}";
2008 m_t << "\n";
2009}
2010
2012{
2013 m_t << "\n" << "\n";
2014}
2015
2020
2024
2029
2033
2038
2042
2047
2051
2056
2058{
2059 m_t << "\\begin{Desc}\n\\item[";
2060 docify(theTranslator->trExamples());
2061 m_t << "]";
2062}
2063
2065{
2066 m_t << "\\end{Desc}\n";
2067}
2068
2070{
2071 /* start of ParameterType ParameterName list */
2072 if (openBracket) m_t << "(";
2073 m_t << "\\begin{DoxyParamCaption}";
2074}
2075
2079
2081{
2082 m_t << "\\item[{";
2083 if (!first && !key.isEmpty()) docify(key);
2084}
2085
2087{
2088 m_t << "}]";
2089}
2090
2091void LatexGenerator::startParameterName(bool /*oneArgOnly*/)
2092{
2093 m_t << "{";
2094}
2095
2097{
2098 m_t << "}";
2099}
2100
2102{
2103 m_t << "{";
2104}
2105
2106void LatexGenerator::endParameterExtra(bool last,bool /*emptyList*/,bool closeBracket)
2107{
2108 m_t << "}";
2109 if (last)
2110 {
2111 m_t << "\\end{DoxyParamCaption}";
2112 if (closeBracket) m_t << ")";
2113 }
2114}
2115
2116void LatexGenerator::exceptionEntry(const QCString &prefix,bool closeBracket)
2117{
2118 if (!prefix.isEmpty())
2119 {
2120 m_t << " " << prefix << "(";
2121 }
2122 else if (closeBracket)
2123 {
2124 m_t << ")";
2125 }
2126 m_t << " ";
2127}
2128
2129void LatexGenerator::writeDoc(const IDocNodeAST *ast,const Definition *ctx,const MemberDef *,int,int)
2130{
2131 const DocNodeAST *astImpl = dynamic_cast<const DocNodeAST*>(ast);
2132 if (astImpl)
2133 {
2135 ctx?ctx->getDefFileExtension():QCString(""),
2137 std::visit(visitor,astImpl->root);
2138 }
2139}
2140
2142{
2143 m_t << "\\begin{Desc}\n\\item[";
2144 docify(header);
2145 m_t << "]";
2146 m_t << "\\begin{description}\n";
2147}
2148
2150{
2151 m_t << "\\item[{\\em ";
2152}
2153
2157
2159{
2160 m_t << "} : {\\em ";
2161}
2162
2164{
2165 m_t << "}]";
2166}
2167
2171
2175
2177{
2178 m_t << "\\end{description}\n";
2179 m_t << "\\end{Desc}\n";
2180}
2181
2183{
2184 if (Config_getBool(COMPACT_LATEX))
2185 {
2186 m_t << "\\doxyparagraph*{";
2187 }
2188 else
2189 {
2190 m_t << "\\doxy" << QCString("sub").repeat(m_hierarchyLevel + 1) << "section*{";
2191 }
2192}
2193
2195{
2196 m_t << "}\n";
2197}
2198
2200{
2201 if (m_codeGen->insideTabbing())
2202 {
2203 m_t << "\\\\\n";
2204 }
2205 else
2206 {
2207 m_t << "\\newline\n";
2208 }
2209}
2210
2212{
2213 m_codeGen->incUsedTableLevel();
2214 if (isEnum)
2215 {
2216 m_t << "\\begin{DoxyEnumFields}{";
2217 docify(theTranslator->trEnumerationValues());
2218 }
2219 else
2220 {
2221 m_t << "\\begin{DoxyFields}{";
2222 docify(theTranslator->trCompoundMembers());
2223 }
2224 m_t << "}\n";
2225 m_insideTableEnv=true;
2226}
2227
2229{
2230 m_insideTableEnv=false;
2231 m_codeGen->decUsedTableLevel();
2232 if (isEnum)
2233 {
2234 m_t << "\\end{DoxyEnumFields}\n";
2235 }
2236 else
2237 {
2238 m_t << "\\end{DoxyFields}\n";
2239 }
2240}
2241
2243{
2244 m_codeGen->setInsideTabbing(true); // to prevent \+ from causing unwanted breaks
2245}
2246
2248{
2249 m_t << "&\n";
2250 m_codeGen->setInsideTabbing(false);
2251}
2252
2254{
2255 m_codeGen->setInsideTabbing(true); // to prevent \+ from causing unwanted breaks
2256}
2257
2259{
2260 m_t << "&\n";
2261 m_codeGen->setInsideTabbing(false);
2262}
2263
2267
2269{
2270 m_t << "\\\\\n\\hline\n\n";
2271}
2272
2274{
2275 m_t << "\\hspace{0.3cm}";
2276}
2277
2278void LatexGenerator::writeLabel(const QCString &l,bool isLast)
2279{
2280 m_t << "{\\ttfamily [" << l << "]}";
2281 if (!isLast) m_t << ", ";
2282}
2283
2285{
2286}
2287
2289 const QCString &/*id*/,const QCString &ref,
2290 const QCString &file, const QCString &anchor,
2291 const QCString &title, const QCString &name)
2292{
2293 if (Config_getBool(COMPACT_LATEX))
2294 {
2295 m_t << "\\doxyparagraph*{";
2296 }
2297 else
2298 {
2299 m_t << "\\doxy" << QCString("sub").repeat(m_hierarchyLevel + 1) << "section*{";
2300 }
2301 m_t << theTranslator->trInheritedFrom(convertToLaTeX(title,m_codeGen->insideTabbing()),
2302 objectLinkToString(ref, file, anchor, name, m_codeGen->insideTabbing(), m_disableLinks));
2303 m_t << "}\n";
2304}
2305
2307{
2308 int maxLevel = level + m_hierarchyLevel;
2309 m_t << "\\etocsetnexttocdepth{" << maxLevel << "}\n";
2310 m_t << "\\localtableofcontents\n";
2311}
2312
2313//--------------------------------------------------------------------------------------------------
2314
2316{
2317 // User-specified packages
2318 const StringVector &extraPackages = Config_getList(EXTRA_PACKAGES);
2319 if (!extraPackages.empty())
2320 {
2321 t << "% Packages requested by user\n";
2322 for (const auto &pkgName : extraPackages)
2323 {
2324 if ((pkgName[0] == '[') || (pkgName[0] == '{'))
2325 t << "\\usepackage" << pkgName << "\n";
2326 else
2327 t << "\\usepackage{" << pkgName << "}\n";
2328 }
2329 t << "\n";
2330 }
2331}
2332
2334{
2335 unsigned char minus[4]; // Superscript minus
2336 unsigned char sup2[3]; // Superscript two
2337 unsigned char sup3[3];
2338 minus[0]= 0xE2;
2339 minus[1]= 0x81;
2340 minus[2]= 0xBB;
2341 minus[3]= 0;
2342 sup2[0]= 0xC2;
2343 sup2[1]= 0xB2;
2344 sup2[2]= 0;
2345 sup3[0]= 0xC2;
2346 sup3[1]= 0xB3;
2347 sup3[2]= 0;
2348
2349 t << "\\ifPDFTeX\n";
2350 t << "\\usepackage{newunicodechar}\n";
2351 // taken from the newunicodechar package and removed the warning message
2352 // actually forcing to redefine the unicode character
2353 t << " \\makeatletter\n"
2354 " \\def\\doxynewunicodechar#1#2{%\n"
2355 " \\@tempswafalse\n"
2356 " \\edef\\nuc@tempa{\\detokenize{#1}}%\n"
2357 " \\if\\relax\\nuc@tempa\\relax\n"
2358 " \\nuc@emptyargerr\n"
2359 " \\else\n"
2360 " \\edef\\@tempb{\\expandafter\\@car\\nuc@tempa\\@nil}%\n"
2361 " \\nuc@check\n"
2362 " \\if@tempswa\n"
2363 " \\@namedef{u8:\\nuc@tempa}{#2}%\n"
2364 " \\fi\n"
2365 " \\fi\n"
2366 " }\n"
2367 " \\makeatother\n";
2368
2369 t << " \\doxynewunicodechar{" << minus << "}{${}^{-}$}% Superscript minus\n"
2370 " \\doxynewunicodechar{" << sup2 << "}{${}^{2}$}% Superscript two\n"
2371 " \\doxynewunicodechar{" << sup3 << "}{${}^{3}$}% Superscript three\n"
2372 "\n";
2373 t << "\\fi\n";
2374}
2375
2377 bool insideTabbing,bool insidePre,bool insideItem,bool insideTable,bool keepSpaces, const bool retainNewline)
2378{
2379 if (str.isEmpty()) return;
2380 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
2381 //printf("filterLatexString(%s) insideTabbing=%d\n",qPrint(str),insideTabbing);
2382 const char *p = str.data();
2383 const char *q = nullptr;
2384 unsigned char pc='\0';
2385
2386 while (*p)
2387 {
2388 unsigned char c=static_cast<unsigned char>(*p++);
2389
2390 if (insidePre)
2391 {
2392 switch(c)
2393 {
2394 case 0xef: // handle U+FFFD i.e. "Replacement character" caused by octal: 357 277 275 / hexadecimal 0xef 0xbf 0xbd
2395 // the LaTeX command \ucr has been defined in doxygen.sty
2396 if (static_cast<unsigned char>(*(p)) == 0xbf && static_cast<unsigned char>(*(p+1)) == 0xbd)
2397 {
2398 t << "{\\ucr}";
2399 p += 2;
2400 }
2401 else
2402 t << static_cast<char>(c);
2403 break;
2404 case '\\': t << "\\(\\backslash\\)"; break;
2405 case '{': t << "\\{"; break;
2406 case '}': t << "\\}"; break;
2407 case '_': t << "\\_"; break;
2408 case '&': t << "\\&"; break;
2409 case '%': t << "\\%"; break;
2410 case '#': t << "\\#"; break;
2411 case '$': t << "\\$"; break;
2412 case '"': t << "\"{}"; break;
2413 case '-': t << "-\\/"; break;
2414 case '^': insideTable ? t << "\\string^" : t << static_cast<char>(c); break;
2415 case '~': t << "\\string~"; break;
2416 case '\n': if (retainNewline) t << "\\newline"; else t << ' ';
2417 break;
2418 case ' ': if (keepSpaces) t << "~"; else t << ' ';
2419 break;
2420 default:
2421 if (c<32) t << ' '; // non printable control character
2422 else t << static_cast<char>(c);
2423 break;
2424 }
2425 }
2426 else
2427 {
2428 switch(c)
2429 {
2430 case 0xef: // handle U+FFFD i.e. "Replacement character" caused by octal: 357 277 275 / hexadecimal 0xef 0xbf 0xbd
2431 // the LaTeX command \ucr has been defined in doxygen.sty
2432 if (static_cast<unsigned char>(*(p)) == 0xbf && static_cast<unsigned char>(*(p+1)) == 0xbd)
2433 {
2434 t << "{\\ucr}";
2435 p += 2;
2436 }
2437 else
2438 t << static_cast<char>(c);
2439 break;
2440 case '#': t << "\\#"; break;
2441 case '$': t << "\\$"; break;
2442 case '%': t << "\\%"; break;
2443 case '^': processEntity(t,pdfHyperlinks,"$^\\wedge$","\\string^"); break;
2444 case '&': {
2445 // possibility to have a special symbol
2446 q = p;
2447 int cnt = 2; // we have to count & and ; as well
2448 while ((*q >= 'a' && *q <= 'z') || (*q >= 'A' && *q <= 'Z') || (*q >= '0' && *q <= '9'))
2449 {
2450 cnt++;
2451 q++;
2452 }
2453 if (*q == ';')
2454 {
2455 --p; // we need & as well
2458 {
2459 p++;
2460 t << "\\&";
2461 }
2462 else
2463 {
2465 q++;
2466 p = q;
2467 }
2468 }
2469 else
2470 {
2471 t << "\\&";
2472 }
2473 }
2474 break;
2475 case '*': processEntity(t,pdfHyperlinks,"$\\ast$","*"); break;
2476 case '_': if (!insideTabbing) t << "\\+";
2477 t << "\\_";
2478 if (!insideTabbing) t << "\\+";
2479 break;
2480 case '{': t << "\\{"; break;
2481 case '}': t << "\\}"; break;
2482 case '<': t << "$<$"; break;
2483 case '>': t << "$>$"; break;
2484 case '|': processEntity(t,pdfHyperlinks,"$\\vert$","|"); break;
2485 case '~': processEntity(t,pdfHyperlinks,"$\\sim$","\\string~"); break;
2486 case '[': if (Config_getBool(PDF_HYPERLINKS) || insideItem)
2487 t << "\\mbox{[}";
2488 else
2489 t << "[";
2490 break;
2491 case ']': if (pc=='[') t << "$\\,$";
2492 if (Config_getBool(PDF_HYPERLINKS) || insideItem)
2493 t << "\\mbox{]}";
2494 else
2495 t << "]";
2496 break;
2497 case '-': t << "-\\/";
2498 break;
2499 case '\\': t << "\\textbackslash{}";
2500 break;
2501 case '"': t << "\"{}";
2502 break;
2503 case '`': t << "\\`{}";
2504 break;
2505 case '\'': t << "\\textquotesingle{}";
2506 break;
2507 case '\n': if (retainNewline)
2508 {
2509 t << "\\newline";
2510 if (insideTable) t << " ";
2511 }
2512 else
2513 {
2514 t << ' ';
2515 }
2516 break;
2517 case ' ': if (keepSpaces) { if (insideTabbing) t << "\\>"; else t << '~'; } else t << ' ';
2518 break;
2519
2520 default:
2521 //if (!insideTabbing && forceBreaks && c!=' ' && *p!=' ')
2522 if (!insideTabbing &&
2523 ((c>='A' && c<='Z' && pc!=' ' && !(pc>='A' && pc <= 'Z') && pc!='\0' && *p) || (c==':' && pc!=':') || (pc=='.' && isId(c)))
2524 )
2525 {
2526 t << "\\+";
2527 }
2528 if (c<32)
2529 {
2530 t << ' '; // non-printable control character
2531 }
2532 else
2533 {
2534 t << static_cast<char>(c);
2535 }
2536 }
2537 }
2538 pc = c;
2539 }
2540}
2541
2542QCString convertToLaTeX(const QCString &s,bool insideTabbing,bool keepSpaces)
2543{
2544 TextStream t;
2545 filterLatexString(t,s,insideTabbing,false,false,false,keepSpaces);
2546 return t.str();
2547}
2548
2550{
2551 //printf("latexEscapeLabelName(%s)\n",qPrint(s));
2552 if (s.isEmpty()) return s;
2554 TextStream t;
2555 const char *p=s.data();
2556 char c = 0;
2557 while ((c=*p++))
2558 {
2559 switch (c)
2560 {
2561 case '|': t << "\\texttt{\"|}"; break;
2562 case '!': t << "\"!"; break;
2563 case '@': t << "\"@"; break;
2564 case '%': t << "\\%"; break;
2565 case '{': t << "\\lcurly{}"; break;
2566 case '}': t << "\\rcurly{}"; break;
2567 case '~': t << "````~"; break; // to get it a bit better in index together with other special characters
2568 // NOTE: adding a case here, means adding it to while below as well!
2569 default:
2570 {
2571 int i=0;
2572 // collect as long string as possible, before handing it to docify
2573 tmp[i++]=c;
2574 while ((c=*p) && c!='@' && c!='[' && c!=']' && c!='!' && c!='{' && c!='}' && c!='|')
2575 {
2576 tmp[i++]=c;
2577 p++;
2578 }
2579 tmp[i]=0;
2580 filterLatexString(t,tmp,
2581 true, // insideTabbing
2582 false, // insidePre
2583 false, // insideItem
2584 false, // insideTable
2585 false // keepSpaces
2586 );
2587 }
2588 break;
2589 }
2590 }
2591 return t.str();
2592}
2593
2595{
2596 //printf("latexEscapeIndexChars(%s)\n",qPrint(s));
2597 if (s.isEmpty()) return s;
2599 TextStream t;
2600 const char *p=s.data();
2601 char c = 0;
2602 while ((c=*p++))
2603 {
2604 switch (c)
2605 {
2606 case '!': t << "\"!"; break;
2607 case '"': t << "\"\""; break;
2608 case '@': t << "\"@"; break;
2609 case '|': t << "\\texttt{\"|}"; break;
2610 case '[': t << "["; break;
2611 case ']': t << "]"; break;
2612 case '{': t << "\\lcurly{}"; break;
2613 case '}': t << "\\rcurly{}"; break;
2614 // NOTE: adding a case here, means adding it to while below as well!
2615 default:
2616 {
2617 int i=0;
2618 // collect as long string as possible, before handing it to docify
2619 tmp[i++]=c;
2620 while ((c=*p) && c!='"' && c!='@' && c!='[' && c!=']' && c!='!' && c!='{' && c!='}' && c!='|')
2621 {
2622 tmp[i++]=c;
2623 p++;
2624 }
2625 tmp[i]=0;
2626 filterLatexString(t,tmp,
2627 true, // insideTabbing
2628 false, // insidePre
2629 false, // insideItem
2630 false, // insideTable
2631 false // keepSpaces
2632 );
2633 }
2634 break;
2635 }
2636 }
2637 return t.str();
2638}
2639
2641{
2642 if (s.isEmpty()) return s;
2643 TextStream t;
2644 const char *p=s.data();
2645 char c = 0;
2646 while ((c=*p++))
2647 {
2648 switch (c)
2649 {
2650 case '\\': t << "\\textbackslash{}"; break;
2651 case '{': t << "\\{"; break;
2652 case '}': t << "\\}"; break;
2653 case '_': t << "\\_"; break;
2654 case '%': t << "\\%"; break;
2655 case '&': t << "\\&"; break;
2656 case '#': t << "\\#"; break;
2657 case '$': t << "\\$"; break;
2658 case '^': t << "\\string^"; break;
2659 case '~': t << "\\string~"; break;
2660 default:
2661 t << c;
2662 break;
2663 }
2664 }
2665 return t.str();
2666}
2667
2669{
2670 constexpr auto hex = "0123456789ABCDEF";
2671 if (s.isEmpty()) return s;
2672 TextStream t;
2673 const char *p=s.data();
2674 char c = 0;
2675 while ((c=*p++))
2676 {
2677 switch (c)
2678 {
2679 case '#': t << "\\#"; break;
2680 case '%': t << "\\%"; break;
2681 case '\\': t << "\\\\"; break;
2682 default:
2683 if (c<0)
2684 {
2685 unsigned char id = static_cast<unsigned char>(c);
2686 t << "\\%" << hex[id>>4] << hex[id&0xF];
2687 }
2688 else
2689 {
2690 t << c;
2691 }
2692 break;
2693 }
2694 }
2695 return t.str();
2696}
2697
2698
constexpr auto prefix
Definition anchor.cpp:44
QCString latexBibFiles()
lists the bibtex cite files in a comma separated list
Definition cite.cpp:576
static CitationManager & instance()
Definition cite.cpp:86
bool isEmpty() const
return TRUE if there are no citations.
Definition cite.cpp:116
Class representing a built-in class diagram.
Definition diagram.h:31
void writeFigure(TextStream &t, const QCString &path, const QCString &file) const
Definition diagram.cpp:1066
The common base class of all entity definitions found in the sources.
Definition definition.h:76
virtual QCString 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:1466
DocNodeVariant root
Definition docnode.h:1491
Representation of an call graph.
QCString writeGraph(TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const QCString &path, const QCString &fileName, const QCString &relPath, bool writeImageMap=TRUE, int graphId=-1)
Representation of a class inheritance or dependency graph.
QCString writeGraph(TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const QCString &path, const QCString &fileName, const QCString &relPath, bool TBRank=TRUE, bool imageMap=TRUE, int graphId=-1)
Representation of an directory dependency graph.
Definition dotdirdeps.h:26
QCString writeGraph(TextStream &out, GraphOutputFormat gf, EmbeddedOutputFormat ef, const QCString &path, const QCString &fileName, const QCString &relPath, bool writeImageMap=TRUE, int graphId=-1, bool linkRelations=TRUE)
Representation of a group collaboration graph.
QCString writeGraph(TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const QCString &path, const QCString &fileName, const QCString &relPath, bool writeImageMap=TRUE, int graphId=-1)
Representation of an include dependency graph.
QCString writeGraph(TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const QCString &path, const QCString &fileName, const QCString &relPath, bool writeImageMap=TRUE, int graphId=-1)
static NamespaceLinkedMap * namespaceLinkedMap
Definition doxygen.h:115
static ConceptLinkedMap * conceptLinkedMap
Definition doxygen.h:98
static std::unique_ptr< PageDef > mainPage
Definition doxygen.h:101
static FileNameLinkedMap * inputNameLinkedMap
Definition doxygen.h:105
static ClassLinkedMap * classLinkedMap
Definition doxygen.h:96
static PageLinkedMap * exampleLinkedMap
Definition doxygen.h:99
static PageLinkedMap * pageLinkedMap
Definition doxygen.h:100
static DirLinkedMap * dirLinkedMap
Definition doxygen.h:129
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.
static HtmlEntityMapper & instance()
Returns the one and only instance of the HTML entity mapper.
SymType name2sym(const QCString &symName) const
Give code of the requested HTML entity name.
opaque representation of the abstract syntax tree (AST)
Definition docparser.h:50
Generator for LaTeX code fragments.
Definition latexgen.h:28
bool m_stripCodeComments
Definition latexgen.h:87
TextStream * m_t
Definition latexgen.h:80
void setStripIndentAmount(size_t amount) override
Definition latexgen.cpp:191
void endFontClass() override
Definition latexgen.cpp:297
void writeLineNumber(const QCString &, const QCString &, const QCString &, int, bool) override
Definition latexgen.cpp:222
void setSourceFileName(const QCString &sourceFileName)
Definition latexgen.cpp:73
void setRelativePath(const QCString &path)
Definition latexgen.cpp:68
void startFontClass(const QCString &) override
Definition latexgen.cpp:291
void endSpecialComment() override
Definition latexgen.cpp:186
void stripCodeComments(bool b) override
Definition latexgen.cpp:176
void startCodeFragment(const QCString &style) override
Definition latexgen.cpp:303
size_t m_stripIndentAmount
Definition latexgen.h:89
void startCodeLine(int) override
Definition latexgen.cpp:269
LatexCodeGenerator(TextStream *t, const QCString &relPath, const QCString &sourceFile)
Definition latexgen.cpp:59
void startSpecialComment() override
Definition latexgen.cpp:181
void endCodeFragment(const QCString &style) override
Definition latexgen.cpp:308
QCString m_sourceFileName
Definition latexgen.h:82
void codify(const QCString &text) override
Definition latexgen.cpp:78
void endCodeLine() override
Definition latexgen.cpp:280
QCString m_relPath
Definition latexgen.h:81
void writeCodeLink(CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip) override
Definition latexgen.cpp:196
bool m_doxyCodeLineOpen
Definition latexgen.h:84
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 startProjectNumber() override
Definition latexgen.cpp:734
void cleanup() override
Definition latexgen.cpp:679
void endPageRef(const QCString &, const QCString &) override
void endSection(const QCString &, SectionType) override
void startIndexSection(IndexSection) override
Definition latexgen.cpp:920
void endParameterList() override
void endMemberDescription() override
std::unique_ptr< OutputCodeList > m_codeList
Definition latexgen.h:326
void endDirDepGraph(DotDirDeps &g) override
void endDescTable() override
void startParameterType(bool, const QCString &) override
void startMemberGroup() override
void endInlineHeader() override
void endGroupHeader(int) override
void startMemberDoc(const QCString &, const QCString &, const QCString &, const QCString &, int, int, bool) override
void writeChar(char c) override
void endDescTableInit() override
void startParameterName(bool) override
void endMemberTemplateParams(const QCString &, const QCString &) override
void endParameterType() override
void startPageRef() override
void writeInheritedSectionTitle(const QCString &, const QCString &, const QCString &, const QCString &, const QCString &, const QCString &) override
void endLabels() override
void startParagraph(const QCString &classDef) override
void endIndexSection(IndexSection) override
void startConstraintType() override
void startClassDiagram() override
void endInlineMemberType() override
void startDescTableTitle() override
void startSection(const QCString &, const QCString &, SectionType) override
void writeString(const QCString &text) override
void endInclDepGraph(DotInclDepGraph &) override
void writeNonBreakableSpace(int) override
void startMemberGroupDocs() override
void endDescTableTitle() override
void startInclDepGraph() override
void lastIndexPage() override
void endExamples() override
void startLocalToc(int level) override
void startFile(const QCString &name, bool isSource, const QCString &manName, const QCString &title, int id, int hierarchyLevel) override
Definition latexgen.cpp:709
void endMemberGroupHeader() override
void docify(const QCString &text) override
void startAnonTypeScope(int) override
void endPlainFile() override
Definition latexgen.h:317
void startDoxyAnchor(const QCString &, const QCString &, const QCString &, const QCString &, const QCString &) 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
QCString m_relPath
Definition latexgen.h:323
void startMemberHeader(const QCString &, int) override
void endConstraintList() override
void startDotGraph() override
void endParameterExtra(bool last, bool one, bool bracket) override
void endDescTableData() override
void writeLabel(const QCString &l, bool isLast) override
void startTextLink(const QCString &, const QCString &) override
void startConstraintList(const QCString &) override
void startGroupCollaboration() override
void startLabels() override
static void writeStyleSheetFile(TextStream &t)
Definition latexgen.cpp:703
void endTitleHead(const QCString &, const QCString &name) override
void endMemberHeader() override
OutputType type() const override
Definition latexgen.h:111
void endIndexItem(const QCString &ref, const QCString &file) override
void startGroupHeader(const QCString &, int) override
void startDescTable(const QCString &title, const bool hasInits) override
void endConstraintDocs() override
void startIndexKey() override
void startConstraintParam() override
void lineBreak(const QCString &style=QCString()) override
void endInlineMemberName() override
void startMemberTemplateParams() override
void startInlineMemberType() override
int m_hierarchyLevel
Definition latexgen.h:329
void startInlineMemberDoc() override
void writeAnchor(const QCString &fileName, const QCString &name) override
void startCallGraph() override
void endMemberList() override
void endFile() override
Definition latexgen.cpp:723
void startExamples() override
LatexGenerator & operator=(const LatexGenerator &)
Definition latexgen.cpp:342
void startDirDepGraph() override
void endTextLink() override
void writeStartAnnoItem(const QCString &type, const QCString &file, const QCString &path, const QCString &name) override
void startMemberList() override
void startDescTableData() override
void endDescTableRow() override
void startConstraintDocs() override
void endMemberGroupDocs() override
void endClassDiagram(const ClassDiagram &, const QCString &, const QCString &) override
void startDescTableInit() override
void endMemberDocSimple(bool) override
void addIndexItem(const QCString &, const QCString &) override
void endParameterName() override
void endIndexValue(const QCString &, bool) override
void writeObjectLink(const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name) override
void startMemberDocSimple(bool) override
void startPlainFile(const QCString &name) override
Definition latexgen.h:316
void exceptionEntry(const QCString &, bool) override
void endCallGraph(DotCallGraph &) override
void endGroupCollaboration(DotGroupCollaboration &g) override
void startIndexItem(const QCString &ref, const QCString &file) override
bool m_disableLinks
Definition latexgen.h:322
void startTitleHead(const QCString &) override
void startInlineHeader() override
void endConstraintParam() override
void endDotGraph(DotClassGraph &) override
void writePageLink(const QCString &, bool) override
void startParameterExtra() override
LatexCodeGenerator * m_codeGen
Definition latexgen.h:327
void endMemberGroup(bool) override
void startMemberGroupHeader(const QCString &, bool) override
void startMemberDescription(const QCString &, const QCString &, bool) override
void startMemberItem(const QCString &, MemberItemType, const QCString &) override
bool m_firstDescItem
Definition latexgen.h:321
static void writeHeaderFile(TextStream &t)
Definition latexgen.cpp:691
void endParagraph() override
void addLabel(const QCString &, const QCString &) override
bool m_insideTableEnv
Definition latexgen.h:328
void writeStyleInfo(int part) override
void endDoxyAnchor(const QCString &, const QCString &) override
void startIndexValue(bool) override
void startInlineMemberName() override
void writeDoc(const IDocNodeAST *node, const Definition *ctx, const MemberDef *, int id, int sectionLevel) override
static void init()
Definition latexgen.cpp:633
bool m_templateMemberItem
Definition latexgen.h:325
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:165
void add(OutputCodeIntfPtr &&p)
Definition outputlist.h:195
Abstract interface for output generators.
Definition outputgen.h:127
QCString dir() const
Definition outputgen.cpp:52
QCString m_dir
Definition outputgen.h:117
TextStream m_t
Definition outputgen.h:116
QCString fileName() const
Definition outputgen.cpp:57
This is an alternative implementation of QCString.
Definition qcstring.h:101
QCString & prepend(const char *s)
Definition qcstring.h:422
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:166
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:163
QCString repeat(unsigned int n) const
Definition qcstring.h:321
const std::string & str() const
Definition qcstring.h:552
QCString & sprintf(const char *format,...)
Definition qcstring.cpp:29
@ ExplicitSize
Definition qcstring.h:146
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:172
QCString quoted() const
Definition qcstring.h:275
static ResourceMgr & instance()
Returns the one and only instance of this class.
QCString getAsString(const QCString &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
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:229
#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
QCString dateToString(DateTimeType includeTime)
Returns the current date, when includeTime is set also the time is provided.
Definition datetime.cpp:63
QCString yearToString()
Returns the current year as a string.
Definition datetime.cpp:76
static constexpr auto hex
static QCString objectLinkToString(const QCString &, const QCString &f, const QCString &anchor, const QCString &text)
bool insideTable(const DocNodeVariant *n)
#define THREAD_LOCAL
Definition doxygen.h:30
static QCString g_header
Definition htmlgen.cpp:64
static QCString g_header_file
Definition htmlgen.cpp:65
static QCString g_footer
Definition htmlgen.cpp:67
static QCString g_footer_file
Definition htmlgen.cpp:66
static void writeDefaultStyleSheet(TextStream &t)
Definition htmlgen.cpp:1408
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 QCString latex_batchmode()
Definition latexgen.cpp:786
QCString latexEscapePDFString(const QCString &s)
QCString convertToLaTeX(const QCString &s, bool insideTabbing, bool keepSpaces)
static QCString makeIndex()
Definition latexgen.cpp:768
QCString latexFilterURL(const QCString &s)
static void writeLatexMakefile()
Definition latexgen.cpp:367
static const SelectionMarkerInfo latexMarkerInfo
Definition latexgen.cpp:55
static QCString extraLatexStyleSheet()
Definition latexgen.cpp:739
void filterLatexString(TextStream &t, const QCString &str, bool insideTabbing, bool insidePre, bool insideItem, bool insideTable, bool keepSpaces, const bool retainNewline)
#define COPYCHAR()
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 writeExtraLatexPackages(TextStream &t)
static QCString substituteLatexKeywords(const QCString &file, const QCString &str, const QCString &title)
Definition latexgen.cpp:800
QCString latexEscapeIndexChars(const QCString &s)
static QCString objectLinkToString(const QCString &ref, const QCString &f, const QCString &anchor, const QCString &text, bool insideTabbing, bool disableLinks)
void writeLatexSpecialFormulaChars(TextStream &t)
QCString latexEscapeLabelName(const QCString &s)
QCString latexEscapePDFString(const QCString &s)
void filterLatexString(TextStream &t, const QCString &str, bool insideTabbing, bool insidePre, bool insideItem, bool insideTable, bool keepSpaces, const bool retainNewline=false)
#define LATEX_STYLE_EXTENSION
Definition latexgen.h:22
QCString convertToLaTeX(const QCString &s, bool insideTabbing, bool keepSpaces=FALSE)
QCString latexEscapeIndexChars(const QCString &s)
QCString latexEscapeLabelName(const QCString &s)
#define term(fmt,...)
Definition message.h:137
std::ofstream openOutputStream(const QCString &name, bool append=false)
Definition portable.cpp:649
const char * ghostScriptCommand()
Definition portable.cpp:438
OutputCodeDefer< LatexCodeGenerator > LatexCodeGeneratorDefer
Definition outputlist.h:103
Portable versions of functions that are platform dependent.
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition qcstring.cpp:482
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
#define ASSERT(x)
Definition qcstring.h:39
CodeSymbolType
Definition types.h:481
Various UTF8 related helper functions.
size_t updateColumnCount(const char *s, size_t col)
Definition util.cpp:6810
void checkBlocks(const QCString &s, const QCString fileName, const SelectionMarkerInfo &markerInfo)
Definition util.cpp:6452
QCString stripPath(const QCString &s)
Definition util.cpp:4870
QCString removeEmptyLines(const QCString &s)
Definition util.cpp:6516
QCString selectBlocks(const QCString &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:6339
QCString substituteKeywords(const QCString &file, const QCString &s, const KeywordSubstitutionList &keywords)
Definition util.cpp:2990
QCString relativePathToRoot(const QCString &name)
Definition util.cpp:3509
void clearSubDirs(const Dir &d)
Definition util.cpp:3597
QCString fileToString(const QCString &name, bool filter, bool isSourceCode)
Definition util.cpp:1432
QCString stripExtensionGeneral(const QCString &fName, const QCString &ext)
Definition util.cpp:4855
void createSubDirs(const Dir &d)
Definition util.cpp:3570
bool checkExtension(const QCString &fName, const QCString &ext)
Definition util.cpp:4838
bool copyFile(const QCString &src, const QCString &dest)
Copies the contents of file with name src to the newly created file with name dest.
Definition util.cpp:5789
A bunch of utility functions.
bool isId(int c)
Definition util.h:208