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 << "\\doxymbox{\\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 << "\\doxymbox{\\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 += "\\doxymbox{\\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 {
1496 }
1497}
1498
1499void LatexGenerator::startGroupHeader(const QCString &,int extraIndentLevel)
1500{
1501 if (Config_getBool(COMPACT_LATEX))
1502 {
1503 extraIndentLevel++;
1504 }
1505
1506 if (extraIndentLevel>=3)
1507 {
1508 m_t << "\\doxysubparagraph*{";
1509 }
1510 else if (extraIndentLevel==2)
1511 {
1512 m_t << "\\doxyparagraph{";
1513 }
1514 else
1515 {
1516 extraIndentLevel += m_hierarchyLevel + 1;
1517 m_t << "\\doxy" << QCString("sub").repeat(extraIndentLevel) << "section{";
1518 }
1520}
1521
1523{
1525 m_t << "}\n";
1526}
1527
1529{
1530 int l = m_hierarchyLevel + 1;
1531 if (Config_getBool(COMPACT_LATEX))
1532 {
1533 ++l;
1534 }
1535
1536 m_t << "\\doxysub" << QCString("sub").repeat(l) << "section*{";
1538}
1539
1541{
1543 m_t << "}\n";
1544}
1545
1547 const QCString &memname,
1548 const QCString &,
1549 const QCString &title,
1550 int memCount,
1551 int memTotal,
1552 bool showInline)
1553{
1554 if (!memname.isEmpty() && memname[0]!='@')
1555 {
1556 latexWriteIndexItem(m_t,clname,memname);
1557 latexWriteIndexItem(m_t,memname,clname);
1558 }
1559 bool compactLatex = Config_getBool(COMPACT_LATEX);
1560 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1561 if (showInline)
1562 {
1563 m_t << "\\doxysubparagraph";
1564 }
1565 else if (compactLatex)
1566 {
1567 m_t << "\\doxyparagraph";
1568 }
1569 else
1570 {
1571 m_t << "\\doxy" << QCString("sub").repeat(m_hierarchyLevel + 2) << "section";
1572 }
1573
1574 m_t << "{";
1575 if (pdfHyperlinks)
1576 {
1577 m_t << "\\texorpdfstring{";
1578 }
1579 m_t << latexEscapeIndexChars(title);
1580 if (pdfHyperlinks)
1581 {
1582 m_t << "}{" << latexEscapePDFString(title) << "}";
1583 }
1584 if (memTotal>1)
1585 {
1586 m_t << "\\hspace{0.1cm}{\\footnotesize\\ttfamily [" << memCount << "/" << memTotal << "]}";
1587 }
1588 m_t << "}";
1589 m_t << "\n{\\footnotesize\\ttfamily ";
1590 //m_disableLinks=TRUE;
1591}
1592
1594{
1596 m_t << "}\n\n";
1597 //if (Config_getBool(COMPACT_LATEX)) m_t << "\\hfill";
1598}
1599
1601 const QCString &anchor, const QCString &,
1602 const QCString &)
1603{
1604 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1605 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1606 if (m_insideTableEnv) m_t << "\\doxymbox{"; // see issue #6093
1607 if (usePDFLatex && pdfHyperlinks)
1608 {
1609 m_t << "\\Hypertarget{";
1610 if (!fName.isEmpty()) m_t << stripPath(fName);
1611 if (!anchor.isEmpty()) m_t << "_" << anchor;
1612 m_t << "}";
1613 }
1614}
1615
1616void LatexGenerator::endDoxyAnchor(const QCString &/* fName */,const QCString &/* anchor */)
1617{
1618}
1619
1620void LatexGenerator::addLabel(const QCString &fName, const QCString &anchor)
1621{
1622 m_t << "\\label{";
1623 if (!fName.isEmpty()) m_t << stripPath(fName);
1624 if (!anchor.isEmpty()) m_t << "_" << anchor;
1625 if (m_insideTableEnv) m_t << "}";
1626 m_t << "} \n";
1627}
1628
1629void LatexGenerator::writeAnchor(const QCString &fName,const QCString &name)
1630{
1631 //printf("LatexGenerator::writeAnchor(%s,%s)\n",fName,name);
1632 m_t << "\\label{" << stripPath(name) << "}\n";
1633 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1634 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1635 if (usePDFLatex && pdfHyperlinks)
1636 {
1637 if (!fName.isEmpty())
1638 {
1639 m_t << "\\Hypertarget{" << stripPath(fName) << "_" << stripPath(name) << "}\n";
1640 }
1641 else
1642 {
1643 m_t << "\\Hypertarget{" << stripPath(name) << "}\n";
1644 }
1645 }
1646}
1647
1648
1649//void LatexGenerator::writeLatexLabel(const QCString &clName,const QCString &anchor)
1650//{
1651// writeDoxyAnchor(0,clName,anchor,0);
1652//}
1653
1655{
1656 if (!s1.isEmpty())
1657 {
1658 latexWriteIndexItem(m_t,s1,s2);
1659 }
1660}
1661
1662
1664{
1665 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1666 bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1667 if (usePDFLatex && pdfHyperlinks)
1668 {
1669 m_t << "\\hypertarget{" << stripPath(lab) << "}{}";
1670 }
1671 m_t << "\\";
1672 if (Config_getBool(COMPACT_LATEX))
1673 {
1674 switch(type.level())
1675 {
1676 case SectionType::Page: m_t << "doxysubsection"; break;
1677 case SectionType::Section: m_t << "doxysubsubsection"; break;
1678 case SectionType::Subsection: m_t << "doxysubsubsubsection"; break;
1679 case SectionType::Subsubsection: m_t << "doxysubsubsubsubsection"; break;
1680 case SectionType::Paragraph: m_t << "doxysubsubsubsubsubsection"; break;
1681 case SectionType::Subparagraph: m_t << "doxysubsubsubsubsubsubsection"; break;
1682 case SectionType::Subsubparagraph: m_t << "doxysubsubsubsubsubsubsection"; break;
1683 default: ASSERT(0); break;
1684 }
1685 m_t << "{";
1686 }
1687 else
1688 {
1689 switch(type.level())
1690 {
1691 case SectionType::Page: m_t << "doxysection"; break;
1692 case SectionType::Section: m_t << "doxysubsection"; break;
1693 case SectionType::Subsection: m_t << "doxysubsubsection"; break;
1694 case SectionType::Subsubsection: m_t << "doxysubsubsubsection"; break;
1695 case SectionType::Paragraph: m_t << "doxysubsubsubsubsection"; break;
1696 case SectionType::Subparagraph: m_t << "doxysubsubsubsubsubsection"; break;
1697 case SectionType::Subsubparagraph: m_t << "doxysubsubsubsubsubsubsection"; break;
1698 default: ASSERT(0); break;
1699 }
1700 m_t << "{";
1701 }
1702}
1703
1705{
1706 m_t << "}\\label{" << lab << "}\n";
1707}
1708
1709
1711{
1713 m_codeGen->insideTabbing(), // insideTabbing
1714 false, // insidePre
1715 false, // insideItem
1716 m_codeGen->usedTableLevel()>0, // insideTable
1717 false // keepSpaces
1718 );
1719}
1720
1722{
1723 char cs[2];
1724 cs[0]=c;
1725 cs[1]=0;
1726 docify(cs);
1727}
1728
1730{
1731 //if (Config_getBool(COMPACT_LATEX)) m_t << "\\doxysubsubsection"; else m_t << "\\doxysubsection";
1732 //m_t << "{";
1733}
1734
1736 const QCString &fileName,const QCString &)
1737{
1739}
1740
1741
1743{
1744 if (indent==0)
1745 {
1746 m_t << "\\begin{tabbing}\n";
1747 m_t << "xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=\\kill\n";
1748 m_codeGen->setInsideTabbing(true);
1749 }
1750 m_indent=indent;
1751}
1752
1754{
1755 if (indent==0)
1756 {
1757 m_t << "\n" << "\\end{tabbing}";
1758 m_codeGen->setInsideTabbing(false);
1759 }
1760 m_indent=indent;
1761}
1762
1764{
1766 {
1767 m_t << "{\\footnotesize ";
1768 }
1769}
1770
1772{
1774 {
1775 m_t << "}\\\\";
1776 }
1777}
1778
1780{
1781 //printf("LatexGenerator::startMemberItem(%d)\n",annType);
1782 if (!m_codeGen->insideTabbing())
1783 {
1784 m_t << "\\item \n";
1786 }
1787}
1788
1790{
1791 if (m_codeGen->insideTabbing())
1792 {
1793 m_t << "\\\\";
1794 }
1796 m_t << "\n";
1797}
1798
1800{
1801 if (!m_codeGen->insideTabbing())
1802 {
1803 m_t << "\\begin{DoxyCompactList}\\small\\item\\em ";
1804 }
1805 else
1806 {
1807 for (int i=0;i<m_indent+2;i++) m_t << "\\>";
1808 m_t << "{\\em ";
1809 }
1810}
1811
1813{
1814 if (!m_codeGen->insideTabbing())
1815 {
1816 //m_t << "\\item\\end{DoxyCompactList}";
1817 m_t << "\\end{DoxyCompactList}";
1818 }
1819 else
1820 {
1821 m_t << "}\\\\\n";
1822 }
1823}
1824
1825
1827{
1828 //printf("writeNonBreakableSpace()\n");
1829 if (m_codeGen->insideTabbing())
1830 {
1831 m_t << "\\>";
1832 }
1833 else
1834 {
1835 m_t << "~";
1836 }
1837}
1838
1839// ----------------------------------------------
1840// nesting of functions below:
1841// startDescTable()
1842// - startDescTableRow()
1843// - startDescTableTitle()
1844// - endDescTableTitle()
1845// - startDescTableData()
1846// - endDescTableData()
1847// - endDescTableRow()
1848// - startDescTableRow()
1849// - ...
1850// - endDescTableRow()
1851// endDescTable()
1852
1853void LatexGenerator::startDescTable(const QCString &title,const bool hasInits)
1854{
1855 m_codeGen->incUsedTableLevel();
1856 m_t << "\\begin{DoxyEnumFields}[" << (hasInits?3:2) << "]{" << title << "}\n";
1857}
1858
1860{
1861 m_codeGen->decUsedTableLevel();
1862 m_t << "\\end{DoxyEnumFields}\n";
1863}
1864
1866{
1867 // this is needed to prevent the \hypertarget, \label, and \index commands from messing up
1868 // the row height (based on http://tex.stackexchange.com/a/186102)
1869 m_t << "\\raisebox{\\heightof{T}}[0pt][0pt]{";
1870}
1871
1875
1877{
1878 m_t << "}";
1879}
1880
1884
1886{
1887 m_t << "&";
1888}
1889
1893
1895{
1896 m_t << "&";
1897}
1898
1900{
1901 m_t << "\\\\\n\\hline\n\n";
1902}
1903
1907
1908
1910{
1911 if (!m_codeGen->insideTabbing())
1912 {
1913 m_t << "\\begin{DoxyCompactItemize}\n";
1914 }
1915}
1916
1918{
1919 //printf("LatexGenerator::endMemberList(%d)\n",m_codeGen->InsideTabbing());
1920 if (!m_codeGen->insideTabbing())
1921 {
1922 m_t << "\\end{DoxyCompactItemize}\n";
1923 }
1924}
1925
1926
1928{
1929 if (hasHeader) m_t << "\\begin{Indent}";
1930 m_t << "\\textbf{ ";
1931 // changed back to rev 756 due to bug 660501
1932 //if (Config_getBool(COMPACT_LATEX))
1933 //{
1934 // m_t << "\\doxysubparagraph*{";
1935 //}
1936 //else
1937 //{
1938 // m_t << "\\doxyparagraph*{";
1939 //}
1940}
1941
1943{
1944 // changed back to rev 756 due to bug 660501
1945 m_t << "}\\par\n";
1946 //m_t << "}\n";
1947}
1948
1950{
1951 m_t << "{\\em ";
1952}
1953
1955{
1956 m_t << "}";
1957}
1958
1962
1964{
1965 if (hasHeader)m_t << "\\end{Indent}";
1966 m_t << "\n";
1967}
1968
1970{
1971 m_t << "\n" << "\n";
1972}
1973
1978
1982
1987
1991
1996
2000
2005
2009
2014
2016{
2017 m_t << "\\begin{Desc}\n\\item[";
2018 docify(theTranslator->trExamples());
2019 m_t << "]";
2020}
2021
2023{
2024 m_t << "\\end{Desc}\n";
2025}
2026
2028{
2029 /* start of ParameterType ParameterName list */
2030 if (openBracket) m_t << "(";
2031 m_t << "\\begin{DoxyParamCaption}";
2032}
2033
2037
2039{
2040 m_t << "\\item[{";
2041 if (!first && !key.isEmpty()) docify(key);
2042}
2043
2045{
2046 m_t << "}]";
2047}
2048
2049void LatexGenerator::startParameterName(bool /*oneArgOnly*/)
2050{
2051 m_t << "{";
2052}
2053
2055{
2056 m_t << "}";
2057}
2058
2060{
2061 m_t << "{";
2062}
2063
2064void LatexGenerator::endParameterExtra(bool last,bool /*emptyList*/,bool closeBracket)
2065{
2066 m_t << "}";
2067 if (last)
2068 {
2069 m_t << "\\end{DoxyParamCaption}";
2070 if (closeBracket) m_t << ")";
2071 }
2072}
2073
2074void LatexGenerator::exceptionEntry(const QCString &prefix,bool closeBracket)
2075{
2076 if (!prefix.isEmpty())
2077 {
2078 m_t << " " << prefix << "(";
2079 }
2080 else if (closeBracket)
2081 {
2082 m_t << ")";
2083 }
2084 m_t << " ";
2085}
2086
2087void LatexGenerator::writeDoc(const IDocNodeAST *ast,const Definition *ctx,const MemberDef *,int,int)
2088{
2089 const DocNodeAST *astImpl = dynamic_cast<const DocNodeAST*>(ast);
2090 if (astImpl)
2091 {
2093 ctx?ctx->getDefFileExtension():QCString(""),
2095 std::visit(visitor,astImpl->root);
2096 }
2097}
2098
2100{
2101 m_t << "\\begin{Desc}\n\\item[";
2102 docify(header);
2103 m_t << "]";
2104 m_t << "\\begin{description}\n";
2105}
2106
2108{
2109 m_t << "\\item[{\\em ";
2110}
2111
2115
2117{
2118 m_t << "} : {\\em ";
2119}
2120
2122{
2123 m_t << "}]";
2124}
2125
2129
2133
2135{
2136 m_t << "\\end{description}\n";
2137 m_t << "\\end{Desc}\n";
2138}
2139
2141{
2142 if (Config_getBool(COMPACT_LATEX))
2143 {
2144 m_t << "\\doxyparagraph*{";
2145 }
2146 else
2147 {
2148 m_t << "\\doxy" << QCString("sub").repeat(m_hierarchyLevel + 1) << "section*{";
2149 }
2150}
2151
2153{
2154 m_t << "}\n";
2155}
2156
2158{
2159 if (m_codeGen->insideTabbing())
2160 {
2161 m_t << "\\\\\n";
2162 }
2163 else
2164 {
2165 m_t << "\\newline\n";
2166 }
2167}
2168
2170{
2171 m_codeGen->incUsedTableLevel();
2172 if (isEnum)
2173 {
2174 m_t << "\\begin{DoxyEnumFields}{";
2175 docify(theTranslator->trEnumerationValues());
2176 }
2177 else
2178 {
2179 m_t << "\\begin{DoxyFields}{";
2180 docify(theTranslator->trCompoundMembers());
2181 }
2182 m_t << "}\n";
2183 m_insideTableEnv=true;
2184}
2185
2187{
2188 m_insideTableEnv=false;
2189 m_codeGen->decUsedTableLevel();
2190 if (isEnum)
2191 {
2192 m_t << "\\end{DoxyEnumFields}\n";
2193 }
2194 else
2195 {
2196 m_t << "\\end{DoxyFields}\n";
2197 }
2198}
2199
2201{
2202 m_codeGen->setInsideTabbing(true); // to prevent \+ from causing unwanted breaks
2203}
2204
2206{
2207 m_t << "&\n";
2208 m_codeGen->setInsideTabbing(false);
2209}
2210
2212{
2213 m_codeGen->setInsideTabbing(true); // to prevent \+ from causing unwanted breaks
2214}
2215
2217{
2218 m_t << "&\n";
2219 m_codeGen->setInsideTabbing(false);
2220}
2221
2225
2227{
2228 m_t << "\\\\\n\\hline\n\n";
2229}
2230
2232{
2233 m_t << "\\hspace{0.3cm}";
2234}
2235
2236void LatexGenerator::writeLabel(const QCString &l,bool isLast)
2237{
2238 m_t << "{\\ttfamily [" << l << "]}";
2239 if (!isLast) m_t << ", ";
2240}
2241
2243{
2244}
2245
2247 const QCString &/*id*/,const QCString &ref,
2248 const QCString &file, const QCString &anchor,
2249 const QCString &title, const QCString &name)
2250{
2251 if (Config_getBool(COMPACT_LATEX))
2252 {
2253 m_t << "\\doxyparagraph*{";
2254 }
2255 else
2256 {
2257 m_t << "\\doxy" << QCString("sub").repeat(m_hierarchyLevel + 1) << "section*{";
2258 }
2259 m_t << theTranslator->trInheritedFrom(convertToLaTeX(title,m_codeGen->insideTabbing()),
2260 objectLinkToString(ref, file, anchor, name, m_codeGen->insideTabbing(), m_disableLinks));
2261 m_t << "}\n";
2262}
2263
2265{
2266 int maxLevel = level + m_hierarchyLevel;
2267 m_t << "\\etocsetnexttocdepth{" << maxLevel << "}\n";
2268 m_t << "\\localtableofcontents\n";
2269}
2270
2272{
2273 m_t << "\\begin{DoxyEmbeddedDoc}[" << indent << "]\n";
2274}
2275
2277{
2278 m_t << "\\end{DoxyEmbeddedDoc}\n";
2279}
2280
2281//--------------------------------------------------------------------------------------------------
2282
2284{
2285 // User-specified packages
2286 const StringVector &extraPackages = Config_getList(EXTRA_PACKAGES);
2287 if (!extraPackages.empty())
2288 {
2289 t << "% Packages requested by user\n";
2290 for (const auto &pkgName : extraPackages)
2291 {
2292 if ((pkgName[0] == '[') || (pkgName[0] == '{'))
2293 t << "\\usepackage" << pkgName << "\n";
2294 else
2295 t << "\\usepackage{" << pkgName << "}\n";
2296 }
2297 t << "\n";
2298 }
2299}
2300
2302{
2303 unsigned char minus[4]; // Superscript minus
2304 unsigned char sup2[3]; // Superscript two
2305 unsigned char sup3[3];
2306 minus[0]= 0xE2;
2307 minus[1]= 0x81;
2308 minus[2]= 0xBB;
2309 minus[3]= 0;
2310 sup2[0]= 0xC2;
2311 sup2[1]= 0xB2;
2312 sup2[2]= 0;
2313 sup3[0]= 0xC2;
2314 sup3[1]= 0xB3;
2315 sup3[2]= 0;
2316
2317 t << "\\ifPDFTeX\n";
2318 t << "\\usepackage{newunicodechar}\n";
2319 // taken from the newunicodechar package and removed the warning message
2320 // actually forcing to redefine the unicode character
2321 t << " \\makeatletter\n"
2322 " \\def\\doxynewunicodechar#1#2{%\n"
2323 " \\@tempswafalse\n"
2324 " \\edef\\nuc@tempa{\\detokenize{#1}}%\n"
2325 " \\if\\relax\\nuc@tempa\\relax\n"
2326 " \\nuc@emptyargerr\n"
2327 " \\else\n"
2328 " \\edef\\@tempb{\\expandafter\\@car\\nuc@tempa\\@nil}%\n"
2329 " \\nuc@check\n"
2330 " \\if@tempswa\n"
2331 " \\@namedef{u8:\\nuc@tempa}{#2}%\n"
2332 " \\fi\n"
2333 " \\fi\n"
2334 " }\n"
2335 " \\makeatother\n";
2336
2337 t << " \\doxynewunicodechar{" << minus << "}{${}^{-}$}% Superscript minus\n"
2338 " \\doxynewunicodechar{" << sup2 << "}{${}^{2}$}% Superscript two\n"
2339 " \\doxynewunicodechar{" << sup3 << "}{${}^{3}$}% Superscript three\n"
2340 "\n";
2341 t << "\\fi\n";
2342}
2343
2345 bool insideTabbing,bool insidePre,bool insideItem,bool insideTable,bool keepSpaces, const bool retainNewline)
2346{
2347 if (str.isEmpty()) return;
2348 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
2349 //printf("filterLatexString(%s) insideTabbing=%d\n",qPrint(str),insideTabbing);
2350 const char *p = str.data();
2351 const char *q = nullptr;
2352 unsigned char pc='\0';
2353
2354 while (*p)
2355 {
2356 unsigned char c=static_cast<unsigned char>(*p++);
2357
2358 if (insidePre)
2359 {
2360 switch(c)
2361 {
2362 case 0xef: // handle U+FFFD i.e. "Replacement character" caused by octal: 357 277 275 / hexadecimal 0xef 0xbf 0xbd
2363 // the LaTeX command \ucr has been defined in doxygen.sty
2364 if (static_cast<unsigned char>(*(p)) == 0xbf && static_cast<unsigned char>(*(p+1)) == 0xbd)
2365 {
2366 t << "{\\ucr}";
2367 p += 2;
2368 }
2369 else
2370 t << static_cast<char>(c);
2371 break;
2372 case '\\': t << "\\(\\backslash\\)"; break;
2373 case '{': t << "\\{"; break;
2374 case '}': t << "\\}"; break;
2375 case '_': t << "\\_"; break;
2376 case '&': t << "\\&"; break;
2377 case '%': t << "\\%"; break;
2378 case '#': t << "\\#"; break;
2379 case '$': t << "\\$"; break;
2380 case '"': t << "\"{}"; break;
2381 case '-': t << "-\\/"; break;
2382 case '^': insideTable ? t << "\\string^" : t << static_cast<char>(c); break;
2383 case '~': t << "\\string~"; break;
2384 case '\n': if (retainNewline) t << "\\newline"; else t << ' ';
2385 break;
2386 case ' ': if (keepSpaces) t << "~"; else t << ' ';
2387 break;
2388 default:
2389 if (c<32) t << ' '; // non printable control character
2390 else t << static_cast<char>(c);
2391 break;
2392 }
2393 }
2394 else
2395 {
2396 switch(c)
2397 {
2398 case 0xef: // handle U+FFFD i.e. "Replacement character" caused by octal: 357 277 275 / hexadecimal 0xef 0xbf 0xbd
2399 // the LaTeX command \ucr has been defined in doxygen.sty
2400 if (static_cast<unsigned char>(*(p)) == 0xbf && static_cast<unsigned char>(*(p+1)) == 0xbd)
2401 {
2402 t << "{\\ucr}";
2403 p += 2;
2404 }
2405 else
2406 t << static_cast<char>(c);
2407 break;
2408 case '#': t << "\\+\\#"; break;
2409 case '$': t << "\\$"; break;
2410 case '%': t << "\\%"; break;
2411 case '^': processEntity(t,pdfHyperlinks,"$^\\wedge$","\\string^"); break;
2412 case '&': {
2413 // possibility to have a special symbol
2414 q = p;
2415 int cnt = 2; // we have to count & and ; as well
2416 while ((*q >= 'a' && *q <= 'z') || (*q >= 'A' && *q <= 'Z') || (*q >= '0' && *q <= '9'))
2417 {
2418 cnt++;
2419 q++;
2420 }
2421 if (*q == ';')
2422 {
2423 --p; // we need & as well
2426 {
2427 p++;
2428 t << "\\&";
2429 }
2430 else
2431 {
2433 q++;
2434 p = q;
2435 }
2436 }
2437 else
2438 {
2439 t << "\\&";
2440 }
2441 }
2442 break;
2443 case '*': processEntity(t,pdfHyperlinks,"$\\ast$","*"); break;
2444 case '_': if (!insideTabbing) t << "\\+";
2445 t << "\\_";
2446 if (!insideTabbing) t << "\\+";
2447 break;
2448 case '{': t << "\\{"; break;
2449 case '}': t << "\\}"; break;
2450 case '<': t << "$<$"; break;
2451 case '>': t << "$>$"; break;
2452 case '|': processEntity(t,pdfHyperlinks,"$\\vert$","|"); break;
2453 case '~': processEntity(t,pdfHyperlinks,"$\\sim$","\\string~"); break;
2454 case '[': if (Config_getBool(PDF_HYPERLINKS) || insideItem)
2455 t << "\\+[";
2456 else
2457 t << "[";
2458 break;
2459 case ']': if (pc=='[') t << "$\\,$";
2460 if (Config_getBool(PDF_HYPERLINKS) || insideItem)
2461 t << "]\\+";
2462 else
2463 t << "]";
2464 break;
2465 case '-': t << "-\\/";
2466 break;
2467 case '\\': t << "\\textbackslash{}";
2468 break;
2469 case '"': t << "\"{}";
2470 break;
2471 case '`': t << "\\`{}";
2472 break;
2473 case '\'': t << "\\textquotesingle{}";
2474 break;
2475 case '\n': if (retainNewline)
2476 {
2477 t << "\\newline";
2478 if (insideTable) t << " ";
2479 }
2480 else
2481 {
2482 t << ' ';
2483 }
2484 break;
2485 case ' ': if (keepSpaces) { if (insideTabbing) t << "\\>"; else t << '~'; } else t << ' ';
2486 break;
2487
2488 default:
2489 //if (!insideTabbing && forceBreaks && c!=' ' && *p!=' ')
2490 if (!insideTabbing &&
2491 ((c>='A' && c<='Z' && pc!=' ' && !(pc>='A' && pc <= 'Z') && pc!='\0' && *p) || (pc=='.' && isId(c)))
2492 )
2493 {
2494 t << "\\+";
2495 }
2496 if (c<32)
2497 {
2498 t << ' '; // non-printable control character
2499 }
2500 else
2501 {
2502 t << static_cast<char>(c);
2503 }
2504 if (!insideTabbing && ((c==':' && *p!=':') || c=='/'))
2505 {
2506 t << "\\+";
2507 }
2508 }
2509 }
2510 pc = c;
2511 }
2512}
2513
2514QCString convertToLaTeX(const QCString &s,bool insideTabbing,bool keepSpaces)
2515{
2516 TextStream t;
2517 filterLatexString(t,s,insideTabbing,false,false,false,keepSpaces);
2518 return t.str();
2519}
2520
2522{
2523 //printf("latexEscapeLabelName(%s)\n",qPrint(s));
2524 if (s.isEmpty()) return s;
2526 TextStream t;
2527 const char *p=s.data();
2528 char c = 0;
2529 while ((c=*p++))
2530 {
2531 switch (c)
2532 {
2533 case '|': t << "\\texttt{\"|}"; break;
2534 case '!': t << "\"!"; break;
2535 case '@': t << "\"@"; break;
2536 case '%': t << "\\%"; break;
2537 case '{': t << "\\lcurly{}"; break;
2538 case '}': t << "\\rcurly{}"; break;
2539 case '~': t << "````~"; break; // to get it a bit better in index together with other special characters
2540 // NOTE: adding a case here, means adding it to while below as well!
2541 default:
2542 {
2543 int i=0;
2544 // collect as long string as possible, before handing it to docify
2545 tmp[i++]=c;
2546 while ((c=*p) && c!='@' && c!='[' && c!=']' && c!='!' && c!='{' && c!='}' && c!='|')
2547 {
2548 tmp[i++]=c;
2549 p++;
2550 }
2551 tmp[i]=0;
2552 filterLatexString(t,tmp,
2553 true, // insideTabbing
2554 false, // insidePre
2555 false, // insideItem
2556 false, // insideTable
2557 false // keepSpaces
2558 );
2559 }
2560 break;
2561 }
2562 }
2563 return t.str();
2564}
2565
2567{
2568 //printf("latexEscapeIndexChars(%s)\n",qPrint(s));
2569 if (s.isEmpty()) return s;
2571 TextStream t;
2572 const char *p=s.data();
2573 char c = 0;
2574 while ((c=*p++))
2575 {
2576 switch (c)
2577 {
2578 case '!': t << "\"!"; break;
2579 case '"': t << "\"\""; break;
2580 case '@': t << "\"@"; break;
2581 case '|': t << "\\texttt{\"|}"; break;
2582 case '[': t << "["; break;
2583 case ']': t << "]"; break;
2584 case '{': t << "\\lcurly{}"; break;
2585 case '}': t << "\\rcurly{}"; break;
2586 // NOTE: adding a case here, means adding it to while below as well!
2587 default:
2588 {
2589 int i=0;
2590 // collect as long string as possible, before handing it to docify
2591 tmp[i++]=c;
2592 while ((c=*p) && c!='"' && c!='@' && c!='[' && c!=']' && c!='!' && c!='{' && c!='}' && c!='|')
2593 {
2594 tmp[i++]=c;
2595 p++;
2596 }
2597 tmp[i]=0;
2598 filterLatexString(t,tmp,
2599 true, // insideTabbing
2600 false, // insidePre
2601 false, // insideItem
2602 false, // insideTable
2603 false // keepSpaces
2604 );
2605 }
2606 break;
2607 }
2608 }
2609 return t.str();
2610}
2611
2613{
2614 if (s.isEmpty()) return s;
2615 TextStream t;
2616 const char *p=s.data();
2617 char c = 0;
2618 while ((c=*p++))
2619 {
2620 switch (c)
2621 {
2622 case '\\': t << "\\textbackslash{}"; break;
2623 case '{': t << "\\{"; break;
2624 case '}': t << "\\}"; break;
2625 case '_': t << "\\_"; break;
2626 case '%': t << "\\%"; break;
2627 case '&': t << "\\&"; break;
2628 case '#': t << "\\#"; break;
2629 case '$': t << "\\$"; break;
2630 case '^': t << "\\string^"; break;
2631 case '~': t << "\\string~"; break;
2632 default:
2633 t << c;
2634 break;
2635 }
2636 }
2637 return t.str();
2638}
2639
2641{
2642 constexpr auto hex = "0123456789ABCDEF";
2643 if (s.isEmpty()) return s;
2644 TextStream t;
2645 const char *p=s.data();
2646 char c = 0;
2647 while ((c=*p++))
2648 {
2649 switch (c)
2650 {
2651 case '#': t << "\\#"; break;
2652 case '%': t << "\\%"; break;
2653 case '\\': t << "\\\\"; break;
2654 case '\n': break; // ignore
2655 default:
2656 if (c<0)
2657 {
2658 unsigned char id = static_cast<unsigned char>(c);
2659 t << "\\%" << hex[id>>4] << hex[id&0xF];
2660 }
2661 else
2662 {
2663 t << c;
2664 }
2665 break;
2666 }
2667 }
2668 return t.str();
2669}
2670
2671void latexWriteIndexItem(TextStream &m_t,const QCString &s1,const QCString &s2)
2672{
2673 if (!s1.isEmpty())
2674 {
2675 m_t << "\\index{";
2676 m_t << latexEscapeLabelName(s1);
2677 m_t << "@{";
2678 m_t << latexEscapeIndexChars(s1);
2679 m_t << "}";
2680 if (!s2.isEmpty())
2681 {
2682 m_t << "!";
2683 m_t << latexEscapeLabelName(s2);
2684 m_t << "@{";
2685 m_t << latexEscapeIndexChars(s2);
2686 m_t << "}";
2687 }
2688 m_t << "}\n";
2689 }
2690}
2691
2692
constexpr auto prefix
Definition anchor.cpp:44
QCString latexBibFiles()
lists the bibtex cite files in a comma separated list
Definition cite.cpp:575
static CitationManager & instance()
Definition cite.cpp:85
bool isEmpty() const
return TRUE if there are no citations.
Definition cite.cpp:115
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:1065
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:114
static ConceptLinkedMap * conceptLinkedMap
Definition doxygen.h:97
static std::unique_ptr< PageDef > mainPage
Definition doxygen.h:100
static FileNameLinkedMap * inputNameLinkedMap
Definition doxygen.h:104
static ClassLinkedMap * classLinkedMap
Definition doxygen.h:95
static PageLinkedMap * exampleLinkedMap
Definition doxygen.h:98
static PageLinkedMap * pageLinkedMap
Definition doxygen.h:99
static DirLinkedMap * dirLinkedMap
Definition doxygen.h:128
static GroupLinkedMap * groupLinkedMap
Definition doxygen.h:113
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:328
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:325
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:331
void startInlineMemberDoc() override
void writeAnchor(const QCString &fileName, const QCString &name) override
void startCallGraph() override
void endMemberList() override
void startEmbeddedDoc(int) 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 endEmbeddedDoc() 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:324
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:329
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:323
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:330
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:327
A model of a class/file/namespace member symbol.
Definition memberdef.h:48
static ModuleManager & instance()
Class representing a list of different code generators.
Definition outputlist.h: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:216
#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:62
QCString yearToString()
Returns the current year as a string.
Definition datetime.cpp:75
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:63
static QCString g_header_file
Definition htmlgen.cpp:64
static QCString g_footer
Definition htmlgen.cpp:66
static QCString g_footer_file
Definition htmlgen.cpp:65
static void writeDefaultStyleSheet(TextStream &t)
Definition htmlgen.cpp:1398
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 latexWriteIndexItem(TextStream &m_t, const QCString &s1, const QCString &s2)
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)
void latexWriteIndexItem(TextStream &t, const QCString &r1, const QCString &s2="")
QCString latexEscapeIndexChars(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:571
#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:6849
void checkBlocks(const QCString &s, const QCString fileName, const SelectionMarkerInfo &markerInfo)
Definition util.cpp:6491
QCString stripPath(const QCString &s)
Definition util.cpp:4902
QCString removeEmptyLines(const QCString &s)
Definition util.cpp:6555
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:6378
QCString substituteKeywords(const QCString &file, const QCString &s, const KeywordSubstitutionList &keywords)
Definition util.cpp:3008
QCString relativePathToRoot(const QCString &name)
Definition util.cpp:3533
void clearSubDirs(const Dir &d)
Definition util.cpp:3621
QCString fileToString(const QCString &name, bool filter, bool isSourceCode)
Definition util.cpp:1444
QCString stripExtensionGeneral(const QCString &fName, const QCString &ext)
Definition util.cpp:4887
void createSubDirs(const Dir &d)
Definition util.cpp:3594
bool checkExtension(const QCString &fName, const QCString &ext)
Definition util.cpp:4870
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:5826
A bunch of utility functions.
bool isId(int c)
Definition util.h:207