I could remove text decorations like highlighting or todos from the TOC but not from the header line. I did this without putting the plain text into the optional parameter of \chapter[]{}
because pandoc is used to convert the text to latex and currently does not support optional parameters.
Here is a simple MWE:
\documentclass[oneside]{book}
\usepackage{xcolor}
\usepackage{soul}
\usepackage{todonotes}
\usepackage{lipsum}
\usepackage{ulem}
\DeclareRobustCommand{\nohl}[1]{#1}
\addtocontents{toc}{\begingroup%
\protect\renewcommand{\protect\todo}[1]{}
\let\hl\nohl
}
\AtEndDocument{%
\addtocontents{toc}{\endgroup}
}
\begin{document}
\tableofcontents
{\let\clearpage\relax \chapter{Header with \hl{highlights} and \sout{deletions}}}
\section[A second header with a note]{A second header with a note\todo{keep it}}
\lipsum[1-2]
\end{document}
How can I remove the highlighting in the header line (default and with fancyhdr) without using the optional parameter of \chapter? Or is it even possible to remove any latex command/macro and just keeping the inner text?
BTW: the \DeclareRobustCommand
and \let\hl\nohl
is a workaround because \protect\renewcommand{\hl}[1]{#1}
produces the error ! Illegal parameter number in definition of \reserved@a.
\markright
or\markboth
are compatible withpandoc
, but they ought to be worth investigating.