I used tikz to define some custom symbols. They work fine in the text, but I have problems using them in a section title:

    \draw (0,0) -- (1,0);

This works fine: \customSymbol{}.
% \section{This does not work: \customSymbol{}}

What can I do to fix this?

  • 3
    The sectioning content is written to an external file, so it can not include "fragile" macros. Try \section{This should work: \protect\customSymbol{}} instead. Commented Dec 19, 2017 at 14:51
  • 1
    Possible duplicate of Adding tikz figure in caption. Please see the explanation and link in the accepted answer there. Commented Dec 19, 2017 at 14:54

1 Answer 1

  • 2
    I think you are missing curly braces around the command name (i.e. use \DeclareRobustCommand{\customSymbol}[1]{...} instead). For other newbies like me, this general discussion of robust vs. new command might also be helpful Commented Jul 26, 2020 at 0:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .