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?

1
  • 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. Aug 31, 2016 at 13:03

1 Answer 1

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.

6
  • 1
    Why not \DeclareRobustCommand, that avoids the need for \protect? I also recommend \symbol{"36} instead of \char"36.
    – egreg
    Aug 31, 2016 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, 2016 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, 2016 at 13:47
  • @egreg Indeed that works and is simpler to use, so I have updated the solution. Thanks. Aug 31, 2016 at 16:34
  • @ Andrew Swann, Sorry for an additional question, but why is it important to change \char to \symbol{...}?
    – Serguei
    Sep 1, 2016 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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