Wie kann „\verb“ in der mit Sternchen versehenen Version von Abschnittsbefehlen gültig gemacht werden?

Wie kann „\verb“ in der mit Sternchen versehenen Version von Abschnittsbefehlen gültig gemacht werden?

Es scheint \cprotectnicht \verbgültig zu sein innerhalbmarkierte Versionvon Abschnittsbefehlen \section*usw.\paragraph*

Wie kann dieses Problem behoben werden?

% MWE
\documentclass{book}
\usepackage{cprotect}
\begin{document}
\cprotect\part*{text and \verb"\verb"}
\cprotect\chapter*{text and \verb"\verb"}
\cprotect\section*{text and \verb"\verb"}
\cprotect\subsection*{text and \verb"\verb"}
\cprotect\subsubsection*{text and \verb"\verb"}
\cprotect\paragraph*{text and \verb"\verb"}
\cprotect\subparagraph*{text and \verb"\verb"}
\end{document}

Antwort1

Bildbeschreibung hier eingeben

\documentclass{book}
\usepackage{cprotect}
\begin{document}
\cprotect{\part*}{text and \verb"\verb"}
\cprotect{\chapter*}{text and \verb"\verb"}
\cprotect{\section*}{text and \verb"\verb"}
\cprotect{\subsection*}{text and \verb"\verb"}
\cprotect{\subsubsection*}{text and \verb"\verb"}
\cprotect{\paragraph*}{text and \verb"\verb"}
\cprotect{\subparagraph*}{text and \verb"\verb"}
\end{document}

verwandte Informationen