# package minted displays two # instead of one

I am using package minted within beamer in order to display LaTeX source code.

Actually, I am having this code to display:

\newcommand{\vektor}[1]{\vec{#1}}


so i coded something like this within an \uncover instruction:

\mint{latex}|\newcommand{\vektor}[1]{\vec{#1}}|


and tried different options like \mint[escapeinside=||,mathescape=true]{l... but nothing helped so far. The problem is, that the # will be presented twice in the output :-(

Here is an MWE

\documentclass{beamer}

\usepackage[T1]{fontenc}
\usepackage{minted}

\begin{document}
\begin{frame}[fragile]
\uncover<1->{\mint{latex}|\newcommand{\vektor}[1]{\vec{#1}}|}
\end{frame}
\end{document}


The problem occurs from using the \uncover, but I would love to use that feature :-(

This is the unpleasant result:

You can't put verbatim material in an argument. Use the uncoverenv instead:

\documentclass{beamer}

\usepackage[T1]{fontenc}
\usepackage{minted}

\begin{document}
\begin{frame}[fragile]
\begin{uncoverenv}<1->\mint{latex}|\newcommand{\vektor}[1]{\vec{#1}}|\end{uncoverenv}
\end{frame}
\end{document}

• Dear @Ulrike Fischer, thank you so much. It worked! – Jan Nov 8 '19 at 6:56