5

I need an exotic symbol in the title of a section (the class is book). So, I write \section{Bla-bla \hbox{\usefont{U}{MnSymbolC}{m}{n}\char"36} tititi}. It works perfectly well in the title, but in the running title the symbol just disappears, it is

Bla-bla tititi

What can be done?

Serguei
  • 153
  • 1
    welcome to tex.sx. this would be much easier to diagnose if you would provide a brief example that we could just cut and paste to experiment. – barbara beeton Aug 31 '16 at 13:03

1 Answers1

6

For the running title you need to stop \MakeUpperCase changing your symbol. One way to this is to define a command for the symbol, which you can use anywhere, and in section titles proceed it by \protect. A simpler solution is to define the command via \DeclareRobustCommand:

Sample output

\documentclass{article}

\usepackage{MnSymbol}

\DeclareRobustCommand{\mysymb}{{\usefont{U}{MnSymbolC}{m}{n}\symbol{"36}}}

\pagestyle{headings}
\begin{document}

\section{Bla-bla \mysymb{} tititi}

\end{document}

Defining the symbol this way allows it to change size with the surrounding text. Note that I have changed \char to \symbol{...} as recommended by egreg.

Andrew Swann
  • 95,762
  • 1
    Why not \DeclareRobustCommand, that avoids the need for \protect? I also recommend \symbol{"36} instead of \char"36. – egreg Aug 31 '16 at 13:35
  • The problem, in fact, is caused not by \MakeUpperCase (though I also thought so), However, \protect does work anyway. Thank you so much! – Serguei Aug 31 '16 at 13:42
  • @ egreg Without protection the replacement \char"36 -> \symbol{"36} doesn't work all the same. But \DeclareRobustCommand is a good idea. Thanks – Serguei Aug 31 '16 at 13:47
  • @egreg Indeed that works and is simpler to use, so I have updated the solution. Thanks. – Andrew Swann Aug 31 '16 at 16:34
  • @ Andrew Swann, Sorry for an additional question, but why is it important to change \char to \symbol{...}? – Serguei Sep 01 '16 at 09:41
  • @Serguei \char works in this case, but \char is the TeX primitive command, \symbol is a LaTeX wrapper with the advantage that the argument is enclosed in {...} so clearly delimited. The LaTeX kernel defines \symbol{#1} to be {\char #1\relax}. See also http://tex.stackexchange.com/a/305676/15925. – Andrew Swann Sep 01 '16 at 11:39