# How do I put special characters in a section title?

I'd like to name my (sub-sub-)section "Something something β something." When I try

\subsubsection{Something something $\beta$ something}


it shows up exactly like that: with the dollar signs, unformatted. How do I fix this?

-
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. Your example actually compiles successfully in an otherwise empty article document. –  Qrrbrbirlbel Oct 14 '12 at 21:59
Are you trying to get it working with hyperref? –  doncherry Oct 14 '12 at 22:16
@doncherry hyperref removes math shift characters (dollar signs) with a warning unless a very ancient version is used. –  Heiko Oberdiek Oct 15 '12 at 13:08

It's hard to tell wether it is that or not without a few more details, but I suspect here that you mean that it does not show up in the pdf menu but shows up nicely in the text.

It is indeed quite a problem to put any foreign mathematical expression in your title as they will be very wrong in the pdf menu.

In order to overcome this issue, I would give you two advice :

• Avoid putting mathematical expressions in your titles. It is often unnecessary.
• If you really need to put something special in there, always provide pdf with it's own way of writing it.

Therefore, in this case, I would do :

\subsubsection{\texorpdfstring{Something with $\beta$ in it. }%
{Something with beta in it. }}


It's a really non-ideal way of doing things (especially for mathematical equations), but I didn't find any better when I ran into the problem.

-

Since it seems we've started guessing, I'll add my guess. It follows the general direction as Samuel's, but actually provides a way of getting the beta in the PDF bookmark. As long as you just need linear math characters that you can somehow get in Unicode, you should be fine with this solution. Putting math in section titles doesn't seem to be a problem for the table of contents, as Américo remarked.

\documentclass{article}

\usepackage[utf8]{inputenc}

\usepackage[pdfencoding=auto]{hyperref}

\begin{document}

\tableofcontents

\section{Foo $\beta$}% doesn't work
\section{\texorpdfstring{Foo $\beta$}{Foo}}% doesn't work, but no errorrs
\section{\texorpdfstring{Foo $\beta$}{Foo β}}% ooooooohh :)

\end{document}


-

In the following article the Greek letter β renders properly.

Code

\documentclass{article}

\begin{document}

\section{Section Something $\beta$ something}

\subsection{Subsection Something $\beta$ something}

Something $\beta$ something.

\subsubsection{Subsubsection Something $\beta$ something}

Something $\beta$ something.

\paragraph{Subsubsubsection $\beta$ something}

Something $\beta$ something.

\end{document}


Output

This code

\documentclass{article}

\begin{document}

\tableofcontents

\section{Section Something $\beta$ something}

\subsection{Subsection Something $\beta$ something}

Something $\beta$ something.

\subsubsection{Subsubsection Something $\beta$ something}

Something $\beta$ something.

\paragraph{Subsubsubsection $\beta$ something}

Something $\beta$ something.

\end{document}


produces

-