Math & Science ⇒ math symbols in headings with hyperref
-
- Posts: 11
- Joined: Wed Sep 15, 2010 2:44 pm
math symbols in headings with hyperref
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
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
-
- Posts: 11
- Joined: Wed Sep 15, 2010 2:44 pm
Re: math symbols in headings with hyperref
\section{\texorpdfstring{$k$-means }{k-means}}
Re: math symbols in headings with hyperref
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!
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
math symbols in headings with hyperref
.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.
Take a look at the bookmarks in the resulting PDF output and you will understand.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?) […]
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
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10