From 66a728cdcf50baeef45f78a1180c5ce86fe734af Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 9 Apr 2018 14:30:49 +0200 Subject: Improvement LaTeX output For a number of languages the output in LaTeX has been improved so the regular documentation can be generated (automatically) in LaTeX / PDF as well. --- src/config.xml | 9 +++--- src/dirdef.cpp | 2 +- src/docbookvisitor.cpp | 2 +- src/docparser.cpp | 2 +- src/filedef.cpp | 2 +- src/formula.cpp | 4 +-- src/groupdef.cpp | 2 +- src/htmldocvisitor.cpp | 2 +- src/latexdocvisitor.cpp | 2 +- src/latexgen.cpp | 84 +++++++++++++++++++++++++++++++------------------ src/layout.cpp | 2 +- src/mandocvisitor.cpp | 1 + src/memberdef.cpp | 2 +- src/membergroup.cpp | 1 + src/memberlist.cpp | 2 +- src/namespacedef.cpp | 2 +- src/rtfdocvisitor.cpp | 2 +- src/translator.h | 30 ++++++++++++++++++ src/translator_am.h | 4 +-- src/translator_cn.h | 12 +++++++ src/translator_dk.h | 3 +- src/translator_gr.h | 4 +-- src/translator_je.h | 14 ++++++++- src/translator_jp.h | 12 +++++++ src/translator_ke.h | 12 ++++++- src/translator_kr.h | 12 ++++++- src/translator_lv.h | 2 +- src/translator_no.h | 3 +- src/translator_pl.h | 10 ++++-- src/translator_pt.h | 5 ++- src/translator_sc.h | 5 +++ src/translator_si.h | 2 +- src/translator_tw.h | 12 +++++++ src/translator_vi.h | 16 +++++++++- src/util.cpp | 2 +- src/xmldocvisitor.cpp | 2 +- 36 files changed, 217 insertions(+), 68 deletions(-) diff --git a/src/config.xml b/src/config.xml index 38dfefb..8d897a5 100644 --- a/src/config.xml +++ b/src/config.xml @@ -2533,13 +2533,14 @@ EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ... ]]> - diff --git a/src/dirdef.cpp b/src/dirdef.cpp index b247ba7..eb6f5d1 100644 --- a/src/dirdef.cpp +++ b/src/dirdef.cpp @@ -5,12 +5,12 @@ #include "doxygen.h" #include "util.h" #include "outputlist.h" +#include "config.h" #include "language.h" #include "message.h" #include "dot.h" #include "layout.h" #include "ftextstream.h" -#include "config.h" #include "docparser.h" //---------------------------------------------------------------------- diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index ab10da0..768acda 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -20,6 +20,7 @@ #include "docbookvisitor.h" #include "docparser.h" +#include "config.h" #include "language.h" #include "doxygen.h" #include "outputgen.h" @@ -29,7 +30,6 @@ #include "util.h" #include "parserintf.h" #include "filename.h" -#include "config.h" #include "filedef.h" #include "msc.h" #include "dia.h" diff --git a/src/docparser.cpp b/src/docparser.cpp index 3d57c2e..893c3ff 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -38,6 +38,7 @@ #include "message.h" #include "section.h" #include "searchindex.h" +#include "config.h" #include "language.h" #include "portable.h" #include "cite.h" @@ -50,7 +51,6 @@ #include "namespacedef.h" #include "reflist.h" #include "formula.h" -#include "config.h" #include "growbuf.h" #include "markdown.h" #include "htmlentity.h" diff --git a/src/filedef.cpp b/src/filedef.cpp index 2cfe37a..b919f74 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -23,6 +23,7 @@ #include "classdef.h" #include "namespacedef.h" #include "util.h" +#include "config.h" #include "language.h" #include "outputlist.h" #include "dot.h" @@ -40,7 +41,6 @@ #include "filename.h" #include "membergroup.h" #include "dirdef.h" -#include "config.h" #include "clangparser.h" #include "settings.h" diff --git a/src/formula.cpp b/src/formula.cpp index 6fe617d..9e48b2d 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -25,6 +25,7 @@ #include "util.h" #include "message.h" #include "config.h" +#include "language.h" #include "portable.h" #include "index.h" #include "doxygen.h" @@ -96,8 +97,7 @@ void FormulaList::generateBitmaps(const char *path) { //printf("Running latex...\n"); //system("latex _formulas.tex /dev/null"); - QCString latexCmd = Config_getString(LATEX_CMD_NAME); - if (latexCmd.isEmpty()) latexCmd="latex"; + QCString latexCmd = theTranslator->latexCommandName(); portable_sysTimerStart(); if (portable_system(latexCmd,"_formulas.tex")!=0) { diff --git a/src/groupdef.cpp b/src/groupdef.cpp index ccfa0df..3a060b9 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -23,6 +23,7 @@ #include "classlist.h" #include "outputlist.h" #include "namespacedef.h" +#include "config.h" #include "language.h" #include "util.h" #include "memberlist.h" @@ -39,7 +40,6 @@ #include "entry.h" #include "membername.h" #include "dirdef.h" -#include "config.h" //--------------------------------------------------------------------------- diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 8b6d26c..539aea8 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -19,12 +19,12 @@ #include #include "htmldocvisitor.h" #include "docparser.h" +#include "config.h" #include "language.h" #include "doxygen.h" #include "outputgen.h" #include "dot.h" #include "message.h" -#include "config.h" #include "htmlgen.h" #include "parserintf.h" #include "msc.h" diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index 5a67c15..aa6981e 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -19,6 +19,7 @@ #include #include "latexdocvisitor.h" #include "docparser.h" +#include "config.h" #include "language.h" #include "doxygen.h" #include "outputgen.h" @@ -30,7 +31,6 @@ #include "dia.h" #include "cite.h" #include "filedef.h" -#include "config.h" #include "htmlentity.h" #include "plantuml.h" diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 1511dcb..c192a97 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -271,13 +271,15 @@ static void writeLatexMakefile() exit(1); } // inserted by KONNO Akihisa 2002-03-05 - QCString latex_command = Config_getString(LATEX_CMD_NAME); + QCString latex_command = theTranslator->latexCommandName(); QCString mkidx_command = Config_getString(MAKEINDEX_CMD_NAME); // end insertion by KONNO Akihisa 2002-03-05 FTextStream t(&file); if (!Config_getBool(USE_PDFLATEX)) // use plain old latex { - t << "all: refman.dvi" << endl + t << "LATEX_CMD=" << latex_command << endl + << endl + << "all: refman.dvi" << endl << endl << "ps: refman.ps" << endl << endl @@ -294,7 +296,7 @@ static void writeLatexMakefile() t << "\tps2pdf refman.ps refman.pdf" << endl << endl; t << "refman.dvi: clean refman.tex doxygen.sty" << endl << "\techo \"Running latex...\"" << endl - << "\t" << latex_command << " refman.tex" << endl + << "\t$(LATEX_CMD) refman.tex" << endl << "\techo \"Running makeindex...\"" << endl << "\t" << mkidx_command << " refman.idx" << endl; if (generateBib) @@ -302,19 +304,19 @@ static void writeLatexMakefile() t << "\techo \"Running bibtex...\"" << endl; t << "\tbibtex refman" << endl; t << "\techo \"Rerunning latex....\"" << endl; - t << "\t" << latex_command << " refman.tex" << endl; + t << "\t$(LATEX_CMD) refman.tex" << endl; } t << "\techo \"Rerunning latex....\"" << endl - << "\t" << latex_command << " refman.tex" << endl + << "\t$(LATEX_CMD) refman.tex" << endl << "\tlatex_count=8 ; \\" << endl << "\twhile egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log && [ $$latex_count -gt 0 ] ;\\" << endl << "\t do \\" << endl << "\t echo \"Rerunning latex....\" ;\\" << endl - << "\t " << latex_command << " refman.tex ;\\" << endl + << "\t $(LATEX_CMD) refman.tex ; \\" << endl << "\t latex_count=`expr $$latex_count - 1` ;\\" << endl << "\t done" << endl << "\t" << mkidx_command << " refman.idx" << endl - << "\t" << latex_command << " refman.tex" << endl << endl + << "\t$(LATEX_CMD) refman.tex" << endl << endl << "refman_2on1.ps: refman.ps" << endl << "\tpsnup -2 refman.ps >refman_2on1.ps" << endl << endl @@ -323,26 +325,28 @@ static void writeLatexMakefile() } else // use pdflatex for higher quality output { + t << "LATEX_CMD=" << latex_command << endl + << endl; t << "all: refman.pdf" << endl << endl << "pdf: refman.pdf" << endl << endl; t << "refman.pdf: clean refman.tex" << endl; - t << "\tpdflatex refman" << endl; + t << "\t$(LATEX_CMD) refman" << endl; t << "\t" << mkidx_command << " refman.idx" << endl; if (generateBib) { t << "\tbibtex refman" << endl; - t << "\tpdflatex refman" << endl; + t << "\t$(LATEX_CMD) refman" << endl; } - t << "\tpdflatex refman" << endl + t << "\t$(LATEX_CMD) refman" << endl << "\tlatex_count=8 ; \\" << endl << "\twhile egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log && [ $$latex_count -gt 0 ] ;\\" << endl << "\t do \\" << endl << "\t echo \"Rerunning latex....\" ;\\" << endl - << "\t pdflatex refman ;\\" << endl + << "\t $(LATEX_CMD) refman ;\\" << endl << "\t latex_count=`expr $$latex_count - 1` ;\\" << endl << "\t done" << endl << "\t" << mkidx_command << " refman.idx" << endl - << "\tpdflatex refman" << endl << endl; + << "\t$(LATEX_CMD) refman" << endl << endl; } t << endl @@ -356,7 +360,7 @@ static void writeMakeBat() #if defined(_MSC_VER) QCString dir=Config_getString(LATEX_OUTPUT); QCString fileName=dir+"/make.bat"; - QCString latex_command = Config_getString(LATEX_CMD_NAME); + QCString latex_command = theTranslator->latexCommandName(); QCString mkidx_command = Config_getString(MAKEINDEX_CMD_NAME); QFile file(fileName); bool generateBib = !Doxygen::citeDict->isEmpty(); @@ -371,14 +375,15 @@ static void writeMakeBat() t << "del /s /f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out *.brf *.blg *.bbl refman.pdf\n\n"; if (!Config_getBool(USE_PDFLATEX)) // use plain old latex { - t << latex_command << " refman.tex\n"; + t << "set LATEX_CMD=" << latex_command << "\n"; + t << "%LATEX_CMD% refman.tex\n"; t << "echo ----\n"; t << mkidx_command << " refman.idx\n"; if (generateBib) { t << "bibtex refman\n"; t << "echo ----\n"; - t << latex_command << " refman.tex\n"; + t << "\t%LATEX_CMD% refman.tex\n"; } t << "setlocal enabledelayedexpansion\n"; t << "set count=8\n"; @@ -390,28 +395,29 @@ static void writeMakeBat() t << "set /a count-=1\n"; t << "if !count! EQU 0 goto :skip\n\n"; t << "echo ----\n"; - t << latex_command << " refman.tex\n"; + t << "%LATEX_CMD% refman.tex\n"; t << "goto :repeat\n"; t << ":skip\n"; t << "endlocal\n"; t << mkidx_command << " refman.idx\n"; - t << latex_command << " refman.tex\n"; + t << "%LATEX_CMD% refman.tex\n"; t << "dvips -o refman.ps refman.dvi\n"; t << "gswin32c -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite " "-sOutputFile=refman.pdf -c save pop -f refman.ps\n"; } else // use pdflatex { - t << "pdflatex refman\n"; + t << "set LATEX_CMD=" << latex_command << "\n"; + t << "%LATEX_CMD% refman\n"; t << "echo ----\n"; t << mkidx_command << " refman.idx\n"; if (generateBib) { t << "bibtex refman" << endl; - t << "pdflatex refman" << endl; + t << "%LATEX_CMD% refman" << endl; } t << "echo ----\n"; - t << "pdflatex refman\n\n"; + t << "%LATEX_CMD% refman\n\n"; t << "setlocal enabledelayedexpansion\n"; t << "set count=8\n"; t << ":repeat\n"; @@ -422,12 +428,12 @@ static void writeMakeBat() t << "set /a count-=1\n"; t << "if !count! EQU 0 goto :skip\n\n"; t << "echo ----\n"; - t << "pdflatex refman\n"; + t << "%LATEX_CMD% refman\n"; t << "goto :repeat\n"; t << ":skip\n"; t << "endlocal\n"; t << mkidx_command << " refman.idx\n"; - t << "pdflatex refman\n"; + t << "%LATEX_CMD% refman\n"; t << "cd /D %Dir_Old%\n"; t << "set Dir_Old=\n"; } @@ -504,6 +510,7 @@ static void writeDefaultHeaderPart1(FTextStream &t) "\\usepackage{textcomp}\n" "\\usepackage[nointegrals]{wasysym}\n" "\\usepackage[table]{xcolor}\n" + "\\usepackage{ifpdf,ifxetex}\n" "\n"; // Language support @@ -516,9 +523,13 @@ static void writeDefaultHeaderPart1(FTextStream &t) } // Define default fonts - t << "% Font selection\n" - "\\usepackage[T1]{fontenc}\n" - "\\usepackage[scaled=.90]{helvet}\n" + t << "% Font selection\n"; + QCString fontenc = theTranslator->latexFontenc(); + if (!fontenc.isEmpty()) + { + t << "\\usepackage[" << fontenc << "]{fontenc}\n"; + } + t << "\\usepackage[scaled=.90]{helvet}\n" "\\usepackage{courier}\n" "\\usepackage{amssymb}\n" "\\usepackage{sectsty}\n" @@ -626,11 +637,14 @@ static void writeDefaultHeaderPart1(FTextStream &t) if (pdfHyperlinks) { t << "% Hyperlinks (required, but should be loaded last)\n" - "\\usepackage{ifpdf}\n" "\\ifpdf\n" " \\usepackage[pdftex,pagebackref=true]{hyperref}\n" "\\else\n" - " \\usepackage[ps2pdf,pagebackref=true]{hyperref}\n" + " \\ifxetex\n" + " \\usepackage[pagebackref=true]{hyperref}\n" + " \\else\n" + " \\usepackage[ps2pdf,pagebackref=true]{hyperref}\n" + " \\fi\n" "\\fi\n" "\\hypersetup{%\n" " colorlinks=true,%\n" @@ -656,8 +670,11 @@ static void writeDefaultHeaderPart1(FTextStream &t) t << "%===== C O N T E N T S =====\n" "\n" "\\begin{document}\n"; - if (theTranslator->idLanguage()=="greek") - t << "\\selectlanguage{greek}\n"; + QCString documentPre = theTranslator->latexDocumentPre(); + if (!documentPre.isEmpty()) + { + t << documentPre; + } t << "\n"; // Front matter @@ -750,8 +767,13 @@ static void writeDefaultFooter(FTextStream &t) "\\clearemptydoublepage\n" "\\addcontentsline{toc}{" << unit << "}{" << theTranslator->trRTFGeneralIndex() << "}\n" "\\printindex\n" - "\n" - "\\end{document}\n"; + "\n"; + QCString documentPost = theTranslator->latexDocumentPost(); + if (!documentPost.isEmpty()) + { + t << documentPost; + } + t << "\\end{document}\n"; } void LatexGenerator::writeHeaderFile(QFile &f) diff --git a/src/layout.cpp b/src/layout.cpp index fdc9f4c..cce68cd 100644 --- a/src/layout.cpp +++ b/src/layout.cpp @@ -18,12 +18,12 @@ #include "layout.h" #include "message.h" +#include "config.h" #include "language.h" #include "vhdldocgen.h" #include "util.h" #include "doxygen.h" #include "version.h" -#include "config.h" #include #include diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp index 2233cc6..2ed557c 100644 --- a/src/mandocvisitor.cpp +++ b/src/mandocvisitor.cpp @@ -20,6 +20,7 @@ #include "mandocvisitor.h" #include "docparser.h" +#include "config.h" #include "language.h" #include "doxygen.h" #include "outputgen.h" diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 01f4d8d..922b75d 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -25,6 +25,7 @@ #include "code.h" #include "message.h" #include "htmlhelp.h" +#include "config.h" #include "language.h" #include "outputlist.h" #include "example.h" @@ -43,7 +44,6 @@ #include "memberlist.h" #include "namespacedef.h" #include "filedef.h" -#include "config.h" //----------------------------------------------------------------------------- diff --git a/src/membergroup.cpp b/src/membergroup.cpp index aaa504f..c5144e2 100644 --- a/src/membergroup.cpp +++ b/src/membergroup.cpp @@ -22,6 +22,7 @@ #include "classdef.h" #include "namespacedef.h" #include "filedef.h" +#include "config.h" #include "language.h" #include "groupdef.h" #include "doxygen.h" diff --git a/src/memberlist.cpp b/src/memberlist.cpp index e19cead..5e3dfcf 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -21,6 +21,7 @@ #include "classdef.h" #include "message.h" #include "util.h" +#include "config.h" #include "language.h" #include "doxygen.h" #include "outputlist.h" @@ -30,7 +31,6 @@ #include "namespacedef.h" #include "filedef.h" #include "membergroup.h" -#include "config.h" #include "docparser.h" MemberList::MemberList() : m_listType(MemberListType_pubMethods) diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index d3eb0df..e78b4e9 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -18,6 +18,7 @@ #include "namespacedef.h" #include "outputlist.h" #include "util.h" +#include "config.h" #include "language.h" #include "classdef.h" #include "classlist.h" @@ -29,7 +30,6 @@ #include "vhdldocgen.h" #include "layout.h" #include "membergroup.h" -#include "config.h" //------------------------------------------------------------------ diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index c85b638..d015757 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -20,6 +20,7 @@ #include "rtfdocvisitor.h" #include "docparser.h" +#include "config.h" #include "language.h" #include "doxygen.h" #include "outputgen.h" @@ -32,7 +33,6 @@ #include "msc.h" #include "dia.h" #include "filedef.h" -#include "config.h" #include "htmlentity.h" #include "plantuml.h" diff --git a/src/translator.h b/src/translator.h index 7092174..0f94ed0 100644 --- a/src/translator.h +++ b/src/translator.h @@ -41,6 +41,36 @@ class Translator virtual QCString idLanguage() = 0; virtual QCString latexLanguageSupportCommand() = 0; + /*! + * Sets the LaTeX font encoding to be used. The default is set to `T1`, + * in case another font encoding has to be used this can be specified with + * this routine. In case no font encoding is required the empty string + * can be returned. + */ + virtual QCString latexFontenc() { return "T1"; }; + /*! + * Sets the commands to be insered directly after the `\\begin{document}` + * in the LaTeX document. + */ + virtual QCString latexDocumentPre() { return ""; }; + /*! + * Sets the commands to be insered directly before the `\\end{document}` + * in the LaTeX document. + */ + virtual QCString latexDocumentPost() { return ""; }; + /*! + * Set the name to be used as latex command. + */ + virtual QCString latexCommandName() + { + QCString latex_command = Config_getString(LATEX_CMD_NAME); + if (latex_command.isEmpty()) latex_command = "latex"; + if (Config_getBool(USE_PDFLATEX)) + { + if (latex_command == "latex") latex_command = "pdflatex"; + } + return latex_command; + } // --- Language translation methods ------------------- diff --git a/src/translator_am.h b/src/translator_am.h index 6f5e671..5b4c446 100644 --- a/src/translator_am.h +++ b/src/translator_am.h @@ -32,8 +32,8 @@ class TranslatorArmenian : public TranslatorAdapter_1_8_0 /* Used to get the command(s) for the language support. */ virtual QCString latexLanguageSupportCommand() { - return "
\\usepackage[latin]{armtex}\n"
-			   "\\usepackage[armscii8]{inputenc}\n
"; + return "\\usepackage[latin]{armtex}\n" + "\\usepackage[armscii8]{inputenc}\n"; } // --- Language translation methods ------------------- diff --git a/src/translator_cn.h b/src/translator_cn.h index fc0cf3c..e53f31d 100644 --- a/src/translator_cn.h +++ b/src/translator_cn.h @@ -53,8 +53,20 @@ class TranslatorChinese : public Translator */ virtual QCString latexLanguageSupportCommand() { + return "\\usepackage{CJKutf8}\n"; + } + virtual QCString latexFontenc() + { return ""; } + virtual QCString latexDocumentPre() + { + return "\\begin{CJK}{UTF8}{min}\n"; + } + virtual QCString latexDocumentPost() + { + return "\\end{CJK}\n"; + } /*! used in the compound documentation before a list of related functions. */ diff --git a/src/translator_dk.h b/src/translator_dk.h index e98cfa8..70e9032 100644 --- a/src/translator_dk.h +++ b/src/translator_dk.h @@ -116,8 +116,7 @@ class TranslatorDanish : public TranslatorAdapter_1_8_0 virtual QCString latexLanguageSupportCommand() { return - "\\usepackage[danish]{babel}\n" - "\\usepackage[T1]{fontenc}\n"; + "\\usepackage[danish]{babel}\n"; } // --- Language translation methods ------------------- diff --git a/src/translator_gr.h b/src/translator_gr.h index 8b7afe1..0ae3e2f 100644 --- a/src/translator_gr.h +++ b/src/translator_gr.h @@ -59,8 +59,8 @@ class TranslatorGreek : public Translator virtual QCString latexLanguageSupportCommand() { - //return "\\usepackage[greek,english]{babel}\n\\usepackage[iso-8859-7]{inputenc}\n"; - return "\\usepackage[greek,english]{babel}\n"; + return "\\usepackage[greek,english]{babel}\n" + "\\usepackage{alphabeta}\n"; } // --- Language translation methods ------------------- diff --git a/src/translator_je.h b/src/translator_je.h index 835a516..d555421 100644 --- a/src/translator_je.h +++ b/src/translator_je.h @@ -36,7 +36,19 @@ class TranslatorJapaneseEn : public TranslatorEnglish { return "japanese-en"; } virtual QCString latexLanguageSupportCommand() { - return "platex"; + return "\\usepackage{CJKutf8}\n"; + } + virtual QCString latexFontenc() + { + return ""; + } + virtual QCString latexDocumentPre() + { + return "\\begin{CJK}{UTF8}{min}\n"; + } + virtual QCString latexDocumentPost() + { + return "\\end{CJK}\n"; } virtual QCString trRTFansicp() { diff --git a/src/translator_jp.h b/src/translator_jp.h index c4f92c2..43c5dc2 100644 --- a/src/translator_jp.h +++ b/src/translator_jp.h @@ -77,8 +77,20 @@ class TranslatorJapanese : public Translator virtual QCString latexLanguageSupportCommand() { + return "\\usepackage{CJKutf8}\n"; + } + virtual QCString latexFontenc() + { return ""; } + virtual QCString latexDocumentPre() + { + return "\\begin{CJK}{UTF8}{min}\n"; + } + virtual QCString latexDocumentPost() + { + return "\\end{CJK}\n"; + } /*! used in the compound documentation before a list of related functions. */ virtual QCString trRelatedFunctions() diff --git a/src/translator_ke.h b/src/translator_ke.h index 525cf84..c9f488c 100644 --- a/src/translator_ke.h +++ b/src/translator_ke.h @@ -35,12 +35,22 @@ class TranslatorKoreanEn : public TranslatorEnglish { return "korean-en"; } virtual QCString latexLanguageSupportCommand() { - return "\\usepackage{hfont}\n"; + return "\\usepackage{kotex}\n"; } virtual QCString trRTFansicp() { return "949"; } + virtual QCString latexCommandName() + { + QCString latex_command = Config_getString(LATEX_CMD_NAME); + if (latex_command.isEmpty()) latex_command = "latex"; + if (Config_getBool(USE_PDFLATEX)) + { + if (latex_command == "latex") latex_command = "xelatex"; + } + return latex_command; + } /*! Used as ansicpg for RTF fcharset * \see trRTFansicp() for a table of possible values. diff --git a/src/translator_kr.h b/src/translator_kr.h index 7e95e3b..80ccc78 100644 --- a/src/translator_kr.h +++ b/src/translator_kr.h @@ -86,7 +86,17 @@ class TranslatorKorean : public Translator // I'm not sure what this should be. // When I figure it out, I'll update this. // see http://www.ktug.or.kr/jsboard/read.php?table=operate&no=4422&page=1 - return "\\usepackage{hfont}\n"; + return "\\usepackage{kotex}\n"; + } + virtual QCString latexCommandName() + { + QCString latex_command = Config_getString(LATEX_CMD_NAME); + if (latex_command.isEmpty()) latex_command = "latex"; + if (Config_getBool(USE_PDFLATEX)) + { + if (latex_command == "latex") latex_command = "xelatex"; + } + return latex_command; } // --- Language translation methods ------------------- diff --git a/src/translator_lv.h b/src/translator_lv.h index 2736bb0..bd579da 100644 --- a/src/translator_lv.h +++ b/src/translator_lv.h @@ -76,7 +76,7 @@ class TranslatorLatvian : public TranslatorAdapter_1_8_4 */ virtual QCString latexLanguageSupportCommand() { - return "\\usepackage[LV]{fontenc}\n" + return "\\usepackage[T2A]{fontenc}\n" "\\usepackage[latvian]{babel}\n"; } diff --git a/src/translator_no.h b/src/translator_no.h index 58b596a..eccd952 100644 --- a/src/translator_no.h +++ b/src/translator_no.h @@ -72,8 +72,7 @@ class TranslatorNorwegian : public TranslatorAdapter_1_4_6 virtual QCString latexLanguageSupportCommand() { return - "\\usepackage[norwegian]{babel}\n" - "\\usepackage[T1]{fontenc}\n"; + "\\usepackage[norsk]{babel}\n"; } // --- Language translation methods ------------------- diff --git a/src/translator_pl.h b/src/translator_pl.h index 421f407..e0ecc8f 100644 --- a/src/translator_pl.h +++ b/src/translator_pl.h @@ -44,8 +44,14 @@ class TranslatorPolish : public TranslatorAdapter_1_8_2 */ QCString latexLanguageSupportCommand() { - return "\\usepackage{polski}\n" - "\\usepackage[T1]{fontenc}\n"; + return "\\usepackage[polish]{babel}\n" + "\\let\\lll\\undefined\n"; /* to overcome problems with the <<< + symbol as defined in the amssymb + package, and the Polish symbol + "Latin Small Letter L With Stroke" + ł or ł or ł + We take the amssymb symbol as leading. + */ } // --- Language translation methods ------------------- diff --git a/src/translator_pt.h b/src/translator_pt.h index c58bf64..25c5762 100644 --- a/src/translator_pt.h +++ b/src/translator_pt.h @@ -85,7 +85,10 @@ class TranslatorPortuguese : public Translator * the empty string is returned in this implementation. */ virtual QCString latexLanguageSupportCommand() - { return "Portuguese"; } + { + return + "\\usepackage[portuges]{babel}\n"; + } // --- Language translation methods ------------------- diff --git a/src/translator_sc.h b/src/translator_sc.h index d2b3954..e8191df 100644 --- a/src/translator_sc.h +++ b/src/translator_sc.h @@ -71,6 +71,11 @@ class TranslatorSerbianCyrillic : public TranslatorAdapter_1_6_0 */ virtual QCString latexLanguageSupportCommand() { + return "\\usepackage[T2A]{fontenc}\n" + "\\usepackage[russian]{babel}\n"; + } + virtual QCString latexFontenc() + { return ""; } diff --git a/src/translator_si.h b/src/translator_si.h index 792053e..2dd7e5b 100644 --- a/src/translator_si.h +++ b/src/translator_si.h @@ -36,7 +36,7 @@ class TranslatorSlovene : public TranslatorAdapter_1_4_6 */ QCString latexLanguageSupportCommand() { - return "\\usepackage[slovene]{babel}\n\\usepackage[T1]{fontenc}\n"; + return "\\usepackage[slovene]{babel}\n"; } QCString trRelatedFunctions() { return "Povezane funkcije"; } diff --git a/src/translator_tw.h b/src/translator_tw.h index 26a6db6..46237ca 100644 --- a/src/translator_tw.h +++ b/src/translator_tw.h @@ -72,8 +72,20 @@ class TranslatorChinesetraditional : public Translator */ virtual QCString latexLanguageSupportCommand() { + return "\\usepackage{CJKutf8}\n"; + } + virtual QCString latexFontenc() + { return ""; } + virtual QCString latexDocumentPre() + { + return "\\begin{CJK}{UTF8}{min}\n"; + } + virtual QCString latexDocumentPost() + { + return "\\end{CJK}\n"; + } // --- Language translation methods ------------------- diff --git a/src/translator_vi.h b/src/translator_vi.h index a0046b0..b391b0c 100644 --- a/src/translator_vi.h +++ b/src/translator_vi.h @@ -78,9 +78,23 @@ class TranslatorVietnamese : public TranslatorAdapter_1_6_0 */ virtual QCString latexLanguageSupportCommand() { + return + "\\usepackage[vietnamese]{babel}\n"; + } + virtual QCString latexFontenc() + { return ""; } - + virtual QCString latexCommandName() + { + QCString latex_command = Config_getString(LATEX_CMD_NAME); + if (latex_command.isEmpty()) latex_command = "latex"; + if (Config_getBool(USE_PDFLATEX)) + { + if (latex_command == "latex") latex_command = "xelatex"; + } + return latex_command; + } // --- Language translation methods ------------------- /*! used in the compound documentation before a list of related functions. */ diff --git a/src/util.cpp b/src/util.cpp index 9100706..25b805a 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -35,8 +35,8 @@ #include "doxygen.h" #include "outputlist.h" #include "defargs.h" -#include "language.h" #include "config.h" +#include "language.h" #include "htmlhelp.h" #include "example.h" #include "version.h" diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index 93765b1..a4bc40b 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -20,6 +20,7 @@ #include "xmldocvisitor.h" #include "docparser.h" +#include "config.h" #include "language.h" #include "doxygen.h" #include "outputgen.h" @@ -29,7 +30,6 @@ #include "util.h" #include "parserintf.h" #include "filename.h" -#include "config.h" #include "htmlentity.h" static void visitCaption(XmlDocVisitor *parent, QList children) -- cgit v0.12 From 496ebe413b20d406ef4a3b6b2a5966461c30af6c Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 9 Apr 2018 15:27:31 +0200 Subject: Improvement LaTeX output (Regression) 1) Build error: Unexpected token 'semic' on the line 50 in '/home/travis/build/doxygen/doxygen/build/src/translator.h'. status = 2 in collectPureVirtualPrototypes() Due to a discrepancy what translator.py expects and is in the actual code. In the actual code a (not required) ; was present after the closing } of the routine. 2) Unknown command \cpdflatex --- src/config.xml | 2 +- src/translator.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config.xml b/src/config.xml index 8d897a5..d4c8c4a 100644 --- a/src/config.xml +++ b/src/config.xml @@ -2538,7 +2538,7 @@ EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ... Note that when not enabling \ref cfg_use_pdflatex "USE_PDFLATEX" the default is \c latex when - enabling \ref cfg_use_pdflatex "USE_PDFLATEX" the default is \cpdflatex and when in the later case + enabling \ref cfg_use_pdflatex "USE_PDFLATEX" the default is \c pdflatex and when in the later case \c latex is chosen this is overwritten by \c pdflatex. For specific output languages the default can have been set differently, this depends on the implementation of the output language. ]]> diff --git a/src/translator.h b/src/translator.h index 0f94ed0..2c15c81 100644 --- a/src/translator.h +++ b/src/translator.h @@ -47,17 +47,17 @@ class Translator * this routine. In case no font encoding is required the empty string * can be returned. */ - virtual QCString latexFontenc() { return "T1"; }; + virtual QCString latexFontenc() { return "T1"; } /*! * Sets the commands to be insered directly after the `\\begin{document}` * in the LaTeX document. */ - virtual QCString latexDocumentPre() { return ""; }; + virtual QCString latexDocumentPre() { return ""; } /*! * Sets the commands to be insered directly before the `\\end{document}` * in the LaTeX document. */ - virtual QCString latexDocumentPost() { return ""; }; + virtual QCString latexDocumentPost() { return ""; } /*! * Set the name to be used as latex command. */ -- cgit v0.12 From d4b5fa51ec2ad9dd2ba59e16fa85c53f9015755f Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Tue, 22 May 2018 21:10:42 +0200 Subject: Moved #include "config.h" back to the original place --- src/dirdef.cpp | 2 +- src/docbookvisitor.cpp | 2 +- src/docparser.cpp | 2 +- src/filedef.cpp | 2 +- src/groupdef.cpp | 2 +- src/htmldocvisitor.cpp | 2 +- src/latexdocvisitor.cpp | 2 +- src/layout.cpp | 2 +- src/mandocvisitor.cpp | 1 - src/memberdef.cpp | 2 +- src/membergroup.cpp | 1 - src/memberlist.cpp | 2 +- src/namespacedef.cpp | 2 +- src/rtfdocvisitor.cpp | 2 +- src/translator.h | 1 + src/util.cpp | 2 +- src/xmldocvisitor.cpp | 2 +- 17 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/dirdef.cpp b/src/dirdef.cpp index 9a94050..6631ed7 100644 --- a/src/dirdef.cpp +++ b/src/dirdef.cpp @@ -5,12 +5,12 @@ #include "doxygen.h" #include "util.h" #include "outputlist.h" -#include "config.h" #include "language.h" #include "message.h" #include "dot.h" #include "layout.h" #include "ftextstream.h" +#include "config.h" #include "docparser.h" //---------------------------------------------------------------------- diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index 768acda..ab10da0 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -20,7 +20,6 @@ #include "docbookvisitor.h" #include "docparser.h" -#include "config.h" #include "language.h" #include "doxygen.h" #include "outputgen.h" @@ -30,6 +29,7 @@ #include "util.h" #include "parserintf.h" #include "filename.h" +#include "config.h" #include "filedef.h" #include "msc.h" #include "dia.h" diff --git a/src/docparser.cpp b/src/docparser.cpp index e767862..29c6ca7 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -38,7 +38,6 @@ #include "message.h" #include "section.h" #include "searchindex.h" -#include "config.h" #include "language.h" #include "portable.h" #include "cite.h" @@ -51,6 +50,7 @@ #include "namespacedef.h" #include "reflist.h" #include "formula.h" +#include "config.h" #include "growbuf.h" #include "markdown.h" #include "htmlentity.h" diff --git a/src/filedef.cpp b/src/filedef.cpp index 312f865..e2df9be 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -23,7 +23,6 @@ #include "classdef.h" #include "namespacedef.h" #include "util.h" -#include "config.h" #include "language.h" #include "outputlist.h" #include "dot.h" @@ -41,6 +40,7 @@ #include "filename.h" #include "membergroup.h" #include "dirdef.h" +#include "config.h" #include "clangparser.h" #include "settings.h" diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 3a060b9..ccfa0df 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -23,7 +23,6 @@ #include "classlist.h" #include "outputlist.h" #include "namespacedef.h" -#include "config.h" #include "language.h" #include "util.h" #include "memberlist.h" @@ -40,6 +39,7 @@ #include "entry.h" #include "membername.h" #include "dirdef.h" +#include "config.h" //--------------------------------------------------------------------------- diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index e0f9038..6a9c142 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -19,12 +19,12 @@ #include #include "htmldocvisitor.h" #include "docparser.h" -#include "config.h" #include "language.h" #include "doxygen.h" #include "outputgen.h" #include "dot.h" #include "message.h" +#include "config.h" #include "htmlgen.h" #include "parserintf.h" #include "msc.h" diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index 7080d02..86ceade 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -19,7 +19,6 @@ #include #include "latexdocvisitor.h" #include "docparser.h" -#include "config.h" #include "language.h" #include "doxygen.h" #include "outputgen.h" @@ -31,6 +30,7 @@ #include "dia.h" #include "cite.h" #include "filedef.h" +#include "config.h" #include "htmlentity.h" #include "plantuml.h" diff --git a/src/layout.cpp b/src/layout.cpp index cce68cd..fdc9f4c 100644 --- a/src/layout.cpp +++ b/src/layout.cpp @@ -18,12 +18,12 @@ #include "layout.h" #include "message.h" -#include "config.h" #include "language.h" #include "vhdldocgen.h" #include "util.h" #include "doxygen.h" #include "version.h" +#include "config.h" #include #include diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp index 2ed557c..2233cc6 100644 --- a/src/mandocvisitor.cpp +++ b/src/mandocvisitor.cpp @@ -20,7 +20,6 @@ #include "mandocvisitor.h" #include "docparser.h" -#include "config.h" #include "language.h" #include "doxygen.h" #include "outputgen.h" diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 256865b..0bd0701 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -25,7 +25,6 @@ #include "code.h" #include "message.h" #include "htmlhelp.h" -#include "config.h" #include "language.h" #include "outputlist.h" #include "example.h" @@ -44,6 +43,7 @@ #include "memberlist.h" #include "namespacedef.h" #include "filedef.h" +#include "config.h" //----------------------------------------------------------------------------- diff --git a/src/membergroup.cpp b/src/membergroup.cpp index c5144e2..aaa504f 100644 --- a/src/membergroup.cpp +++ b/src/membergroup.cpp @@ -22,7 +22,6 @@ #include "classdef.h" #include "namespacedef.h" #include "filedef.h" -#include "config.h" #include "language.h" #include "groupdef.h" #include "doxygen.h" diff --git a/src/memberlist.cpp b/src/memberlist.cpp index 5e3dfcf..e19cead 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -21,7 +21,6 @@ #include "classdef.h" #include "message.h" #include "util.h" -#include "config.h" #include "language.h" #include "doxygen.h" #include "outputlist.h" @@ -31,6 +30,7 @@ #include "namespacedef.h" #include "filedef.h" #include "membergroup.h" +#include "config.h" #include "docparser.h" MemberList::MemberList() : m_listType(MemberListType_pubMethods) diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index e78b4e9..d3eb0df 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -18,7 +18,6 @@ #include "namespacedef.h" #include "outputlist.h" #include "util.h" -#include "config.h" #include "language.h" #include "classdef.h" #include "classlist.h" @@ -30,6 +29,7 @@ #include "vhdldocgen.h" #include "layout.h" #include "membergroup.h" +#include "config.h" //------------------------------------------------------------------ diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index d015757..c85b638 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -20,7 +20,6 @@ #include "rtfdocvisitor.h" #include "docparser.h" -#include "config.h" #include "language.h" #include "doxygen.h" #include "outputgen.h" @@ -33,6 +32,7 @@ #include "msc.h" #include "dia.h" #include "filedef.h" +#include "config.h" #include "htmlentity.h" #include "plantuml.h" diff --git a/src/translator.h b/src/translator.h index 2c15c81..f572f57 100644 --- a/src/translator.h +++ b/src/translator.h @@ -19,6 +19,7 @@ #define TRANSLATOR_H #include "classdef.h" +#include "config.h" /** Abstract base class for all translatable text fragments. */ class Translator diff --git a/src/util.cpp b/src/util.cpp index 37608bd..ff0d0c6 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -35,8 +35,8 @@ #include "doxygen.h" #include "outputlist.h" #include "defargs.h" -#include "config.h" #include "language.h" +#include "config.h" #include "htmlhelp.h" #include "example.h" #include "version.h" diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index a4bc40b..93765b1 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -20,7 +20,6 @@ #include "xmldocvisitor.h" #include "docparser.h" -#include "config.h" #include "language.h" #include "doxygen.h" #include "outputgen.h" @@ -30,6 +29,7 @@ #include "util.h" #include "parserintf.h" #include "filename.h" +#include "config.h" #include "htmlentity.h" static void visitCaption(XmlDocVisitor *parent, QList children) -- cgit v0.12