I have a library of tikz pictures, eg.


which I would like to print together with their names (including arguments). However,

\renewcommand{\show}[1]{\verb|#1|\quad #1}


Package tikz Error: Sorry, some package has redefined the meaning of the math-mode dollar sign. This is incompatible with tikz and its calc library and might cause unrecoverable errors.

I guess \show is trying to expand its argument inside \verb. I experimented with \expandafter but it didn't help. When I replaced \verb| | with \texttt{}, \show didn't print the macro name at all.

  • \verb cannot appear inside another macro. Aug 18 '20 at 5:03
  • 1
    Try instead \renewcommand{\show}[1]{\detokenize{#1}\quad #1} Aug 18 '20 at 5:03
  • Also \show only takes a single token. If you want to print multiple, try \message{...} or \errmessage{...}. Aug 18 '20 at 5:04

Firstly, it's better to not redefine primitive, for example \show. Just choose another command name. Then, \Verb from fvextra package is more robust than \verb, when used inside another macro.


    \node[draw, circle] {text}; 

\newcommand{\showTikzPic}[1]{\Verb|#1|\quad #1}


enter image description here

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.