diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2000-07-23 15:31:35 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2000-07-23 15:31:35 (GMT) |
commit | 7295388a3c6b3a12a77dc7a56862333c97e4ccb6 (patch) | |
tree | 191fcbf13137ceda80267e217af7556d5a1f194e /src/latexgen.cpp | |
parent | 4c7970f62fae48e85aee5b1d2a6d3d505e25c9b0 (diff) | |
download | Doxygen-7295388a3c6b3a12a77dc7a56862333c97e4ccb6.zip Doxygen-7295388a3c6b3a12a77dc7a56862333c97e4ccb6.tar.gz Doxygen-7295388a3c6b3a12a77dc7a56862333c97e4ccb6.tar.bz2 |
Release-1.2.0
Diffstat (limited to 'src/latexgen.cpp')
-rw-r--r-- | src/latexgen.cpp | 251 |
1 files changed, 147 insertions, 104 deletions
diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 1a19618..1f2e1a2 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -96,6 +96,7 @@ LatexGenerator::LatexGenerator() : OutputGenerator() col=0; //printf("LatexGenerator::LatexGenerator() insideTabbing=FALSE\n"); insideTabbing=FALSE; + firstDescItem=TRUE; } LatexGenerator::~LatexGenerator() @@ -113,6 +114,7 @@ void LatexGenerator::append(const OutputGenerator *g) t << g->getContents(); col+=((LatexGenerator *)g)->col; insideTabbing=insideTabbing || ((LatexGenerator *)g)->insideTabbing; + firstDescItem = ((LatexGenerator *)g)->firstDescItem; //printf("LatexGenerator::append(%s) insideTabbing=%s\n", g->getContents().data(), // insideTabbing ? "TRUE" : "FALSE" ); } @@ -175,7 +177,7 @@ void LatexGenerator::init() << "\trm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out" << endl; } -static void writeDefaultsStyleSheetPart1(QTextStream &t) +static void writeDefaultHeaderPart1(QTextStream &t) { // part 1 @@ -252,7 +254,7 @@ static void writeDefaultsStyleSheetPart1(QTextStream &t) } -static void writeDefaultsStyleSheetPart2(QTextStream &t) +static void writeDefaultHeaderPart2(QTextStream &t) { // part 2 t << "}\\\\" << endl @@ -260,7 +262,7 @@ static void writeDefaultsStyleSheetPart2(QTextStream &t) << "{\\large "; } -static void writeDefaultsStyleSheetPart3(QTextStream &t) +static void writeDefaultHeaderPart3(QTextStream &t) { // part 3 t << " Doxygen " << versionString << "}\\\\" << endl @@ -275,16 +277,112 @@ static void writeDefaultsStyleSheetPart3(QTextStream &t) t << "\\pagenumbering{arabic}\n"; } -void LatexGenerator::writeStyleSheetFile(QFile &f) +static void writeDefaultStyleSheetPart1(QTextStream &t) +{ + // part 1 + t << "\\NeedsTeXFormat{LaTeX2e}\n"; + t << "\\ProvidesPackage{doxygen}\n"; + t << "\\RequirePackage{calc}\n"; + t << "\\RequirePackage{array}\n"; + t << "\\pagestyle{fancyplain}\n"; + t << "\\addtolength{\\headwidth}{\\marginparsep}\n"; + t << "\\addtolength{\\headwidth}{\\marginparwidth}\n"; + t << "\\newcommand{\\clearemptydoublepage}{\\newpage{\\pagestyle{empty}"; + t << "\\cleardoublepage}}\n"; + if (!Config::compactLatexFlag) + t << "\\renewcommand{\\chaptermark}[1]{\\markboth{#1}{}}\n"; + t << "\\renewcommand{\\sectionmark}[1]{\\markright{\\thesection\\ #1}}\n"; + t << "\\lhead[\\fancyplain{}{\\bfseries\\thepage}]\n"; + t << " {\\fancyplain{}{\\bfseries\\rightmark}}\n"; + t << "\\rhead[\\fancyplain{}{\\bfseries\\leftmark}]\n"; + t << " {\\fancyplain{}{\\bfseries\\thepage}}\n"; + t << "\\rfoot[\\fancyplain{}{\\bfseries\\scriptsize "; +} + +static void writeDefaultStyleSheetPart2(QTextStream &t) +{ + t << "\\lfoot[]{\\fancyplain{}{\\bfseries\\scriptsize "; +} + +static void writeDefaultStyleSheetPart3(QTextStream &t) +{ + t << "}}\n"; + t << "\\cfoot{}\n"; + t << "\\newenvironment{CompactList}\n"; + t << "{\\begin{list}{}{\n"; + t << " \\setlength{\\leftmargin}{0.5cm}\n"; + t << " \\setlength{\\itemsep}{0pt}\n"; + t << " \\setlength{\\parsep}{0pt}\n"; + t << " \\setlength{\\topsep}{0pt}\n"; + t << " \\renewcommand{\\makelabel}{}}}\n"; + t << "{\\end{list}}\n"; + t << "\\newenvironment{CompactItemize}\n"; + t << "{\n"; + t << " \\begin{itemize}\n"; + t << " \\setlength{\\itemsep}{-3pt}\n"; + t << " \\setlength{\\parsep}{0pt}\n"; + t << " \\setlength{\\topsep}{0pt}\n"; + t << " \\setlength{\\partopsep}{0pt}\n"; + t << "}\n"; + t << "{\\end{itemize}}\n"; + t << "\\newcommand{\\PBS}[1]{\\let\\temp=\\\\#1\\let\\\\=\\temp}\n"; + t << "\\newlength{\\tmplength}\n"; + t << "\\newenvironment{TabularC}[1]\n"; + t << "{\n"; + t << "\\setlength{\\tmplength}\n"; + t << " {\\linewidth/(#1)-\\tabcolsep*2-\\arrayrulewidth*(#1+1)/(#1)}\n"; + t << " \\par\\begin{tabular*}{\\linewidth}\n"; + t << " {*{#1}{|>{\\PBS\\raggedright\\hspace{0pt}}p{\\the\\tmplength}}|}\n"; + t << "}\n"; + t << "{\\end{tabular*}\\par}\n"; + t << "\\newcommand{\\entrylabel}[1]{\n"; + t << " {\\parbox[b]{\\labelwidth-4pt}{\\makebox[0pt][l]{\\textbf{#1}}\\\\}}}\n"; + t << "\\newenvironment{Desc}\n"; + t << "{\\begin{list}{}\n"; + t << " {\n"; + t << " \\settowidth{\\labelwidth}{40pt}\n"; + t << " \\setlength{\\leftmargin}{\\labelwidth}\n"; + t << " \\setlength{\\parsep}{0pt}\n"; + t << " \\setlength{\\itemsep}{-4pt}\n"; + t << " \\renewcommand{\\makelabel}{\\entrylabel}\n"; + t << " }\n"; + t << "}\n"; + t << "{\\end{list}}\n"; + + t << "\\newenvironment{Indent}\n"; + t << " {\\begin{list}{}{\\setlength{\\leftmargin}{0.5cm}}\n"; + t << " \\item[]\\ignorespaces}\n"; + t << " {\\unskip\\end{list}}\n"; + + t << "\\setlength{\\parindent}{0cm}\n"; + t << "\\setlength{\\parskip}{0.2cm}\n"; + t << "\\addtocounter{secnumdepth}{1}\n"; + t << "\\sloppy\n"; +} + +void LatexGenerator::writeHeaderFile(QFile &f) { QTextStream t(&f); - writeDefaultsStyleSheetPart1(t); + writeDefaultHeaderPart1(t); t << "Your title here"; - writeDefaultsStyleSheetPart2(t); + writeDefaultHeaderPart2(t); t << "Generated by"; - writeDefaultsStyleSheetPart3(t); + writeDefaultHeaderPart3(t); } +void LatexGenerator::writeStyleSheetFile(QFile &f) +{ + QTextStream t(&f); + writeDefaultStyleSheetPart1(t); + t << "Generated at " << dateToString(TRUE); + if (Config::projectName.isEmpty()) t << " for " << Config::projectName << " "; + t << "by doxygen written by Dimitri van Heesch \\copyright{} 1997-2000"; + writeDefaultStyleSheetPart2(t); + t << "Generated at " << dateToString(TRUE); + if (Config::projectName.isEmpty()) t << " for " << Config::projectName << " "; + t << "by doxygen written by Dimitri van Heesch \\copyright{} 1997-2000"; + writeDefaultStyleSheetPart3(t); +} void LatexGenerator::startFile(const char *name,const char *,bool) { @@ -316,7 +414,7 @@ void LatexGenerator::startIndexSection(IndexSections is) { if (Config::latexHeaderFile.isEmpty()) { - writeDefaultsStyleSheetPart1(t); + writeDefaultHeaderPart1(t); } else { @@ -328,7 +426,7 @@ void LatexGenerator::startIndexSection(IndexSections is) case isTitlePageAuthor: if (Config::latexHeaderFile.isEmpty()) { - writeDefaultsStyleSheetPart2(t); + writeDefaultHeaderPart2(t); } break; case isMainPage: @@ -365,7 +463,7 @@ void LatexGenerator::startIndexSection(IndexSections is) bool found=FALSE; while (gd && !found) { - if (gd->isLinkableInProject() || gd->countMembers()>0) + if (gd->countMembers()>0) { if (Config::compactLatexFlag) t << "\\section"; else t << "\\chapter"; t << "{"; //Module Documentation}\n"; @@ -381,7 +479,7 @@ void LatexGenerator::startIndexSection(IndexSections is) bool found=FALSE; while (nd && !found) { - if (nd->isLinkableInProject()) + if (nd->isLinkableInProject() && nd->countMembers()>0) { if (Config::compactLatexFlag) t << "\\section"; else t << "\\chapter"; t << "{"; // Namespace Documentation}\n": @@ -458,7 +556,7 @@ void LatexGenerator::endIndexSection(IndexSections is) case isTitlePageAuthor: if (Config::latexHeaderFile.isEmpty()) { - writeDefaultsStyleSheetPart3(t); + writeDefaultHeaderPart3(t); } break; case isMainPage: @@ -512,7 +610,7 @@ void LatexGenerator::endIndexSection(IndexSections is) bool found=FALSE; while (nd && !found) { - if (nd->isLinkableInProject() || nd->countMembers()>0) + if (nd->isLinkableInProject() && nd->countMembers()>0) { t << "}\n\\input{" << nd->getOutputFileBase() << "}\n"; found=TRUE; @@ -521,7 +619,7 @@ void LatexGenerator::endIndexSection(IndexSections is) } while (nd) { - if (nd->isLinkableInProject() || nd->countMembers()>0) + if (nd->isLinkableInProject() && nd->countMembers()>0) { if (Config::compactLatexFlag) t << "\\input"; else t << "\\include"; t << "{" << nd->getOutputFileBase() << "}\n"; @@ -640,23 +738,7 @@ void LatexGenerator::writeStyleInfo(int part) { //QCString pname=Config::projectName.stripWhiteSpace(); startPlainFile("doxygen.sty"); - t << "\\NeedsTeXFormat{LaTeX2e}\n"; - t << "\\ProvidesPackage{doxygen}\n"; - t << "\\RequirePackage{calc}\n"; - t << "\\RequirePackage{array}\n"; - t << "\\pagestyle{fancyplain}\n"; - t << "\\addtolength{\\headwidth}{\\marginparsep}\n"; - t << "\\addtolength{\\headwidth}{\\marginparwidth}\n"; - t << "\\newcommand{\\clearemptydoublepage}{\\newpage{\\pagestyle{empty}"; - t << "\\cleardoublepage}}\n"; - if (!Config::compactLatexFlag) - t << "\\renewcommand{\\chaptermark}[1]{\\markboth{#1}{}}\n"; - t << "\\renewcommand{\\sectionmark}[1]{\\markright{\\thesection\\ #1}}\n"; - t << "\\lhead[\\fancyplain{}{\\bfseries\\thepage}]\n"; - t << " {\\fancyplain{}{\\bfseries\\rightmark}}\n"; - t << "\\rhead[\\fancyplain{}{\\bfseries\\leftmark}]\n"; - t << " {\\fancyplain{}{\\bfseries\\thepage}}\n"; - t << "\\rfoot[\\fancyplain{}{\\bfseries\\scriptsize "; + writeDefaultStyleSheetPart1(t); } break; case 1: @@ -665,83 +747,15 @@ void LatexGenerator::writeStyleInfo(int part) break; case 2: { - t << " Dimitri van Heesch \\copyright{} 1997-2000}]{}\n"; - //QCString dtString=dateToString(FALSE); - t << "\\lfoot[]{\\fancyplain{}{\\bfseries\\scriptsize "; + t << " Dimitri van Heesch \\copyright{} 1997-2000"; + t << "}]{}\n"; + writeDefaultStyleSheetPart2(t); } break; case 4: { - t << " Dimitri van Heesch \\copyright{} 1997-2000}}\n"; - t << "\\cfoot{}\n"; - t << "\\newenvironment{CompactList}\n"; - t << "{\\begin{list}{}{\n"; - t << " \\setlength{\\leftmargin}{0.5cm}\n"; - t << " \\setlength{\\itemsep}{0pt}\n"; - t << " \\setlength{\\parsep}{0pt}\n"; - t << " \\setlength{\\topsep}{0pt}\n"; - t << " \\renewcommand{\\makelabel}{}}}\n"; - t << "{\\end{list}}\n"; - t << "\\newenvironment{CompactItemize}\n"; - t << "{\n"; - t << " \\begin{itemize}\n"; - t << " \\setlength{\\itemsep}{-3pt}\n"; - t << " \\setlength{\\parsep}{0pt}\n"; - t << " \\setlength{\\topsep}{0pt}\n"; - t << " \\setlength{\\partopsep}{0pt}\n"; - t << "}\n"; - t << "{\\end{itemize}}\n"; - t << "\\newcommand{\\PBS}[1]{\\let\\temp=\\\\#1\\let\\\\=\\temp}\n"; - t << "\\newlength{\\tmplength}\n"; - t << "\\newenvironment{TabularC}[1]\n"; - t << "{\n"; - t << "\\setlength{\\tmplength}\n"; - t << " {\\linewidth/(#1)-\\tabcolsep*2-\\arrayrulewidth*(#1+1)/(#1)}\n"; - t << " \\par\\begin{tabular*}{\\linewidth}\n"; - t << " {*{#1}{|>{\\PBS\\raggedright\\hspace{0pt}}p{\\the\\tmplength}}|}\n"; - t << "}\n"; - t << "{\\end{tabular*}\\par}\n"; - t << "\\newcommand{\\entrylabel}[1]{\n"; - t << " {\\parbox[b]{\\labelwidth-4pt}{\\makebox[0pt][l]{\\textbf{#1}}\\\\}}}\n"; - t << "\\newenvironment{Desc}\n"; - t << "{\\begin{list}{}\n"; - t << " {\n"; - t << " \\settowidth{\\labelwidth}{40pt}\n"; - t << " \\setlength{\\leftmargin}{\\labelwidth}\n"; - t << " \\setlength{\\parsep}{0pt}\n"; - t << " \\setlength{\\itemsep}{-4pt}\n"; - t << " \\renewcommand{\\makelabel}{\\entrylabel}\n"; - t << " }\n"; - t << "}\n"; - t << "{\\end{list}}\n"; - - t << "\\newenvironment{Indent}\n"; - t << " {\\begin{list}{}{\\setlength{\\leftmargin}{0.5cm}}\n"; - t << " \\item[]\\ignorespaces}\n"; - t << " {\\unskip\\end{list}}\n"; - - t << "\\setlength{\\parindent}{0cm}\n"; - t << "\\setlength{\\parskip}{0.2cm}\n"; - t << "\\addtocounter{secnumdepth}{1}\n"; - //if (!Config::compactLatexFlag) - //{ - // t << "\\renewcommand{\\subsection}{\\@startsection{subsection}{2}{\\z@}\n"; - // t << " {-3.25ex \\@plus -1ex \\@minus -.2ex}\n"; - // t << " {1.5ex \\@plus.2ex}\n"; - // t << " {\\normalfont\\large\\bfseries\\medskip\n"; - // t << " \\vspace{0.6cm}\\hrule\\vspace{-0.6cm}}\n"; - // t << " }\n"; - //} - //else - //{ - // t << "\\renewcommand{\\subsubsection}{\\@startsection{subsubsection}{3}{\\z@}\n"; - // t << " {-3.25ex \\@plus -1ex \\@minus -.2ex}\n"; - // t << " {1.5ex \\@plus.2ex}\n"; - // t << " {\\normalfont\\normalsize\\bfseries\\medskip\n"; - // t << " \\vspace{0.6cm}\\hrule\\vspace{-0.6cm}}\n"; - // t << " }\n"; - //} - t << "\\sloppy\n"; + t << " Dimitri van Heesch \\copyright{} 1997-2000"; + writeDefaultStyleSheetPart3(t); endPlainFile(); } break; @@ -1435,4 +1449,33 @@ void LatexGenerator::endInclDepGraph(DotInclDepGraph &g) g.writeGraph(t,EPS,Config::latexOutputDir); } +void LatexGenerator::startDescription() +{ + t << "\\begin{description}" << endl; +} + +void LatexGenerator::endDescription() +{ + t << "\\end{description}" << endl; + firstDescItem=TRUE; +} + +void LatexGenerator::startDescItem() +{ + firstDescItem=TRUE; + t << "\\item["; +} + +void LatexGenerator::endDescItem() +{ + if (firstDescItem) + { + t << "]" << endl; + firstDescItem=FALSE; + } + else + { + lineBreak(); + } +} |