# Incorrect accent after \verb

I have following snippet of code:

\documentclass[11pt, a4paper]{article}
\begin{document}
\newcommand{\test}[0]{\verb£Test£'}
\test

\verb£Test£'
\end{document}


The second scenario works as I want: the accents around test are in the same font. However, when I nest it in the test command, the closing accent is in the same font as verbatim. Why is that? And how can I fix this?

It looks like this:

This is of course a trivial example, but I want to use accents around verbatim inside more complex commands.

Thanks, Yves

• \newcommand{\test}[0]{\verb£Test£'} is a syntax error, you can not use \verb in the argument of another command. – David Carlisle Jul 8 '16 at 9:39
• Also note that £ is only safe to use as a \verb delimiter if you are using a legacy 8bit encoding such as latin1, if you use UTF-8 then it will not work. – David Carlisle Jul 8 '16 at 9:42

You can't have \verb inside the argument to another command (including \newcommand).

The newverbs package provides “quoted verbatim” out of the box and also features \newverbcommand to do many more things.

\documentclass{article}

\usepackage{newverbs}

\begin{document}

\qverb|test\*&}|

\end{document}
`