summaryrefslogtreecommitdiffstats
path: root/src/latexgen.cpp
diff options
context:
space:
mode:
authordimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2002-08-26 17:33:07 (GMT)
committerdimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2002-08-26 17:33:07 (GMT)
commit55d2ef8412008e1560b0d5a2ecc2031f269af4a1 (patch)
tree6d5ee0db5c717ebabc57f2d2a15a1365d5e3fa19 /src/latexgen.cpp
parent17e35fd285d98df3c7fe59ee8805152726c3572e (diff)
downloadDoxygen-55d2ef8412008e1560b0d5a2ecc2031f269af4a1.zip
Doxygen-55d2ef8412008e1560b0d5a2ecc2031f269af4a1.tar.gz
Doxygen-55d2ef8412008e1560b0d5a2ecc2031f269af4a1.tar.bz2
Release-1.2.17-20020826
Diffstat (limited to 'src/latexgen.cpp')
-rw-r--r--src/latexgen.cpp330
1 files changed, 26 insertions, 304 deletions
diff --git a/src/latexgen.cpp b/src/latexgen.cpp
index 987538b..d9f7b24 100644
--- a/src/latexgen.cpp
+++ b/src/latexgen.cpp
@@ -29,6 +29,7 @@
#include "version.h"
#include "dot.h"
#include "page.h"
+#include "latexdocvisitor.h"
//static QCString filterTitle(const char *s)
//{
@@ -242,6 +243,7 @@ static void writeDefaultHeaderPart1(QTextStream &t)
t << "\\usepackage{makeidx}\n"
"\\usepackage{fancyhdr}\n"
"\\usepackage{graphicx}\n"
+ "\\usepackage{multicol}\n"
"\\usepackage{float}\n"
"\\usepackage{alltt}\n";
if (Config_getBool("PDF_HYPERLINKS"))
@@ -1163,6 +1165,7 @@ void LatexGenerator::endDoxyAnchor(const char *fName,const char *anchor)
void LatexGenerator::writeAnchor(const char *fName,const char *name)
{
+ //printf("LatexGenerator::writeAnchor(%s,%s)\n",fName,name);
t << "\\label{" << name << "}" << endl;
if (fName && Config_getBool("PDF_HYPERLINKS"))
{
@@ -1283,158 +1286,42 @@ void LatexGenerator::writeSectionRefItem(const char *,const char *lab,
// t << " (p.\\,\\pageref{" << lab << "})" << endl;
//}
-//void LatexGenerator::docify(const char *str)
-//{
-// docifyStatic(t,str);
-//}
-
-/*!
- * Function converts Latin2 character to latex strin] representin the same
- * character.
- */
-void LatexGenerator::latin2ToLatex(unsigned char c)
-{
- switch (c)
- {
- case 0xA1: t << c; break;
- case 0xA2: t << c; break;
- case 0xA3: t << c; break;
- case 0xA4: t << c; break;
- case 0xA5: t << c; break;
- case 0xA6: t << "\\'{S}"; break;
- case 0xA7: t << c; break;
- case 0xA8: t << c; break;
- case 0xA9: t << "\\v{S}"; break;
- case 0xAA: t << "\\c{S}"; break;
- case 0xAB: t << "\\v{T}"; break;
- case 0xAC: t << "\\'{Z}"; break;
- case 0xAD: t << c; break;
- case 0xAE: t << "\\v{Z}"; break;
- case 0xAF: t << "\\.{Z}"; break;
-
- case 0xB0: t << c; break;
- case 0xB1: t << c; break;
- case 0xB2: t << c; break;
- case 0xB3: t << c; break;
- case 0xB4: t << c; break;
- case 0xB5: t << c; break;
- case 0xB6: t << "\\'{s}"; break;
- case 0xB7: t << c; break;
- case 0xB8: t << c; break;
- case 0xB9: t << "\\v{s}"; break;
- case 0xBA: t << "\\c{s}"; break;
- case 0xBB: t << "\\v{t}"; break;
- case 0xBC: t << "\\'{z}"; break;
- case 0xBD: t << c; break;
- case 0xBE: t << "\\v{z}"; break;
- case 0xBF: t << "\\.{z}"; break;
-
- case 0xC0: t << "\\'{R}"; break;
- case 0xC1: t << "\\'{A}"; break;
- case 0xC2: t << "\\^{A}"; break;
- case 0xC3: t << "\\u{A}"; break;
- case 0xC4: t << "\\\"{A}"; break;
- case 0xC5: t << "\\'{L}"; break;
- case 0xC6: t << "\\'{C}"; break;
- case 0xC7: t << "\\c{C}"; break;
- case 0xC8: t << "\\v{C}"; break;
- case 0xC9: t << "\\'{E}"; break;
- case 0xCA: t << "\\c{E}"; break;
- case 0xCB: t << "\\\"{E}"; break;
- case 0xCC: t << "\\v{E}"; break;
- case 0xCD: t << "\\'{I}"; break;
- case 0xCE: t << "\\^{I}"; break;
- case 0xCF: t << "\\v{D}"; break;
-
- case 0xD0: t << "\\bar{D}"; break;
- case 0xD1: t << "\\'{N}"; break;
- case 0xD2: t << "\\v{N}"; break;
- case 0xD3: t << "\\'{O}"; break;
- case 0xD4: t << "\\^{O}"; break;
- case 0xD5: t << "\\H{O}"; break;
- case 0xD6: t << "\\\"{O}"; break;
- case 0xD7: t << c; break;
- case 0xD8: t << "\\v{R}"; break;
- case 0xD9: t << c; break;
- case 0xDA: t << "\\'{U}"; break;
- case 0xDB: t << "\\H{U}"; break;
- case 0xDC: t << "\\\"{U}"; break;
- case 0xDD: t << "\\'{Y}"; break;
- case 0xDE: t << "\\c{T}"; break;
- case 0xDF: t << "\\ss"; break;
-
- case 0xE0: t << "\\'{r}"; break;
- case 0xE1: t << "\\'{a}"; break;
- case 0xE2: t << "\\^{a}"; break;
- case 0xE3: t << c; break;
- case 0xE4: t << "\\\"{a}"; break;
- case 0xE5: t << "\\'{l}"; break;
- case 0xE6: t << "\\'{c}"; break;
- case 0xE7: t << "\\c{c}"; break;
- case 0xE8: t << "\\v{c}"; break;
- case 0xE9: t << "\\'{e}"; break;
- case 0xEA: t << c; break;
- case 0xEB: t << "\\\"{e}"; break;
- case 0xEC: t << "\\v{e}"; break;
- case 0xED: t << "\\'{\\i}"; break;
- case 0xEE: t << "\\^{\\i}"; break;
- case 0xEF: t << "\\v{d}"; break;
-
- case 0xF0: t << "\\bar{d}"; break;
- case 0xF1: t << "\\'{n}"; break;
- case 0xF2: t << "\\v{n}"; break;
- case 0xF3: t << "\\'{o}"; break;
- case 0xF4: t << "\\^{o}"; break;
- case 0xF5: t << "\\H{o}"; break;
- case 0xF6: t << "\\\"{o}"; break;
- case 0xF7: t << c; break;
- case 0xF8: t << "\\v{r}"; break;
- case 0xF9: t << c; break;
- case 0xFA: t << "\\'{u}"; break;
- case 0xFB: t << "\\H{u}"; break;
- case 0xFC: t << "\\\"{u}"; break;
- case 0xFD: t << "\\'{y}"; break;
- case 0xFE: t << c; break;
- case 0xFF: t << c; break;
-
- default: t << c;
- }
-}
//void LatexGenerator::docifyStatic(QTextStream &t,const char *str)
void LatexGenerator::docify(const char *str)
{
- static bool isCzech = theTranslator->idLanguage()=="czech";
+#if 0
+ //static bool isCzech = theTranslator->idLanguage()=="czech";
static bool isJapanese = theTranslator->idLanguage()=="japanese";
- static bool isKorean = theTranslator->idLanguage()=="korean";
- static bool isRussian = theTranslator->idLanguage()=="russian";
- static bool isUkrainian = theTranslator->idLanguage()=="ukrainian";
- static bool isChinese = theTranslator->idLanguage()=="chinese" ||
- theTranslator->idLanguage()=="chinese-traditional";
- static bool isLatin2 = theTranslator->idLanguageCharset()=="iso-8859-2";
- static bool isGreek = theTranslator->idLanguage()=="greek";
+ //static bool isKorean = theTranslator->idLanguage()=="korean";
+ //static bool isRussian = theTranslator->idLanguage()=="russian";
+ //static bool isUkrainian = theTranslator->idLanguage()=="ukrainian";
+ //static bool isChinese = theTranslator->idLanguage()=="chinese" ||
+ // theTranslator->idLanguage()=="chinese-traditional";
+ //static bool isLatin2 = theTranslator->idLanguageCharset()=="iso-8859-2";
+ //static bool isGreek = theTranslator->idLanguage()=="greek";
if (str)
{
const unsigned char *p=(const unsigned char *)str;
unsigned char c;
unsigned char pc='\0';
+ bool multiByte = FALSE;
while (*p)
{
- static bool MultiByte = FALSE;
c=*p++;
if( isJapanese)
{
- if (MultiByte)
+ if (multiByte)
{
t << (char)c;
- MultiByte = FALSE;
+ multiByte = FALSE;
pc = c;
continue;
}
if (c>=0x80)
{
- MultiByte = TRUE;
+ multiByte = TRUE;
t << (char)c;
pc = c;
continue;
@@ -1453,185 +1340,13 @@ void LatexGenerator::docify(const char *str)
}
else
{
- switch(c)
- {
- case '#': t << "\\#"; break;
- case '$': t << "\\$"; break;
- case '%': t << "\\%"; break;
- case '^': t << "$^\\wedge$"; break;
- case '&': t << "\\&"; break;
- case '*': t << "$\\ast$"; break;
- case '_': t << "\\_";
- if (!insideTabbing) t << "\\-";
- break;
- case '{': t << "\\{"; break;
- case '}': t << "\\}"; break;
- case '<': t << "$<$"; break;
- case '>': t << "$>$"; break;
- case '|': t << "$|$"; break;
- case '~': t << "$\\sim$"; break;
- case '[': if (Config_getBool("PDF_HYPERLINKS"))
- t << "\\mbox{[}";
- else
- t << "[";
- break;
- case ']': if (pc=='[') t << "$\\,$";
- if (Config_getBool("PDF_HYPERLINKS"))
- t << "\\mbox{]}";
- else
- t << "]";
- break;
- case '-': if (*p=='>')
- { t << " $\\rightarrow$ "; p++; }
- else
- { t << (char)c; }
- break;
- case '\\': if (*p=='<')
- { t << "$<$"; p++; }
- else if (*p=='>')
- { t << "$>$"; p++; }
- else
- { t << "$\\backslash$"; }
- break;
- case '"': { t << "\\char`\\\"{}"; }
- break;
-
- default:
- // Some languages uses wide characters
- if (isJapanese || isKorean || isChinese)
- {
- if (c>=128)
- {
- t << (char)c;
- if (*p)
- {
- c = *p++;
- t << (char)c;
- }
- }
- else // ascii char => see if we can insert a hypenation hint
- {
- if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-";
- t << (char)c;
- }
- }
- else if (isCzech || isRussian || isUkrainian)
- {
- if (c>=128)
- {
- t << (char)c;
- }
- else // ascii char => see if we can insert a hypenation hint
- {
- if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-";
- t << (char)c;
- }
- }
- else if (isLatin2)
- {
- if (c>=128)
- {
- latin2ToLatex(c);
- }
- else
- {
- // see if we can insert an hyphenation hint
- if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-";
- t << (char)c;
- }
- }
- else if (isGreek)
- {
- if (c<128)
- {
- t << "\\textlatin{" << (char)c << "}";
- }
- else
- {
- t << (char)c;
- }
- }
- else // language is other than Czech, Russian or Japanese
- {
- switch(c)
- {
- // the Latin-1 characters
- case 161: t << "!`"; break;
- case 181: t << "$\\mu$"; break;
- case 191: t << "?`"; break;
- case 192: t << "\\`{A}"; break;
- case 193: t << "\\'{A}"; break;
- case 194: t << "\\^{A}"; break;
- case 195: t << "\\~{A}"; break;
- case 196: t << "\\\"{A}"; break;
- case 197: t << "\\AA{}"; break;
- case 198: t << "\\AE{}"; break;
- case 199: t << "\\c{C}"; break;
- case 200: t << "\\`{E}"; break;
- case 201: t << "\\'{E}"; break;
- case 202: t << "\\^{E}"; break;
- case 203: t << "\\\"{E}"; break;
- case 204: t << "\\`{I}"; break;
- case 205: t << "\\'{I}"; break;
- case 206: t << "\\^{I}"; break;
- case 207: t << "\\\"{I}"; break;
- case 208: t << "D "; break; // anyone know the real code?
- case 209: t << "\\~{N}"; break;
- case 210: t << "\\`{O}"; break;
- case 211: t << "\\'{O}"; break;
- case 212: t << "\\^{O}"; break;
- case 213: t << "\\~{O}"; break;
- case 214: t << "\\\"{O}"; break;
- case 215: t << "$\\times$"; break;
- case 216: t << "\\O"; break;
- case 217: t << "\\`{U}"; break;
- case 218: t << "\\'{U}"; break;
- case 219: t << "\\^{U}"; break;
- case 220: t << "\\\"{U}"; break;
- case 221: t << "\\'{Y}"; break;
- case 223: t << "\\ss{}"; break;
- case 224: t << "\\`{a}"; break;
- case 225: t << "\\'{a}"; break;
- case 226: t << "\\^{a}"; break;
- case 227: t << "\\~{a}"; break;
- case 228: t << "\\\"{a}"; break;
- case 229: t << "\\aa{}"; break;
- case 230: t << "\\ae{}"; break;
- case 231: t << "\\c{c}"; break;
- case 232: t << "\\`{e}"; break;
- case 233: t << "\\'{e}"; break;
- case 234: t << "\\^{e}"; break;
- case 235: t << "\\\"{e}"; break;
- case 236: t << "\\`{\\i}"; break;
- case 237: t << "\\'{\\i}"; break;
- case 238: t << "\\^{\\i}"; break;
- case 239: t << "\\\"{\\i}"; break;
- case 241: t << "\\~{n}"; break;
- case 242: t << "\\`{o}"; break;
- case 243: t << "\\'{o}"; break;
- case 244: t << "\\^{o}"; break;
- case 245: t << "\\~{o}"; break;
- case 246: t << "\\\"{o}"; break;
- case 248: t << "\\o{}"; break;
- case 249: t << "\\`{u}"; break;
- case 250: t << "\\'{u}"; break;
- case 251: t << "\\^{u}"; break;
- case 252: t << "\\\"{u}"; break;
- case 253: t << "\\'{y}"; break;
- case 255: t << "\\\"{y}"; break;
- default: // normal ascii char
- {
- // see if we can insert an hyphenation hint
- if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-";
- t << (char)c;
- }
- }
- }
- }
+ filterLatexChar(t,c,insideTabbing);
}
pc = c;
}
}
+#endif
+ filterLatexString(t,str,insideTabbing,insidePre);
}
void LatexGenerator::codify(const char *str)
@@ -1965,3 +1680,10 @@ void LatexGenerator::endSectionRefList()
t << "\\normalsize" << endl;
}
+void LatexGenerator::printDoc(DocNode *n)
+{
+ LatexDocVisitor *visitor = new LatexDocVisitor(t,*this);
+ n->accept(visitor);
+ delete visitor;
+}
+