Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to obtain the following:

  • the title of a section occurs in the text as Math symbols $\boldsymbol{\sum, \int}$,

  • in the table of contents it is Math symbols $\sum, \int$ (without bold),

  • in bookmarks it is Math symbols sum, integral.

I can obtain what I want in bookmarks and either of two (bold or standard) in both: TOC and text with \texorpdfstring. I can also use \section[This will go to bookmarks and TOC.]{This will appear in the content.}. But I don't know how to make it all work at the same time.

share|improve this question
    
See tex.stackexchange.com/questions/53513/… for example –  Christian Hupfer May 25 at 11:08
1  
1  
Also related: Make math font respect the surrounding family –  Tobi May 25 at 15:00
    
Thanks @Tobi and barbarabeeton. I will definitely check this out -- it's much simpler than writing the same text three times (I will still need two times, but it's always better). –  user863458 May 26 at 20:24

2 Answers 2

up vote 9 down vote accepted

Two suggestions:

  • Use the "long title" -- the stuff inside curly braces -- to typeset the material in the way you want it to appear in the sectioning header itself; in particular, use \bm (or an equivalent macro) to create bold math symbols.

  • Use the \texorpdfstring macro (provided by the hyperref package) inside the "short title" -- the stuff inside square brackets -- to instruct LaTeX what to show (a) in the table of contents (e.g., ordinary, non-bold math symbols) and (b) in the pdf bookmarks (e.g., no math symbols at all).

Note that the following screenshot shows only the ToC entry (resulting from the first argument of \texorpdfstring) and the header line (the "long title"), but not the pdf bookmark (which results from the second argument of \texorpdfstring):

enter image description here

\documentclass{article}  
\usepackage{bm} % for bold math
\usepackage[colorlinks=true]hyperref}  
\begin{document}  
\tableofcontents
\section[\texorpdfstring{Math symbols $\sum, \int$}%
                        {Math symbols sum, integral}]% % choose text-only material here
        {Math symbols $\bm{\sum, \int}$}  % note use of \bm ("bold math")
\end{document}
share|improve this answer
    
Works like a charm, thank you very much! –  user863458 May 25 at 12:30

Both symbols \sum and \int are also available in Unicode and are supported with Unicode bookmarks. Example of Mico extended accordingly:

\documentclass{article}
\usepackage{bm} % for bold math
\usepackage[
  colorlinks=true,
  pdfencoding=auto, % or unicode
  psdextra,
]{hyperref}[2012/08/13]
\usepackage{bookmark}% recommended
\begin{document}
\tableofcontents
\section[\texorpdfstring{Math symbols $\sum, \int$}%
                        {Math symbols \sum, \int}]%
        {Math symbols $\bm{\sum, \int}$}  % note use of \bm ("bold math")
\end{document}

Result AR9/Linux

share|improve this answer
    
Good to know that \sum and \int are available as macros for bookmarking purposes if a unicode-aware font is used. (I had treated them in my answer as generic stand-ins for whatever the OP really wants to typeset rather than as the actual symbols that might occur in a sectioning header...) –  Mico May 25 at 15:59
    
@Mico: Only the PDF viewer needs a Unicode font for the bookmarks. This Unicode encoding for bookmarks is not related to the TeX encodings (for font or input). –  Heiko Oberdiek May 25 at 16:12
    
Thanks Heiko! That's good to know that I can use Unicode in bookmarks. @Mico: your assumption that my needs are more general than just the two exemplary symbols I mentioned in the question was correct. –  user863458 May 26 at 20:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.