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,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
1504{
1505 if (Config_getBool(COMPACT_LATEX))
1506 {
1507 m_t << "\\doxysubsection{";
1508 }
1509 else
1510 {
1511 m_t << "\\doxysection{";
1512 }
1513}
1514
1515void LatexGenerator::startGroupHeader(const QCString &,int extraIndentLevel)
1516{
1517 if (Config_getBool(COMPACT_LATEX))
1518 {
1519 extraIndentLevel++;
1520 }
1521
1522 if (extraIndentLevel>=3)
1523 {
1524 m_t << "\\doxysubparagraph*{";
1525 }
1526 else if (extraIndentLevel==2)
1527 {
1528 m_t << "\\doxyparagraph{";
1529 }
1530 else
1531 {
1532 extraIndentLevel += m_hierarchyLevel + 1;
1533 m_t << "\\doxy" << QCString("sub").repeat(extraIndentLevel) << "section{";
1534 }
1536}
1537
1539{
1541 m_t << "}\n";
1542}
1543
1545{
1546 int l = m_hierarchyLevel + 1;
1547 if (Config_getBool(COMPACT_LATEX))
1548 {
1549 ++l;
1550 }
1551
1552 m_t << "\\doxysub" << QCString("sub").repeat(l) << "section*{";
1554}
1555
1557{
1559 m_t << "}\n";
1560}
1561
1563 const QCString &memname,
1564 const QCString &,
1565 const QCString &title,
1566 int memCount,
1567 int memTotal,
1568 bool showInline)
1569{
1570 if (!memname.isEmpty() && memname[0]!='@')
1571 {
1572 m_t << "\\index{";
1573 if (!clname.isEmpty())
1574 {
1575 m_t << latexEscapeLabelName(clname);
1576 m_t << "@{";
1577 m_t << latexEscapeIndexChars(clname);
1578 m_t << "}!";
1579 }
1580 m_t << latexEscapeLabelName(memname);
1581 m_t << "@{";
1582 m_t << latexEscapeIndexChars(memname);
1583 m_t << "}}\n";
1584
1585 m_t << "\\index{";
1586 m_t << latexEscapeLabelName(memname);
1587 m_t << "@{";
1588 m_t << latexEscapeIndexChars(memname);
1589 m_t << "}";
1590 if (!clname.isEmpty())
1591 {
1592 m_t << "!";
1593 m_t << latexEscapeLabelName(clname);
1594 m_t << "@{";
1595 m_t << latexEscapeIndexChars(clname);
1596 m_t << "}";
1597 }
1598 m_t << "}\n";
1599 }
1600 bool compactLatex = Config_getBool(COMPACT_LATEX);
1601 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1602 if (showInline)
1603 {
1604 m_t << "\\doxysubparagraph";
1605 }
1606 else if (compactLatex)
1607 {
1608 m_t << "\\doxyparagraph";
1609 }
1610 else
1611 {
1612 m_t << "\\doxy" << QCString("sub").repeat(m_hierarchyLevel + 2) << "section";
1613 }
1614
1615 m_t << "{";
1616 if (pdfHyperlinks)
1617 {
1618 m_t << "\\texorpdfstring{";
1619 }
1620 m_t << latexEscapeIndexChars(title);
1621 if (pdfHyperlinks)
1622 {
1623 m_t << "}{" << latexEscapePDFString(title) << "}";
1624 }
1625 if (memTotal>1)
1626 {
1627 m_t << "\\hspace{0.1cm}{\\footnotesize\\ttfamily [" << memCount << "/" << memTotal << "]}";
1628 }
1629 m_t << "}";
1630 m_t << "\n{\\footnotesize\\ttfamily ";
1631 //m_disableLinks=TRUE;
1632}
1633
1635{
1637 m_t << "}\n\n";
1638 //if (Config_getBool(COMPACT_LATEX)) m_t << "\\hfill";
1639}
1640
1642 const QCString &anchor, const QCString &,
1643 const QCString &)
1644{
1645 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1646 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1647 if (m_insideTableEnv) m_t << "\\mbox{"; // see issue #6093
1648 if (usePDFLatex && pdfHyperlinks)
1649 {
1650 m_t << "\\Hypertarget{";
1651 if (!fName.isEmpty()) m_t << stripPath(fName);
1652 if (!anchor.isEmpty()) m_t << "_" << anchor;
1653 m_t << "}";
1654 }
1655}
1656
1657void LatexGenerator::endDoxyAnchor(const QCString &/* fName */,const QCString &/* anchor */)
1658{
1659}
1660
1661void LatexGenerator::addLabel(const QCString &fName, const QCString &anchor)
1662{
1663 m_t << "\\label{";
1664 if (!fName.isEmpty()) m_t << stripPath(fName);
1665 if (!anchor.isEmpty()) m_t << "_" << anchor;
1666 if (m_insideTableEnv) m_t << "}";
1667 m_t << "} \n";
1668}
1669
1670void LatexGenerator::writeAnchor(const QCString &fName,const QCString &name)
1671{
1672 //printf("LatexGenerator::writeAnchor(%s,%s)\n",fName,name);
1673 m_t << "\\label{" << stripPath(name) << "}\n";
1674 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1675 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1676 if (usePDFLatex && pdfHyperlinks)
1677 {
1678 if (!fName.isEmpty())
1679 {
1680 m_t << "\\Hypertarget{" << stripPath(fName) << "_" << stripPath(name) << "}\n";
1681 }
1682 else
1683 {
1684 m_t << "\\Hypertarget{" << stripPath(name) << "}\n";
1685 }
1686 }
1687}
1688
1689
1690//void LatexGenerator::writeLatexLabel(const QCString &clName,const QCString &anchor)
1691//{
1692// writeDoxyAnchor(0,clName,anchor,0);
1693//}
1694
1696{
1697 if (!s1.isEmpty())
1698 {
1699 m_t << "\\index{";
1701 m_t << "@{";
1703 m_t << "}";
1704 if (!s2.isEmpty())
1705 {
1706 m_t << "!";
1708 m_t << "@{";
1710 m_t << "}";
1711 }
1712 m_t << "}";
1713 }
1714}
1715
1716
1718{
1719 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1720 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1721 if (usePDFLatex && pdfHyperlinks)
1722 {
1723 m_t << "\\hypertarget{" << stripPath(lab) << "}{}";
1724 }
1725 m_t << "\\";
1726 if (Config_getBool(COMPACT_LATEX))
1727 {
1728 switch(type.level())
1729 {
1730 case SectionType::Page: m_t << "doxysubsection"; break;
1731 case SectionType::Section: m_t << "doxysubsubsection"; break;
1732 case SectionType::Subsection: m_t << "doxysubsubsubsection"; break;
1733 case SectionType::Subsubsection: m_t << "doxysubsubsubsubsection"; break;
1734 case SectionType::Paragraph: m_t << "doxysubsubsubsubsubsection"; break;
1735 case SectionType::Subparagraph: m_t << "doxysubsubsubsubsubsubsection"; break;
1736 case SectionType::Subsubparagraph: m_t << "doxysubsubsubsubsubsubsection"; break;
1737 default: ASSERT(0); break;
1738 }
1739 m_t << "{";
1740 }
1741 else
1742 {
1743 switch(type.level())
1744 {
1745 case SectionType::Page: m_t << "doxysection"; break;
1746 case SectionType::Section: m_t << "doxysubsection"; break;
1747 case SectionType::Subsection: m_t << "doxysubsubsection"; break;
1748 case SectionType::Subsubsection: m_t << "doxysubsubsubsection"; break;
1749 case SectionType::Paragraph: m_t << "doxysubsubsubsubsection"; break;
1750 case SectionType::Subparagraph: m_t << "doxysubsubsubsubsubsection"; break;
1751 case SectionType::Subsubparagraph: m_t << "doxysubsubsubsubsubsubsection"; break;
1752 default: ASSERT(0); break;
1753 }
1754 m_t << "{";
1755 }
1756}
1757
1759{
1760 m_t << "}\\label{" << lab << "}\n";
1761}
1762
1763
1765{
1767 m_codeGen->insideTabbing(), // insideTabbing
1768 false, // insidePre
1769 false, // insideItem
1770 m_codeGen->usedTableLevel()>0, // insideTable
1771 false // keepSpaces
1772 );
1773}
1774
1776{
1777 char cs[2];
1778 cs[0]=c;
1779 cs[1]=0;
1780 docify(cs);
1781}
1782
1784{
1785 //if (Config_getBool(COMPACT_LATEX)) m_t << "\\doxysubsubsection"; else m_t << "\\doxysubsection";
1786 //m_t << "{";
1787}
1788
1790 const QCString &fileName,const QCString &)
1791{
1793}
1794
1795
1797{
1798 if (indent==0)
1799 {
1800 m_t << "\\begin{tabbing}\n";
1801 m_t << "xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=\\kill\n";
1802 m_codeGen->setInsideTabbing(true);
1803 }
1804 m_indent=indent;
1805}
1806
1808{
1809 if (indent==0)
1810 {
1811 m_t << "\n" << "\\end{tabbing}";
1812 m_codeGen->setInsideTabbing(false);
1813 }
1814 m_indent=indent;
1815}
1816
1818{
1820 {
1821 m_t << "{\\footnotesize ";
1822 }
1823}
1824
1826{
1828 {
1829 m_t << "}\\\\";
1830 }
1831}
1832
1834{
1835 //printf("LatexGenerator::startMemberItem(%d)\n",annType);
1836 if (!m_codeGen->insideTabbing())
1837 {
1838 m_t << "\\item \n";
1840 }
1841}
1842
1844{
1845 if (m_codeGen->insideTabbing())
1846 {
1847 m_t << "\\\\";
1848 }
1850 m_t << "\n";
1851}
1852
1854{
1855 if (!m_codeGen->insideTabbing())
1856 {
1857 m_t << "\\begin{DoxyCompactList}\\small\\item\\em ";
1858 }
1859 else
1860 {
1861 for (int i=0;i<m_indent+2;i++) m_t << "\\>";
1862 m_t << "{\\em ";
1863 }
1864}
1865
1867{
1868 if (!m_codeGen->insideTabbing())
1869 {
1870 //m_t << "\\item\\end{DoxyCompactList}";
1871 m_t << "\\end{DoxyCompactList}";
1872 }
1873 else
1874 {
1875 m_t << "}\\\\\n";
1876 }
1877}
1878
1879
1881{
1882 //printf("writeNonBreakableSpace()\n");
1883 if (m_codeGen->insideTabbing())
1884 {
1885 m_t << "\\>";
1886 }
1887 else
1888 {
1889 m_t << "~";
1890 }
1891}
1892
1893// ----------------------------------------------
1894// nesting of functions below:
1895// startDescTable()
1896// - startDescTableRow()
1897// - startDescTableTitle()
1898// - endDescTableTitle()
1899// - startDescTableData()
1900// - endDescTableData()
1901// - endDescTableRow()
1902// - startDescTableRow()
1903// - ...
1904// - endDescTableRow()
1905// endDescTable()
1906
1907void LatexGenerator::startDescTable(const QCString &title,const bool hasInits)
1908{
1909 m_codeGen->incUsedTableLevel();
1910 m_t << "\\begin{DoxyEnumFields}[" << (hasInits?3:2) << "]{" << title << "}\n";
1911}
1912
1914{
1915 m_codeGen->decUsedTableLevel();
1916 m_t << "\\end{DoxyEnumFields}\n";
1917}
1918
1920{
1921 // this is needed to prevent the \hypertarget, \label, and \index commands from messing up
1922 // the row height (based on http://tex.stackexchange.com/a/186102)
1923 m_t << "\\raisebox{\\heightof{T}}[0pt][0pt]{";
1924}
1925
1929
1931{
1932 m_t << "}";
1933}
1934
1938
1940{
1941 m_t << "&";
1942}
1943
1947
1949{
1950 m_t << "&";
1951}
1952
1954{
1955 m_t << "\\\\\n\\hline\n\n";
1956}
1957
1961
1962
1964{
1965 if (!m_codeGen->insideTabbing())
1966 {
1967 m_t << "\\begin{DoxyCompactItemize}\n";
1968 }
1969}
1970
1972{
1973 //printf("LatexGenerator::endMemberList(%d)\n",m_codeGen->InsideTabbing());
1974 if (!m_codeGen->insideTabbing())
1975 {
1976 m_t << "\\end{DoxyCompactItemize}\n";
1977 }
1978}
1979
1980
1982{
1983 if (hasHeader) m_t << "\\begin{Indent}";
1984 m_t << "\\textbf{ ";
1985 // changed back to rev 756 due to bug 660501
1986 //if (Config_getBool(COMPACT_LATEX))
1987 //{
1988 // m_t << "\\doxysubparagraph*{";
1989 //}
1990 //else
1991 //{
1992 // m_t << "\\doxyparagraph*{";
1993 //}
1994}
1995
1997{
1998 // changed back to rev 756 due to bug 660501
1999 m_t << "}\\par\n";
2000 //m_t << "}\n";
2001}
2002
2004{
2005 m_t << "{\\em ";
2006}
2007
2009{
2010 m_t << "}";
2011}
2012
2016
2018{
2019 if (hasHeader)m_t << "\\end{Indent}";
2020 m_t << "\n";
2021}
2022
2024{
2025 m_t << "\n" << "\n";
2026}
2027
2032
2036
2041
2045
2050
2054
2059
2063
2068
2070{
2071 m_t << "\\begin{Desc}\n\\item[";
2072 docify(theTranslator->trExamples());
2073 m_t << "]";
2074}
2075
2077{
2078 m_t << "\\end{Desc}\n";
2079}
2080
2082{
2083 /* start of ParameterType ParameterName list */
2084 if (openBracket) m_t << "(";
2085 m_t << "\\begin{DoxyParamCaption}";
2086}
2087
2091
2093{
2094 m_t << "\\item[{";
2095 if (!first && !key.isEmpty()) docify(key);
2096}
2097
2099{
2100 m_t << "}]";
2101}
2102
2103void LatexGenerator::startParameterName(bool /*oneArgOnly*/)
2104{
2105 m_t << "{";
2106}
2107
2109{
2110 m_t << "}";
2111}
2112
2114{
2115 m_t << "{";
2116}
2117
2118void LatexGenerator::endParameterExtra(bool last,bool /*emptyList*/,bool closeBracket)
2119{
2120 m_t << "}";
2121 if (last)
2122 {
2123 m_t << "\\end{DoxyParamCaption}";
2124 if (closeBracket) m_t << ")";
2125 }
2126}
2127
2128void LatexGenerator::exceptionEntry(const QCString &prefix,bool closeBracket)
2129{
2130 if (!prefix.isEmpty())
2131 {
2132 m_t << " " << prefix << "(";
2133 }
2134 else if (closeBracket)
2135 {
2136 m_t << ")";
2137 }
2138 m_t << " ";
2139}
2140
2141void LatexGenerator::writeDoc(const IDocNodeAST *ast,const Definition *ctx,const MemberDef *,int)
2142{
2143 const DocNodeAST *astImpl = dynamic_cast<const DocNodeAST*>(ast);
2144 if (astImpl)
2145 {
2147 ctx?ctx->getDefFileExtension():QCString(""),
2149 std::visit(visitor,astImpl->root);
2150 }
2151}
2152
2154{
2155 m_t << "\\begin{Desc}\n\\item[";
2156 docify(header);
2157 m_t << "]";
2158 m_t << "\\begin{description}\n";
2159}
2160
2162{
2163 m_t << "\\item[{\\em ";
2164}
2165
2169
2171{
2172 m_t << "} : {\\em ";
2173}
2174
2176{
2177 m_t << "}]";
2178}
2179
2183
2187
2189{
2190 m_t << "\\end{description}\n";
2191 m_t << "\\end{Desc}\n";
2192}
2193
2195{
2196 if (Config_getBool(COMPACT_LATEX))
2197 {
2198 m_t << "\\doxyparagraph*{";
2199 }
2200 else
2201 {
2202 m_t << "\\doxy" << QCString("sub").repeat(m_hierarchyLevel + 1) << "section*{";
2203 }
2204}
2205
2207{
2208 m_t << "}\n";
2209}
2210
2212{
2213 if (m_codeGen->insideTabbing())
2214 {
2215 m_t << "\\\\\n";
2216 }
2217 else
2218 {
2219 m_t << "\\newline\n";
2220 }
2221}
2222
2224{
2225 m_codeGen->incUsedTableLevel();
2226 if (isEnum)
2227 {
2228 m_t << "\\begin{DoxyEnumFields}{";
2229 docify(theTranslator->trEnumerationValues());
2230 }
2231 else
2232 {
2233 m_t << "\\begin{DoxyFields}{";
2234 docify(theTranslator->trCompoundMembers());
2235 }
2236 m_t << "}\n";
2237 m_insideTableEnv=true;
2238}
2239
2241{
2242 m_insideTableEnv=false;
2243 m_codeGen->decUsedTableLevel();
2244 if (isEnum)
2245 {
2246 m_t << "\\end{DoxyEnumFields}\n";
2247 }
2248 else
2249 {
2250 m_t << "\\end{DoxyFields}\n";
2251 }
2252}
2253
2255{
2256 m_codeGen->setInsideTabbing(true); // to prevent \+ from causing unwanted breaks
2257}
2258
2260{
2261 m_t << "&\n";
2262 m_codeGen->setInsideTabbing(false);
2263}
2264
2266{
2267 m_codeGen->setInsideTabbing(true); // to prevent \+ from causing unwanted breaks
2268}
2269
2271{
2272 m_t << "&\n";
2273 m_codeGen->setInsideTabbing(false);
2274}
2275
2279
2281{
2282 m_t << "\\\\\n\\hline\n\n";
2283}
2284
2286{
2287 m_t << "\\hspace{0.3cm}";
2288}
2289
2290void LatexGenerator::writeLabel(const QCString &l,bool isLast)
2291{
2292 m_t << "{\\ttfamily [" << l << "]}";
2293 if (!isLast) m_t << ", ";
2294}
2295
2297{
2298}
2299
2301 const QCString &/*id*/,const QCString &ref,
2302 const QCString &file, const QCString &anchor,
2303 const QCString &title, const QCString &name)
2304{
2305 if (Config_getBool(COMPACT_LATEX))
2306 {
2307 m_t << "\\doxyparagraph*{";
2308 }
2309 else
2310 {
2311 m_t << "\\doxy" << QCString("sub").repeat(m_hierarchyLevel + 1) << "section*{";
2312 }
2313 m_t << theTranslator->trInheritedFrom(convertToLaTeX(title,m_codeGen->insideTabbing()),
2314 objectLinkToString(ref, file, anchor, name, m_codeGen->insideTabbing(), m_disableLinks));
2315 m_t << "}\n";
2316}
2317
2319{
2320 int maxLevel = level + m_hierarchyLevel;
2321 m_t << "\\etocsetnexttocdepth{" << maxLevel << "}\n";
2322 m_t << "\\localtableofcontents\n";
2323}
2324
2325//--------------------------------------------------------------------------------------------------
2326
2328{
2329 // User-specified packages
2330 const StringVector &extraPackages = Config_getList(EXTRA_PACKAGES);
2331 if (!extraPackages.empty())
2332 {
2333 t << "% Packages requested by user\n";
2334 for (const auto &pkgName : extraPackages)
2335 {
2336 if ((pkgName[0] == '[') || (pkgName[0] == '{'))
2337 t << "\\usepackage" << pkgName << "\n";
2338 else
2339 t << "\\usepackage{" << pkgName << "}\n";
2340 }
2341 t << "\n";
2342 }
2343}
2344
2346{
2347 unsigned char minus[4]; // Superscript minus
2348 unsigned char sup2[3]; // Superscript two
2349 unsigned char sup3[3];
2350 minus[0]= 0xE2;
2351 minus[1]= 0x81;
2352 minus[2]= 0xBB;
2353 minus[3]= 0;
2354 sup2[0]= 0xC2;
2355 sup2[1]= 0xB2;
2356 sup2[2]= 0;
2357 sup3[0]= 0xC2;
2358 sup3[1]= 0xB3;
2359 sup3[2]= 0;
2360
2361 t << "\\ifPDFTeX\n";
2362 t << "\\usepackage{newunicodechar}\n";
2363 // taken from the newunicodechar package and removed the warning message
2364 // actually forcing to redefine the unicode character
2365 t << " \\makeatletter\n"
2366 " \\def\\doxynewunicodechar#1#2{%\n"
2367 " \\@tempswafalse\n"
2368 " \\edef\\nuc@tempa{\\detokenize{#1}}%\n"
2369 " \\if\\relax\\nuc@tempa\\relax\n"
2370 " \\nuc@emptyargerr\n"
2371 " \\else\n"
2372 " \\edef\\@tempb{\\expandafter\\@car\\nuc@tempa\\@nil}%\n"
2373 " \\nuc@check\n"
2374 " \\if@tempswa\n"
2375 " \\@namedef{u8:\\nuc@tempa}{#2}%\n"
2376 " \\fi\n"
2377 " \\fi\n"
2378 " }\n"
2379 " \\makeatother\n";
2380
2381 t << " \\doxynewunicodechar{" << minus << "}{${}^{-}$}% Superscript minus\n"
2382 " \\doxynewunicodechar{" << sup2 << "}{${}^{2}$}% Superscript two\n"
2383 " \\doxynewunicodechar{" << sup3 << "}{${}^{3}$}% Superscript three\n"
2384 "\n";
2385 t << "\\fi\n";
2386}
2387
2389 bool insideTabbing,bool insidePre,bool insideItem,bool insideTable,bool keepSpaces, const bool retainNewline)
2390{
2391 if (str.isEmpty()) return;
2392 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
2393 //printf("filterLatexString(%s) insideTabbing=%d\n",qPrint(str),insideTabbing);
2394 const char *p = str.data();
2395 const char *q = nullptr;
2396 unsigned char pc='\0';
2397
2398 while (*p)
2399 {
2400 unsigned char c=static_cast<unsigned char>(*p++);
2401
2402 if (insidePre)
2403 {
2404 switch(c)
2405 {
2406 case 0xef: // handle U+FFFD i.e. "Replacement character" caused by octal: 357 277 275 / hexadecimal 0xef 0xbf 0xbd
2407 // the LaTeX command \ucr has been defined in doxygen.sty
2408 if (static_cast<unsigned char>(*(p)) == 0xbf && static_cast<unsigned char>(*(p+1)) == 0xbd)
2409 {
2410 t << "{\\ucr}";
2411 p += 2;
2412 }
2413 else
2414 t << static_cast<char>(c);
2415 break;
2416 case '\\': t << "\\(\\backslash\\)"; break;
2417 case '{': t << "\\{"; break;
2418 case '}': t << "\\}"; break;
2419 case '_': t << "\\_"; break;
2420 case '&': t << "\\&"; break;
2421 case '%': t << "\\%"; break;
2422 case '#': t << "\\#"; break;
2423 case '$': t << "\\$"; break;
2424 case '"': t << "\"{}"; break;
2425 case '-': t << "-\\/"; break;
2426 case '^': insideTable ? t << "\\string^" : t << static_cast<char>(c); break;
2427 case '~': t << "\\string~"; break;
2428 case '\n': if (retainNewline) t << "\\newline"; else t << ' ';
2429 break;
2430 case ' ': if (keepSpaces) t << "~"; else t << ' ';
2431 break;
2432 default:
2433 if (c<32) t << ' '; // non printable control character
2434 else t << static_cast<char>(c);
2435 break;
2436 }
2437 }
2438 else
2439 {
2440 switch(c)
2441 {
2442 case 0xef: // handle U+FFFD i.e. "Replacement character" caused by octal: 357 277 275 / hexadecimal 0xef 0xbf 0xbd
2443 // the LaTeX command \ucr has been defined in doxygen.sty
2444 if (static_cast<unsigned char>(*(p)) == 0xbf && static_cast<unsigned char>(*(p+1)) == 0xbd)
2445 {
2446 t << "{\\ucr}";
2447 p += 2;
2448 }
2449 else
2450 t << static_cast<char>(c);
2451 break;
2452 case '#': t << "\\#"; break;
2453 case '$': t << "\\$"; break;
2454 case '%': t << "\\%"; break;
2455 case '^': processEntity(t,pdfHyperlinks,"$^\\wedge$","\\string^"); break;
2456 case '&': {
2457 // possibility to have a special symbol
2458 q = p;
2459 int cnt = 2; // we have to count & and ; as well
2460 while ((*q >= 'a' && *q <= 'z') || (*q >= 'A' && *q <= 'Z') || (*q >= '0' && *q <= '9'))
2461 {
2462 cnt++;
2463 q++;
2464 }
2465 if (*q == ';')
2466 {
2467 --p; // we need & as well
2470 {
2471 p++;
2472 t << "\\&";
2473 }
2474 else
2475 {
2477 q++;
2478 p = q;
2479 }
2480 }
2481 else
2482 {
2483 t << "\\&";
2484 }
2485 }
2486 break;
2487 case '*': processEntity(t,pdfHyperlinks,"$\\ast$","*"); break;
2488 case '_': if (!insideTabbing) t << "\\+";
2489 t << "\\_";
2490 if (!insideTabbing) t << "\\+";
2491 break;
2492 case '{': t << "\\{"; break;
2493 case '}': t << "\\}"; break;
2494 case '<': t << "$<$"; break;
2495 case '>': t << "$>$"; break;
2496 case '|': processEntity(t,pdfHyperlinks,"$\\vert$","|"); break;
2497 case '~': processEntity(t,pdfHyperlinks,"$\\sim$","\\string~"); break;
2498 case '[': if (Config_getBool(PDF_HYPERLINKS) || insideItem)
2499 t << "\\mbox{[}";
2500 else
2501 t << "[";
2502 break;
2503 case ']': if (pc=='[') t << "$\\,$";
2504 if (Config_getBool(PDF_HYPERLINKS) || insideItem)
2505 t << "\\mbox{]}";
2506 else
2507 t << "]";
2508 break;
2509 case '-': t << "-\\/";
2510 break;
2511 case '\\': t << "\\textbackslash{}";
2512 break;
2513 case '"': t << "\"{}";
2514 break;
2515 case '`': t << "\\`{}";
2516 break;
2517 case '\'': t << "\\textquotesingle{}";
2518 break;
2519 case '\n': if (retainNewline)
2520 {
2521 t << "\\newline";
2522 if (insideTable) t << " ";
2523 }
2524 else
2525 {
2526 t << ' ';
2527 }
2528 break;
2529 case ' ': if (keepSpaces) { if (insideTabbing) t << "\\>"; else t << '~'; } else t << ' ';
2530 break;
2531
2532 default:
2533 //if (!insideTabbing && forceBreaks && c!=' ' && *p!=' ')
2534 if (!insideTabbing &&
2535 ((c>='A' && c<='Z' && pc!=' ' && !(pc>='A' && pc <= 'Z') && pc!='\0' && *p) || (c==':' && pc!=':') || (pc=='.' && isId(c)))
2536 )
2537 {
2538 t << "\\+";
2539 }
2540 if (c<32)
2541 {
2542 t << ' '; // non-printable control character
2543 }
2544 else
2545 {
2546 t << static_cast<char>(c);
2547 }
2548 }
2549 }
2550 pc = c;
2551 }
2552}
2553
2554QCString convertToLaTeX(const QCString &s,bool insideTabbing,bool keepSpaces)
2555{
2556 TextStream t;
2557 filterLatexString(t,s,insideTabbing,false,false,false,keepSpaces);
2558 return t.str();
2559}
2560
2562{
2563 //printf("latexEscapeLabelName(%s)\n",qPrint(s));
2564 if (s.isEmpty()) return s;
2566 TextStream t;
2567 const char *p=s.data();
2568 char c = 0;
2569 while ((c=*p++))
2570 {
2571 switch (c)
2572 {
2573 case '|': t << "\\texttt{\"|}"; break;
2574 case '!': t << "\"!"; break;
2575 case '@': t << "\"@"; break;
2576 case '%': t << "\\%"; break;
2577 case '{': t << "\\lcurly{}"; break;
2578 case '}': t << "\\rcurly{}"; break;
2579 case '~': t << "````~"; break; // to get it a bit better in index together with other special characters
2580 // NOTE: adding a case here, means adding it to while below as well!
2581 default:
2582 {
2583 int i=0;
2584 // collect as long string as possible, before handing it to docify
2585 tmp[i++]=c;
2586 while ((c=*p) && c!='@' && c!='[' && c!=']' && c!='!' && c!='{' && c!='}' && c!='|')
2587 {
2588 tmp[i++]=c;
2589 p++;
2590 }
2591 tmp[i]=0;
2592 filterLatexString(t,tmp,
2593 true, // insideTabbing
2594 false, // insidePre
2595 false, // insideItem
2596 false, // insideTable
2597 false // keepSpaces
2598 );
2599 }
2600 break;
2601 }
2602 }
2603 return t.str();
2604}
2605
2607{
2608 //printf("latexEscapeIndexChars(%s)\n",qPrint(s));
2609 if (s.isEmpty()) 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 << "\"!"; break;
2619 case '"': t << "\"\""; break;
2620 case '@': t << "\"@"; break;
2621 case '|': t << "\\texttt{\"|}"; break;
2622 case '[': t << "["; break;
2623 case ']': t << "]"; break;
2624 case '{': t << "\\lcurly{}"; break;
2625 case '}': t << "\\rcurly{}"; break;
2626 // NOTE: adding a case here, means adding it to while below as well!
2627 default:
2628 {
2629 int i=0;
2630 // collect as long string as possible, before handing it to docify
2631 tmp[i++]=c;
2632 while ((c=*p) && c!='"' && c!='@' && c!='[' && c!=']' && c!='!' && c!='{' && c!='}' && c!='|')
2633 {
2634 tmp[i++]=c;
2635 p++;
2636 }
2637 tmp[i]=0;
2638 filterLatexString(t,tmp,
2639 true, // insideTabbing
2640 false, // insidePre
2641 false, // insideItem
2642 false, // insideTable
2643 false // keepSpaces
2644 );
2645 }
2646 break;
2647 }
2648 }
2649 return t.str();
2650}
2651
2653{
2654 if (s.isEmpty()) return s;
2655 TextStream t;
2656 const char *p=s.data();
2657 char c = 0;
2658 while ((c=*p++))
2659 {
2660 switch (c)
2661 {
2662 case '\\': t << "\\textbackslash{}"; break;
2663 case '{': t << "\\{"; break;
2664 case '}': t << "\\}"; break;
2665 case '_': t << "\\_"; break;
2666 case '%': t << "\\%"; break;
2667 case '&': t << "\\&"; break;
2668 case '#': t << "\\#"; break;
2669 case '$': t << "\\$"; break;
2670 case '^': t << "\\string^"; break;
2671 case '~': t << "\\string~"; break;
2672 default:
2673 t << c;
2674 break;
2675 }
2676 }
2677 return t.str();
2678}
2679
2681{
2682 constexpr auto hex = "0123456789ABCDEF";
2683 if (s.isEmpty()) return s;
2684 TextStream t;
2685 const char *p=s.data();
2686 char c = 0;
2687 while ((c=*p++))
2688 {
2689 switch (c)
2690 {
2691 case '#': t << "\\#"; break;
2692 case '%': t << "\\%"; break;
2693 case '\\': t << "\\\\"; break;
2694 default:
2695 if (c<0)
2696 {
2697 unsigned char id = static_cast<unsigned char>(c);
2698 t << "\\%" << hex[id>>4] << hex[id&0xF];
2699 }
2700 else
2701 {
2702 t << c;
2703 }
2704 break;
2705 }
2706 }
2707 return t.str();
2708}
2709
2710
constexpr auto prefix
Definition anchor.cpp:44
QCString latexBibFiles()
lists the bibtex cite files in a comma separated list
Definition cite.cpp:577
static CitationManager & instance()
Definition cite.cpp:86
bool isEmpty() const
return TRUE if there are no citations.
Definition cite.cpp:117
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:1073
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:332
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 endMemberGroupHeader() override
void docify(const QCString &text) override
void startAnonTypeScope(int) override
void endPlainFile() override
Definition latexgen.h:320
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:329
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:114
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 writeDoc(const IDocNodeAST *node, const Definition *ctx, const MemberDef *, int id) 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:335
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:319
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:328
void startFile(const QCString &name, const QCString &manName, const QCString &title, int id, int hierarchyLevel) override
Definition latexgen.cpp:709
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:333
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:327
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:334
void writeStyleInfo(int part) override
void endDoxyAnchor(const QCString &, const QCString &) override
void startIndexValue(bool) override
void startInlineMemberName() override
static void init()
Definition latexgen.cpp:633
bool m_templateMemberItem
Definition latexgen.h:331
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:164
void add(OutputCodeIntfPtr &&p)
Definition outputlist.h:194
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:1407
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:102
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:7397
void checkBlocks(const QCString &s, const QCString fileName, const SelectionMarkerInfo &markerInfo)
Definition util.cpp:7039
QCString stripPath(const QCString &s)
Definition util.cpp:5467
QCString removeEmptyLines(const QCString &s)
Definition util.cpp:7103
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:6926
QCString substituteKeywords(const QCString &file, const QCString &s, const KeywordSubstitutionList &keywords)
Definition util.cpp:3575
QCString relativePathToRoot(const QCString &name)
Definition util.cpp:4095
void clearSubDirs(const Dir &d)
Definition util.cpp:4183
QCString fileToString(const QCString &name, bool filter, bool isSourceCode)
Definition util.cpp:1442
QCString stripExtensionGeneral(const QCString &fName, const QCString &ext)
Definition util.cpp:5430
void createSubDirs(const Dir &d)
Definition util.cpp:4156
bool checkExtension(const QCString &fName, const QCString &ext)
Definition util.cpp:5413
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:6376
A bunch of utility functions.
bool isId(int c)
Definition util.h:208