Math & Sciencemath symbols in headings with hyperref

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
totalnewbi
Posts: 11
Joined: Wed Sep 15, 2010 2:44 pm

math symbols in headings with hyperref

Post by totalnewbi »

Dears,


does anybody have an idea how I can put math symbols in section headings?

I get an error message when I try this:

\section{$k$-means clustering}

error:
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):

It produces a heading though, I would just want to do it without the error!

Cheers
Newbi
Last edited by totalnewbi on Sun Oct 03, 2010 8:49 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

totalnewbi
Posts: 11
Joined: Wed Sep 15, 2010 2:44 pm

Re: math symbols in headings with hyperref

Post by totalnewbi »

Sorry for not looking thoroughly before ..... here is the solution:

\section{\texorpdfstring{$k$-means }{k-means}}
fredbel6
Posts: 1
Joined: Sat Jan 22, 2011 10:51 am

Re: math symbols in headings with hyperref

Post by fredbel6 »

Hello,

I am very new to this board.

I am struggling with quite a few latex problems, although I have in fact been using this program for many years.

I found this question using the search function. I am getting a lot of these "token not allowed" warnings at this point. I know how to fix it from the above, but that in my opinion takes a lot of effort if you have tons of these titles with $-signs in them.

I also don't quite understand what difference it makes if you do this or not (there is not really an error, only a warning, and the output looks exactly the same?)

Many thanks!
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

math symbols in headings with hyperref

Post by localghost »

fredbel6 wrote:[…] I am getting a lot of these "token not allowed" warnings at this point. I know how to fix it from the above, but that in my opinion takes a lot of effort if you have tons of these titles with $-signs in them. […]
.
I see no other solution than to replace them manually. For future projects you know what to do.
fredbel6 wrote:[…] I also don't quite understand what difference it makes if you do this or not (there is not really an error, only a warning, and the output looks exactly the same?) […]
Take a look at the bookmarks in the resulting PDF output and you will understand.

According to Section 1.5 of the Board Rules (to be read before posting) you should not hijack topics that are marked as solved. Please keep that in mind for the future.


Best regards and welcome to the board
Thorsten
Post Reply