Permalink
Browse files

Fixed problem with latex and PDF bookmarks

  • Loading branch information...
Dimitri van Heesch
Dimitri van Heesch committed Nov 15, 2015
1 parent c5a7911 commit 499ecaedf1ee1222535be27f77050ee633595685
Showing with 34 additions and 73 deletions.
  1. +10 −73 src/latexgen.cpp
  2. +23 −0 src/util.cpp
  3. +1 −0 src/util.h
View
@@ -682,7 +682,7 @@ static void writeDefaultHeaderPart1(FTextStream &t)
// To avoid duplicate page anchors due to reuse of same numbers for
// the index (be it as roman numbers)
t << "\\hypersetup{pageanchor=false,\n"
<< " bookmarks=true,\n"
// << " bookmarks=true,\n" // commented out to prevent warning
<< " bookmarksnumbered=true,\n"
<< " pdfencoding=unicode\n"
<< " }\n";
@@ -1569,13 +1569,22 @@ void LatexGenerator::startMemberDoc(const char *clname,
}
static const char *levelLab[] = { "subsubsection","paragraph","subparagraph", "subparagraph" };
static bool compactLatex = Config_getBool("COMPACT_LATEX");
static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS");
int level=0;
if (showInline) level+=2;
if (compactLatex) level++;
t << "\\" << levelLab[level];
t << "[{";
if (pdfHyperlinks)
{
t << "\\texorpdfstring{";
}
t << latexEscapeIndexChars(title,insideTabbing);
if (pdfHyperlinks)
{
t << "}{" << latexEscapePDFString(title) << "}";
}
t << "}]";
t << "{\\setlength{\\rightskip}{0pt plus 5cm}";
disableLinks=TRUE;
@@ -2088,78 +2097,6 @@ void LatexGenerator::endConstraintList()
t << "\\end{Desc}" << endl;
}
#if 0
void LatexGenerator::escapeLabelName(const char *s)
{
if (s==0) return;
const char *p=s;
char c;
QCString result(qstrlen(s)+1); // worst case allocation
int i;
while ((c=*p++))
{
switch (c)
{
case '|': t << "\\texttt{\"|}"; break;
case '!': t << "\"!"; break;
case '%': t << "\\%"; break;
case '{': t << "\\lcurly{}"; break;
case '}': t << "\\rcurly{}"; break;
case '~': t << "````~"; break; // to get it a bit better in index together with other special characters
// NOTE: adding a case here, means adding it to while below as well!
default:
i=0;
// collect as long string as possible, before handing it to docify
result[i++]=c;
while ((c=*p) && c!='|' && c!='!' && c!='%' && c!='{' && c!='}' && c!='~')
{
result[i++]=c;
p++;
}
result[i]=0;
docify(result);
break;
}
}
}
void LatexGenerator::escapeMakeIndexChars(const char *s)
{
if (s==0) return;
const char *p=s;
char c;
QCString result(qstrlen(s)+1); // worst case allocation
int i;
while ((c=*p++))
{
switch (c)
{
case '!': t << "\"!"; break;
case '"': t << "\"\""; break;
case '@': t << "\"@"; break;
case '|': t << "\\texttt{\"|}"; break;
case '[': t << "["; break;
case ']': t << "]"; break;
case '{': t << "\\lcurly{}"; break;
case '}': t << "\\rcurly{}"; break;
// NOTE: adding a case here, means adding it to while below as well!
default:
i=0;
// collect as long string as possible, before handing it to docify
result[i++]=c;
while ((c=*p) && c!='"' && c!='@' && c!='[' && c!=']' && c!='!' && c!='{' && c!='}' && c!='|')
{
result[i++]=c;
p++;
}
result[i]=0;
docify(result);
break;
}
}
}
#endif
void LatexGenerator::startCodeFragment()
{
t << "\n\\begin{DoxyCode}\n";
View
@@ -6713,6 +6713,29 @@ QCString latexEscapeIndexChars(const char *s,bool insideTabbing)
return result.data();
}
QCString latexEscapePDFString(const char *s)
{
QGString result;
FTextStream t(&result);
const char *p=s;
char c;
int i;
while ((c=*p++))
{
switch (c)
{
case '\\': t << "\\textbackslash{}"; break;
case '{': t << "\\{"; break;
case '}': t << "\\}"; break;
default:
t << c;
break;
}
}
return result.data();
}
QCString rtfFormatBmkStr(const char *name)
{
static QCString g_nextTag( "AAAAAAAAAA" );
View
@@ -344,6 +344,7 @@ void filterLatexString(FTextStream &t,const char *str,
QCString latexEscapeLabelName(const char *s,bool insideTabbing);
QCString latexEscapeIndexChars(const char *s,bool insideTabbing);
QCString latexEscapePDFString(const char *s);
QCString rtfFormatBmkStr(const char *name);

0 comments on commit 499ecae

Please sign in to comment.