dimanche 30 novembre 2014

How to create a minimal working example for verbatim use in macro definition with cprotect


cprotect can be used to use verbatim in a macro definition according to the package specification. Just like everything else in the world that doesn't provide an example it doesn't work in real life and therefore I want/have to do that job myself. Why does



\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{cprotect}
\usepackage{fancyvrb}

\begin{document}
\newcommand{\bla}{Like this one: \verb-!@#$%^&*()_+-.}
% same in TeX
%\def\bla{\verb+Yes!+}
\cprotect\bla
\end{document}


not work (error message is ! Forbidden control sequence found while scanning use of \@argdef.? Using a verbatim environment doesn't work (or does, we'll see...).





Aucun commentaire:

Enregistrer un commentaire