[PPL-devel] A problem with hypertarget.

Enea Zaffanella zaffanella at cs.unipr.it
Tue Feb 22 14:22:55 CET 2011


When producing a PDF file with PDF_HYPERLINKS = yes,
the latex generated by a template class documentation such as

//! A template class.
template <typename T>
class Templ { T a; };

generates the following LaTeX:

\hypertarget{classTempl}{
\section{Templ$<$ T $>$ Class Template Reference}
\label{classTempl}\index{Templ@{Templ}}
}

which results in the following warning:

Package hyperref Warning: Token not allowed in a PDF string (Unicode):
(hyperref)                removing `math shift' on input line 4.

The problem is in the use of `$' inside a hypertarget.

The attached patch solves this issue by adding a boolean status flag
(insideHypertarget) to classes LatexGenerator and LatexDocVisitor.

NOTE: the patch only addresses the cases of $<$ and $>$.
It might be worth to consider whether or not other mathematical symbols
produced by function LatexDocVisitor::visit(DocSymbol *s)
could occur inside a hypertarget (and hence should be guarded using the
same technique).

Regards,
Enea.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hypertarget.patch
Type: text/x-patch
Size: 5594 bytes
Desc: not available
URL: <http://www.cs.unipr.it/pipermail/ppl-devel/attachments/20110222/4db97100/attachment.bin>


More information about the PPL-devel mailing list